mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #13342 from wosym/pr/socketcanfix
cpu/native/can/candev_linux: add check for real can
This commit is contained in:
commit
58450c6c59
@ -195,7 +195,14 @@ static int _init(candev_t *candev)
|
||||
|
||||
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");
|
||||
|
||||
@ -300,6 +307,8 @@ static int _set(candev_t *candev, canopt_t opt, void *value, size_t value_len)
|
||||
case CANOPT_BITTIMING:
|
||||
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"))) {
|
||||
DEBUG("candev_native: _set: error interface is not real can\n");
|
||||
return -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user