3

I initially asked this question on SU but it is so specific to Ubuntu that I move it here.

I installed an 433Mhz transceiver on my Ubuntu system (3.8.0-35). It is an USB-to-Serial kind of device and is somehow recognized:

dmesg output:

[  324.051498] usb 3-1: new full-speed USB device number 2 using xhci_hcd
[  324.088070] usb 3-1: New USB device found, idVendor=10c4, idProduct=8668
[  324.088081] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  324.088087] usb 3-1: Product: NETUSB1100 NEWMSG 
[  324.088093] usb 3-1: Manufacturer: HZWB
[  324.102259] hid-generic 0003:10C4:8668.0002: hiddev0,hidraw1: USB HID v1.01 Device [HZWB NETUSB1100 NEWMSG ] on usb-0000:0e:00.0-1/input0

lsusb output:

Bus 003 Device 002: ID 10c4:8668 Cygnal Integrated Products, Inc.

I would like to access it (via rfxcmd for instance) but I cannot get a relevant /dev path. The contents of /dev do not change when I plug it in so there is certainly something missing.

What other steps must be done in order to create a /dev/... device path - which can be then used in scripts?

EDIT after lekensteyn's answer: output of tree /sys/bus/usb/drivers/ following a modprobe cp210x (with non-relevant parts removed). Please note that following a reboot the 3-1 above became a 3-2 below. I took that into account in the tests.

/sys/bus/usb/drivers/
├── cp210x
│   ├── bind
│   ├── module -> ../../../../module/usbserial
│   ├── uevent
│   └── unbind
├── hub
│   ├── 1-0:1.0 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-0:1.0
│   ├── 1-1:1.0 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1:1.0
│   ├── 2-0:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb2/2-0:1.0
│   ├── 2-1:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0
│   ├── 3-0:1.0 -> ../../../../devices/pci0000:00/0000:00:1c.6/0000:0e:00.0/usb3/3-0:1.0
│   ├── 4-0:1.0 -> ../../../../devices/pci0000:00/0000:00:1c.6/0000:0e:00.0/usb4/4-0:1.0
│   ├── bind
│   ├── module -> ../../../../module/usbcore
│   ├── new_id
│   ├── remove_id
│   ├── uevent
│   └── unbind
├── usb
│   ├── 1-1 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1
│   ├── 1-1.2 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2
│   ├── 1-1.3 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3
│   ├── 1-1.4 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4
│   ├── 1-1.6 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6
│   ├── 2-1 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb2/2-1
│   ├── 3-2 -> ../../../../devices/pci0000:00/0000:00:1c.6/0000:0e:00.0/usb3/3-2
│   ├── bind
│   ├── uevent
│   ├── unbind
│   ├── usb1 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1
│   ├── usb2 -> ../../../../devices/pci0000:00/0000:00:1d.0/usb2
│   ├── usb3 -> ../../../../devices/pci0000:00/0000:00:1c.6/0000:0e:00.0/usb3
│   └── usb4 -> ../../../../devices/pci0000:00/0000:00:1c.6/0000:0e:00.0/usb4
├── usbhid
│   ├── 1-1.2:1.0 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0
│   ├── 3-2:1.0 -> ../../../../devices/pci0000:00/0000:00:1c.6/0000:0e:00.0/usb3/3-2/3-2:1.0
│   ├── bind
│   ├── module -> ../../../../module/usbhid
│   ├── new_id
│   ├── remove_id
│   ├── uevent
│   └── unbind
├── usbserial
│   ├── bind
│   ├── module -> ../../../../module/usbserial
│   ├── uevent
│   └── unbind
├── usbserial_generic
│   ├── bind
│   ├── module -> ../../../../module/usbserial
│   ├── uevent
│   └── unbind

EDIT: added dmesg after cp210x.ko recompilation and reboot (with the new cp210x.ko)

[    1.352918] usb 3-2: new full-speed USB device number 2 using xhci_hcd
[    1.389854] usb 3-2: New USB device found, idVendor=10c4, idProduct=8668
[    1.389865] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    1.389871] usb 3-2: Product: NETUSB1100 NEWMSG 
[    1.389877] usb 3-2: Manufacturer: HZWB
[    1.399869] usbcore: registered new interface driver usbhid
[    1.399872] usbhid: USB HID core driver
[    1.406870] hid-generic 0003:10C4:8668.0001: hiddev0,hidraw0: USB HID v1.01 Device [HZWB NETUSB1100 NEWMSG ] on usb-0000:0e:00.0-2/input0

after a manual modprobe cp210x, the extra lines in dmesg.

[ 1313.312593] usbcore: registered new interface driver usbserial
[ 1313.312642] usbcore: registered new interface driver usbserial_generic
[ 1313.312674] usbserial: USB Serial support registered for generic
[ 1313.329536] usbcore: registered new interface driver cp210x
[ 1313.329575] usbserial: USB Serial support registered for cp210x
(end of file)
1
  • did you ever manage to communicate with your device through the ttyUSB channel? When following the steps above and below, I had a ttyUSB0 device, but when trying to read from it, I recieved an error in dmesg: cp210x_open - Unable to enable UART Oct 31, 2015 at 13:59

2 Answers 2

5

When the generic HID drivers owns a device, it makes clear that a more specific driver is missing for the device. I grepped the kernel tree (3.13) for your device (10[Cc]4 and 8668), but did not find a driver for this. The closest I found was the cp210x module, but it has no entry for your 8668 device.

You can try to manually bind the device to the cp210x driver (Change 3-1 to the addresses listed in dmesg):

sudo modprobe cp210x
sudo tee /sys/bus/usb/drivers/usbhid/unbind <<<3-1
sudo tee /sys/bus/usb/drivers/cp210x/bind <<<3.1

Try editing the cp210x module and add your product ID to the list:

apt-get source linux-headers-$(uname -r)
cd linux-lts-*/drivers/usb/serial
wget https://gist.github.com/Lekensteyn/8544581/raw/cp210x-10c4-8668.patch
patch < cp210x-10c4-8668.patch

If you do not want to fetch 124MB of sources, all you need are the Makefile and cp210x.c files. See https://gist.github.com/Lekensteyn/8544581 for already patched versions based on 3.8.0-35-generic.

Then build the module (install the build-essential package using apt-get if you have not already):

make -C /usr/src/linux-headers-$(uname -r) M=$PWD cp210x.ko

Then unload the old module (if any) and load the newly built one (you need to disable Secure Boot if you had it enabled):

sudo rmmod cp210x
sudo insmod cp210x.ko
11
  • Thank you for the help. cp210x is likely to be the good choice as I found out from some documentation. I tried the manual bind but i) I had to give a more explicit device for the unbind part (sudo tee /sys/bus/usb/drivers/usbhid/unbind <<<"3-1:1.0") and ii) I could not bind manually, the commnand returns a tee: /sys/bus/usb/drivers/cp210x/bind: No such device. I updated my question with a tree of /sys/bus/usb/drivers immediately follwing the modprobe.
    – WoJ
    Jan 21, 2014 at 12:15
  • Note: Following a reboot the 3-1 in the two first listings became a 3-2 in the treeoutput. I used the correct one in the tests (and will update the question).
    – WoJ
    Jan 21, 2014 at 12:23
  • One more thing: I tried to re-bind the device to usbhid right after unbinding it , it worked (back to the same tree layout than before the unbind). In that case I really have no idea why the same command on /sys/bus/usb/drivers/cp210x/bind does not work
    – WoJ
    Jan 21, 2014 at 13:47
  • @WoJ See edit, can you test that out?
    – Lekensteyn
    Jan 21, 2014 at 17:57
  • 1
    YES - that was it. I forgot to unbind from usbhid. After reloading the module I have a /dev/ttyUSB0. Thank you very, very much for the extended help!
    – WoJ
    Jan 22, 2014 at 15:51
0

I use shell scripts to manage identifying device node and use custom cp210x driver. The also give appropriate udev rules and scripts to dynamically execute a script when a CP210X device is hot plugged.

github.com/RishiGupta12/serial-communication-manager/tree/master/drivers/cp210x-silicon-labs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.