mvp / uhubctl

uhubctl - USB hub per-port power control
Other
2.23k stars 232 forks source link

Fix endian conversions to work for big-endian #577

Closed bluecmd closed 3 months ago

bluecmd commented 3 months ago

Before:

Current status for hub 3 [6b1d:0200 Linux 6.1.98 xhci-hcd xHCI Host Controller 0000:01:00.0, USB 0.02, 2 ports, ppps]
  Port 1: 0305 power lowspeed suspend connect [9911:c068 Sierra Wireless, Incorporated MC7304-CP]
  Port 2: 0301 power lowspeed connect [0304:0160 FTDI FT232R USB UART A10OEDEW]

After:

Current status for hub 4 [1d6b:0003 Linux 6.1.98 xhci-hcd xHCI Host Controller 0000:01:00.0, USB 3.00, 2 ports, ppps]
  Port 1: 02a0 power 5gbps Rx.Detect
  Port 2: 02a0 power 5gbps Rx.Detect
Current status for hub 3 [1d6b:0002 Linux 6.1.98 xhci-hcd xHCI Host Controller 0000:01:00.0, USB 2.00, 2 ports, ppps]
  Port 1: 0503 power highspeed enable connect [1199:68c0 Sierra Wireless, Incorporated MC7304-CP]
  Port 2: 0103 power enable connect [0403:6001 FTDI FT232R USB UART A10OEDEW]

Tested on both x86-64 and MIPS64.

I've compared the output of uhubctl with lsusb -v and it seems to match now.

mvp commented 3 months ago

Thank you so much for fixing this bug @bluecmd 👍 ! Unfortunately, I did not have access to big-endian hardware during original development, so I had to do it blind. Weird that no one noticed this for so many years 😄