New inxi test, usb without lsusb, using /sys

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
h2-1
Level 4
Level 4
Posts: 293
Joined: Sat Oct 16, 2010 4:02 pm
Contact:

New inxi test, usb without lsusb, using /sys

Post by h2-1 »

The development branch of inxi, pinxi, now has support for no lsusb usb data, using /sys, which will apply to -A, -N, and --usb. Blame or thank gm10 for these new features, who requested this set of changes.

Devices I do not have: printers, usb wifi, more than 1 daisy chained usb hubs (could of sworn I had at least 2 external hubs but I guess not).

As always, any feedback is appreciated, this is actually a quite large change for inxi, since it's the first time in it's life it's tried to do usb without the help of lsusb (which contains enormous, about 20k items, internal databases to match product id/vendor ids to their string values). Depending on the results of tests, I may decide to get rid of lsusb for -A or -N only, if it turns out that /sys is usually to almost always close enough, because it's so radically faster to skip lsusb.

To help with testing, I made the --usb-sys flag, which if added to --usb, like so:

Code: Select all

pinxi -xxx --usb --usb-sys 
will force inxi/pinxi to use /sys as the primary usb data source, and not use lsusb. The trickiest issue is matching the 'type' for various devices, I've handled the most common types, and I can't probably add many more.

The good parts are:
1. radically faster to get it straight from /sys than using lsusb, depending on the system, between 40 and 500 milliseconds faster (or more, for very old systems).
2. Since the /sys parser is integrated into the usb logic now and always runs, this allowed me to add some valuable items, like true busID-port[.port][.port] paths for Bus ID: or Hub:. Device ID is still tacked onto the end like so: busid-port:device id, allowing for easy matches with lsusb or lsusb -v output.
3. USB per device driver(s) is now supported. Since all hubs use the 'hub' driver, I don't bother listing it.
4. if a system does not have lsusb, or you cannot install it ( a remote server, for example), you will now get usb data, maybe not quite as good as lsusb based, but you will get enough to see what is going on.
5. Does a slightly better job with multi interface usb devices, and will root through all of them to construct a string version, comma separated, like: type: keyboard,mouse
6. If a serial is available, shows it, some devices have it. This info for some reason was not in lsusb. Normal filter rules apply.
7. Hub ports are now listed. Note that not all ports are external, a motherboard usb header that is not used still counts as usually 2 ports, for example, and an internal usb device, like a laptop video camera, is a on a port, but not an external one.
8. Uses a hack to get type: Network if it showed vendor defined, this is better than the lsusb method.

The bad parts:
1. tends to be less accurate, not as much vendor/product id information.
2. the information can be different, or more generic, for example, I have a laptop docking station that with lsusb was correctly identified as the dock brand/vendor, but with /sys, it only showed that it was a hub with multi TT, no indication it's a docking station, that is.

The neutral parts:
1. sometimes the regular lsusb based way is better, sometimes, but not as often, the /sys based way is better.

For -A, -N, and --usb, you can force inxi to use /sys with the additional --usb-sys flag.

If you prefer the --usb-sys output, you can add to your configuration file:

Code: Select all

USB_SYS=true
which will then make inxi use /sys, which makes it much faster, particularly for -N and -A.

To override this config setting, you can use --usb-tool which forces inxi to use lsusb.

Since I have only a limited number of usb devices, further tests would be nice if anyone feels like running them.

If you already have pinxi installed, simply run:

Code: Select all

pinxi -U 
If you don't have it installed, as root, do:

Code: Select all

cd /usr/local/bin
wget smxi.org/pinxi
chmod +x pinxi
then post:

Code: Select all

pinxi -xxxzAN --usb
pinxi -xxxzAN --usb --usb-sys
Here are two samples.

First without --usb-sys, using lsusb as primary info.

Code: Select all

pinxi --usb -xxx
USB:       Hub: 1-0:1 usb: 2.0 type: Full speed (or root) hub ports: 14 chip ID: 1d6b:0002 
           Hub: 1-3:85 usb: 1.1 type: Atmel 4-Port Hub ports: 4 chip ID: 03eb:0902 
           Device-1: C-Media Audio Adapter (Planet UP-100 Genius G-Talk) driver: cm109,snd-usb-audio usb: 1.1 
           type: Audio bus ID: 1-3.2:86 chip ID: 0d8c:000e 
           Device-2: Wacom Graphire 2 4x5 driver: usbhid,wacom usb: 1.1 type: Mouse bus ID: 1-4:2 
           chip ID: 056a:0011 
           Device-3: Verbatim driver: usb-storage usb: 2.0 type: Mass Storage bus ID: 1-7:11 chip ID: 18a5:3623 
           Device-4: Tangtop HID Keyboard driver: hid-generic,usbhid usb: 1.1 type: Keyboard bus ID: 1-10:3 
           chip ID: 0d3d:0001 
           Device-5: Canon CanoScan LiDE 110 usb: 2.0 type: Vendor Specific Protocol bus ID: 1-13:112 
           chip ID: 04a9:1909 
           Device-6: Apple Ethernet Adapter [A1277] driver: asix usb: 2.0 type: Vendor Specific Class 
           bus ID: 1-14:13 chip ID: 05ac:1402 
           Hub: 2-0:1 usb: 3.1 type: Full speed (or root) hub ports: 8 chip ID: 1d6b:0003 
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0002 
           Hub: 4-0:1 usb: 3.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0003 
           Hub: 5-0:1 usb: 2.0 type: Full speed (or root) hub ports: 4 chip ID: 1d6b:0002 
           Hub: 6-0:1 usb: 3.0 type: Full speed (or root) hub ports: 4 chip ID: 1d6b:0003
Second with --usb-sys:

Code: Select all

USB:       Hub: 1-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 14 chip ID: 1d6b:0002 
           Hub: 1-3:85 usb: 1.1 type: Full speed (or root) Hub ports: 4 chip ID: 03eb:0902 
           Device-1: Generic USB Audio Device driver: cm109,snd-usb-audio usb: 1.1 type: Audio bus ID: 1-3.2:86 
           chip ID: 0d8c:000e 
           Device-2: WACOM ET-0405A-UV2.0-3 driver: usbhid,wacom usb: 1.1 type: Mouse bus ID: 1-4:2 
           chip ID: 056a:0011 
           Device-3: Verbatim STORE N GO driver: usb-storage usb: 2.0 type: Mass Storage bus ID: 1-7:11 
           chip ID: 18a5:3623 serial: C800431440279C23 
           Device-4: USBPS2 HID Keyboard / Mouse driver: hid-generic,usbhid usb: 1.1 type: Keyboard,Mouse 
           bus ID: 1-10:3 chip ID: 0d3d:0001 
           Device-5: Canon CanoScan usb: 2.0 type: <vendor specific> bus ID: 1-13:112 chip ID: 04a9:1909 
           Device-6: Apple USB Ethernet Adapter driver: asix usb: 2.0 type: Network bus ID: 1-14:13 
           chip ID: 05ac:1402 serial: 117630 
           Hub: 2-0:1 usb: 3.1 type: Full speed (or root) Hub ports: 8 chip ID: 1d6b:0003 
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0002 
           Hub: 4-0:1 usb: 3.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0003 
           Hub: 5-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 4 chip ID: 1d6b:0002 
           Hub: 6-0:1 usb: 3.0 type: Full speed (or root) Hub ports: 4 chip ID: 1d6b:0003
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: New inxi test, usb without lsusb, using /sys

Post by catweazel »

h2-1 wrote: Mon Aug 13, 2018 5:51 pm Blame or thank gm10 for these new features
We blame @gm10 for everything.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
gm10

Re: New inxi test, usb without lsusb, using /sys

Post by gm10 »

catweazel wrote: Wed Aug 15, 2018 2:38 am
h2-1 wrote: Mon Aug 13, 2018 5:51 pm Blame or thank gm10 for these new features
We blame @gm10 for everything.
That's usually a good approach!

I blame you for not giving h2-1 some feedback though after all the effort and research he put into this:
h2-1 wrote: Mon Aug 13, 2018 5:51 pm Since I have only a limited number of usb devices, further tests would be nice if anyone feels like running them.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: New inxi test, usb without lsusb, using /sys

Post by catweazel »

gm10 wrote: Fri Aug 17, 2018 4:35 am
catweazel wrote: Wed Aug 15, 2018 2:38 am
h2-1 wrote: Mon Aug 13, 2018 5:51 pm Blame or thank gm10 for these new features
We blame @gm10 for everything.
That's usually a good approach!

I blame you for not giving h2-1 some feedback though after all the effort and research he put into this:
h2-1 wrote: Mon Aug 13, 2018 5:51 pm Since I have only a limited number of usb devices, further tests would be nice if anyone feels like running them.
Yes, you'd like to blame me, but it's your fault.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
gm10

Re: New inxi test, usb without lsusb, using /sys

Post by gm10 »

catweazel wrote: Fri Aug 17, 2018 4:37 am Yes, you'd like to blame me, but it's your fault.
I take full responsibility for not training you well enough.
Locked

Return to “Software & Applications”