Udev rule setting up SocketCAN socket only works correctly only when run manually
Clash Royale CLAN TAG#URR8PPP
I want to start slcand
(the userspace daemon for the serial line CAN interface driver) when my Lawicel CanUSB dongle is plugged in. I followed Pascal Walter's step-by-step guide and all seems to work (slcan0 is there and i can bind(2)), except I never actually receive anything (only outgoing messages are visible in candump
and Wireshark).
The udev rule looks as follows:
# Lawicel CANUSB module
ACTION=="add", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="tty", RUN+="/usr/bin/logger [udev] Lawicel CANUSB detected - running slcan_add.sh!", RUN+="/usr/local/bin/slcan_add.sh $kernel"
ACTION=="remove", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="usb", RUN+="/usr/bin/logger [udev] Lawicel CANUSB removed - running slcan_remove.sh!", RUN+="/usr/local/bin/slcan_remove.sh"
with /usr/local/bin/slcan_add.sh
#!/bin/sh
# Bind the USBCAN device
slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
and /usr/local/bin/slcan_remove.sh
#!/bin/sh
# Remove the USBCAN device
pkill slcand
However when I manually execute sudo /usr/local/bin/slcan_remove.sh && sudo /usr/local/bin/slcan_add.sh ttyUSB0
, everything works as expected and I can see all CAN messages with candump slcan0
).
The interface looks just the same as with udev. ip link show slcan0
gives:
91: slcan0: <NOARP,UP,LOWER_UP> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
The NetworkManager has a problem with slcan0, but that appears also when creating slcan0 manually as described above. The output of tail -f /var/log/syslog
when plugging in is:
May 26 18:29:18 laurenz-T440p logger: [udev] Lawicel CANUSB detected - running slcan_add.sh
May 26 18:29:18 laurenz-T440p slcand[14924]: starting on TTY device /dev/ttyUSB0
May 26 18:29:18 laurenz-T440p slcand[14925]: attached TTY /dev/ttyUSB0 to netdevice slcan0
May 26 18:29:18 laurenz-T440p slcand[14925]: netdevice slcan0 renamed to slcan0
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/slcan0, iface: slcan0)
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/slcan0, iface: slcan0): no ifupdown configuration found.
May 26 18:29:18 laurenz-T440p NetworkManager[866]: <warn> /sys/devices/virtual/net/slcan0: couldn't determine device driver; ignoring...
ps -fauxw | grep can
(manual start as above):
root 1221 0.0 0.0 4336 100 ? Ss 11:38 0:00 _ slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
ps -fauxw | grep can
(re-plugging triggered udev start):
root 1362 0.0 0.0 4336 96 ? Ss 11:45 0:00 slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
What could the problem with udev be? How can I fix it?
Update: Ok, so I added an Ixxat USB-to-CAN V2 and installed its SocketCan driver. It has the same problem: Tx fine, Rx not working.
Interestingly, I can just plug the two together (120R in the middle). Then I run candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
in one Terminal. In another, I send CAN frames with cansend can0 000#
(Send one frame with CanID 0, length 0 via can0 (the Ixxat adapter)). The result depends on if I started the slcand manually or via udev.
Manual (as described above):
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614442.246548) can0 TX - - 000 [0]
(1464614442.249320) slcan0 RX - - 000 [0]
Via Udev:
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614643.800545) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.807361) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.814058) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.820840) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
[and so on...]
Here is my lsmod | grep can
:
vcan 16384 0
slcan 16384 1
can_dev 24576 2 ixx_pci,ixx_usb
can_raw 20480 0
can 45056 1 can_raw
I'm on a Ubuntu 14.04 machine with a 4.4 kernel. uname -rv
:
4.4.0-21-generic #37~14.04.1-Ubuntu SMP Wed Apr 20 16:33:38 UTC 2016
kernel-modules udev socket
add a comment |
I want to start slcand
(the userspace daemon for the serial line CAN interface driver) when my Lawicel CanUSB dongle is plugged in. I followed Pascal Walter's step-by-step guide and all seems to work (slcan0 is there and i can bind(2)), except I never actually receive anything (only outgoing messages are visible in candump
and Wireshark).
The udev rule looks as follows:
# Lawicel CANUSB module
ACTION=="add", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="tty", RUN+="/usr/bin/logger [udev] Lawicel CANUSB detected - running slcan_add.sh!", RUN+="/usr/local/bin/slcan_add.sh $kernel"
ACTION=="remove", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="usb", RUN+="/usr/bin/logger [udev] Lawicel CANUSB removed - running slcan_remove.sh!", RUN+="/usr/local/bin/slcan_remove.sh"
with /usr/local/bin/slcan_add.sh
#!/bin/sh
# Bind the USBCAN device
slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
and /usr/local/bin/slcan_remove.sh
#!/bin/sh
# Remove the USBCAN device
pkill slcand
However when I manually execute sudo /usr/local/bin/slcan_remove.sh && sudo /usr/local/bin/slcan_add.sh ttyUSB0
, everything works as expected and I can see all CAN messages with candump slcan0
).
The interface looks just the same as with udev. ip link show slcan0
gives:
91: slcan0: <NOARP,UP,LOWER_UP> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
The NetworkManager has a problem with slcan0, but that appears also when creating slcan0 manually as described above. The output of tail -f /var/log/syslog
when plugging in is:
May 26 18:29:18 laurenz-T440p logger: [udev] Lawicel CANUSB detected - running slcan_add.sh
May 26 18:29:18 laurenz-T440p slcand[14924]: starting on TTY device /dev/ttyUSB0
May 26 18:29:18 laurenz-T440p slcand[14925]: attached TTY /dev/ttyUSB0 to netdevice slcan0
May 26 18:29:18 laurenz-T440p slcand[14925]: netdevice slcan0 renamed to slcan0
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/slcan0, iface: slcan0)
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/slcan0, iface: slcan0): no ifupdown configuration found.
May 26 18:29:18 laurenz-T440p NetworkManager[866]: <warn> /sys/devices/virtual/net/slcan0: couldn't determine device driver; ignoring...
ps -fauxw | grep can
(manual start as above):
root 1221 0.0 0.0 4336 100 ? Ss 11:38 0:00 _ slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
ps -fauxw | grep can
(re-plugging triggered udev start):
root 1362 0.0 0.0 4336 96 ? Ss 11:45 0:00 slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
What could the problem with udev be? How can I fix it?
Update: Ok, so I added an Ixxat USB-to-CAN V2 and installed its SocketCan driver. It has the same problem: Tx fine, Rx not working.
Interestingly, I can just plug the two together (120R in the middle). Then I run candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
in one Terminal. In another, I send CAN frames with cansend can0 000#
(Send one frame with CanID 0, length 0 via can0 (the Ixxat adapter)). The result depends on if I started the slcand manually or via udev.
Manual (as described above):
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614442.246548) can0 TX - - 000 [0]
(1464614442.249320) slcan0 RX - - 000 [0]
Via Udev:
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614643.800545) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.807361) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.814058) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.820840) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
[and so on...]
Here is my lsmod | grep can
:
vcan 16384 0
slcan 16384 1
can_dev 24576 2 ixx_pci,ixx_usb
can_raw 20480 0
can 45056 1 can_raw
I'm on a Ubuntu 14.04 machine with a 4.4 kernel. uname -rv
:
4.4.0-21-generic #37~14.04.1-Ubuntu SMP Wed Apr 20 16:33:38 UTC 2016
kernel-modules udev socket
add a comment |
I want to start slcand
(the userspace daemon for the serial line CAN interface driver) when my Lawicel CanUSB dongle is plugged in. I followed Pascal Walter's step-by-step guide and all seems to work (slcan0 is there and i can bind(2)), except I never actually receive anything (only outgoing messages are visible in candump
and Wireshark).
The udev rule looks as follows:
# Lawicel CANUSB module
ACTION=="add", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="tty", RUN+="/usr/bin/logger [udev] Lawicel CANUSB detected - running slcan_add.sh!", RUN+="/usr/local/bin/slcan_add.sh $kernel"
ACTION=="remove", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="usb", RUN+="/usr/bin/logger [udev] Lawicel CANUSB removed - running slcan_remove.sh!", RUN+="/usr/local/bin/slcan_remove.sh"
with /usr/local/bin/slcan_add.sh
#!/bin/sh
# Bind the USBCAN device
slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
and /usr/local/bin/slcan_remove.sh
#!/bin/sh
# Remove the USBCAN device
pkill slcand
However when I manually execute sudo /usr/local/bin/slcan_remove.sh && sudo /usr/local/bin/slcan_add.sh ttyUSB0
, everything works as expected and I can see all CAN messages with candump slcan0
).
The interface looks just the same as with udev. ip link show slcan0
gives:
91: slcan0: <NOARP,UP,LOWER_UP> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
The NetworkManager has a problem with slcan0, but that appears also when creating slcan0 manually as described above. The output of tail -f /var/log/syslog
when plugging in is:
May 26 18:29:18 laurenz-T440p logger: [udev] Lawicel CANUSB detected - running slcan_add.sh
May 26 18:29:18 laurenz-T440p slcand[14924]: starting on TTY device /dev/ttyUSB0
May 26 18:29:18 laurenz-T440p slcand[14925]: attached TTY /dev/ttyUSB0 to netdevice slcan0
May 26 18:29:18 laurenz-T440p slcand[14925]: netdevice slcan0 renamed to slcan0
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/slcan0, iface: slcan0)
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/slcan0, iface: slcan0): no ifupdown configuration found.
May 26 18:29:18 laurenz-T440p NetworkManager[866]: <warn> /sys/devices/virtual/net/slcan0: couldn't determine device driver; ignoring...
ps -fauxw | grep can
(manual start as above):
root 1221 0.0 0.0 4336 100 ? Ss 11:38 0:00 _ slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
ps -fauxw | grep can
(re-plugging triggered udev start):
root 1362 0.0 0.0 4336 96 ? Ss 11:45 0:00 slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
What could the problem with udev be? How can I fix it?
Update: Ok, so I added an Ixxat USB-to-CAN V2 and installed its SocketCan driver. It has the same problem: Tx fine, Rx not working.
Interestingly, I can just plug the two together (120R in the middle). Then I run candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
in one Terminal. In another, I send CAN frames with cansend can0 000#
(Send one frame with CanID 0, length 0 via can0 (the Ixxat adapter)). The result depends on if I started the slcand manually or via udev.
Manual (as described above):
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614442.246548) can0 TX - - 000 [0]
(1464614442.249320) slcan0 RX - - 000 [0]
Via Udev:
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614643.800545) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.807361) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.814058) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.820840) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
[and so on...]
Here is my lsmod | grep can
:
vcan 16384 0
slcan 16384 1
can_dev 24576 2 ixx_pci,ixx_usb
can_raw 20480 0
can 45056 1 can_raw
I'm on a Ubuntu 14.04 machine with a 4.4 kernel. uname -rv
:
4.4.0-21-generic #37~14.04.1-Ubuntu SMP Wed Apr 20 16:33:38 UTC 2016
kernel-modules udev socket
I want to start slcand
(the userspace daemon for the serial line CAN interface driver) when my Lawicel CanUSB dongle is plugged in. I followed Pascal Walter's step-by-step guide and all seems to work (slcan0 is there and i can bind(2)), except I never actually receive anything (only outgoing messages are visible in candump
and Wireshark).
The udev rule looks as follows:
# Lawicel CANUSB module
ACTION=="add", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="tty", RUN+="/usr/bin/logger [udev] Lawicel CANUSB detected - running slcan_add.sh!", RUN+="/usr/local/bin/slcan_add.sh $kernel"
ACTION=="remove", ENVID_MODEL=="CANUSB", ENVSUBSYSTEM=="usb", RUN+="/usr/bin/logger [udev] Lawicel CANUSB removed - running slcan_remove.sh!", RUN+="/usr/local/bin/slcan_remove.sh"
with /usr/local/bin/slcan_add.sh
#!/bin/sh
# Bind the USBCAN device
slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
and /usr/local/bin/slcan_remove.sh
#!/bin/sh
# Remove the USBCAN device
pkill slcand
However when I manually execute sudo /usr/local/bin/slcan_remove.sh && sudo /usr/local/bin/slcan_add.sh ttyUSB0
, everything works as expected and I can see all CAN messages with candump slcan0
).
The interface looks just the same as with udev. ip link show slcan0
gives:
91: slcan0: <NOARP,UP,LOWER_UP> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
The NetworkManager has a problem with slcan0, but that appears also when creating slcan0 manually as described above. The output of tail -f /var/log/syslog
when plugging in is:
May 26 18:29:18 laurenz-T440p logger: [udev] Lawicel CANUSB detected - running slcan_add.sh
May 26 18:29:18 laurenz-T440p slcand[14924]: starting on TTY device /dev/ttyUSB0
May 26 18:29:18 laurenz-T440p slcand[14925]: attached TTY /dev/ttyUSB0 to netdevice slcan0
May 26 18:29:18 laurenz-T440p slcand[14925]: netdevice slcan0 renamed to slcan0
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/slcan0, iface: slcan0)
May 26 18:29:18 laurenz-T440p NetworkManager[866]: SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/slcan0, iface: slcan0): no ifupdown configuration found.
May 26 18:29:18 laurenz-T440p NetworkManager[866]: <warn> /sys/devices/virtual/net/slcan0: couldn't determine device driver; ignoring...
ps -fauxw | grep can
(manual start as above):
root 1221 0.0 0.0 4336 100 ? Ss 11:38 0:00 _ slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
ps -fauxw | grep can
(re-plugging triggered udev start):
root 1362 0.0 0.0 4336 96 ? Ss 11:45 0:00 slcand -o -c -f -s8 /dev/ttyUSB0 slcan0
What could the problem with udev be? How can I fix it?
Update: Ok, so I added an Ixxat USB-to-CAN V2 and installed its SocketCan driver. It has the same problem: Tx fine, Rx not working.
Interestingly, I can just plug the two together (120R in the middle). Then I run candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
in one Terminal. In another, I send CAN frames with cansend can0 000#
(Send one frame with CanID 0, length 0 via can0 (the Ixxat adapter)). The result depends on if I started the slcand manually or via udev.
Manual (as described above):
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614442.246548) can0 TX - - 000 [0]
(1464614442.249320) slcan0 RX - - 000 [0]
Via Udev:
$ candump -d -e -c -x -t absolute any,0:0,#FFFFFFFF
(1464614643.800545) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.807361) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.814058) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
(1464614643.820840) can0 RX - - 20000020 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
no-acknowledgement-on-tx
[and so on...]
Here is my lsmod | grep can
:
vcan 16384 0
slcan 16384 1
can_dev 24576 2 ixx_pci,ixx_usb
can_raw 20480 0
can 45056 1 can_raw
I'm on a Ubuntu 14.04 machine with a 4.4 kernel. uname -rv
:
4.4.0-21-generic #37~14.04.1-Ubuntu SMP Wed Apr 20 16:33:38 UTC 2016
kernel-modules udev socket
kernel-modules udev socket
edited May 31 '16 at 8:38
Laurenz
asked May 27 '16 at 9:52
LaurenzLaurenz
1216
1216
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
So the solution to making the Canusb work in udev was found by Kurt Van Dijck:
Sometimes one can have race conditions with udev rules since not all attributes are present on the launch of the uevent
This updated /usr/local/bin/slcan_add.sh
makes the CanUsb work correctly with udev when plugged in:
#!/bin/sh
# Bind the USBCAN device
sleep 1
/usr/local/bin/slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
I still have to find out how to make the Ixxat Can-to-Usb V2 work with SocketCan.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f285858%2fudev-rule-setting-up-socketcan-socket-only-works-correctly-only-when-run-manuall%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So the solution to making the Canusb work in udev was found by Kurt Van Dijck:
Sometimes one can have race conditions with udev rules since not all attributes are present on the launch of the uevent
This updated /usr/local/bin/slcan_add.sh
makes the CanUsb work correctly with udev when plugged in:
#!/bin/sh
# Bind the USBCAN device
sleep 1
/usr/local/bin/slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
I still have to find out how to make the Ixxat Can-to-Usb V2 work with SocketCan.
add a comment |
So the solution to making the Canusb work in udev was found by Kurt Van Dijck:
Sometimes one can have race conditions with udev rules since not all attributes are present on the launch of the uevent
This updated /usr/local/bin/slcan_add.sh
makes the CanUsb work correctly with udev when plugged in:
#!/bin/sh
# Bind the USBCAN device
sleep 1
/usr/local/bin/slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
I still have to find out how to make the Ixxat Can-to-Usb V2 work with SocketCan.
add a comment |
So the solution to making the Canusb work in udev was found by Kurt Van Dijck:
Sometimes one can have race conditions with udev rules since not all attributes are present on the launch of the uevent
This updated /usr/local/bin/slcan_add.sh
makes the CanUsb work correctly with udev when plugged in:
#!/bin/sh
# Bind the USBCAN device
sleep 1
/usr/local/bin/slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
I still have to find out how to make the Ixxat Can-to-Usb V2 work with SocketCan.
So the solution to making the Canusb work in udev was found by Kurt Van Dijck:
Sometimes one can have race conditions with udev rules since not all attributes are present on the launch of the uevent
This updated /usr/local/bin/slcan_add.sh
makes the CanUsb work correctly with udev when plugged in:
#!/bin/sh
# Bind the USBCAN device
sleep 1
/usr/local/bin/slcand -o -c -f -s8 /dev/$1 slcan0
sleep 2
ifconfig slcan0 up
I still have to find out how to make the Ixxat Can-to-Usb V2 work with SocketCan.
answered May 31 '16 at 13:20
LaurenzLaurenz
1216
1216
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f285858%2fudev-rule-setting-up-socketcan-socket-only-works-correctly-only-when-run-manuall%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown