udev not capturing information (lot of missing attributes) for usb device
Asked Answered
S

0

6

I have two systems, one running Ubutu 14.04, one running raspbian. When I connect a usb printer to my Ubuntu machine I can can get lots of information about from udevadm:

:~$ udevadm info -q property --export -n /dev/usb/lp2 
   DEVNAME='/dev/usb/lp2'
   DEVPATH='/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2.1/3-2.1.1/3-2.1.1:1.0/usbmisc/lp2'
   ID_BUS='usb'
   ID_MODEL='DYMO_LabelWriter_450'
   ID_MODEL_ENC='DYMO\x20LabelWriter\x20450'
   ID_MODEL_ID='0020'
   ID_REVISION='0112'
   ID_SERIAL='DYMO_DYMO_LabelWriter_450_09041413125694'
   ID_SERIAL_SHORT='09041413125694'
   ID_TYPE='printer'
   ID_USB_DRIVER='usblp'
   ID_USB_INTERFACES=':070102:'
   ID_USB_INTERFACE_NUM='00'
   ID_VENDOR='DYMO'
   ID_VENDOR_ENC='DYMO'
   ID_VENDOR_ID='0922'
   MAJOR='180'
   MINOR='2'
   SUBSYSTEM='usbmisc'
   USEC_INITIALIZED='873171356'

But when I do the same command on another system (raspbian) I get almost no information back:

:~$ udevadm info -q property --export -n /dev/usb/lp0
DEVNAME='usb/lp0'
DEVPATH='/devices/platform/bcm2708_usb/usb1/1-1/1-1.4/1-1.4:1.0/usbmisc/lp0'
MAJOR='180'
MINOR='0'
SUBSYSTEM='usbmisc'
UDEV_LOG='3'

On the 2nd (raspbian) system I can see information in the syslog about the device when I connect it:

Jun  3 17:24:06 raspberryPi kernel: [ 2517.897717] usb 1-1.4: new full-speed USB device number 9 using dwc_otg
Jun  3 17:24:06 raspberryPi kernel: [ 2518.001031] usb 1-1.4: New USB device found, idVendor=0922, idProduct=0020
Jun  3 17:24:06 raspberryPi kernel: [ 2518.001049] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jun  3 17:24:06 raspberryPi kernel: [ 2518.001061] usb 1-1.4: Product: DYMO LabelWriter 450
Jun  3 17:24:06 raspberryPi kernel: [ 2518.001072] usb 1-1.4: Manufacturer: DYMO
Jun  3 17:24:06 raspberryPi kernel: [ 2518.001083] usb 1-1.4: SerialNumber: 12092215544125
Jun  3 17:24:06 raspberryPi kernel: [ 2518.003113] usblp 1-1.4:1.0: usblp0: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x0922 pid 0x0020

Given that udev does not report anything useful (no serial, vendor, type, etc) it seems it would be impossible to write udev rules on raspbian.

I've also tries lsusb to get information about the device but:

:~$ sudo lsusb -D /dev/usb/lp0
Cannot open /dev/usb/lp0

However lsusb -v does provide some of the info I would expect (along with a bunch of info I don't care about for other devices):

:~$ lsusb -v
....
Bus 001 Device 008: ID 0922:0020 Dymo-CoStar Corp. LabelWriter 450
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0922 Dymo-CoStar Corp.
  idProduct          0x0020 LabelWriter 450
  bcdDevice            1.12
  iManufacturer           1 DYMO
  iProduct                2 DYMO LabelWriter 450
  iSerial                 3 14040809283557
  ....

So I know the information is available, just not to udev. Any ideas on how to make this information available to udev?

EDIT I've tried the same command on a brand new Ubuntu 14.04 install and it reports the same short list of information as the raspbian device. So that tells me that something interesting is happening on the first Ubuntu 14.04 box that isn't happening on the other devices.

Secretariat answered 3/6, 2015 at 17:36 Comment(5)
Did you ever solve this? I'm having the same exact issue, also on an rpi. I found unix.stackexchange.com/questions/209647/… but it's unanswered.Cup
Could you test this: 1) lsmod 2) modprobe usblp, and the messages that you get after it?Teacart
Also you cat test this sudo apt-get install system-config-printer-udevTeacart
We did eventually come up with a solution for getting the info we were after. We still used udevadm but we had to explicitly supply the device path. Here is an example for lp0: $:udevadm info -q property --path=udevadm info -q property /dev/usb/lp0 | sed -rn 's/DEVPATH=(.*)\\/[0-9\\.:-]+\\/usbmisc\\/lp0/\\1/p' We also worked around our need to write udev rules so YMMV.Secretariat
Other times I had-to write udev rules I first did a little debugging with the aid of an external script that writes to messages via logger. This way I can see what attributes are available and consequently write a fine tuned rule to target what I wanted.Coppage

© 2022 - 2024 — McMap. All rights reserved.