Giter Site home page Giter Site logo

usbutils's Introduction

usbutils

This is a collection of USB tools for use on Linux and BSD systems to query what type of USB devices are connected to the system. This is to be run on a USB host (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.)

Building and installing

Note, usbutils depends on libusb, be sure that library is properly installed first.

To work with the "raw" repo, after cloning it just do:

./autogen.sh

Or if you like doing things "by hand" you can try the following:

Get the usbhid-dump git submodule:

git submodule init
git submodule update

Initialize autobuild with:

autoreconf --install --symlink

Configure the project with:

./configure

Build everything with:

make

Install it, if you really want to, with:

make install

Source location

The source for usbutils can be found in many places, depending on the git hosting site you prefer. Here are the primary locations, in order of preference by the maintainer:

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usbutils.git/
https://git.sr.ht/~gregkh/usbutils
https://github.com/gregkh/usbutils

usbutils's People

Contributors

10110111 avatar aurel32 avatar bmork avatar dlitz avatar flameeyes avatar garloff avatar grawity avatar gregkh avatar jazzguitar81 avatar jwilk avatar kaysievers avatar lnykryn avatar ltuikov avatar lzaoral avatar muthulnx avatar naruto-abc avatar philipl avatar pinchartl avatar rexut avatar soig avatar spbnick avatar stephanechatty avatar tchebb avatar teg avatar tklauser avatar tlsa avatar tormodvolden avatar tsundre avatar vapier avatar vianney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usbutils's Issues

lsusb names are mixed

I had a video capture device without a name and a problem of mixed up names of my keyboard with webcam and phone..

lsusb1

So i installed 20-usb-vendor-model.hwdb to /etc/udev/hwdb.d and updated the database. Now my video capture device has a name, but the mixing of names from my keyboard (green) and the creative webcam (red) is still an issue. The mixing of names with keyboard an my Huawei P10 is gone now!

lsusb2

Any idea what this could be? Something wrong on my system or a bug??
I am on Linux Mint 20.3 with kernel 5.14 and lsusb version 012.

usbutils-011 release tarball incomplete

I found two issues with 011 release tarball:

  • there is no pre-generated configure file
  • the usbhid-dump folder is empty which requires net access (git submodule update ...) in order to successfully bootstrap the package. I do not expect that from a release tarball.

When is next release/tag planned?

[email protected] and I are wondering if there is a plan for the next release.

It appears the most recent release was Oct 2020 (V013) and the repo has nearly 30 changes since then:
grundler <2241>git log --oneline v013.. | fgrep -v "Merge pull request" | wc -l
29

thanks,
grant

lsusb outputs not match the usbutils version

Hi, I try to install and explore the usage of usbutils in two different ways:

1 install from apt

install

$ sudo apt update
$ sudo apt install usbutils -y

use

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

$ lsusb -V
lsusb (usbutils) 007

2 make and install from source code

install & make

$ sudo apt update
$ sudo apt install git gcc make autoconf pkg-config libusb-1.0-0-dev libudev-dev -y
$ git clone https://github.com/gregkh/usbutils.git && cd usbutils/ 
$ git submodule init && git submodule update
$ autoreconf --install --symlink && ./configure
$ make && make install

use

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux 5.13.0-51-generic ehci_hcd EHCI Host Controller
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. VMware Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware VMware Virtual USB Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux 5.13.0-51-generic uhci_hcd UHCI Host Controller

$ lsusb -V
lsusb (usbutils) 014

My env:
Linux 3f0a1abbf23a 5.13.0-51-generic #58~20.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

And I use docker for these tests:
docker run -it ubuntu:18.04

My questions:

  1. In way-1, why I already apt update, but usbutils installed version is 007 which is outdated?
  2. In way-2, though the version 014 is up-to-date, but the lsusb outputs are not up-to-date? I go to check the usb.ids in http://www.linux-usb.org/usb.ids, and I find the outputs don't match the latest usb.ids.
  3. How can I get the way-1's lsusb outputs through way-2's installation steps?

Is there something I misunderstood?

Thanks in advance :)

Bus sort order

See Debian bug report #927188 (https://bugs.debian.org/927188): The lsusb seems to list busses in reverse order.
For the simple mode (default), this can be fixed by adding sorter in list_devices (patch available upon request).
For the tree mode (-t), I noticed the buses are sorted in reverse order by intention:

    static void sort_busses(void)
    {
            /* need to reverse sort bus numbers */

[lsusb-t.c:661]

This has been around since the introduction in 2009.
While reversing the sort order is trivial - mind to explain the idea behind this?

heap-buffer-overflow when getting verbose info of a usb camera device

The camera device is:

Bus 001 Device 004: ID 13d3:56bb IMC Networks Integrated Camera

Version:
usbutils v014-7-g77b93c9
libusb1-1.0.25-8.fc36.x86_64

Steps:

  1. Compile the code with address sanitizer: CFLAGS=' -fsanitize=address -fno-omit-frame-pointer -static-libasan -g' ./configure && make
  2. Get the verbose info of 13d3:56bb: ASAN_OPTIONS=fast_unwind_on_malloc=0 ./lsusb -d 13d3:56bb -v. Then get the heap-buffer-overflow report:

Bus 001 Device 004: ID 13d3:56bb IMC Networks Integrated Camera
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.01
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x13d3 IMC Networks
  idProduct          0x56bb
  bcdDevice           19.02
  iManufacturer           2 Azurewave
  iProduct                1 Integrated Camera
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0334
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass         14 Video
      bFunctionSubClass       3 Video Interface Collection
      bFunctionProtocol       0
      iFunction               5 Integrated Camera
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0
      iInterface              5 Integrated Camera
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.00
        wTotalLength       0x004e
        dwClockFrequency       15.000000MHz
        bInCollection           1
        baInterfaceNr( 0)       1
      VideoControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             4
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               3
        iTerminal               0
      VideoControl Interface Descriptor:
        bLength                27
        bDescriptorType        36
        bDescriptorSubtype      6 (EXTENSION_UNIT)
        bUnitID                 3
        guidExtensionCode         {28f03370-6311-4a2e-ba2c-6890eb334016}
        bNumControls           16
        bNrInPins               1
        baSourceID( 0)          2
        bControlSize            2
        bmControls( 0)       0x9f
        bmControls( 1)       0x1e
        iExtension              0
      VideoControl Interface Descriptor:
        bLength                18
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Camera Sensor
        bAssocTerminal          0
        iTerminal               0
        wObjectiveFocalLengthMin      0
        wObjectiveFocalLengthMax      0
        wOcularFocalLength            0
        bControlSize                  3
        bmControls           0x0020000e
          Auto-Exposure Mode
          Auto-Exposure Priority
          Exposure Time (Absolute)
      VideoControl Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      5 (PROCESSING_UNIT)
      Warning: Descriptor too short
        bUnitID                 2
        bSourceID               1
        wMaxMultiplier          0
        bControlSize            2
        bmControls     0x0000157f
          Brightness
          Contrast
          Hue
          Saturation
          Sharpness
          Gamma
          White Balance Temperature
          Backlight Compensation
          Power Line Frequency
          White Balance Temperature, Auto
=================================================================
==1351035==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700000076e at pc 0x000000418d25 bp 0x7ffc63a6f010 sp 0x7ffc63a6f008
READ of size 1 at 0x60700000076e thread T0
    #0 0x418d24 in dump_videocontrol_interface (/home/hhan/Software/usbutils/lsusb+0x418d24)
    #1 0x409ade in dump_altsetting (/home/hhan/Software/usbutils/lsusb+0x409ade)
    #2 0x40a527 in dump_interface (/home/hhan/Software/usbutils/lsusb+0x40a527)
    #3 0x408840 in dump_config (/home/hhan/Software/usbutils/lsusb+0x408840)
    #4 0x432725 in dumpdev (/home/hhan/Software/usbutils/lsusb+0x432725)
    #5 0x4334c8 in list_devices (/home/hhan/Software/usbutils/lsusb+0x4334c8)
    #6 0x433ed4 in main (/home/hhan/Software/usbutils/lsusb+0x433ed4)
    #7 0x7ff6efafe54f in __libc_start_call_main (/lib64/libc.so.6+0x2954f)
    #8 0x7ff6efafe608 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x29608)
    #9 0x403664 in _start (/home/hhan/Software/usbutils/lsusb+0x403664)

0x60700000076e is located 0 bytes to the right of 78-byte region [0x607000000720,0x60700000076e)
allocated by thread T0 here:
    #0 0x7ff6f040e68f in __interceptor_malloc (/lib64/libasan.so.8+0xba68f)
    #1 0x7ff6f033b16c in raw_desc_to_config (/lib64/libusb-1.0.so.0+0x616c)

SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/hhan/Software/usbutils/lsusb+0x418d24) in dump_videocontrol_interface
Shadow bytes around the buggy address:
  0x0c0e7fff8090: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fd fd
  0x0c0e7fff80a0: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
  0x0c0e7fff80b0: fd fd fd fd fd fd fa fa fa fa 00 00 00 00 00 00
  0x0c0e7fff80c0: 00 00 00 00 fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c0e7fff80d0: fd fd fa fa fa fa fd fd fd fd fd fd fd fd fd fd
=>0x0c0e7fff80e0: fa fa fa fa 00 00 00 00 00 00 00 00 00[06]fa fa
  0x0c0e7fff80f0: fa fa fd fd fd fd fd fd fd fd fd fd fa fa fa fa
  0x0c0e7fff8100: 00 00 00 00 00 00 00 00 00 03 fa fa fa fa fa fa
  0x0c0e7fff8110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff8120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==1351035==ABORTING

Endianness of guids

lsusb prints guids in the transmitted byte order. Since there is a comment about byte order in the get_guid function that refers to RFC 4122, I assume this is not by coincidence. However, at least for UVC, this results in guids being printed differently from the ones listed in the documentation.

As an example, according to the specification for UVC1.1 Uncompressed Payload, the following GUID is supposed to represent YUY2:
{32595559-0000-0010-8000-00AA00389B71}
In the lsusb output, this is printed as:
{59555932-0000-1000-8000-00aa00389b71}

According to RFC 4122, the three first fields are supposed to be big-endian. According to chapter 8.1 in the USB 2.0 specification, USB trasmission order is little-endian.

To me, it looks like it would be correct to swap byte order for the first three fields when printing.

Next release for usbutils?

Is it possible to make a new release of usbutils? The last release was v008 on Oct 21, 2014 and I need some fixes from usbhid-dump. The usbhid-dump submodule already points to the most recent commit, but since no new release of usbutils is made since 2014, my distro doesn't contain the fixes I'm interested yet...

lsusb with -v flag hangs for a few seconds

See the transition from 02:25:29 to 02:25:34 in the log: lsusb-v.txt (strace -o lsusb-v.txt -f -t lsusb -v)

[...]
6156 02:25:29 timerfd_settime(9, TFD_TIMER_ABSTIME, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=14426, tv_nsec=79963000}}, NULL) = 0
6156 02:25:29 ioctl(10, USBDEVFS_SUBMITURB, 0x55ec1208f170) = 0
6156 02:25:29 poll([{fd=7, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLOUT}], 3, 60000) = 1 ([{fd=9, revents=POLLIN}])
6156 02:25:34 ioctl(10, USBDEVFS_DISCARDURB, 0x55ec1208f170) = 0
[...]

Thanks.

fails to autoreconf on ubuntu xenial

root@host:/usr/local/src# git clone https://github.com/gregkh/usbutils.git
Cloning into 'usbutils'...
remote: Counting objects: 1204, done.
remote: Total 1204 (delta 0), reused 0 (delta 0), pack-reused 1204
Receiving objects: 100% (1204/1204), 837.16 KiB | 643.00 KiB/s, done.
Resolving deltas: 100% (732/732), done.
Checking connectivity... done.
root@host:/usr/local/src# cd usbutils/
root@host:/usr/local/src/usbutils# git submodule init
Submodule 'usbhid-dump' (https://github.com/DIGImend/usbhid-dump.git) registered for path 'usbhid-dump'
root@host:/usr/local/src/usbutils# git submodule update
Cloning into 'usbhid-dump'...
remote: Counting objects: 541, done.
remote: Total 541 (delta 0), reused 0 (delta 0), pack-reused 541
Receiving objects: 100% (541/541), 99.04 KiB | 0 bytes/s, done.
Resolving deltas: 100% (358/358), done.
Checking connectivity... done.
Submodule path 'usbhid-dump': checked out 'b18e816cbf65fe3b7f53d1d275f550c0c18e9b0f'
root@host:/usr/local/src/usbutils# autoreconf --install --symlink
configure.ac:47: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
root@host:/usr/local/src/usbutils# apt policy autoconf
autoconf:
  Installed: 2.69-9
  Candidate: 2.69-9
  Version table:
 *** 2.69-9 500
        500 http://ro.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://ro.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        500 http://ftp.lug.ro/ubuntu xenial/main amd64 Packages
        500 http://ftp.lug.ro/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status

output json

Hi,

the output of lsusb is human readable, but it would be nice, if it had a flag to print its knowledge about devices in a machine readable form, e.g. json, for easy parsing from other programs.

regards

Fails to build in GNOME Continuous

Commit 8623cb5 added a C99-ism:

for (unsigned char i = 0; i < cap_data_len; i++) {

which requires -std=c99 in order to build on GCC. This was caught by the GNOME Continuous builder:

../lsusb.c: In function 'dump_platform_device_capability_desc':
../lsusb.c:3818:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for (unsigned char i = 0; i < cap_data_len; i++) {
  ^
../lsusb.c:3818:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
Makefile:597: recipe for target 'lsusb-lsusb.o' failed
make[2]: *** [lsusb-lsusb.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Full log: http://build.gnome.org/continuous/buildmaster/builds/2016/04/29/40/build/log-usbutils.txt

What does it expects in -D or -s

Hi I have the fololwing
usb_util -v -t

 Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        ID 04b4:0060 Cypress Semiconductor Corp. Wireless optical mouse
    |__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        ID 04b4:0060 Cypress Semiconductor Corp. Wireless optical mouse
    |__ Port 2: Dev 11, If 4, Class=Human Interface Device, Driver=usbhid, 480M
        ID 2454:1292  
    |__ Port 2: Dev 11, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        ID 2454:1292  
    |__ Port 2: Dev 11, If 0, Class=Audio, Driver=snd-usb-audio, 480M

How do I see details for Port 2: Dev 11, If 2, Class=Audio, Driver=snd-usb-audio, 480M

I tried:

./usb_utils -Dsnd-usb-audio  -v
Cannot open snd-usb-audio

also

sudo ./usb_utils -s01:11 -v

nothing

Thank you

USB device often named incorrectly

I am facing some weird issue on the output from lsusb, appending HD USB Camera to some USB devices names, as can be seen below:

Bus 001 Device 011: ID 32e4:9520 HD Camera Manufacturer HD USB Camera
Bus 001 Device 014: ID 060e:0960 Transmonde Technologies, Inc. HD USB Camera
Bus 001 Device 019: ID 0b05:1939 ASUSTek Computer, Inc. HD USB Camera
Bus 001 Device 018: ID 04b8:0e28 Seiko Epson Corp. HD USB Camera

this is from usbutils 012, as below:

lsusb --version
lsusb (usbutils) 012

Is there any work around this to have USB devices properly named?

iconv / libiconv detection problem (buildroot, uClibc)

When compiling usbutils under buildroot I got linker errors because of missing "libiconf_open" etc.. This patch solved the issue in my case (adapted from libglib2):

--- usbutils-010.original/configure.ac	2018-05-15 16:15:34.000000000 +0200
+++ usbutils-010/configure.ac	2019-04-11 14:54:18.841489702 +0200
@@ -13,7 +13,20 @@
 AC_SYS_LARGEFILE
 
 AC_CHECK_HEADERS([byteswap.h])
-AC_CHECK_FUNCS([nl_langinfo iconv])
+
+found_iconv=no
+# Check if we have GNU libiconv
+if test $found_iconv = "no"; then
+        AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
+fi
+# Check in the C library first
+if test $found_iconv = "no"; then
+        AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
+fi
+# Check if we have a iconv in -liconv, possibly from vendor
+if test $found_iconv = "no"; then
+        AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
+fi
 
 PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.9)
 

Strange usb request to device

Hello!

I'm embedded developer and got some strange USB request from lsusb.

lsusb -d 24dc:0401 -v

Unhandled STANDART request
bmRequestType: 80
bRequest: 6
wValue: A00
wIndex: 0
wLength: 4

What is 0xA descriptor type? I don't found it in USB2.0 specification.

Not working with raspberry pi Zero w ?

hi,

i tried to use usbreset on a huawei usb 4g modem after using usb_modswitch its not working ?

the command to usb_modswitch is below
usb_modeswitch -v 12d1 -p 157c -P 1506 -M 55534243123456780000000000000011062000000100000000000000000000 -i 2

here is output of the process i tried

root@PIZeroBot:/reset2# lsusb
Bus 001 Device 004: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@PIZeroBot:
/reset2# ./usbreset 12d1:1506
Resetting HUAWEI_MOBILE ... ok
root@PIZeroBot:~/reset2# lsusb
Bus 001 Device 004: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Regards
Dee

README lacks statement of origin of code

Hi,

it's easy to get the source code for usbutils, e.g. under debian/ubuntu just do an apt source usbutils.

But then, the code itself does not contain any hint about it's origin, where to get the original source, where to open issues, i.e. a link to this github repository here. It's just the debian patch which tells in debian/control, where the source came from, or the allmighty Google.

Usually source codes contain some statement, usually in the README, about where their home is.

regards

USB device(s) not listing correctly

We're struggling to get a fingerprint scanner working on Ubuntu (also Debian etc.); and as one person suggested, the issue might be related to usbutils not listing the device properly - https://bugs.launchpad.net/usbutils/+bug/1721909/
I am not an expert myself in linux driver development, yet there are quite a lot of people looking for a fix. lsusb shows either one of these lines:

Bus 001 Device 005: ID 27c6:5381
or Bus 001 Device 003: ID 27c6:5395
or Bus 001 Device 004: ID 27c6:5301
or Bus 001 Device 003: ID 27c6:5395
or Bus 001 Device 004: ID 27c6:538c
or Bus 001 Device 007: ID 27c6:5740
etc.

Also, as another person pointed out, the vendor id 27c6 should at least say "Shenzhen Huiding" instead of an empty string, as per https://github.com/torvalds/linux/blob/e19b205be43d11bff638cad4487008c48d21c103/Documentation/devicetree/bindings/vendor-prefixes.txt

Any help will be long appreciated.

Package description vs. version 008

Description says:

USB utilities for Linux, includes the usb.ids file and lsusb http://www.linux-usb.org

But 5d7ea40 tells otherwise:

Also remove usb.ids from the repository. [Note that these were probably
never used by distributions regarless, as most distros ship the usb.ids
directly from upstream.]

lsusb for windows

Why not lsusb under windows? You can collect it with minimal edits ...

USB MIDI 2.0 Descriptors

This is output from lsusb on Ubuntu 22.04.01. This is a prototype MIDI 2.0 (UMP) USB device using alternate setting 1 descriptors
Descriptor type 37 subtype 2 is supposed to list bNumGrpTrmBlock but it shows MIDIJack.
Reference: USB Device Class Definition for MIDI Devices, Version 2.0 p.42.
Not sure where to post this. Only could find this github repo with libusb sources
Have no reference to other devices as a comparison (no such devices seem to exist yet).

Retrieving interface descriptors

Just a question. Does the library support control transfer to retrieve interface descriptors ?
I have a case for a project where a call not seem to reach the SETUP stage code for an embedded controller firmware:

The device is just plugged in, no drivers are using it. After plugging in Linux did set the address (0x05) and configure (0x09) and retrieved the string descriptors successfully. After that no transactions are done.
Then using libusb the following call is issues:
int ret = libusb_control_transfer(handle,0x81,0x06,0x2601,1,data,5,0);
Libusb returns an error -1: Input/Output Error
but using this (device) does reach the firmware:
int ret = libusb_control_transfer(handle,0x80,0x06,0x2601,1,data,5,0);
I am trying to figure out how to further nail down if this is related to libusb or the firmware.
The firmware code is quite complex and have not yet found out where this gets stuck

posted this ib thelibusb repo. This can be closed.

usb-devices: printf bugs on value of /sys/bus/.../bInterfaceNumber > 9

/sys/bus/usb/devices/usb?///bInterfaceNumber provides hexadecimal values.
when > 9, printf fails to interpret them (expect a decimal input number to print using the %2i modifier).
Prefixing the value with "0x" solves this.

Eg:

$ cat /sys/bus/usb/devices/usb1/1-2/1-2:1.10/bInterfaceNumber
0a
$ printf 'I:  If#=%2i Alt=%2i #EPs=%2i Cls=%s(%s) Sub=%s Prot=%s Driver=%s\n' 0a 0 00 02 commc 0b 00 '(none)'
bash: printf: 0a: invalid number

This patch attempts fixes printf for values of bInterfaceNumber but other /sys/* files may be at concern.

# lsusb -s 1:2
Bus 001 Device 002: ID 0421:0264 Nokia Mobile Phone
# cat /sys/bus/usb/devices/usb1/1-2/1-2:1.10/bInterfaceNumber
0a
# bash -vx usb-devices
[...]
printf 'I:  If#=%2i Alt=%2i #EPs=%2i Cls=%s(%s) Sub=%s Prot=%s Driver=%s\n' 0a 0 00 02 commc 0b 00 '(none)'
bash: printf: 0a: invalid number
[...]

--- /usr/bin/usb-devices.save   2014-10-08 19:14:19.062029163 -0300
+++ /usr/bin/usb-devices    2014-10-08 19:25:29.969355876 -0300
@@ -77,7 +77,7 @@
    fi
    classname=`class_decode $class`
    printf "I:  If#=%2i Alt=%2i #EPs=%2i Cls=%s(%s) Sub=%s Prot=%s Driver=%s\n" \
-       $ifnum $altset $numeps $class "$classname" $subclass \
+       0x$ifnum $altset $numeps $class "$classname" $subclass \
        $protocol $driver

    for endpoint in $ifpath/ep_??

syntax error in autogen.sh

hi

getting a syntax error when using autogen.sh for configure but cant figure out how to fix

./configure: line 4500: syntax error near unexpected token LIBUSB,' ./configure: line 4500: PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.9)'

Cannot mount USB floppy disk drive

Device is recognised as a floppy when it is plugged in and allocated to /dev/sdb if plugged in after the system has booted. A device /dev/sg1 is also created. ufiformat -v -i gives the same output for sdb and sg1.
Kernel is 5.2.17 compiled from Debian source. CONFIG_USB_STORAGE=y
Drive is identified as 0409:0040 NEC Corp. Floppy
~# mount /dev/sdb /media/floppy
mount: /media/floppy0: can't read superblock on /dev/sdb.
~# mount /dev/sg1 /media/floppy
mount: /media/floppy0: /dev/sg1 is not a block device.

~# mount -t msdos /dev/sdb /media/floppy
mount: /media/floppy0: can't read superblock on /dev/sdb.
from dmesg:
[47430.337431] sd 2:0:0:0: [sdb] tag#0 access beyond end of device
[47430.337444] print_req_error: I/O error, dev sdb, sector 0 flags 0
[47430.337458] FAT-fs (sdb): unable to read boot sector

Please do a release with Python 3 support

v010 doesn't support Python 3 and Python 2 is being EOL'd in 2020 and it's gradually disappearing from default configurations for distros. Apparently the support is added in trunk. Is there any chance of having a new release soon?

Offered usbutils.pc.in file for inclusion... or not

# An added .pc.in file  :  by DRE 2022  (https://github.com/DaemonDave)

# The Folder Variables 
prefix=@prefix@
exec_prefix=@prefix@
libdir=@prefix@/lib64
includedir=@prefix@/include

# Package Name that may change but requires no update
Name: @PACKAGE_NAME@					 		# human-readable name
Description: usbutils    This is a collection of USB tools for use on Linux and BSD systems\
 to query what type of USB devices are connected to the system. This is to be run on a USB host\
  (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.) # human-readable description
# Version updated everytime
Version: @VERSION@
# where to find the repository?
URL: https://github.com/gregkh/usbutils
# Requires: is from configure.ac
  Requires: libusb-1.0 >= 1.0.14  libudev >= 196
  Conflicts:
  Libs: -L@prefix@/lib64
  Libs.private: @LIBUSB_LIBS@ @UDEV_LIBS@
  Cflags: @CFLAGS@ @LIBUSB_CFLAGS@ @UDEV_CFLAGS@

github doesn't allow .pc.in files so above is the file contents. I placed it in the top folder.

If you want to make this pkgconfig file then replace these lines into your configure.ac and you are finished!


AC_CONFIG_FILES([
    usbutils.pc
    Makefile
])

Above is a proposed usbutils.pc.in package-config configuration file to be included. I made it because the udev copy I am using requires configure.ac looks for a usbutils.pc file for some creepy hidden variable looking....

Adopt or ignore at your leisure.

Cheers!

Daemondave

Insufficient minimum version for libusb

Commit 89a279c updated the version of usbhid-dump to the latest commit, but usbhid-dump now requires libusb ≥ 1.0.22, as it uses libusb_set_options() — see DIGImend/usbhid-dump#4 for the missing version check there.

Usbutils depends on libusb ≥ 1.0.9, but since it builds usbhid-dump as a sub-module, it should bump up the required version of libusb to 1.0.22.

lsusb stalls with "UNRECOGNIZED" errors

Not sure if this is a problem upstream or with lsusb. Can confirm at least with the latest git (010) and CentOS release (007).

007: Strange thing is it also appears on virtual hubs:
https://gist.github.com/h1z1/d21035ec804de5ad77f9487479e039a4

    bU2DevExitLat           0 micro seconds
  **** UNRECOGNIZED:  1c 10 0a 00 23 00 00 00 01 00 00 00 34 00 05 00 b4 00 05 00 35 40 0a 00 b5 40 0a 00**
Device Status:     0x0001
  Self Powered

010: Different error possibly related?
https://gist.github.com/h1z1/d21035ec804de5ad77f9487479e039a4

      Speed Attribute ID: 5 10Gb/s Symmetric TX SuperSpeedPlus
**can't get debug descriptor: Resource temporarily unavailable**
Device Status:     0x0001
  Self Powered

DNS Queries to get updated ID information

I noticed today that even though I'm running Ubuntu 18.04, my usb ID database was from 2017.

The pci-id database operates at pci-ids.ucw.cz, and the lspci command has a neat feature.

When pci-ids.ucw.cz updates their database, they generate and apply a DNS zone file and create TXT records for the ID records.

If you have a PCI ID of 0014:7a00, you can do a DNS TXT query for 0014.pci-ids.ucw.cz and the record is i=Loongson Technology LLC showing the manufacturer. If you dig txt 7a00.0014.pci.id.ucw.cz" you get i=Hyper Transport Bridge Controller`

It's an easy way to update the local database for specific entries without having to sync the entire pci.ids file. lspci has native support for the DNS search method so there are never any unrecognized devices.

I think lsusb and the usb.ids file could benefit from a similar configuration. Michal 'vorner' Vaner could likely assist with the code merges from lspci to lsusb as well as help you work out the DNS infrastructure (or if you ask nicely, he might just let you use his DNS servers to host the linux-usb.org zone DNS information)

fails to ./configure on ubuntu xenial

[...]
checking for iconv... yes
./configure: line 4533: syntax error near unexpected token `LIBUSB,'
./configure: line 4533: `PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.9)'

it looks for "libusb-1.0" but in ubuntu is called "libusb-1.0-0"

also

./configure: line 4535: syntax error near unexpected token `UDEV,'
./configure: line 4535: `PKG_CHECK_MODULES(UDEV, libudev >= 196)'

ubuntu package name is libudev1

I tried replacing with ubuntu packages names but it gave the same error, then tried commenting these lines as well as usbhid-dump/configure at line 11958, but further I get this:

make[4]: Entering directory '/usr/local/src/usbutils/usbhid-dump/lib'
CC dev.lo
In file included from /usr/local/src/usbutils/usbhid-dump/include/uhd/dev.h:31:0,
from dev.c:29:
/usr/local/src/usbutils/usbhid-dump/include/uhd/libusb.h:30:20: fatal error: libusb.h: No such file or directory
compilation terminated.
Makefile:393: recipe for target 'dev.lo' failed
make[4]: *** [dev.lo] Error 1
make[4]: Leaving directory '/usr/local/src/usbutils/usbhid-dump/lib'
Makefile:422: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/usr/local/src/usbutils/usbhid-dump'
Makefile:354: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/usr/local/src/usbutils/usbhid-dump'
Makefile:791: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/usbutils'
Makefile:406: recipe for target 'all' failed
make: *** [all] Error 2

UAC2: lsusb -v only show first string descriptor when there are several ones

Hi,

trying to implement an alsa UCM2 profile for my USB audio interface (Arturia Minifuse 2), I noticed that when using lsusb -v, I can only see the first channel description in iChannelNames attribute from a cluster.

e.g:

    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              4 MiniFuse 2 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             4
        bmChannelConfig    0x00000000
        iChannelNames          13 Output Left

Dumping the usb data under windows, I see all the iChannelNames, there is one per channel (so 4 here). In this case, it should show
Output Left, Output Right, Loopback Left, Loopback Right or something similar.

I suppose the issue is only the first string descriptor (array[0]) is shown, where it should iterate on bNrChannels to get array[1-3] descriptors as well.

Sadly, I'm not fluent enough in C to see where in the code it could be fixed ;)

Thanks!

New release?

Would it be possible to do a new release in the near future? I am preparing the package for a new major version of a distribution and I would rather use a official release then a git snapshot. Thanks!

lsusb.py not fully converted to Python 3

The conversion (from commit f523873) seems incomplete. usb.ids cannot be read because file() does not exist anymore in Py3.

Replacing this with open(), a decode error occurs because the usb.ids file is inconsistently encoded, or at least not UTF-8.

/cc @lnykryn

The returned value of the "lsusb -h" command is not 0.

[root@localhost ~]# lsusb -h
Usage: lsusb [options]...
List USB devices
-v, --verbose
Increase verbosity (show descriptors)
-s [[bus]:][devnum]
Show only devices with specified device and/or
bus numbers (in decimal)
-d vendor:[product]
Show only devices with the specified vendor and
product ID numbers (in hexadecimal)
-D device
Selects which device lsusb will examine
-t, --tree
Dump the physical USB device hierarchy as a tree
-V, --version
Show version of program
-h, --help
Show usage and help
[root@localhost ~]# echo $?
1
[root@localhost ~]#

Why the hub port number is hardcoded as 1?

The lsusb always treat the port number of root hub as 1.
While the lsusb.py treat the port number of hub as 0.

Related code:

printf("/: Bus %02u.Port %u: Dev %u, Class=%s, Driver=%s/%up, %sM%s\n", b->busnum, 1,

Related output of lsusb:
image

Related output of lsusb.py:
image

I think they should be consistent at least...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.