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 1 [1d6b:0002 Linux 6.1.98 ehci_hcd EHCI Host Controller 16f0000000000.ehci, USB 2.00, 2 ports, nops]
Port 1: 0503 power highspeed enable connect [0424:2240 Generic Ultra Fast Media 000000225001]
Port 2: 0100 power
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.
Signed-off-by: Christian Svensson <blue@cmd.nu>
Recent libusb seems to have removed extra symlink `libusb-1.0/libusb.h`,
which breaks build on Mac.
TODO: consider always using `<libusb.h>`, but that would
put hard dependency on `pkg-config` usage.
Dell Wyse 3040 is odd - it has 6 ports advertised on USB2 and 7 ports on USB3,
and both USB2+USB3 do not advertise power switching support.
However, using -f it seems that power switching does work.
I assume it needs separate control for USB2+USB3 using -e as well.
Closes#512.
Add a warning link for StarTech HB30A4AIB - new hardware is using
different USB chipset and different USB vid:pid,
which does not support power switching correctly.
Closes#509.
This used to work fine, perhaps something has changed in how Github
creates archives so archive checksum does not match anymore?
Confirmed that actual file content at https://github.com/mvp/uhubctl/archive/v2.5.0.tar.gz
is exactly the same as content for `git checkout v2.5.0`.
Updated checksum to expected value so `brew install uhubctl` should pass.
Closes#489.
This is additional fix for #447.
We use old convention for USB versions in device table:
USB 3.2 spec version | Max speed | Old style USB version
---------------------+-----------+----------------------
USB 3.2 Gen 1 | 5 gbps | USB 3.0
USB 3.2 Gen 2 | 10 gbps | USB 3.1
USB 3.2 Gen 2x2 | 20 gbps | USB 3.2
All affected hubs were USB 3.2 Gen 1, which corresponds to original USB 3.0.
It turns out that we can allow udev access to any USB hub using DRIVER=="hub"
udev filter, this should make it easier for linux ditros to add proper udev rules.
This change adds more documentation to README, and also adds ready to use udev rule
that should work for any USB hub and any Linux kernel version.
The udev rules for the sysfs case are a bit more complex than those for the
libusb based interface, as udev has built-in support for changing permissions
on device files but not for sysfs attributes.
Instead we have to use chmod / chown to set permissions and owners.
You may notice the " || true" parts in the RUN part of the rules in addition
to the -f parameters. These are there to make sure that no error is logged by
udev even if the disable attribute does not exist. chmod/chown still return
an error exit code even with -f if the requested path does not exist.
" || true" makes sure this error is not propagated to udev.
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Starting with Linux kernel 6.0[1] there will be a sysfs interface to power USB
ports off/on from userspace.
Try to use this interface before falling back to the usual libusb based
power switching (e.g. when running on a kernel <6.0 or if file permissions do
not allow using the sysfs interface).
The main benefit of using the sysfs interface is that the kernel does not get
confused about the state of a port, so retrying should no longer be required.
[1]: https://lore.kernel.org/all/20220607114522.3359148-1-m.grzeschik@pengutronix.de/
Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>