diff options
| author | 2026-11-23 01:21:19 +0100 | |
|---|---|---|
| committer | 2026-11-23 01:21:19 +0100 | |
| commit | 9d394f7b81117db0e079b9dd78245f516942a1ae (patch) | |
| tree | 939d707a0a8826c1055068b66b605fa4884f3853 /src | |
| parent | b741400a0bad80c00c946cc7f98a672f5d516a5a (diff) | |
| download | usbmuxd-9d394f7b81117db0e079b9dd78245f516942a1ae.tar.gz usbmuxd-9d394f7b81117db0e079b9dd78245f516942a1ae.tar.bz2 | |
Don't leave unusable devices unconfigured; stop unconfiguring 05ac:1905
The udev rule reset 05ac:1905 (an Apple Silicon Mac exposing Apple
private CDC-NCM networking) to configuration 0. usbmuxd then found no
usbmux interface and left it unconfigured, so the Mac gave up and
re-enumerated in a loop.
- udev: don't write bConfigurationValue for 1905, same as for 8600.
usbmuxd still switches the configuration itself if the device has a
usbmux interface.
- usb: if no suitable interface is found and the device is
unconfigured, restore its default configuration so kernel drivers
can bind again.
Diffstat (limited to 'src')
| -rw-r--r-- | src/usb.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -606,6 +606,17 @@ static int set_valid_configuration(struct libusb_device* dev, struct usb_device if(!found) { usbmuxd_log(LL_WARNING, "Could not find a suitable USB interface for device %i-%i", bus, address); + if(current_config == 0) { + // don't leave a device we cannot use unconfigured (e.g. after udev + // reset it), let the kernel drivers bind to the default configuration + if(libusb_get_config_descriptor(dev, 0, &config) == 0) { + usbmuxd_log(LL_NOTICE, "Restoring configuration %d of device %i-%i", config->bConfigurationValue, bus, address); + if((res = libusb_set_configuration(handle, config->bConfigurationValue)) != 0) { + usbmuxd_log(LL_WARNING, "Could not restore configuration %d for device %d-%d: %s", config->bConfigurationValue, bus, address, libusb_error_name(res)); + } + libusb_free_config_descriptor(config); + } + } return -1; } |
