Welcome!
Forum users

Current releases
--MX-23 release info here
--Migration information to MX-23 here
--antiX-23.1 (Arditi del Popolo) release info here

Important information
--If in starting your system it boots to an unwanted Desktop, right click desktop, then select leave and logout. At the
login screen there is a session chooser at the top of the screen.

News
-- MX Linux on social media: here
-- New Forum Features, Marking Solved and Referencing a User: here

New inxi feature, /sys based usb data

Message
Author
User avatar
h2-1
Posts: 208
Joined: Sat Nov 15, 2008 3:16 pm

New inxi feature, /sys based usb data

#1 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.

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
smxi/sgfxi site (manuals, how-to's, faqs) :: script forums :: Check out inxi sys info script!

User avatar
sunrat
Posts: 634
Joined: Mon Mar 28, 2016 9:54 pm

Re: New inxi feature, /sys based usb data

#2 Post by sunrat »

Happy to help. This is a 10 year old computer so no USB3.

Code: Select all

pinxi -xxxzAN --usb
Audio:     Device-1: Intel 82801JI HD Audio vendor: Gigabyte GA-EP45-UD3R 
           driver: snd_hda_intel v: kernel bus ID: 00:1b.0 chip ID: 8086:3a3e
           Device-2: NVIDIA GF114 HDMI Audio vendor: ASUSTeK driver: snd_hda_intel
           v: kernel bus ID: 01:00.1 chip ID: 10de:0e0c
           Sound Server: ALSA v: k4.17.11-towo.1-siduction-amd64
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169
           v: 2.3LK-NAPI port: d000 bus ID: 04:00 chip ID: 10ec:8168
           Device-2: TP-Link TL-WN821N v3 / TL-WN822N v2 802.11n [Atheros AR7010+AR9287]
           type: USB driver: ath9k_htc bus ID: 3-3:2 chip ID: 0cf3:7015
USB:       Hub: 1-0:1 usb: 1.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0001
           Hub: 2-0:1 usb: 1.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0001
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) hub ports: 6 chip ID: 1d6b:0002
           Device-1: TP-Link TL-WN821N v3 / TL-WN822N v2 802.11n [Atheros AR7010+AR9287]
           driver: ath9k_htc usb: 2.0 type: Vendor Specific Class bus ID: 3-3:2
           chip ID: 0cf3:7015
           Hub: 4-0:1 usb: 2.0 type: Full speed (or root) hub ports: 6 chip ID: 1d6b:0002
           Hub: 5-0:1 usb: 1.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0001
           Device-2: Logitech MouseMan Wheel driver: hid-generic,usbhid usb: 1.1
           type: Mouse bus ID: 5-2:2 chip ID: 046d:c00b
           Hub: 6-0:1 usb: 1.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0001
           Hub: 7-0:1 usb: 1.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0001
           Hub: 8-0:1 usb: 1.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0001

Code: Select all

pinxi -xxx --usb --usb-sys
USB:       Hub: 1-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001
           Hub: 2-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 6 chip ID: 1d6b:0002
           Device-1: ATHEROS USB WLAN driver: ath9k_htc usb: 2.0 type: Network
           bus ID: 3-3:2 chip ID: 0cf3:7015 serial: 12345
           Hub: 4-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 6 chip ID: 1d6b:0002
           Hub: 5-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001
           Device-2: Logitech USB Mouse driver: hid-generic,usbhid usb: 1.1 type: Mouse
           bus ID: 5-2:2 chip ID: 046d:c00b
           Hub: 6-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001
           Hub: 7-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001
           Hub: 8-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001

User avatar
richb
Administrator
Posts: 10306
Joined: Wed Jul 12, 2006 2:17 pm

Re: New inxi feature, /sys based usb data

#3 Post by richb »

root@mxyola:/home/rich# pinxi -xxx --usb --usb-sys
USB: Hub: 1-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0002
Hub: 2-0:1 usb: 3.0 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0003
Device-1: PNY USB 3.0 FD driver: usb-storage usb: 3.1 type: Mass Storage
bus ID: 2-1:2 chip ID: 154b:00d2 serial: 070B66C291C06789
Hub: 3-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 5 chip ID: 1d6b:0002
Hub: 4-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 5 chip ID: 1d6b:0002
Hub: 5-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 5 chip ID: 1d6b:0001
Device-2: Logitech USB Receiver RQR12.03_B0025 driver: logitech-djreceiver,usbhid
usb: 2.0 type: Keyboard,Mouse,HID bus ID: 5-4:2 chip ID: 046d:c52b
Hub: 6-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 5 chip ID: 1d6b:0001
Device-3: Logitech USB Receiver RQR12.03_B0025 driver: logitech-djreceiver,usbhid
usb: 2.0 type: Keyboard,Mouse,HID bus ID: 6-4:2 chip ID: 046d:c52b
Hub: 7-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001
Actually this helped correct a misconception I had about one of my USB thumb drives. I had purchased it some time ago and thought it was a uSB 3 drive, I apparently forgot that it was USB 2. And with that plugged in it reported it as USB 2.0 which initially confused me.
The one in the report is a newer USB 3.
Forum Rules
Guide - How to Ask for Help

richb Administrator
System: MX 23 KDE
AMD A8 7600 FM2+ CPU R7 Graphics, 16 GIG Mem. Three Samsung EVO SSD's 250 GB

User avatar
rokytnji.1
Global Moderator
Posts: 697
Joined: Sun Apr 13, 2014 9:06 pm

Re: New inxi feature, /sys based usb data

#4 Post by rokytnji.1 »

Chromebook Acer C 710. Threw a 8 gig mini pny usb in to test. It is a older usb 2.0 drive.

Code: Select all

harry@biker:~
$ pinxi -xxxzAN --usb
Audio:
  Device-1: Intel 7 Series/C216 Family High Definition Audio driver: snd_hda_intel 
  v: kernel bus ID: 00:1b.0 chip ID: 8086:1e20 
  Sound Server: ALSA v: k4.15.9-antix.1-amd64-smp 
Network:
  Device-1: Qualcomm Atheros AR9462 Wireless Network Adapter driver: ath9k v: kernel 
  bus ID: 01:00 chip ID: 168c:0034 
  Device-2: Broadcom Limited NetLink BCM57785 Gigabit Ethernet PCIe driver: tg3 
  v: 3.137 port: N/A bus ID: 02:00 chip ID: 14e4:16b5 
USB:
  Hub: 1-0:1 usb: 2.0 type: Full speed (or root) hub ports: 3 chip ID: 1d6b:0002 
  Hub: 1-1:2 usb: 2.0 type: Intel Integrated Rate Matching Hub ports: 4 
  chip ID: 8087:0024 
  Device-1: Foxconn / Hon Hai driver: btusb usb: 1.1 type: Bluetooth bus ID: 1-1.1:5 
  chip ID: 0489:e04e 
  Device-2: Chicony driver: uvcvideo usb: 2.0 type: Video bus ID: 1-1.3:4 
  chip ID: 04f2:b336 
  Hub: 2-0:1 usb: 2.0 type: Full speed (or root) hub ports: 3 chip ID: 1d6b:0002 
  Hub: 2-1:2 usb: 2.0 type: Intel Integrated Rate Matching Hub ports: 4 
  chip ID: 8087:0024 
  Device-3: PNY Classic Attache Flash Drive driver: usb-storage usb: 2.0 
  type: Mass Storage bus ID: 2-1.2:3 chip ID: 154b:007a 
harry@biker:~
$ pinxi -M
Machine:
  Type: Desktop System: Google product: Parrot v: 1.0 serial: <root required> 
  Mobo: Google model: Parrot v: 1.0 serial: <root required> BIOS: coreboot 
  v: 4.0-6588-g4acd8ea-dirty date: 09/04/2014 
harry@biker:~
$ 

User avatar
timkb4cq
Developer
Posts: 3179
Joined: Wed Jul 12, 2006 4:05 pm

Re: New inxi feature, /sys based usb data

#5 Post by timkb4cq »

No, I don't normally run with three USB nics. :p
I just plugged in some of the inexpensive (<$15) ones I've picked up over time. None of them are actually connected, but they all work.

Code: Select all

$ pinxi -xxxzAN --usb
Audio:     Device-1: AMD SBx00 Azalia vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus ID: 00:14.2 chip ID: 1002:4383 
           Device-2: AMD RS780 HDMI Audio [Radeon 3000/3100 / HD 3200/3300] 
           driver: snd_hda_intel v: kernel bus ID: 01:05.1 chip ID: 1002:960f 
           Sound Server: ALSA v: k4.16.0-10.1-liquorix-amd64 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           v: 2.3LK-NAPI port: de00 bus ID: 04:00 chip ID: 10ec:8168 
           Device-2: Ralink MT7601U Wireless Adapter type: USB driver: mt7601u bus ID: 1-1.4:3 
           chip ID: 148f:7601 
           Device-3: Realtek RTL8191SU 802.11n WLAN Adapter type: USB driver: r8712u 
           bus ID: 4-3.4:7 chip ID: 0bda:8172 
           Device-4: Realtek RTL8188ETV Wireless LAN 802.11n Network Adapter type: USB 
           driver: r8188eu bus ID: 4-3.6:8 chip ID: 0bda:0179 
USB:       Hub: 1-0:1 usb: 2.0 type: Full speed (or root) hub ports: 1 chip ID: 1d6b:0002 
           Hub: 1-1:2 usb: 2.1 type: VIA Labs Hub ports: 4 chip ID: 2109:3431 
           Device-1: Ralink MT7601U Wireless Adapter driver: mt7601u usb: 2.0 
           type: Vendor Specific Protocol bus ID: 1-1.4:3 chip ID: 148f:7601 
           Hub: 2-0:1 usb: 3.0 type: Full speed (or root) hub ports: 4 chip ID: 1d6b:0003 
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) hub ports: 6 chip ID: 1d6b:0002 
           Hub: 4-0:1 usb: 2.0 type: Full speed (or root) hub ports: 6 chip ID: 1d6b:0002 
           Hub: 4-3:2 usb: 2.0 type: Terminus FE 2.1 7-port Hub ports: 7 chip ID: 1a40:0201 
           Device-2: Canon MP210 ser driver: usblp usb: 2.0 type: Vendor Specific Class 
           bus ID: 4-3.1:5 chip ID: 04a9:1721 
           Device-3: Genesys Logic Logilink CR0012 driver: usb-storage usb: 2.0 
           type: Mass Storage bus ID: 4-3.2:3 chip ID: 05e3:0745 
           Device-4: Silicon Motion - Taiwan (formerly Feiya ) Endoscope camera driver: uvcvideo 
           usb: 2.0 type: Video bus ID: 4-3.3:10 chip ID: 090c:f37d 
           Device-5: Realtek RTL8191SU 802.11n WLAN Adapter driver: r8712u usb: 2.0 
           type: Vendor Specific Protocol bus ID: 4-3.4:7 chip ID: 0bda:8172 
           Device-6: Logitech Unifying Receiver driver: hid-generic,usbhid usb: 2.0 type: Mouse 
           bus ID: 4-3.5:4 chip ID: 046d:c52f 
           Device-7: Realtek RTL8188ETV Wireless LAN 802.11n Network Adapter driver: r8188eu 
           usb: 2.0 type: Vendor Specific Protocol bus ID: 4-3.6:8 chip ID: 0bda:0179 
           Device-8: Bulk-Only driver: usb-storage usb: 2.1 type: Mass Storage bus ID: 4-3.7:9 
           chip ID: 2897:5650 
           Hub: 5-0:1 usb: 1.1 type: Full speed (or root) hub ports: 3 chip ID: 1d6b:0001 
           Hub: 6-0:1 usb: 1.1 type: Full speed (or root) hub ports: 3 chip ID: 1d6b:0001 
           Hub: 7-0:1 usb: 1.1 type: Full speed (or root) hub ports: 3 chip ID: 1d6b:0001 
           Hub: 8-0:1 usb: 1.1 type: Full speed (or root) hub ports: 3 chip ID: 1d6b:0001 
           Hub: 9-0:1 usb: 1.1 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0001 

Code: Select all

$ pinxi -xxxzAN --usb --usb-sys
Audio:     Device-1: AMD SBx00 Azalia vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus ID: 00:14.2 chip ID: 1002:4383 
           Device-2: AMD RS780 HDMI Audio [Radeon 3000/3100 / HD 3200/3300] 
           driver: snd_hda_intel v: kernel bus ID: 01:05.1 chip ID: 1002:960f 
           Sound Server: ALSA v: k4.16.0-10.1-liquorix-amd64 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           v: 2.3LK-NAPI port: de00 bus ID: 04:00 chip ID: 10ec:8168 
           Device-2: Realtek 802.11n NIC type: USB driver: r8188eu bus ID: 4-3.6:8 
           chip ID: 0bda:0179 
USB:       Hub: 1-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 1 chip ID: 1d6b:0002 
           Hub: 1-1:2 usb: 2.1 type: Full speed (or root) Hub ports: 4 chip ID: 2109:3431 
           Device-1: N/A driver: mt7601u usb: 2.0 type: Network bus ID: 1-1.4:3 
           chip ID: 148f:7601 
           Hub: 2-0:1 usb: 3.0 type: Full speed (or root) Hub ports: 4 chip ID: 1d6b:0003 
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 6 chip ID: 1d6b:0002 
           Hub: 4-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 6 chip ID: 1d6b:0002 
           Hub: 4-3:2 usb: 2.0 type: Hi-speed hub with multiple TTs ports: 7 chip ID: 1a40:0201 
           Device-2: Canon MP210 series driver: usblp usb: 2.0 type: <vendor specific>,Printer 
           bus ID: 4-3.1:5 chip ID: 04a9:1721 serial: <filter> 
           Device-3: USB Storage driver: usb-storage usb: 2.0 type: Mass Storage bus ID: 4-3.2:3 
           chip ID: 05e3:0745 serial: <filter> 
           Device-4: SMI USB 2.0 Camera driver: uvcvideo usb: 2.0 type: Video bus ID: 4-3.3:10 
           chip ID: 090c:f37d serial: <filter> 
           Device-5: Manufacturer Realtek 11n USB Adapter driver: r8712u usb: 2.0 type: Network 
           bus ID: 4-3.4:7 chip ID: 0bda:8172 serial: <filter> 
           Device-6: Logitech USB Receiver RQR22.01_B0006 driver: hid-generic,usbhid usb: 2.0 
           type: Mouse,HID bus ID: 4-3.5:4 chip ID: 046d:c52f 
           Device-7: Realtek 802.11n NIC driver: r8188eu usb: 2.0 type: Network bus ID: 4-3.6:8 
           chip ID: 0bda:0179 serial: <filter> 
           Device-8: MONSTER OD ADVANCE driver: usb-storage usb: 2.1 type: Mass Storage 
           bus ID: 4-3.7:9 chip ID: 2897:5650 serial: <filter> 
           Hub: 5-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 3 chip ID: 1d6b:0001 
           Hub: 6-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 3 chip ID: 1d6b:0001 
           Hub: 7-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 3 chip ID: 1d6b:0001 
           Hub: 8-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 3 chip ID: 1d6b:0001 
           Hub: 9-0:1 usb: 1.1 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0001 
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
kmathern
Developer
Posts: 2398
Joined: Wed Jul 12, 2006 2:26 pm

Re: New inxi feature, /sys based usb data

#6 Post by kmathern »

I have something strange with how it shows the serial number of my fitbit dongle. It doesn't show up in a forum post when I paste the terminal output into a code block so I'm posting an image (attachment) instead. I think the problem might be some kind of unicode error.
pinxi.png
You do not have the required permissions to view the files attached to this post.

User avatar
h2-1
Posts: 208
Joined: Sat Nov 15, 2008 3:16 pm

Re: New inxi feature, /sys based usb data

#7 Post by h2-1 »

kmathern, you're probably right, unicode error is likely. Could be those magic symbols sometimes used in /sys data. Hard to know what those are in order to filter them out, though I can make educated guess.

timkb4cq, this is starting to confirm a suspicion I have, that I might want to inject the 'type:' data from /sys into the lsusb data, it seems to be more accurate, and I can also see, I needed one more filter in case where two types are found, one being <vendor defined> and the other a valid one, I would want to filter out vendor defined and leave just the valid one, that's a case I hadn't seen, exactly what I was hoping to see.

rokytnji.1, I'd need to also see -xxxNA --usb --usb-sys, thanks.

These roughly confirm a few things, or made me realize:
1. I should try to inject the /sys based type: info into the lsusb data, it seems a bit more accurate, or more able to be hacked easily to be accurate. Particularly for networking devices, which are actually quite easy to detect using a hack, but which lsusb does not know about.

2. I need to filter out more accurately the type: data to get rid of <vendor defined> when a valid type was found.

Otherwise it is looking quite good, thanks for taking the time.
smxi/sgfxi site (manuals, how-to's, faqs) :: script forums :: Check out inxi sys info script!

User avatar
MX-16_fan
Posts: 331
Joined: Mon Feb 13, 2017 12:09 pm

Re: New inxi feature, /sys based usb data

#8 Post by MX-16_fan »

h2-1:
h2-1 wrote: Mon Aug 13, 2018 6:01 pm (...) 4. if a system does not have lsusb, or you cannot install it ( a remote server, for example), you will now get usb data (...)
How is this not going to make connected systems more vulnerable?

h2-1 wrote: Mon Aug 13, 2018 6:01 pm ... maybe not quite as good as lsusb based
How would that be progress of any kind?

h2-1 wrote: Mon Aug 13, 2018 6:01 pm 1. tends to be less accurate, not as much vendor/product id information.
How would that be progress of any kind?


Personally, I'd love to see the current lsusb-oriented implementation kept intact for at least another three years until we really know how well this whole idea works out. Might be another systemd-style disaster.

Just my two cents.


Greetings, Joe

User avatar
fehlix
Developer
Posts: 10275
Joined: Wed Apr 11, 2018 5:09 pm

Re: New inxi feature, /sys based usb data

#9 Post by fehlix »

h2-1 wrote: Mon Aug 13, 2018 6:01 pm then post:

Code: Select all

pinxi -xxxzAN --usb
pinxi -xxxzAN --usb --usb-sys
pinxi -xxxzAN --usb

Code: Select all

$ pinxi -xxxzAN --usb
Audio:     Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Gigabyte driver: snd_hda_intel 
           v: kernel bus ID: 00:1b.0 chip ID: 8086:1e20 
           Device-2: NVIDIA GK104 HDMI Audio vendor: Gigabyte driver: snd_hda_intel v: kernel bus ID: 01:00.1 
           chip ID: 10de:0e0a 
           Device-3: Sennheiser type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-1.1:3 
           chip ID: 1395:0025 
           Sound Server: ALSA v: k4.15.0-1-amd64 
Network:   Device-1: Qualcomm Atheros AR8161 Gigabit Ethernet driver: alx v: kernel port: d000 bus ID: 03:00 
           chip ID: 1969:1091 
           Device-2: IMC Networks 802.11 n/g/b Wireless LAN Adapter type: USB driver: rt2800usb bus ID: 2-1.7:4 
           chip ID: 13d3:3247 
           Device-3: Realtek RTL8191SU 802.11n WLAN Adapter type: USB driver: r8712u bus ID: 3-3:2 
           chip ID: 0bda:8172 
USB:       Hub: 1-0:1 usb: 2.0 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0002 
           Hub: 1-1:2 usb: 2.0 type: Intel Integrated Rate Matching Hub ports: 6 chip ID: 8087:0024 
           Device-1: Sennheiser driver: hid-generic,snd-usb-audio,usbhid usb: 1.1 type: Audio bus ID: 1-1.1:3 
           chip ID: 1395:0025 
           Device-2: Realtek driver: r8152 usb: 2.1 type: Vendor Specific Class bus ID: 1-1.3:7 
           chip ID: 0bda:8152 
           Device-3: Logitech M-U0007 [Corded Mouse M500] driver: hid-generic,usbhid usb: 2.0 type: Mouse 
           bus ID: 1-1.5:5 chip ID: 046d:c069 
           Device-4: China Resource Semico driver: hid-generic,usbhid usb: 1.1 type: Keyboard bus ID: 1-1.6:6 
           chip ID: 1a2c:0e24 
           Hub: 2-0:1 usb: 2.0 type: Full speed (or root) hub ports: 2 chip ID: 1d6b:0002 
           Hub: 2-1:2 usb: 2.0 type: Intel Integrated Rate Matching Hub ports: 8 chip ID: 8087:0024 
           Device-5: Standard Microsystems 9-in-2 Card Reader driver: usb-storage usb: 2.0 type: Mass Storage 
           bus ID: 2-1.5:3 chip ID: 0424:2228 
           Device-6: IMC Networks 802.11 n/g/b Wireless LAN Adapter driver: rt2800usb usb: 2.0 
           type: Vendor Specific Protocol bus ID: 2-1.7:4 chip ID: 13d3:3247 
           Device-7: X10 Wireless Wireless Transceiver (ACPI-compliant) driver: ati_remote usb: 1.1 
           type: Vendor Specific Class bus ID: 2-1.8:5 chip ID: 0bc7:0006 
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) hub ports: 4 chip ID: 1d6b:0002 
           Device-8: Realtek RTL8191SU 802.11n WLAN Adapter driver: r8712u usb: 2.0 
           type: Vendor Specific Protocol bus ID: 3-3:2 chip ID: 0bda:8172 
           Device-9: Edimax usb: 2.1 type: Vendor Specific Protocol bus ID: 3-4:3 chip ID: 7392:a812 
           Hub: 4-0:1 usb: 3.0 type: Full speed (or root) hub ports: 4 chip ID: 1d6b:0003 
pinxi -xxxzAN --usb --usb-sys

Code: Select all

$ pinxi -xxxzAN --usb --usb-sys
Audio:     Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Gigabyte driver: snd_hda_intel 
           v: kernel bus ID: 00:1b.0 chip ID: 8086:1e20 
           Device-2: NVIDIA GK104 HDMI Audio vendor: Gigabyte driver: snd_hda_intel v: kernel bus ID: 01:00.1 
           chip ID: 10de:0e0a 
           Device-3: Sennheiser USB headset type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-1.1:3 
           chip ID: 1395:0025 
           Sound Server: ALSA v: k4.15.0-1-amd64 
Network:   Device-1: Qualcomm Atheros AR8161 Gigabit Ethernet driver: alx v: kernel port: d000 bus ID: 03:00 
           chip ID: 1969:1091 
           Device-2: Realtek USB 10/100 LAN type: USB driver: r8152 bus ID: 1-1.3:7 chip ID: 0bda:8152 
           Device-3: Ralink 802.11 n WLAN type: USB driver: rt2800usb bus ID: 2-1.7:4 chip ID: 13d3:3247 
           Device-4: Manufacturer Realtek RTL8191S WLAN Adapter type: USB driver: r8712u bus ID: 3-3:2 
           chip ID: 0bda:8172 
USB:       Hub: 1-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0002 
           Hub: 1-1:2 usb: 2.0 type: Full speed (or root) Hub ports: 6 chip ID: 8087:0024 
           Device-1: Sennheiser USB headset driver: hid-generic,snd-usb-audio,usbhid usb: 1.1 type: Audio,HID 
           bus ID: 1-1.1:3 chip ID: 1395:0025 
           Device-2: Realtek USB 10/100 LAN driver: r8152 usb: 2.1 type: Network bus ID: 1-1.3:7 
           chip ID: 0bda:8152 serial: <filter> 
           Device-3: Logitech USB Laser Mouse U56.01_B0009 driver: hid-generic,usbhid usb: 2.0 type: Mouse 
           bus ID: 1-1.5:5 chip ID: 046d:c069 
           Device-4: SEM USB Keyboard driver: hid-generic,usbhid usb: 1.1 type: Keyboard,HID bus ID: 1-1.6:6 
           chip ID: 1a2c:0e24 
           Hub: 2-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 2 chip ID: 1d6b:0002 
           Hub: 2-1:2 usb: 2.0 type: Full speed (or root) Hub ports: 8 chip ID: 8087:0024 
           Device-5: Generic Flash Card Reader driver: usb-storage usb: 2.0 type: Mass Storage bus ID: 2-1.5:3 
           chip ID: 0424:2228 serial: <filter> 
           Device-6: Ralink 802.11 n WLAN driver: rt2800usb usb: 2.0 type: Network bus ID: 2-1.7:4 
           chip ID: 13d3:3247 serial: <filter> 
           Device-7: X10 WTI RF receiver driver: ati_remote usb: 1.1 type: <vendor specific> bus ID: 2-1.8:5 
           chip ID: 0bc7:0006 
           Hub: 3-0:1 usb: 2.0 type: Full speed (or root) Hub ports: 4 chip ID: 1d6b:0002 
           Device-8: Manufacturer Realtek RTL8191S WLAN Adapter driver: r8712u usb: 2.0 type: Network 
           bus ID: 3-3:2 chip ID: 0bda:8172 serial: <filter> 
           Device-9: Realtek Edimax AC600 USB usb: 2.1 type: <vendor specific> bus ID: 3-4:3 chip ID: 7392:a812 
           serial: <filter> 
           Hub: 4-0:1 usb: 3.0 type: Full speed (or root) Hub ports: 4 chip ID: 1d6b:0003 
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
h2-1
Posts: 208
Joined: Sat Nov 15, 2008 3:16 pm

Re: New inxi feature, /sys based usb data

#10 Post by h2-1 »

Joe, I believe you're unclear on this. First, there is zero vulnerability involved, that's a non existing idea. This is a report from /sys, which exists on your computer. /sys is not systemd, of which i am no fan at all, /sys is just a bunch of weird interconnected files the kernel makes, which roughly aims to replace /proc, though /proc is still used quite a bit because its summary reports are much easier to read as one file. inxi already uses /sys extensively, that's where your machine data comes from unless you force dmidecode, for example. Using /sys data is not adding in anything that does not exist on all linux operating systems that are less than about 12 or 15 years old. /sys is just a way easier way to get kernel data than writing a C program that uses the kernel's API to get data.

The lsusb implementation is not going anywhere anytime soon, and the primary reason is that the lsusb guys use a gigantic database of all known vendor and product IDs, about 20,000 lines long, I found it while researching this, and could in theory do exactly what lsusb does, literally exactly, if I made a module that contained that 20k line db, at that point, reading /sys and using lsusb would basically identical. But I don't want to make and maintain a module. lsusb however is horrendously slow, in fact, in terms of overall inxi execution time, it's the biggest single slowdown when USB data is involved, which is for -A, if found, -N, always checks, and of course, USB:

Now that I know where the file is located, it would actually be fairly trivial to script a grabber and parse it into Perl, at which point the /sys based version would probably run maybe, roughly, 10x faster than the lsusb version, with almost identical results. But I'm not going to do that, but I do know now what would be involved if I really wanted to dump lsusb as a dependency, and it wouldn't honestly be that hard to do at this point.

Note that based on the improved /sys data and the results here in this thread, I'm already using /sys data for the BusID, the drivers, and am going to use it for 'type:' because that's actually better because I can do specific hacks, like determining if network device, for example.

lsusb is not going to be replaced because /sys does not contain the string matches to product and vendor IDs, that's the 20k line long db I referred to in lsusb, but that is literally the only reason, the other data I have, or am synthesizing and it's already better than what inxi had, particularly for type and drivers (which weren't there at all). So I'm today going to replace the lsusb type: data with /sys based plus sythesized data because it's actually more accurare. lsusb -v is a real pain to parse, the lsusb guys did not give machine parsing much thought sadly when they went over their output format options, /sys parsing is actually quite a bit easier because I'm able to control the looping and depths I drill in dynamically so I know when to stop, when I have enough data, and so on.

So your concers aren't really valid here, lsusb maintains default, if lsusb is not installed, users now get a full usb report, which might not be as accurate, but it actually varies, about 20% maybe of the time /sys data is better for vendor/product ID, or it has more specific stuff, then maybe 80% or so of the time the vendor/product data is better with lsusb, but because it's variable, I can't try to be too clever, I have to pick one source and use it, right now default is lsusb if lsusb is installed, and, as a new feature, if lsusb is not installed, you still get a very accurate bus id based report, that will be in general quite usable, and certainly better than nothing, which is what inxi gave you before. This means all systems with usb and with linux kernel are now supported at least partially, vs only systems with lsusb. Again, this is the same as with -M machine, which also uses /sys, which let me add Machine support without root and without needing dmidecode, though you can use either source.

No matter what, there are config options to force the non default, in this case: USB_SYS=true will force inxi to use /sys, otherwise it will use lsusb if installed, and otherwise, it uses /sys.

No need for worries, this is basically a rock solid win for everyone, every machine is now at least basically covered, a major and very slow dependency for usb is now merely a recommended item, inxi always strives to remove as many dependencies as possible so that you will get good results without a lot of tools installed.
smxi/sgfxi site (manuals, how-to's, faqs) :: script forums :: Check out inxi sys info script!

Post Reply

Return to “antiX”