3

I'm running Jessie Lite on a RPi2. When I connect my USB to Serial device it does show up, however the driver is not assigned.

lsusb -t

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 3: Dev 13, If 0, Class=Vendor Specific Class, Driver=, 12M

The CP210x driver from Silicon Labs seems to be installed:

lsmod

Module                  Size  Used by
cp210x                  9419  0 
usbserial              29964  1 cp210x

Now I did try manual binding without success:

echo -n "1-1.3:1.0" > /sys/bus/usb/drivers/cp210x/bind

write error: No such device

Since I'm fairly new to Linux and I need that thing running, I'd be grateful for suggestions. Side note: I have a little Python script running on a Windows machine that is able to talk to the very device just fine...

The device is there, I can't figure out why it's not been found:

tree /sys/bus/usb/devices/

├── 1-1.3 -> ../../../devices/platform/soc/20980000.usb/usb1/1-1/1-1.3
├── 1-1.3:1.0 -> ../../../devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3:1.0

Might the additional information from usb-devices help finding the problem?

T:  Bus=01 Lev=02 Prnt=02 Port=04 Cnt=02 Dev#=  6 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=18ef ProdID=e030 Rev=01.00
S:  Manufacturer=Silicon Labs
S:  Product=ALC 8500 Expert
S:  SerialNumber=3ENAEFJAVJCO9AQQ
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
Matthias Frei
  • 31
  • 1
  • 4
  • What is the directory listing under /sys/bus/usb/drivers/cp210x ? Is there a new_id file? – jc__ Aug 01 '16 at 18:24
  • There's just bind, module, uevent and unbind. The same goes for usbserial. – Matthias Frei Aug 02 '16 at 19:48
  • Double check the id for your device and try to rebind. (1-1:1.3). – jc__ Aug 02 '16 at 20:39
  • Just passing through today... Here is a help page in my notes: (https://lwn.net/Articles/143397/) – jc__ Aug 02 '16 at 20:44
  • Are you working from a root shell? Remember that sudo echo... will not work. – jc__ Aug 03 '16 at 18:34
  • The BUS-PORT.PORT (1-1.3) could change every time you plug the device in. – jc__ Aug 03 '16 at 18:54
  • I'm indeed working from a root shell. Thanks for the tip. But that wouldn't affect the udev rule, right? – Matthias Frei Aug 04 '16 at 17:28
  • No. But the udev rule only does the bind automatically, therefore you must get the bind to work manually first before you can add the command to the rule. Ive been thinking a little about it, If you change the USB slot the BUS-PORT.PORT will change, so AFTER you get it to work once manually, the rule will have to be written to use the serial number of the device or another way (PID VID). Go ahead and post the dmesg out put. Oh, and udev will always run as root. – jc__ Aug 04 '16 at 17:52
  • Post a couple of links for the device. Im not finding what I expected for "Silicon Labs ALC 8500 Expert". If it used HID mode the syntax will be different. – jc__ Aug 04 '16 at 18:31
  • Are you still getting the "write error: No such device" error? – jc__ Aug 04 '16 at 18:53
  • Yes, I still get this error. This is the link to the device: http://www.elv.de/elv-akku-lade-center-alc-8500-2-expert-inkl-pc-software-chargeprofessional-vierleiter-ri-messkabel-temperaturfuehler-und-usb-kabel-1-6-m.html. – Matthias Frei Aug 04 '16 at 20:03
  • okay, just want to verify something. When you plug in the device and then do a dmesg and the output refers to the device as "usb 1-1.5" or other, this is the numbers that you are plugging in to echo -n "1-1.5:1.0" > /sys/bus/usb/drivers/cp210x/bind. – jc__ Aug 04 '16 at 20:10
  • Yes, that's what I do. – Matthias Frei Aug 05 '16 at 14:57
  • Any progress on binding the driver? – jc__ Aug 08 '16 at 19:53

1 Answers1

2

Add a rule to udev that will automatically load a driver for an USB device.

Information needed:

  • USB device PID / VID numbers. lsusb output. Does not show in tree mode. lsusb -t
  • Device driver modprobe command. /sbin/modprobe usb-storage

Create a udev rule.

Add your own rule file under /etc/udev/rules.d

sudo vi /etc/udev/rules.d/80-serialToUsb_VID-PID.rules

When you add the rule for udev. This will allow udev to automatically load the driver, upon USB insertion, for any device with the vid/pid listed.

  • Replace #VID# with the VID of your device.
  • Replace #PID# with the PID of your device.
  • Replace #DRIVER# with the command to load the module.
  • Replace #SYS# with the location of the driver's new_id file under the /sys directory.

ACTION=="add", ATTRS{idVendor}=="#VID#", ATTRS{idProduct}=="#PID#", RUN+="#DRIVER#" RUN+="/bin/sh -c 'echo #VID# #PID# > #SYS#'"

Restart udev

sudo /etc/init.d/udev restart

Attach the device and use dmesg to verify


Here is an example I used for a custom mp3 player.

ACTION=="add", ATTRS{idVendor}=="a000", ATTRS{idProduct}=="a000", RUN+="/sbin/modprobe usb-storage" RUN+="/bin/sh -c 'echo a000 a000 > /sys/bus/usb/drivers/usb-storage/new_id'"

And an example for a custom Silicon Labs serial to usb device:

ACTION=="add", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="84a0", RUN+="/usr/sbin/modprobe cp210x" RUN+="/bin/sh -c 'echo 10c4 84a0 > /sys/bus/usb-serial/drivers/cp210x/new_id'"

This works on Debian 8, and Ubuntu 14.

You are using Debian lite. So, I'm am not 100% sure this will work for you.

I have a Freescale embedded device, mx23, that uses mdev instead of udev and the procedure is a bit different.

willbradley
  • 103
  • 2
jc__
  • 2,605
  • For most drivers I have the subdir new_id (like for usb-storage or smc95xx). Also I'm not permitted to make it, nor will it be created automatically when I write the rule like you described?! The PI uses udev though. – Matthias Frei Aug 02 '16 at 20:25
  • new_id is supplied by the driver, not you. Also you may need to sudo su to have permission to echo to bind or new_id. – jc__ Aug 02 '16 at 20:41
  • Replace the ...new_id line with the ...bind command you use. – jc__ Aug 02 '16 at 20:45
  • I tried all of the above - still nothing. Does the added output from the edited question help verify the problem? – Matthias Frei Aug 02 '16 at 21:55
  • Is this supposed to show up as a ttyUSB or other tty? – jc__ Aug 03 '16 at 18:18
  • Yes... Lets get some more info. It looks like the issue is how you are referencing the device. unplug the device and do a dmesg plug in to USB and dmesg again. Post the info when the device is connected – jc__ Aug 03 '16 at 18:23
  • [ 826.472454] usb 1-1.5: USB disconnect, device number 5 [ 829.008626] usb 1-1.5: new full-speed USB device number 7 using dwc_otg [ 829.113278] usb 1-1.5: New USB device found, idVendor=18ef, idProduct=e030 [ 829.113316] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 829.113337] usb 1-1.5: Product: ALC 8500 Expert [ 829.113353] usb 1-1.5: Manufacturer: Silicon Labs [ 829.113370] usb 1-1.5: SerialNumber: 3ENAEFJAVJCO9AQQ – Matthias Frei Aug 04 '16 at 17:53
  • I just plugged in another usb2serial connector which was attached to ttyUSB0. I expected a similar outcome with my device. – Matthias Frei Aug 04 '16 at 17:55
  • Show the dmesg of the one that worked. – jc__ Aug 04 '16 at 17:57
  • [ ] usb 1-1.2: USB disconnect, device number 6 [ ] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0 [ ] ch341 1-1.2:1.0: device disconnected [ ] usb 1-1.2: new full-speed USB device number 8 using dwc_otg [ 1910.345921] usb 1-1.2: New USB device found, idVendor=1a86, idProduct=7523 [ ] usb 1-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [ ] usb 1-1.2: Product: USB2.0-Ser! [ ] ch341 1-1.2:1.0: ch341-uart converter detected [ ] usb 1-1.2: ch341-uart converter now attached to ttyUSB0 – Matthias Frei Aug 04 '16 at 18:12
  • I downloaded the driver "cp210x" source code from (https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx#linux) for the 3.x kernel. The PID and VID of your device (vid 18ef pid e030) is not listed. The closest is (18ef:e00f USB to I2c). Are you in the position of adding your device to the source code and compiling for the RPi2 ( ARM Cortex-A7)? I do not know if the absence of your PID VID from the source will prevent the manual binding of this driver. – jc__ Aug 04 '16 at 18:50
  • Ah, I thought that's the purpose of the manual binding?! Wouldn't the device be attached automatically otherwise? Well that sounds Greek to me;-) Sorry I've never done such a thing. Not yet that is... – Matthias Frei Aug 05 '16 at 15:05
  • I agree on the manual binding. The issue seems to be identifying the device correctly. There are some good trouble shooting help in this QA. (http://unix.stackexchange.com/questions/60078/find-out-which-modules-are-associated-with-a-usb-device). – jc__ Aug 05 '16 at 18:45