USB-to-Serial device, why no /dev entry?
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)
Solution 1:
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