cpu/native/can/candev_linux: add check for real can when setting bittimings in init
This commit is contained in:
parent
769209351a
commit
d477b5bc24
@ -195,7 +195,14 @@ static int _init(candev_t *candev)
|
|||||||
|
|
||||||
real_bind(dev->sock, (struct sockaddr *)&addr, sizeof(addr));
|
real_bind(dev->sock, (struct sockaddr *)&addr, sizeof(addr));
|
||||||
|
|
||||||
_set_bittiming(dev, &candev->bittiming);
|
/* Only set bitrate on real can interfaces.
|
||||||
|
* Not supported on virtual can interfaces ("vcanX") */
|
||||||
|
if (strncmp(dev->conf->interface_name, "can", strlen("can"))) {
|
||||||
|
DEBUG("not setting bitrate on virtual can interface %s\n", dev->conf->interface_name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_set_bittiming(dev, &candev->bittiming);
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG("CAN linux device ready\n");
|
DEBUG("CAN linux device ready\n");
|
||||||
|
|
||||||
@ -300,6 +307,8 @@ static int _set(candev_t *candev, canopt_t opt, void *value, size_t value_len)
|
|||||||
case CANOPT_BITTIMING:
|
case CANOPT_BITTIMING:
|
||||||
DEBUG("candev_linux: CANOPT_BITTIMING\n");
|
DEBUG("candev_linux: CANOPT_BITTIMING\n");
|
||||||
|
|
||||||
|
/* Only set bitrate on real can interfaces.
|
||||||
|
* Not supported on virtual can interfaces ("vcanX") */
|
||||||
if (strncmp(dev->conf->interface_name, "can", strlen("can"))) {
|
if (strncmp(dev->conf->interface_name, "can", strlen("can"))) {
|
||||||
DEBUG("candev_native: _set: error interface is not real can\n");
|
DEBUG("candev_native: _set: error interface is not real can\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user