我在 Ubuntu 17.10 上使用自制的 hid 设备时遇到了问题。它在 Windows 上运行良好,在另一台装有 Kubuntu 18.04 的机器上运行良好。
我已经删除了所有 udev 规则,重新启动了 udev,重新启动了 PC,但没有任何变化。
每次我连接设备时,它都会被添加并立即删除。
输出如下udevadm monitor
:
KERNEL[6204.330291] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4 (usb)
KERNEL[6204.332824] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0 (usb)
KERNEL[6204.337649] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006 (hid)
KERNEL[6204.337676] add /class/usbmisc (class)
KERNEL[6204.337781] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/usbmisc/hiddev0 (usbmisc)
KERNEL[6204.337902] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006/hidraw/hidraw3 (hidraw)
UDEV [6204.339176] add /class/usbmisc (class)
UDEV [6204.342657] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4 (usb)
KERNEL[6204.343301] remove /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/usbmisc/hiddev0 (usbmisc)
KERNEL[6204.343321] remove /usbmisc (class)
KERNEL[6204.343441] remove /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006/hidraw/hidraw3 (hidraw)
KERNEL[6204.343467] remove /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006 (hid)
UDEV [6204.344076] remove /usbmisc (class)
UDEV [6204.349535] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0 (usb)
UDEV [6204.353769] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006 (hid)
UDEV [6204.353793] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/usbmisc/hiddev0 (usbmisc)
UDEV [6204.353805] remove /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/usbmisc/hiddev0 (usbmisc)
UDEV [6204.353819] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006/hidraw/hidraw3 (hidraw)
UDEV [6204.354254] remove /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006/hidraw/hidraw3 (hidraw)
UDEV [6204.355106] remove /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006 (hid)
KERNEL[6204.921022] add /devices/parport0/ppdev0.0 (parport)
KERNEL[6204.921041] remove /devices/parport0/ppdev0.0 (parport)
UDEV [6204.922874] add /devices/parport0/ppdev0.0 (parport)
UDEV [6204.923290] remove /devices/parport0/ppdev0.0 (parport)
KERNEL[6209.296515] add /devices/parport0/ppdev0.0 (parport)
UDEV [6209.298376] add /devices/parport0/ppdev0.0 (parport)
KERNEL[6209.348220] remove /devices/parport0/ppdev0.0 (parport)
UDEV [6209.349800] remove /devices/parport0/ppdev0.0 (parport)
对我来说最奇怪的是这两行:
UDEV [6204.353819] add /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006/hidraw/hidraw3 (hidraw)
UDEV [6204.354254] remove /devices/pci0000:00/0000:00:1c.5/0000:06:00.0/usb5/5-1/5-1.4/5-1.4:1.0/0003:0483:5750.0006/hidraw/hidraw3 (hidraw)
结果/dev 中hidraw3
没有任何文件hiddev0
请提出一些我可以尝试的建议,以了解这种行为的原因。
谢谢。
更新以下是 dmesg 输出:
[ 1897.305402] usb 3-6: new full-speed USB device number 13 using xhci_hcd
[ 1897.446811] usb 3-6: New USB device found, idVendor=0483, idProduct=5750
[ 1897.446820] usb 3-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1897.446825] usb 3-6: Product: Smart Display
[ 1897.446829] usb 3-6: Manufacturer: QS
[ 1897.446832] usb 3-6: SerialNumber: 00000000001A
[ 1897.448254] hid-generic 0003:0483:5750.0008: hiddev0,hidraw3: USB HID v1.01 Device [QS Smart Display] on usb-0000:00:14.0-6/input0
答案1
当我在 Ubuntu Xenial 上插入条形码扫描仪时,我遇到了同样的问题。
我检查了 /var/log/syslog 以及 lsof 的输出,发现我遇到了来自 fwupd 的这个错误: https://bugs.launchpad.net/ubuntu/+source/fwupd/+bug/1717009
我停止了 fwupd 并且能够扫描条形码。
我希望这有帮助。