Udev rule to connect USB to CAN Lawicell

by Tabarnak   Last Updated September 11, 2019 19:02 PM - source

I did purchase a USB to CAN from Lawicell Using this tutorial (http://pascal-walter.blogspot.com/2015/08/installing-lawicel-canusb-on-linux.html) device is running but I cannot automatically detect it using udev rule (ubuntu 16 04 LTS)

udev rule is triggered at USB connection :

#Lawicell CAN USB auto detect
ACTION=="add", ATTRS{serial}=="LW2ZV78N", RUN+="/etc/udev/scripts/start_slcand"

Script works if run manually (there is only this device connected to my labtop, I run sudo pkill slcand manually when unplugging)

#!/bin/sh
#Add USB CAN
sleep 1
slcand -o -c -f -s6 /dev/ttyUSB* slcan0
sleep 2
ifconfig slcan0 up

There are issues issues in log causing device to be removed, but I have no clue what to do. Can someone help?

Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.356397] usb 6-1: new full-speed USB device number 7 using uhci_hcd
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.571681] usb 6-1: New USB device found, idVendor=0403, idProduct=6001
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.571690] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.571695] usb 6-1: Product: CANUSB
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.571700] usb 6-1: Manufacturer: LAWICEL
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.571704] usb 6-1: SerialNumber: LW2ZV78N
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.577727] ftdi_sio 6-1:1.0: FTDI USB Serial Device converter detected
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.577801] usb 6-1: Detected FT232RL
Sep 11 19:52:02 elliot-Satellite-P300 kernel: [ 1168.579780] usb 6-1: FTDI USB Serial Device converter now attached to ttyUSB0
Sep 11 19:52:02 elliot-Satellite-P300 mtp-probe: checking bus 6, device 7: "/sys/devices/pci0000:00/0000:00:1d.0/usb6/6-1"
Sep 11 19:52:03 elliot-Satellite-P300 mtp-probe: bus: 6, device: 7 was not an MTP device
Sep 11 19:52:04 elliot-Satellite-P300 slcand[4976]: starting on TTY device /dev/ttyUSB0
Sep 11 19:52:04 elliot-Satellite-P300 slcand[4977]: attached TTY /dev/ttyUSB0 to netdevice slcan0
Sep 11 19:52:04 elliot-Satellite-P300 NetworkManager[751]: nm_device_get_device_type: assertion 'NM_IS_DEVICE (self)' failed
Sep 11 19:52:04 elliot-Satellite-P300 NetworkManager[751]: <info>  [1568224324.0234] manager: (slcan0): new Generic device (/org/freedesktop/NetworkManager/Devices/10)
Sep 11 19:52:04 elliot-Satellite-P300 NetworkManager[751]: <info>  [1568224324.0520] devices added (path: /sys/devices/virtual/net/slcan0, iface: slcan0)
Sep 11 19:52:04 elliot-Satellite-P300 NetworkManager[751]: <info>  [1568224324.0520] device added (path: /sys/devices/virtual/net/slcan0, iface: slcan0): no ifupdown configuration found.
Sep 11 19:52:08 elliot-Satellite-P300 slcand[5009]: starting on TTY device /dev/ttyUSB0
Sep 11 19:52:08 elliot-Satellite-P300 slcand[5010]: attached TTY /dev/ttyUSB0 to netdevice slcan0
Sep 11 19:52:11 elliot-Satellite-P300 slcand[5019]: starting on TTY device /dev/ttyUSB0
Sep 11 19:52:11 elliot-Satellite-P300 slcand[5020]: attached TTY /dev/ttyUSB0 to netdevice slcan0
Sep 11 19:52:14 elliot-Satellite-P300 slcand[5028]: starting on TTY device /dev/ttyUSB0
Sep 11 19:52:14 elliot-Satellite-P300 slcand[5029]: attached TTY /dev/ttyUSB0 to netdevice slcan0
Sep 11 19:52:16 elliot-Satellite-P300 NetworkManager[751]: <error> [1568224336.1011] platform-linux: do-change-link[11]: failure changing link: failure 19 (No such device)
Sep 11 19:52:16 elliot-Satellite-P300 NetworkManager[751]: <warn>  [1568224336.1011] device (slcan0): failed to disable userspace IPv6LL address handling
Sep 11 19:52:16 elliot-Satellite-P300 NetworkManager[751]: <info>  [1568224336.1108] devices removed (path: /sys/devices/virtual/net/slcan0, iface: slcan0)


Related Questions


How do i make udev trigger custom rules

Updated May 03, 2015 00:00 AM


Creating js* udev input device as non-root

Updated April 13, 2015 00:00 AM


Distinguishing between two similar usb devices

Updated November 17, 2015 06:01 AM