openSUSE / hwinfo

Hardware information tool
GNU General Public License v2.0
261 stars 71 forks source link

Incorrect hardware classification #149

Closed brianmcgee closed 1 week ago

brianmcgee commented 1 week ago

USB and PCI devices end up as Hardware Class: unknown when they should default to usb or pci.

I think the line if(!hd->hw_class) hd->hw_class = hw_unknown; is preventing the block further down from defaulting the hardware class to hw_usb, hw_pci etc.

https://github.com/openSUSE/hwinfo/blob/65c75d823398a7e868e2d41535e899fcf123d87a/src/hd/hd.c#L4802-L4824

88: PCI 14.0: 0c05 SMBus
  [Created at pci.386]
  Unique ID: MZfG.cxmkCdE9dJ7
  SysFS ID: /devices/pci0000:00/0000:00:14.0
  SysFS BusID: 0000:00:14.0
  Hardware Class: unknown
  Model: "AMD FCH SMBus Controller"
  Vendor: pci 0x1022 "AMD"
  Device: pci 0x790b "FCH SMBus Controller"
  SubVendor: pci 0x1043 "ASUSTeK Computer Inc."
  SubDevice: pci 0x87c0 
  Revision: 0x61
  Driver: "piix4_smbus"
  Driver Modules: "i2c_piix4"
  Module Alias: "pci:v00001022d0000790Bsv00001043sd000087C0bc0Csc05i00"
  Config Status: cfg=new, avail=yes, need=no, active=unknown

133: USB 00.2: 0000 Unclassified device
  [Created at usb.122]
  Unique ID: rjwZ.MteL3GpOaS6
  Parent ID: wkjR.lRoCB54l1cE
  SysFS ID: /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:08:00.1/usb1/1-5/1-5.3/1-5.3:1.2
  SysFS BusID: 1-5.3:1.2
  Hardware Class: unknown
  Model: "ASUSTek AURA LED Controller"
  Hotplug: USB
  Vendor: usb 0x0b05 "ASUSTek Computer, Inc."
  Device: usb 0x18f3 "AURA LED Controller"
  Revision: "1.00"
  Serial ID: "9876543210"
  Driver: "usbhid"
  Driver Modules: "usbhid"
  Speed: 12 Mbps
  Module Alias: "usb:v0B05p18F3d0100dc00dsc00dp00ic03isc00ip00in02"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #135 (Hub)
brianmcgee commented 1 week ago

I now understand the hardware classification better after enabling the debug output.

69: USB 00.1: 0000 Unclassified device
  [Created at usb.122]
  Unique ID: JRd1.nXPV_d5LjE5
  Old Unique ID: FrNE.6cEYkEA3jA6
  Parent ID: Uc5H.lRoCB54l1cE
  SysFS ID: /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:08:00.1/usb1/1-4/1-4.3/1-4.3:1.1
  SysFS BusID: 1-4.3:1.1
  Hardware Class: unknown
  HW Class List: usb
  Model: "Yubico.com Yubikey 4/5 OTP+U2F+CCID"
  Hotplug: USB
  Vendor: usb 0x1050 "Yubico.com"
  Device: usb 0x0407 "Yubikey 4/5 OTP+U2F+CCID"
  Revision: "5.43"
  Driver: "usbhid"
  Driver Modules: "usbhid"
  Main Driver Module: "usbhid"
  Speed: 12 Mbps
  Module Alias: "usb:v1050p0407d0543dc00dsc00dp00ic03isc00ip00in01"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #87 (Hub)

I can rely on the class list as a fallback when the overall classification is unknown.