aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2023-10-30usbutils 017 releaseHEADv017masterGreg Kroah-Hartman3-26/+38
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-30names: simplify get_vendor_product_with_fallback() a bitGreg Kroah-Hartman1-4/+6
Based on some review from Lonnie Abelbeck, if get_sysfs_name() failed in get_vendor_product_with_fallback(), the strings "[unknown]" would not be properly set for the product/vendor. Now the odds of that happening are very slim, but simplify this all by setting the strings first, and then, if we can find a real override, use that instead. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-30lsusb: add fallback names for 'lsusb -v' outputGreg Kroah-Hartman4-35/+41
Previously the -v output would not show the vendor/product names if they were not in the hwdb. Change that to look in sysfs as well if the database does not have a string, as that's what the non-v version does. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-30lsusb: fix build warning for dump_billboard_alt_mode_capability_desc()Greg Kroah-Hartman1-3/+2
The parameter 'dev' is not used, so remove it. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-30Merge pull request #176 from rezso/patch-1Greg Kroah-Hartman1-3/+3
Honor system libdir and includedir
2023-10-30lsusb: fix up [unknown] vendor and product strings.Greg Kroah-Hartman2-6/+6
In commit 8a80f70a8afb ("names.c: if a string can not be found in the usb.ids file, return [unknown]"), the logic for determining the vendor and product for the USB device was changed to ONLY rely on the usb.ids file, instead of falling back to any vendor/product strings that are on the device itself. This had the bad side-affect of causing many devices that previously showed vendor/product information just fine, to now show up as [unknown]. Fix this up to fall back to looking at the string in the device itself, and ONLY if the string is not present, will '[unknown]' be printed out. This changes the output on one of my machines from: Bus 003 Device 002: ID 32ac:0002 [unknown] [unknown] to: Bus 003 Device 002: ID 32ac:0002 Framework HDMI Expansion Card This should resolve github issue #177, many thanks to the people reporting it quickly there. Fixes: 8a80f70a8afb ("names.c: if a string can not be found in the usb.ids file, return [unknown]") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-28Honor system libdir and includedirrezso1-3/+3
Both libdir and includedir are defined by autoconf, use these dirs instead of hardcoded dirs. Signed-off-by: rezso <rezso@rezso.net>
2023-10-22usbutils 016 releasev016Greg Kroah-Hartman3-115/+166
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-22lsusb-t: if a driver is not bound to an interface, report "[none]"Greg Kroah-Hartman1-0/+2
For the output of 'lsusb -t' if a driver is not bound to an interface, the result looks odd. Fix that up by printing out "[none]" instead. This changes the output of a line that previous looked like: |__ Port 004: Dev 006, If 0, Class=[unknown], Driver=, 12M to be: |__ Port 004: Dev 006, If 0, Class=[unknown], Driver=[none], 12M Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-22names.c: if a string can not be found in the usb.ids file, return [unknown]Greg Kroah-Hartman1-4/+4
For interfaces or other USB strings, if they are not in the current hardware database, return "[unknown]" to give people a chance to understand why their device isn't reporting anything for those fields. This changes the output of a line that previous looked like: |__ Port 004: Dev 006, If 0, Class=, Driver=, 12M to be: |__ Port 004: Dev 006, If 0, Class=[unknown], Driver=, 12M Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-22lsusb.py.in: add another default path for usb.idsGreg Kroah-Hartman1-0/+1
Most distros put usb.ids in /usr/share/hwdata/ now, so add that as a default search path to make working with the script directly out of the source directory easier. This does not change the ability for the build system to add their own default path, so distros should not have any functional change at all. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-22lsusb.py: fix up wakeup logic for devices that do not support itGreg Kroah-Hartman1-1/+4
Some interfaces/devices can not do wakeup at all, and the script will crash if it runs into them. Handle this properly by reporting "unsupported" if the file can not be read from sysfs, as that is what this means. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-16usbutils: lsusb-t: print entries for devices with no interfacesAlan Stern1-5/+9
Not all USB devices have interfaces. This is true in particular of the STMicroelectronics STEVAL-USBC2DP Type-C to DisplayPort adapter, as well as possibly other USB-C devices. As a result these devices do not show up in the output from "lsusb -t", because the logic in print_tree_dev_interface() lists interfaces, not devices (as implied by the function's name). This means that the output from "lsusb -t" can be inconsistent with the output from "lsusb", since some devices are omitted. To fix the problem, we make the subroutine call print_usbdevice() at least once even if the device has no interfaces, and make the latter routine print a minimal description of such devices (anything that does not require access to the interface descriptor). Reported-and-tested-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/linux-usb/70c563f1-847c-32a1-cf4d-6bf9802017ab@interlog.com/ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-12README.md: add source locationGreg Kroah-Hartman1-0/+10
Add a section saying where the source is located. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-12lsusb.8.in: fix up missing '-' in textGreg Kroah-Hartman1-3/+3
In translations, people noticed the missing '-' for options in the text, so fix that up to look correct. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-12lsusb -t: assign_interface_to_parent() fixupsGreg Kroah-Hartman1-1/+1
It was pointed out that assign_interface_to_parent() was looking at the wrong string for the string check, so fix that up. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-12lsusb -t: print ports and busses and devices with same widthGreg Kroah-Hartman1-3/+3
lsusb shows values in 3 digit fields, so do the same for 'lsusb -t' as well, making it more obvious what device matches up with what. This also mirrors the output of the -vv option as well, which shows that the kernel uses 3 digits for these values in /dev/bus/usb/ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-12lsusb -t: sort in bus order, not reverse orderGreg Kroah-Hartman1-2/+2
I can't remember why this was in reverse order, but now that 'lsusb' outputs the busses in sorted order, do the same thing here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-12Merge pull request #148 from undisputed-seraphim/sort-device-by-idGreg Kroah-Hartman1-0/+26
lsusb: Add function that sorts the output by device ID.
2023-10-12Merge pull request #175 from naruto-abc/masterGreg Kroah-Hartman1-2/+2
Use bigger buffer to place speed value string
2023-10-12Merge pull request #174 from bobhy/powerwakeupGreg Kroah-Hartman1-4/+11
Display (device) power/wakeup via -w option.
2023-10-11lsusb.py.in: Display (device) power/wakeup via -w option.Bob Hyman1-4/+11
e.g. > ./lsusb.py.in -w usb1 1d6b:0002 09 1IF [USB 2.00, 480 Mbps, 0mA, power wakeup: disabled] (xhci-hcd 0000:c4:00.3) hub 1-2 2109:2822 09 1IF [USB 2.10, 480 Mbps, 0mA, power wakeup: disabled] (VIA Labs, Inc. USB2.0 Hub 000000001) hub 1-2.1 046d:c52f 00 2IFs [USB 2.00,12 Mbps, 98mA, power wakeup: enabled] (Logitech USB Receiver) Signed-off-by: Bob Hyman <bob.hyman@gmail.com>
2023-10-12Use bigger buffer to place speed value stringDingyan Li1-2/+2
Also add more possible speed value strings in the comments. Signed-off-by: Dingyan Li <18500469033@163.com>
2023-10-11Merge pull request #169 from hannesweisbach/usbutils.pcGreg Kroah-Hartman3-0/+24
Generate usbutils.pc pkgconfig file
2023-10-11Generate usbutils.pc pkgconfig fileHannes Weisbach3-0/+24
Allow buildsystems using pkgconfig to find usb-utils. I think some library I was using was trying to find usb.ids using pkgconfig. Signed-off-by: Hannes Weisbach <hannesweisbach@gmail.com>
2023-06-25lsusb -h fixupsGreg Kroah-Hartman1-1/+4
Previous change to make `lsusb -h` not return an error forgot to account that the help is also printed when an invalid option is used. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-25Merge pull request #163 from naruto-abc/devGreg Kroah-Hartman1-8/+10
lsusb: fix incorrect variable type and unalignments when dumping hid …
2023-06-25Merge pull request #167 from lnykryn/scGreg Kroah-Hartman1-76/+90
usb-devices: make shellcheck happy
2023-06-25Merge pull request #168 from aurel32/masterGreg Kroah-Hartman1-1/+1
Fix a typo in usb-spec.h
2023-06-25lsusb -h returns an errorGreg Kroah-Hartman1-1/+1
Fix up the issue where 'lsusb -h' will return an error to the shell, it succeeded, so return 0 instead. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-16Fix a typo in usb-spec.hAurelien Jarno1-1/+1
Rigth => Right Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2023-03-31usb-devices: make shellcheck happyLukas Nykryn1-76/+90
This change should not make any difference in behavior, but fixes all shellcheck warnings besides https://www.shellcheck.net/wiki/SC3043 Also replacing 'var=`cat file`' with 'read' makes usb-devices much faster. Old: real 0m0,849s user 0m0,388s sys 0m0,531s New: real 0m0,245s user 0m0,109s sys 0m0,155s Signed-off-by: Lukas Nykryn <lnykryn@redhat.com>
2023-03-11Fix misalignments in hid device descripptor.Dingyan Li1-4/+4
Extra spaces should be added when printing below lines: 'Report Descriptors: ** UNAVAILABLE **' Signed-off-by: Dingyan Li <18500469033@163.com>
2023-03-11Fix an incorrect length value in hid descriptor.Dingyan Li1-4/+6
While dumping descriptors of a USB hid device, I saw a weird line: 'Report Descriptor: (length is -1)' This is because variable 'n' is used to hold a potential negative integer value even though it's an unsigned int type in function dump_hid_device. When usb_control_msg() fails, overflow happens. It will always pass the 'if' statement below and call dump_report_desc(), where this weird line finally shows up. To fix it, an int type should be used to avoid overflow. Signed-off-by: Dingyan Li <18500469033@163.com>
2023-03-01Merge pull request #165 from kristofferkoch/masterGreg Kroah-Hartman1-1/+3
usbreset: Allow idProduct and idVendor to be 0
2023-03-01usbreset: Allow idProduct and idVendor to be 0Kristoffer Ellersgaard Koch1-1/+3
idProduct at least, is valid as 0, and I guess idVendor can typically be left at 0 while developing some new usb thing. Signed-off-by: Kristoffer Ellersgaard Koch <kristoffer.koch@gmail.com>
2022-10-22usbutils 015 releasev015Greg Kroah-Hartman3-25/+46
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-22Merge pull request #137 from undisputed-seraphim/fix-sort-child-deviceGreg Kroah-Hartman1-0/+1
lsusb-t: Fix recursive sorting on child devices.
2022-10-22Merge pull request #135 from robhancock/improve-ssplus-hub-statusGreg Kroah-Hartman1-12/+30
lsusb: Improve status display for SuperSpeedPlus hubs
2022-09-14lsusb: This is a more compact implementation of the device list sort ↵Tan Li Boon1-10/+4
implemented within this pull request. The output remains the same as the one demonstrated in the previous commit. Signed-off-by: Tan Li Boon <liboon.tan@mujin.co.jp>
2022-09-14lsusb: Additional sorting by bus number.Tan Li Boon1-3/+5
In the previous commit, the output is as thus: Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 004 Device 002: ID 17ef:a391 Lenovo USB3.1 Hub Bus 004 Device 003: ID 17ef:a393 Lenovo USB3.1 Hub Bus 004 Device 004: ID 17ef:a387 Lenovo USB-C Dock Ethernet Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 002: ID 0bda:0328 Realtek Semiconductor Corp. USB3.0-CRW Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 006: ID 5986:2115 Acer, Inc Integrated Camera Bus 001 Device 008: ID 06cb:009a Synaptics, Inc. Metallica MIS Touch Fingerprint Reader Bus 001 Device 025: ID 17ef:a392 Lenovo USB2.0 Hub Bus 001 Device 026: ID 17ef:a394 Lenovo USB2.0 Hub Bus 001 Device 027: ID 2be8:0002 ARCHISS PTR87 ARCHISS PTR87 Bus 001 Device 028: ID 17ef:a395 Lenovo USB2.0 Hub Bus 001 Device 029: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P Bus 001 Device 030: ID 04b4:521a Cypress Semiconductor Corp. USB-I2C Bridge Bus 001 Device 031: ID 17ef:a396 Lenovo ThinkPad USB-C Dock Gen2 USB Audio With the changes introduced by this commit, the output becomes: Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 045e:0823 Microsoft Corp. Classic IntelliMouse Bus 001 Device 003: ID 17ef:a392 Lenovo USB2.0 Hub Bus 001 Device 005: ID 5986:2115 Acer, Inc Integrated Camera Bus 001 Device 006: ID 17ef:a394 Lenovo USB2.0 Hub Bus 001 Device 007: ID 06cb:009a Synaptics, Inc. Metallica MIS Touch Fingerprint Reader Bus 001 Device 008: ID 17ef:a395 Lenovo USB2.0 Hub Bus 001 Device 009: ID 04b4:521a Cypress Semiconductor Corp. USB-I2C Bridge Bus 001 Device 010: ID 17ef:a396 Lenovo ThinkPad USB-C Dock Gen2 USB Audio Bus 001 Device 011: ID 2be8:0002 ARCHISS PTR87 ARCHISS PTR87 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 002: ID 0bda:0328 Realtek Semiconductor Corp. USB3.0-CRW Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 004 Device 002: ID 17ef:a391 Lenovo USB3.1 Hub Bus 004 Device 003: ID 17ef:a393 Lenovo USB3.1 Hub Bus 004 Device 004: ID 17ef:a387 Lenovo USB-C Dock Ethernet Signed-off-by: Tan Li Boon <liboon.tan@mujin.co.jp>
2022-08-25lsusb: fix up Midi Device specification devicesGreg Kroah-Hartman1-1/+1
The DescriptorSubtype should be checking for 0x02, not 0x01, in order to display (GENERAL) or (Invalid) as per the USB specification for USB MIDI devices. Reported-by: symdeb Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-20Merge pull request #149 from qiankehan/undefinedGreg Kroah-Hartman1-1/+1
Fix an runtime error reported by undefind sanitizer
2022-06-20Fix an runtime error reported by undefind sanitizerHan Han1-1/+1
Fix the following error when compiling with undefined sanitizer: ./lsusb names.c:36:29: runtime error: left shift of 16 by 27 places cannot be represented in type 'int' Signed-off-by: Han Han <hhan@redhat.com>
2022-06-17lsusb: Add function that sorts the output by device ID.Tan Li Boon1-0/+30
On the master branch, device IDs are unsorted. An example from my laptop: Bus 004 Device 003: ID 17ef:a393 Lenovo USB3.1 Hub Bus 004 Device 004: ID 17ef:a387 Lenovo USB-C Dock Ethernet Bus 004 Device 002: ID 17ef:a391 Lenovo USB3.1 Hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 002: ID 0bda:0328 Realtek Semiconductor Corp. USB3.0-CRW Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 008: ID 06cb:009a Synaptics, Inc. Metallica MIS Touch Fingerprint Reader Bus 001 Device 006: ID 5986:2115 Acer, Inc Integrated Camera Bus 001 Device 029: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P Bus 001 Device 032: ID 045e:0823 Microsoft Corp. Classic IntelliMouse Bus 001 Device 031: ID 17ef:a396 Lenovo ThinkPad USB-C Dock Gen2 USB Audio Bus 001 Device 030: ID 04b4:521a Cypress Semiconductor Corp. USB-I2C Bridge Bus 001 Device 028: ID 17ef:a395 Lenovo USB2.0 Hub Bus 001 Device 027: ID 2be8:0002 ARCHISS PTR87 ARCHISS PTR87 Bus 001 Device 026: ID 17ef:a394 Lenovo USB2.0 Hub Bus 001 Device 025: ID 17ef:a392 Lenovo USB2.0 Hub Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub This patch introduces a function that sorts the device IDs by bus: Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 004 Device 002: ID 17ef:a391 Lenovo USB3.1 Hub Bus 004 Device 003: ID 17ef:a393 Lenovo USB3.1 Hub Bus 004 Device 004: ID 17ef:a387 Lenovo USB-C Dock Ethernet Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 002: ID 0bda:0328 Realtek Semiconductor Corp. USB3.0-CRW Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 006: ID 5986:2115 Acer, Inc Integrated Camera Bus 001 Device 008: ID 06cb:009a Synaptics, Inc. Metallica MIS Touch Fingerprint Reader Bus 001 Device 025: ID 17ef:a392 Lenovo USB2.0 Hub Bus 001 Device 026: ID 17ef:a394 Lenovo USB2.0 Hub Bus 001 Device 027: ID 2be8:0002 ARCHISS PTR87 ARCHISS PTR87 Bus 001 Device 028: ID 17ef:a395 Lenovo USB2.0 Hub Bus 001 Device 029: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P Bus 001 Device 030: ID 04b4:521a Cypress Semiconductor Corp. USB-I2C Bridge Bus 001 Device 031: ID 17ef:a396 Lenovo ThinkPad USB-C Dock Gen2 USB Audio Signed-off-by: Tan Li Boon <liboon.tan@mujin.co.jp>
2022-06-17lsusb-t: Fix recursive sorting on child devices.Tan Li Boon1-0/+1
Before this change, child devices beyond the first level of children underneath Bus IDs are not sorted. An example can be seen on a laptop with a USB-C dock attached to it. On current master, the output of lsusb -t looks like this: /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M |__ Port 1: Dev 4, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M |__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 10000M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M |__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M |__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 3: Dev 25, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 3: Dev 26, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 4: Dev 29, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M |__ Port 2: Dev 27, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 2: Dev 27, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 3: Dev 28, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 4: Dev 32, If 1, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 4: Dev 32, If 0, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 2: Dev 31, If 2, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 2: Dev 31, If 0, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 2: Dev 31, If 3, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 2: Dev 31, If 1, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 1: Dev 30, If 0, Class=Vendor Specific Class, Driver=, 12M |__ Port 1: Dev 30, If 1, Class=Vendor Specific Class, Driver=, 12M |__ Port 8: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M |__ Port 8: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M |__ Port 9: Dev 8, If 0, Class=Vendor Specific Class, Driver=, 12M The devices or ports of the children from second level onwards are unsorted on in reverse order. After my change, the output becomes /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M |__ Port 1: Dev 4, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M |__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 10000M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M |__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 3: Dev 25, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 3: Dev 26, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 2: Dev 27, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 2: Dev 27, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 3: Dev 28, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 1: Dev 30, If 0, Class=Vendor Specific Class, Driver=, 12M |__ Port 1: Dev 30, If 1, Class=Vendor Specific Class, Driver=, 12M |__ Port 2: Dev 31, If 0, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 2: Dev 31, If 1, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 2: Dev 31, If 2, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 2: Dev 31, If 3, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 4: Dev 32, If 0, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 4: Dev 32, If 1, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 4: Dev 29, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M |__ Port 8: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M |__ Port 8: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M |__ Port 9: Dev 8, If 0, Class=Vendor Specific Class, Driver=, 12M Where all devices are now correctly sorted in ascending order. Signed-off-by: Tan Li Boon <liboon.tan@mujin.co.jp>
2022-04-17lsusb: Improve status display for SuperSpeedPlus hubsRobert Hancock1-12/+30
Add more status information for SuperSpeedPlus hubs by using the EXT_PORT_STATUS request to determine the actual link speed ID and number of lanes that the hub reports it is connected with. This is needed to be able to figure out the actual connection speed for SuperSpeedPlus devices. This requires parsing the BOS prior to the hub information, since we can only use EXT_PORT_STATUS if the device actually has a SuperSpeedPlus device capability. Also fix some issues with the SuperSpeedPlus device capability parsing - the speed attribute and speed ID counts were off by one, and the minimum functional speed information is now parsed out. Signed-off-by: Robert Hancock <hancockrwd@gmail.com>
2022-01-20usb-devices: fix field width on device speed fieldGreg Kroah-Hartman1-1/+1
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-17lsusb: remove wireless descriptor informationGreg Kroah-Hartman1-91/+4
Again, wireless USB is long dead, this code would never get triggered at all, so just remove it as it is not being used. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-17lsusb: remove unused wireless checkGreg Kroah-Hartman1-10/+0
Wireless USB is long dead, and this check never actually worked, so remove it. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-15usb-devices: use 'local' variable type to handle recursionGreg Kroah-Hartman1-4/+4
When recursing into a long USB tree, the local variables in the print_device() function would get confused and take on the value of the previous device it printed. This caused devices to not get printed out at all, the exact opposite of what we wanted. Resolve this by using the non-POSIX 'local' variable declaration. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-15usb-devices: list the root devices in numerical orderGreg Kroah-Hartman1-2/+2
Previously "usb10" would come before "usb2" Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-06usbutils 014 releasev014Greg Kroah-Hartman3-25/+82
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-28Merge pull request #128 from grundlerchromium/handle_EAGAINGreg Kroah-Hartman1-5/+16
lsusb: don't complain on EAGAIN
2021-07-27lsusb: don't complain on EAGAINGrant Grundler1-4/+16
Given the requested decriptors are optional, seems like lsusb should NOT use perror() to communicate why it can't get the descriptors in question (output is directed to stderr, not stdout). Further, if we were told to "come back later" (EGAIN), then it's really not an error. Only emit this output when user adds "-vv" to the command line. Signed-off-by: Grant Grundler <grundler@chromium.org>
2021-07-27lsusb: remove unused RETRIES constantGrant Grundler1-1/+0
CTRL_RETRIES was never used. Remove it. Signed-off-by: Grant Grundler <grundler@chromium.org>
2021-07-22Merge pull request #125 from mb720/patch-1Greg Kroah-Hartman1-3/+3
Fix typos in lsusb.8.in
2021-07-21Fix typos in lsusb.8.inMatthias Braun1-3/+3
Signed-off-by: Matthias Braun <m.braun@htl-leonding.ac.at>
2021-07-21Merge pull request #131 from lzaoral/desc-defs-oobGreg Kroah-Hartman1-1/+1
desc-defs.c: fix possible out-of-bound read
2021-07-21Merge pull request #129 from lzaoral/lsusb-leakGreg Kroah-Hartman1-0/+1
lsusb.c: fix leak in dump_printer_device
2021-07-21Merge pull request #127 from bleungatchromium/fix-iAdditionalInfoURL-typoGreg Kroah-Hartman1-1/+1
lsusb: Fix typo in string output for iAdditionalInfoURL
2021-07-21Merge pull request #130 from lzaoral/usb-devices-posixGreg Kroah-Hartman1-10/+10
usb-devices: do not use `local` in a POSIX shell script
2021-07-21desc-defs.c: fix possible out-of-bound readLukas Zaoral1-1/+1
Found by static analysis: Expression (UAC_FORMAT_TYPE_I << 12) + ARRAY_LEN(audio_data_format_type_i) evaluates to 6 which is the length of the audio_data_format_type_i array. Therefore, if value is set to 6, the condition evaluates to true and ouf-of-bound read could occur. Signed-off-by: Lukas Zaoral <lzaoral@redhat.com>
2021-07-21usb-devices: do not use `local` in a POSIX shell scriptLukas Zaoral1-10/+10
Fixes: $ ksh /bin/usb-devices /bin/usb-devices[92]: local: not found [No such file or directory] Signed-off-by: Lukas Zaoral <lzaoral@redhat.com>
2021-07-21lsusb.c: fix leak in dump_printer_deviceLukas Zaoral1-0/+1
Allocation made by get_dev_string was not freed. Signed-off-by: Lukas Zaoral <lzaoral@redhat.com>
2021-06-17lsusb: Fix typo in string output for iAdditionalInfoURLBenson Leung1-1/+1
Fixes #126 Signed-off-by: Benson Leung <bleung@chromium.org>
2021-04-13Merge pull request #121 from minhbq-99/fix/read-sysfs-oobGreg Kroah-Hartman1-2/+2
lsusb-t: Add lower bound checks in read_sysfs_file_string
2021-04-13Merge pull request #122 from tchebb/fix-sizeof-mistakeGreg Kroah-Hartman1-3/+3
lsusb: Fix buffer size copy/paste error
2021-04-04lsusb: Fix buffer size copy/paste errorThomas Hebb1-3/+3
When I added these calls, I mistakenly passed them all the size of the vendor buffer instead of the buffers they actually fill. As it happens, all the sizes are the same, so there's no correctness issue, but we should still fix the issue for code clarity and ease of modification. Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2021-03-31lsusb-t: Add lower bound checks in read_sysfs_file_stringBui Quang Minh1-2/+2
I have a USB device that returns "\n\n" in manufacturer field which makes newline cleanup in read_sysfs_file_string result in out-of-bound access. Fix this by adding lower bound checks in the loops. Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
2021-02-25Merge pull request #118 from 10110111/masterGreg Kroah-Hartman1-6/+18
Some fixes for printing endpoints and interfaces by usb-devices
2021-02-23Fix formatting of max endpoint packet size to match ↵Ruslan Kabatsayev1-3/+3
/sys/kernel/debug/usb/devices Max packet size is printed as a single number in /sys/kernel/debug/usb/devices, rather than a product of the form X*Y. This patch makes the output of usb-devices match /sys/kernel/debug/usb/devices. Signed-off-by: Ruslan Kabatsayev <b7.10110111@gmail.com>
2021-02-23Fix formatting of endpoint type to match /sys/kernel/debug/usb/devicesRuslan Kabatsayev1-0/+5
Endpoint type is given as "Control" or "Interrupt" in /sys/bus/usb/devices/..../type, while in /sys/kernel/debug/usb/devices it's instead "Ctrl" or "Int.", respectively. This patch adds conversion so that the relevant output of usb-devices matches /sys/kernel/debug/usb/devices. Signed-off-by: Ruslan Kabatsayev <b7.10110111@gmail.com>
2021-02-22Fix formatting of endpoint direction to match /sys/kernel/debug/usb/devicesRuslan Kabatsayev1-0/+7
Direction of an endpoint is formatted as "I", "O" or "B" in /sys/kernel/debug/usb/devices, while in /sys/bus/usb/devices/..../direction it's instead "in", "out" or "both". This patch adds the conversion to make the relevant output of usb-devices look like /sys/kernel/debug/usb/devices. Signed-off-by: Ruslan Kabatsayev <b7.10110111@gmail.com>
2021-02-22Fix formatting of interface descriptors to match /sys/kernel/debug/usb/devicesRuslan Kabatsayev1-2/+2
Interface and number of endpoints are formatted as decimals in /sys/kernel/debug/usb/devices, while their formatting in dedicated files under /sys/bus/usb/devices/ is in hexadecimal without 0x prefix. This patch ensures the correct conversion for both. Signed-off-by: Ruslan Kabatsayev <b7.10110111@gmail.com>
2021-02-22Merge pull request #117 from KLZ-0/masterGreg Kroah-Hartman1-6/+33
lsusb-t.c: fix tree mode for dual-lane modes of USB 3.2
2021-02-22Add Tx+Rx lanes to tree modeAdrian Kalazi1-6/+33
Signed-off-by: Adrian Kalazi <adrian@kalazi.com>
2021-02-22Fix locating endpoint when it's a directory rather than a symlinkRuslan Kabatsayev1-1/+1
This is required at least on my Linux 4.14.157 system, as well as Ubuntu 20.04 with Linux 5.4.0-42-generic. Signed-off-by: Ruslan Kabatsayev <b7.10110111@gmail.com>
2021-02-22Merge pull request #120 from neuschaefer/uvcGreg Kroah-Hartman1-7/+10
lsusb: Improvements to UVC Interface Descriptor decoding
2021-02-22Merge pull request #119 from aurel32/masterGreg Kroah-Hartman1-1/+2
lsusb(8): mention the udev's hardware database
2021-02-22usbutils.spdx: update with output of latest reuse toolGreg Kroah-Hartman1-245/+263
usbutils is now REUSE 3.0 spec compliant! Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22SPDX header cleanups from GPL-2.0 -> GPL-2.0-onlyGreg Kroah-Hartman14-13/+13
Ugh, the fact that this license is treated "unique" like this by SPDX is crazy... Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22usbhid-dump: add copyright and SPDX infoGreg Kroah-Hartman5-1/+13
There were a few files in usbhid-dump that were missing this. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22.gitignore: add copyright and SPDX infoGreg Kroah-Hartman1-0/+3
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22usbhid-dump.8.in: add copyright informationGreg Kroah-Hartman1-0/+1
Taken from the git log Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22LICENSE: rename GPL-3.0.txt -> GPL-3.0-only.txtGreg Kroah-Hartman2-2/+1
{sigh} tools... Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22rename "GPL-2.0+" to "GPL-2.0-or-later"Greg Kroah-Hartman31-31/+31
This makes `reuse lint` happy as well as license lawyers... Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22LICENSES: put spdx headers on the license filesGreg Kroah-Hartman2-0/+36
This lets us parse things easier and points to where these files came from. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22LICENSES: add symlink to handle "or-later" issue for GPL-2.0Greg Kroah-Hartman1-0/+1
reuse wants to see license files that match the SPDX tag, but for the "fun" that the FSF seems to have inflicted on the "or-later" moniker for the GPL licenses, having a duplicated copy of the file is pointless. So just add a symlink to point to the same thing and all is good as far as `reuse lint` cares. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-22sysfs: add copyright notice taken from name.*Greg Kroah-Hartman2-0/+6
These functions were split out of name.c/h but the copyright lines did not follow. Fix that up. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-24lsusb: Decode endpoint addresses in UVCJonathan Neuschäfer1-7/+10
The bEndpointAddress field in UVC VideoStreaming Interface Descriptors follows the same format as in Endpoint Descriptors. This patch changes dump_videostreaming_interface to display the endpoint addresses in the same way. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
2021-01-24lsusb: Fix spelling of bEndpointAddress in UVCJonathan Neuschäfer1-1/+1
According to the USB Device Class Definition, Revision 1.5, it is spelled bEndpointAddress. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
2021-01-20lsusb(8): mention the udev's hardware databaseAurelien Jarno1-1/+2
Despite the switch to the udev's hardware database being a few years old, users are still confused when they update usb.ids on their system and see no effects. This patch therefore updates the lsusb(8) manpage to mention it. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-10-22Merge pull request #116 from tormodvolden/datadirGreg Kroah-Hartman1-2/+1
Makefile.am: Remove unused DATADIR
2020-10-22usbutils 013 releasev013Greg Kroah-Hartman2-1/+56
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-22Makefile.am: Remove unused DATADIRTormod Volden1-2/+1
Probably missing from commit 5d7ea40b Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2020-10-22lsusb.py: strip whitespace from device stringsGreg Kroah-Hartman1-1/+1
Some devices have a bunch of whitespace in the string for no good reason. Strip that off to make things look better. The diff of an output from before/after for a device I have looks like: - 3-2 2109:2812 09 1IF [USB 2.10, 480 Mbps, 0mA] (VIA Labs, Inc. USB2.0 Hub ) hub + 3-2 2109:2812 09 1IF [USB 2.10, 480 Mbps, 0mA] (VIA Labs, Inc. USB2.0 Hub) hub Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-22lsusb.py: drop trailing space on non-hub devicesGreg Kroah-Hartman1-2/+2
Devices that are not a hub end up with a trailing space on the line, which is not nice. Prevent that from happening. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-22Merge pull request #110 from tchebb/overhaul-sysfsGreg Kroah-Hartman6-50/+130
Fix bug in sysfs path construction and expand usage of sysfs queries
2020-10-22Merge branch 'master' of github.com:gregkh/usbutilsGreg Kroah-Hartman2-3/+1
2020-10-22Merge pull request #104 from pinotree/remove-usb.ids-private-pathsGreg Kroah-Hartman1-2/+0
lsusb.py: remove private paths for usb.ids
2020-10-22usbmisc: initialize string buffer before reading from device.Greg Kroah-Hartman1-0/+6
Cliff Biffle points out that some devices lie about the length of their string, so we end up with stack data in the string buffer, which is then displayed by userspace. Fix this up by initializing the data to 0 first before reading from the device. Reported-by: Cliff L. Biffle <code@cliffle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-22Merge pull request #105 from trbednarzyk/masterGreg Kroah-Hartman1-1/+1
bootstrap: change /bin/bash to /bin/sh
2020-10-22Merge pull request #114 from tormodvolden/libusb_debugGreg Kroah-Hartman1-0/+1
usbhid-dump: Put back autoconf check for libusb_set_option()
2020-10-22Merge pull request #113 from jwilk-forks/man-treeGreg Kroah-Hartman1-1/+1
lsusb(8): document --tree
2020-10-22Merge pull request #112 from jwilk-forks/man-formatGreg Kroah-Hartman1-3/+3
lsusb(8): fix formatting
2020-10-22Merge pull request #107 from rrobgill/classesGreg Kroah-Hartman1-0/+3
Additional device classes for usb-devices script
2020-10-11usbhid-dump: Put back autoconf check for libusb_set_option()Tormod Volden1-0/+1
It fell out in commit e0525b6 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2020-08-25lsusb(8): document --treeJakub Wilk1-1/+1
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2020-08-25lsusb(8): fix formattingJakub Wilk1-3/+3
Commas separating options should not be in bold; punctuation following variable name should not be in italics. Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2020-08-08lsusb: Get manufacturer, product, and serial from sysfsThomas Hebb1-10/+9
When running with -v, we previously populated these strings only if we were able to open the device and query the string descriptors directly. However, these three values are also reported by the kernel as world-readable files in sysfs. By querying those instead (using the same function that already existed for querying fallback vendor and product names), we can populate these values even for unprivileged users. These sysfs properties have existed since at least 2005, so I think it's quite unlikely that this change will regress existing users. However, if it turns out to, we can always add back the old logic as a fallback when sysfs isn't available. Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2020-08-08lsusb: Use vendor and product name fallback logic in -D mode tooThomas Hebb1-15/+37
commit dddb696e0172 ("lsusb: Read unkown names from sysfs device desc.") introduced a fallback option for vendor and product names in device summary lines, fetching them from sysfs when the VID/PID are not present in udev hwdb. However, it applied this new logic only to summary lines listing multiple devices (i.e. not -D mode, which only lists a single device). Refactor the logic into a common function and use it in both places. Fixes: dddb696e0172 ("lsusb: Read unkown names from sysfs device desc.") Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2020-08-08sysfs: Don't return bogus data for devices under a hubThomas Hebb3-7/+41
commit dddb696e0172 ("lsusb: Read unkown names from sysfs device desc.") added code to query a device's self-reported vendor and product names from sysfs in the case where no names were present in the udev hwdb. However, as far as I can tell that code was and still is totally broken for any device that isn't directly under a root hub: this is because it uses the libusb_get_port_number() function, which only returns the leaf port number, but treats the returned number as if it's a full device path. For example, when trying to query sysfs for the device 2-8.3 (a device on Port 3 of a hub that's on Port 8 of Bus 2), it will instead erroneously query device 2-3, ignoring the first hub altogether. This results in nonsensical output from lsusb, such as a device identified as a "Bose Corp. Steam Controller". To fix the issue, use the libusb_get_port_numbers() function to get a full list of port numbers from the root and use that to construct the proper dotted devpath. Additionally, special case root devices, which have the sysfs name "usbN", where "N" is the bus number. Thanks to Tian Yunhao, who submitted a different fix for this same issue, for spotting that last piece. Fixes: dddb696e0172 ("lsusb: Read unkown names from sysfs device desc.") Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2020-08-08Move read_sysfs_prop() from names.c to its own fileThomas Hebb6-26/+51
This function was added to names.c by commit dddb696e0172 ("lsusb: Read unkown names from sysfs device desc."), but it doesn't really belong there: sysfs is an entirely different data source from the udev hwdb that names.c works with, and this function both does things (like directly accessing files) that other functions in names.c don't and doesn't do things (like depending on the work done by names_init()) that those other functions do. Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2020-06-21Additional device classes for usb-devices scriptRob Gill1-0/+3
Several newer USB Device classes are not presently reported individually by usb-devices, (They are reported as "unk. "). This patch adds the following classes: 10h (USB Type-C combined Audio/Video devices) 11h (USB billboard), 12h (USB Type-C Bridge). As defined at [https://www.usb.org/defined-class-codes] Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2020-04-09bootstrap: change /bin/bash to /bin/shTimothy Robert Bednarzyk1-1/+1
Signed-off-by: Timothy Robert Bednarzyk <trbednarzyk@protonmail.com>
2020-03-08lsusb.py: remove private paths for usb.idsPino Toscano1-2/+0
Do not look for usb.ids in the private paths of other software, as those locations are not public interface. Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
2020-01-10Merge pull request #98 from neheb/rindexGreg Kroah-Hartman1-1/+1
usbhid-dump: Do not use rindex
2020-01-10Merge pull request #100 from tsundre/fix-uvc-xu-typosGreg Kroah-Hartman1-2/+2
lsusb: fix two typos in UVC Extension Unit descriptor
2019-11-06lsusb: fix two typos in UVC Extension Unit descriptorTorleiv Sundre1-2/+2
Fix two minor typos in UVC Extension Unit descriptor to make all the field names match the UVC 1.1 spec, page 58, Table 3-10. Signed-off-by: Torleiv Sundre <torleiv@huddly.com>
2019-10-13Merge pull request #97 from aurel32/lsusb.8-usb.idsGreg Kroah-Hartman2-6/+1
lsusb.8.in: do not mention usb.ids
2019-10-02usbhid-dump: Do not use rindexRosen Penev1-1/+1
rindex was removed in POSIX 2008. It is optionally unavailable with uClibc-ng. Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-09-30lsusb.8.in: do not mention usb.idsAurelien Jarno2-6/+1
The lsusb binary does not use the usb.ids file anymore, instead it uses the udev hardware database. Mentionning usb.ids in lsusb(8) is therefore very confusing for the users. This patch therefore drops that part.
2019-06-06usb-devices.1: don't mention bashBaruch Siach1-1/+1
Since commit 508d1acf42e ("usb-devices: use /bin/sh hashbang") usb-devices does not require bash. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-16dump_audiostreaming_interface(): remove unused variableGreg Kroah-Hartman1-3/+0
As pointed out ValZapod, the name variable is not used at all, so just delete it. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-09usbhid-dump: remove some dev_list functions that were never usedGreg Kroah-Hartman2-34/+0
uhd_dev_list_len() and uhd_dev_list_empty() were never used, so delete them. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-09usbhid-dump: some autoconf cleanupGreg Kroah-Hartman4-20/+4
This removes some unused autoconf stuff (like the libtool checking) and cleans up the need for some subdirectories for build tools. Also unified the configure.ac file a bit to match the main usbutils file, with the goal of eventually only having one run of autoconf needed, hopefully soon. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-09Makefile.am: add usbhid-dump.8 to distclean listGreg Kroah-Hartman1-1/+2
'make distclean' fails as I forgot to add this file to the clean list. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-09usbhid-dump: move .h files into src/ directoryGreg Kroah-Hartman17-42/+21
No need for a two-level-deep include directory for some local include files. Just put them next to the .c files and all is good. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-09usbhid-dump: remove lib directoryGreg Kroah-Hartman9-21/+7
There is no need for a "library" here at all, just build all of the .c files into the one binary, saving a link step and making the tree a bit smaller. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08usbhid-dump: remove libusb.h libusb_strerror() implementationGreg Kroah-Hartman7-86/+3
libusb_strerror() has been around for a long time, we can rely on it being in the library if we use it. So remove our local copy of the function. This deletes 2 files and cleans up some autoconf logic as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08usbhid-dump: add SPDX identifiers to all files.Greg Kroah-Hartman18-363/+59
This cleans up the headers of all of the usbhid-dump files by putting proper SPDX identifiers on them, and removing all of the license boiler-plate code that is not needed. No license or copyright has been changed at all. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08.gitignore: add usbhid-dump.8Greg Kroah-Hartman1-0/+1
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08usbhid-dump.8: autogenerate it with the usbutils version numberGreg Kroah-Hartman2-1/+6
This puts the proper manpage header on usbhid-dump.8 to show where it came from. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08usbhid-dump.8: add SPDX headerGreg Kroah-Hartman1-19/+1
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08usbhid-dump: move manpage to main directory out of subdirGreg Kroah-Hartman6-24/+3
This saves us some extra subdirectories that are not needed. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-07usbutils 012 releasev012Greg Kroah-Hartman3-5/+12
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-07Merge upstream usbhid-dump repo into usbutils repoGreg Kroah-Hartman31-0/+3090
This "merges" the usbhid-dump upstream repository (found at git@github.com:DIGImend/usbhid-dump.git) into the usbutils directory. We are doing this to make the management of the two simpler to handle overall, and hopefully reduce the size of the usbhid-dump source tree a bit. Note, this was done by "rewriting" the history of the usbhid-dump repository by moving it into the usbhid-dump subdirectory. All of the commits are still here, just under a new sha1 because of the rewrite. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-07delete local usbhid-dump directoryGreg Kroah-Hartman1-0/+0
Needed so that we can merge the "real" usbhid-dump tree into here. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06usbutils 011 releasev011Greg Kroah-Hartman3-7/+107
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06usbutils.spdx: update with latest informationGreg Kroah-Hartman1-29/+30
Refresh the spdx file and add my authorship information to the file itself. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: visually group USB-version-related fieldsMantas Mikulėnas1-3/+3
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: fix endpoint interval spacingMantas Mikulėnas1-2/+2
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: rework output for more consistent indent of both columnsMantas Mikulėnas1-25/+29
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: use color by defaultMantas Mikulėnas1-2/+13
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: convert readattr() and readlink() to methods of the containerMantas Mikulėnas1-36/+33
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: give all Usb* classes a superclassMantas Mikulėnas1-3/+6
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: add an actual __repr__() to classesMantas Mikulėnas1-0/+9
This simplifies debugging. Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: give all Usb* objects a .path attributeMantas Mikulėnas1-41/+36
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: shorten find_usb_class()Mantas Mikulėnas1-7/+3
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: a few cosmetic changesMantas Mikulėnas1-23/+15
- Place all globals above functions. - Do not need chr(), this is not Visual Basic. - Use .startswith() instead of hardcoding the length. Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: UsbEndpoint: indent is a class implementation detailMantas Mikulėnas1-5/+6
The class knows how to format itself, so it should know how to indent itself, like the other two classes do. Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: Usb* classes: call read() automatically from constructorMantas Mikulėnas1-20/+21
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: use a constant for the magic class number 9Mantas Mikulėnas1-3/+5
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: allow - as well as _ when matching hci module namesMantas Mikulėnas1-1/+1
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: move unrelated code out of try..exceptMantas Mikulėnas1-6/+4
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: remove dead codeMantas Mikulėnas1-11/+0
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: use 'elif' where suitableMantas Mikulėnas1-17/+12
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: cosmetic - replace tuples-as-"immutable lists" with regular listsMantas Mikulėnas1-17/+22
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: entirely remove Usb* classesMantas Mikulėnas1-47/+6
Their main purpose in life was to be sortable, which we no longer do. Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: insert class FF:FF:FF into usbclasses to avoid special casingMantas Mikulėnas1-2/+1
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: replace __repr__() for USB IDs with __str__()Mantas Mikulėnas1-8/+8
This is more suitable for a method that returns human-oriented strings. Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: avoid manual calls to __foo__()Mantas Mikulėnas1-9/+9
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: remove now-unused bin_search()Mantas Mikulėnas1-19/+0
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: replace usb.ids binary search with dict lookupMantas Mikulėnas1-30/+23
There is no significant gain in reinventing the wheel here. Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: avoid shadowing Python's built-in 'str'Mantas Mikulėnas1-12/+12
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: use regular print() instead of hand-rolling the same thingMantas Mikulėnas1-2/+1
Even sys.stdout.write(str(usbdev)) would have been better. Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: support long optionsMantas Mikulėnas1-18/+30
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: ensure all error messages are written to stderrMantas Mikulėnas1-2/+2
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: remove -w (warn if usb.ids not sorted) optionMantas Mikulėnas1-43/+2
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: replace fake deepcopy()Mantas Mikulėnas1-10/+3
It doesn't actually do a deep copy, and Python already has ways of doing a shallow copy (list(foo) and [*foo] for arbitrary iterables; foo[:] for indexable lists). Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: improve usage textMantas Mikulėnas1-12/+14
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: sort toplevel entriesMantas Mikulėnas1-0/+4
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06lsusb.py: sort devices and interfaces numericallyMantas Mikulėnas1-0/+3
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06usbhid-dump: update to a newer version of usbhid-dump again.Greg Kroah-Hartman1-0/+0
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-06update usbhid-dump git idGreg Kroah-Hartman1-0/+0
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12Merge pull request #86 from stefanct/masterGreg Kroah-Hartman2-1/+1
Revert "Require newer version of libusb"
2019-02-11Depend on libusb 1.0.14Stefan Tauner2-1/+1
This partially reverts commit 3fe9f89 of usbutils and updates the usbhid-dump submodule to 209c2b0, which works around possibly missing libusb_set_option() in older versions of libusb and thus does not require libusb 1.0.22. However, lsusb.c itself relies on libusb_get_port_number() since dddb696 which was added in libusb 1.0.12. Furthermore the enum values declaring the various debug levels have changed to their current state in libusb 1.0.13. This version temporarily fixed a typo in struct libusb_config_descriptor which was reverted in 1.0.14 again. So to sum up the previous version check for 1.0.9 in usbutils previous to 3fe9f89 was wrong and we should test against 1.0.14 instead. This change was tested against libusb 1.0.14 built from source. Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at>
2019-02-11Merge pull request #88 from ValZapod/masterGreg Kroah-Hartman1-4/+5
man pages: add information on verbosity levels of -t option
2019-02-10man pages: add information on verbosity levels of -t optionValerii Zapodovnikov1-4/+5
Signed-off-by: Valerii Zapodovnikov <val.zapod.vz@gmail.com>
2019-01-22Fallback to libusb_set_debug without libusb_set_optionNikolai Kondrashov2-1/+5
Resolves #4
2019-01-22configure: Check for ar with AM_PROG_ARNikolai Kondrashov1-0/+1
2019-01-22bootstrap: Switch to autoreconf -i -fNikolai Kondrashov1-10/+1
2018-12-29Merge pull request #82 from garloff/masterGreg Kroah-Hartman1-34/+89
Some more compat and convenience for lsusb.py
2018-12-29Merge pull request #84 from ebassi/issue-83Greg Kroah-Hartman1-1/+1
Require newer version of libusb
2018-12-29lsusb.py: python2 compatibilityKurt Garloff1-2/+10
... was very simple to achieve: Import print_function from future and fallback in open(errors=ignore) function. Signed-off-by: Kurt Garloff <kurt@garloff.de>
2018-12-29lsusb.py: Add driver names for usbhid.Kurt Garloff1-0/+30
For usbhid devices, find and display hidraw and driver names. Signed-off-by: Kurt Garloff <kurt@garloff.de>
2018-12-29lsusb.py: Usb enum for parser state machine.Kurt Garloff1-21/+32
This makes the parser more readable. Also add one special case to work around a syntax error "01xy" in some versions of usb.ids. Avoid variable name "dir" in find_dev(). Signed-off-by: Kurt Garloff <kurt@garloff.de>
2018-12-29lsusb.py: Search multiple paths for usb.ids.Kurt Garloff1-13/+19
We can look at several well-known places for usb.ids. The @usbids@ mechanism from configure remains at the first position and option -f overrides the searching. Signed-off-by: Kurt Garloff <kurt@garloff.de>
2018-12-28Require newer version of libusbEmmanuele Bassi1-1/+1
The change to update usbhid-dump in commit 89a279c implicitly changed the required version of libusb from 1.0.9 to a version that contains libusb_set_options(). The function was introduced in libusb 1.0.22, so let's update the pkg-config check to match. Fixes: #83
2018-12-28fix up standard int typesGreg Kroah-Hartman8-54/+49
Use the C standard uint*_t variable types, not the "unix" types of u_int*_t as we should be able to all finally agree on one type of C variables. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-28usbhid-dump: update to latest versionGreg Kroah-Hartman1-0/+0
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-28Merge pull request #81 from JohnAZoidberg/vendor-product-device-descriptorGreg Kroah-Hartman3-3/+40
lsusb: Read unkown names from sysfs device desc.
2018-12-22lsusb: Read unkown names from sysfs device desc.Daniel Schaefer3-3/+40
lsusb tries to get the names for manufacturer and product of a device by asking the udev hwdb for the names of the device id. Not every manufacturer and device are in this database. Most devices however provide those names in the standard USB descriptors, namely iManufacturer and iProduct. To get those with libusb we would have to open the device which requires superuser privileges. To get those values anyway the kernel provides them in sysfs. Signed-off-by: Daniel Schaefer <git@danielschaefer.me>
2018-11-26usbreset: fix some build warningsGreg Kroah-Hartman1-3/+3
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-26add usbreset to .gitignoreGreg Kroah-Hartman1-0/+1
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-26Merge pull request #76 from clefru/usbreset-noinstGreg Kroah-Hartman1-0/+6
Add usbreset.c as noinst_PROGRAMS target.
2018-11-26Merge pull request #75 from dlitz/lsusb-verbose-treeGreg Kroah-Hartman3-5/+31
lsusb-t: Emit USB IDs and other handy info when verbosity is increased
2018-11-26Merge pull request #77 from philipl/masterGreg Kroah-Hartman2-1/+23
Add support for Billboard Alt Mode descriptor (and a formatting fix)
2018-11-26Merge branch 'master' into masterGreg Kroah-Hartman2-1/+62