summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #165 from kristofferkoch/masterHEADmasterGreg Kroah-Hartman2023-03-011-1/+3
|\ | | | | usbreset: Allow idProduct and idVendor to be 0
| * usbreset: Allow idProduct and idVendor to be 0Kristoffer Ellersgaard Koch2023-03-011-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>
* usbutils 015 releasev015Greg Kroah-Hartman2022-10-223-25/+46
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge pull request #137 from undisputed-seraphim/fix-sort-child-deviceGreg Kroah-Hartman2022-10-221-0/+1
|\ | | | | lsusb-t: Fix recursive sorting on child devices.
| * lsusb-t: Fix recursive sorting on child devices.Tan Li Boon2022-06-171-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>
* | Merge pull request #135 from robhancock/improve-ssplus-hub-statusGreg Kroah-Hartman2022-10-221-12/+30
|\ \ | | | | | | lsusb: Improve status display for SuperSpeedPlus hubs
| * | lsusb: Improve status display for SuperSpeedPlus hubsRobert Hancock2022-04-171-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>
* | lsusb: fix up Midi Device specification devicesGreg Kroah-Hartman2022-08-251-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>
* | Merge pull request #149 from qiankehan/undefinedGreg Kroah-Hartman2022-06-201-1/+1
|\ \ | |/ |/| Fix an runtime error reported by undefind sanitizer
| * Fix an runtime error reported by undefind sanitizerHan Han2022-06-201-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>
* usb-devices: fix field width on device speed fieldGreg Kroah-Hartman2022-01-201-1/+1
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* lsusb: remove wireless descriptor informationGreg Kroah-Hartman2022-01-171-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>
* lsusb: remove unused wireless checkGreg Kroah-Hartman2022-01-171-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>
* usb-devices: use 'local' variable type to handle recursionGreg Kroah-Hartman2021-10-151-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>
* usb-devices: list the root devices in numerical orderGreg Kroah-Hartman2021-10-151-2/+2
| | | | | | Previously "usb10" would come before "usb2" Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usbutils 014 releasev014Greg Kroah-Hartman2021-08-063-25/+82
| | | | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge pull request #128 from grundlerchromium/handle_EAGAINGreg Kroah-Hartman2021-07-281-5/+16
|\ | | | | lsusb: don't complain on EAGAIN
| * lsusb: don't complain on EAGAINGrant Grundler2021-07-271-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>
| * lsusb: remove unused RETRIES constantGrant Grundler2021-07-271-1/+0
|/ | | | | | CTRL_RETRIES was never used. Remove it. Signed-off-by: Grant Grundler <grundler@chromium.org>
* Merge pull request #125 from mb720/patch-1Greg Kroah-Hartman2021-07-221-3/+3
|\ | | | | Fix typos in lsusb.8.in
| * Fix typos in lsusb.8.inMatthias Braun2021-07-211-3/+3
| | | | | | | | Signed-off-by: Matthias Braun <m.braun@htl-leonding.ac.at>
* | Merge pull request #131 from lzaoral/desc-defs-oobGreg Kroah-Hartman2021-07-211-1/+1
|\ \ | | | | | | desc-defs.c: fix possible out-of-bound read
| * | desc-defs.c: fix possible out-of-bound readLukas Zaoral2021-07-211-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>
* | Merge pull request #129 from lzaoral/lsusb-leakGreg Kroah-Hartman2021-07-211-0/+1
|\ \ | | | | | | lsusb.c: fix leak in dump_printer_device
| * | lsusb.c: fix leak in dump_printer_deviceLukas Zaoral2021-07-211-0/+1
| |/ | | | | | | | | | | Allocation made by get_dev_string was not freed. Signed-off-by: Lukas Zaoral <lzaoral@redhat.com>
* | Merge pull request #127 from bleungatchromium/fix-iAdditionalInfoURL-typoGreg Kroah-Hartman2021-07-211-1/+1
|\ \ | | | | | | lsusb: Fix typo in string output for iAdditionalInfoURL
| * | lsusb: Fix typo in string output for iAdditionalInfoURLBenson Leung2021-06-171-1/+1
| |/ | | | | | | | | | | Fixes #126 Signed-off-by: Benson Leung <bleung@chromium.org>
* | Merge pull request #130 from lzaoral/usb-devices-posixGreg Kroah-Hartman2021-07-211-10/+10
|\ \ | |/ |/| usb-devices: do not use `local` in a POSIX shell script
| * usb-devices: do not use `local` in a POSIX shell scriptLukas Zaoral2021-07-211-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>
* Merge pull request #121 from minhbq-99/fix/read-sysfs-oobGreg Kroah-Hartman2021-04-131-2/+2
|\ | | | | lsusb-t: Add lower bound checks in read_sysfs_file_string
| * lsusb-t: Add lower bound checks in read_sysfs_file_stringBui Quang Minh2021-03-311-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>
* | Merge pull request #122 from tchebb/fix-sizeof-mistakeGreg Kroah-Hartman2021-04-131-3/+3
|\ \ | |/ |/| lsusb: Fix buffer size copy/paste error
| * lsusb: Fix buffer size copy/paste errorThomas Hebb2021-04-041-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>
* Merge pull request #118 from 10110111/masterGreg Kroah-Hartman2021-02-251-6/+18
|\ | | | | Some fixes for printing endpoints and interfaces by usb-devices
| * Fix formatting of max endpoint packet size to match ↵Ruslan Kabatsayev2021-02-231-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>
| * Fix formatting of endpoint type to match /sys/kernel/debug/usb/devicesRuslan Kabatsayev2021-02-231-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>
| * Fix formatting of endpoint direction to match /sys/kernel/debug/usb/devicesRuslan Kabatsayev2021-02-221-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>
| * Fix formatting of interface descriptors to match /sys/kernel/debug/usb/devicesRuslan Kabatsayev2021-02-221-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>
| * Fix locating endpoint when it's a directory rather than a symlinkRuslan Kabatsayev2021-02-221-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>
* | Merge pull request #117 from KLZ-0/masterGreg Kroah-Hartman2021-02-221-6/+33
|\ \ | |/ |/| lsusb-t.c: fix tree mode for dual-lane modes of USB 3.2
| * Add Tx+Rx lanes to tree modeAdrian Kalazi2021-02-221-6/+33
| | | | | | | | Signed-off-by: Adrian Kalazi <adrian@kalazi.com>
* | Merge pull request #120 from neuschaefer/uvcGreg Kroah-Hartman2021-02-221-7/+10
|\ \ | | | | | | lsusb: Improvements to UVC Interface Descriptor decoding
| * | lsusb: Decode endpoint addresses in UVCJonathan Neuschäfer2021-01-241-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>
| * | lsusb: Fix spelling of bEndpointAddress in UVCJonathan Neuschäfer2021-01-241-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>
* | Merge pull request #119 from aurel32/masterGreg Kroah-Hartman2021-02-221-1/+2
|\ \ | | | | | | lsusb(8): mention the udev's hardware database
| * | lsusb(8): mention the udev's hardware databaseAurelien Jarno2021-01-201-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>
* | usbutils.spdx: update with output of latest reuse toolGreg Kroah-Hartman2021-02-221-245/+263
| | | | | | | | | | | | usbutils is now REUSE 3.0 spec compliant! Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | SPDX header cleanups from GPL-2.0 -> GPL-2.0-onlyGreg Kroah-Hartman2021-02-2214-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>
* | usbhid-dump: add copyright and SPDX infoGreg Kroah-Hartman2021-02-225-1/+13
| | | | | | | | | | | | There were a few files in usbhid-dump that were missing this. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | .gitignore: add copyright and SPDX infoGreg Kroah-Hartman2021-02-221-0/+3
| | | | | | | | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>