[英]Obtaining information about /dev/usb/lp* devices
I have a problem obtaining information about /dev/usb/lp*
devices. 我在获取有关
/dev/usb/lp*
设备的信息时遇到问题。
The lsusb
command gives me USB bus and device IDs, and a name of the device but I can't figure out how to get it to tell me the name of the corresponding /dev/usb/lp*
device. lsusb
命令为我提供了USB总线和设备ID,以及设备的名称,但是我不知道如何获取它来告诉我相应的/dev/usb/lp*
设备的名称。
I don't have CUPS available. 我没有CUPS。
You can use libudev
to get the equivalent of the following command: 您可以使用
libudev
来获得与以下命令等效的命令:
$ udevadm info -a /dev/usb/lp*
In my PC it prints something like: 在我的PC上,它打印如下内容:
looking at device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.1/usbmisc/lp2':
KERNEL=="lp2"
SUBSYSTEM=="usbmisc"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.1':
KERNELS=="1-1.3:1.1"
SUBSYSTEMS=="usb"
DRIVERS=="usblp"
...
looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3':
KERNELS=="1-1.3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
...
ATTRS{idProduct}=="341b"
ATTRS{idVendor}=="04e8"
...
And there they are! 在那里! The wanted
idProduct
and the idVendor
通缉
idProduct
和idVendor
You can also get the information by navigating the /sys
directory manually: 您还可以通过手动导航
/sys
目录来获取信息:
$ ls -l /dev/usb/lp2
crw-rw---- 1 root lp 180, 2 Sep 27 11:46 /dev/usb/lp2
$ readlink -f /sys/dev/char/180:2
/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.1/usbmisc/lp2
$ cat /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/{idVendor,idProduct}
04e8
341b
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.