Linux kernels before had devpath containing `usbN-portM`.
Newer kernels just use `port` symlink instead, which breaks our udev rules.
Changing glob from `*-port*` to `*port*` makes it work for both old and new kernels.
Closes issues #608, #609.
Fixed all warnings when compiling with `c++ -std=c++11 ...`:
* bzero() appears to be deprecated, replaced with memset()
* fixed few const warnings
* suppressed zero array warnings (emitted by libusb headers)
There are multiple reports that RSH-A107 does not turn off VBUS:
While it is possible that some hardware revisions which are working,
looks like most don't. It is better to remove it from the list.
Closes#604.
* No need to check for both __gnu_linux__ and __linux__, latter is enough.
* Require libusb 1.0.13 to build - this makes LIBUSB_API_VERSION always defined.
* Include `<libusb.h>` not `<libusb-1.0/libusb.h>` - this will always work
if `pkg-config` is detected. For backwards compatibility still try building
without `pkg-config` present, but it is much less reliable and will not work on Mac.
* Bump copyright year.
* Add --sysdev/-u option for direct device node access
Only the device specified by the given device path will be accessed,
instead of scanning the USB bus.
Most useful if you use udev rules to create stable device node aliases for hubs,
independent of bus topology.
For instance, if your matching udev rules include SYMLINK+="MYSMARTHUB1"
you can call uhubctl with --sysdev /dev/MYSMARTHUB1 instead of using -l
and a non-stable bus location to specify it.
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
* Detect if we are running on Raspberry 4B or 5
* Add RPi 4B and 5 conditionals for RPi hacks
* Relax some conditions which may vary depending on RPi hardware and/or OS
(in particular Ubuntu hub numbering differs from Raspbian).
* For RPi5, changed README to suggest using busses 2 and 4 instead of 1 and 3.
This makes the same recipe work on both Raspbian and Ubuntu.
This fixes#587.
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.