USB to Serial device won't assign CP210x driver
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_PID-VID.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 pid/vid listed.
- Replace #PID# with the PID of your device.
- Replace #VID# with the VID of your device.
- Replace #DRIVER# with the command to load the module.
- Replace #SYS# with the location of the driver under the
/sys
directory.
ACTION=="add", ATTRS{idVendor}=="#VID#", ATTRS{idProduct}=="#PID#", RUN+="#DRIVER#" RUN+="/bin/sh -c 'echo #PID# #VID# > #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'"
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.
Related videos on Youtube
Matthias Frei
Updated on September 18, 2022Comments
-
Matthias Frei over 1 year
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)
-
jc__ almost 8 yearsWhat is the directory listing under
/sys/bus/usb/drivers/cp210x
? Is there anew_id
file? -
jc__ almost 8 yearsDouble check the id for your device and try to rebind. (1-1:1.3).
-
jc__ almost 8 yearsJust passing through today... Here is a help page in my notes: (lwn.net/Articles/143397)
-
jc__ almost 8 yearsAre you working from a root shell? Remember that
sudo echo...
will not work. -
jc__ almost 8 yearsThe BUS-PORT.PORT (1-1.3) could change every time you plug the device in.
-
Matthias Frei almost 8 yearsI'm indeed working from a root shell. Thanks for the tip. But that wouldn't affect the udev rule, right?
-
jc__ almost 8 yearsNo. 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__ almost 8 yearsPost 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__ almost 8 yearsAre you still getting the "write error: No such device" error?
-
jc__ almost 8 yearsokay, 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 toecho -n "1-1.5:1.0" > /sys/bus/usb/drivers/cp210x/bind
. -
Matthias Frei almost 8 yearsYes, that's what I do.
-
jc__ almost 8 yearsAny progress on binding the driver?
-
-
Matthias Frei almost 8 yearsFor 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. -
jc__ almost 8 yearsnew_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__ almost 8 yearsReplace the ...new_id line with the ...bind command you use.
-
Matthias Frei almost 8 yearsI tried all of the above - still nothing. Does the added output from the edited question help verify the problem?
-
jc__ almost 8 yearsIs this supposed to show up as a ttyUSB or other tty?
-
jc__ almost 8 yearsYes... 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
-
Matthias Frei almost 8 years[ 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 almost 8 yearsI just plugged in another usb2serial connector which was attached to ttyUSB0. I expected a similar outcome with my device.
-
jc__ almost 8 yearsShow the
dmesg
of the one that worked. -
Matthias Frei almost 8 years[ ] 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
-
jc__ almost 8 yearsI downloaded the driver "cp210x" source code from (silabs.com/products/mcu/Pages/…) 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.
-
Matthias Frei almost 8 yearsAh, 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...
-
jc__ almost 8 yearsI agree on the manual binding. The issue seems to be identifying the device correctly. There are some good trouble shooting help in this QA. (unix.stackexchange.com/questions/60078/…).