lsusb-v дает подробный ответ USB-устройств.
Пример:
Bus 003 Device 003: ID 413c:2003 Dell Computer Corp. Keyboard
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x413c Dell Computer Corp.
idProduct 0x2003 Keyboard
bcdDevice 3.06
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 70mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 24
Теперь я хочу видеть только bInterfaceProtocol
из Interface Descriptor
раздел для Bus 003 Device 003
устройство только или я хочу перечислить это bInterfaceProtocol
содержание всех USB-устройств. Кто-либо может сказать мне какой-либо определенный формат для этого?
Вы не можете сделать этого использование lsusb
только. Вы можете:
Используйте -s
или -d
опции сделать lsusb
покажите вывод только для определенных устройств:
-s [[bus]:][devnum]
Show only devices in specified bus and/or devnum. Both ID's are
given in decimal and may be omitted.
-d [vendor]:[product]
Show only devices with the specified vendor and product ID.
Both ID's are given in hexadecimal.
И используйте grep
отфильтровывать поля.
Например:
$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 003 Device 004: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 003 Device 002: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
$ lsusb -s 003:003
Bus 003 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
$ lsusb -s 003:003 -v | grep bInterfaceProtocol
bInterfaceProtocol 0 Full speed (or root) hub
# lsusb -v | grep -e bInterfaceProtocol -e Bus
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
bInterfaceProtocol 0 Full speed (or root) hub
Bus 003 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
bInterfaceProtocol 0 Full speed (or root) hub
Bus 003 Device 004: ID 0e0f:0003 VMware, Inc. Virtual Mouse
bInterfaceProtocol 2 Mouse
Bus 003 Device 002: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
bInterfaceProtocol 0 Full speed (or root) hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
bInterfaceProtocol 0 Full speed (or root) hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
bInterfaceProtocol 0 Full speed (or root) hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
bInterfaceProtocol 0 Full speed (or root) hub