-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support different USB "modes" (via configuration #5) #205
Comments
After you commit, I am getting Segmentation fault
|
Can you check if it would be fixed with this: |
Yes, it is fixed |
Great! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
idevices "hide" a couple of useful USB interfaces when the device is first plugged in. These interface can be revealed by:
Under the hood, macOS sends vendor specific control URBs to the device, instructing it to reconnect with a different set of configurations. Both modes add a new configuration (# 5) with both the desired interface (Valeria/CDC NCM) and "Apple USB Multiplexor".
A previous commit (bf2e2ec) was made to support the former ("Valeria") mode. This commit assumes that the extra configuration has 3 interfaces, USBMUX being 3rd, which is not the case for CDC NCM (2nd out of 4).
The latter mode can be considered more valuable on Linux, as it has an out-of-the-box support with the
cdc_ncm
USB driver module. Once the device is switched to the correct mode and configuration 5 is set, a new Network Interface is added to the system, which can then be easily controlled via UI ("Share this connection ...") ornft
/iptables
.To prevent
usbmuxd
from conflicting with Ethernet/USB, and also to allow users to switch to those modes, I suggest the following changes (which I plan to soon submit a PR for):USBMUXD_DEFAULT_DEVICE_MODE
) that the user can set to control the desired mode:0
ignore mode and connect to USBMUX interface on highest available configuration (usually 4)1
if needed, switch to initial mode before connecting to USBMUX interface on highest available configuration (usually 4)2
if needed, switch to "Valeria" mode before connecting to USBMUX interface on highest available configuration (usually 5)3
if needed, switch to "Ethernet/USB" mode before connecting to USBMUX interface on highest available configuration (usually 5)usb_device_add
functionality (that is, the part that finds the suitable configuration/interface/endpoint and adds the device to the "live" list) intousb_device_complete_initialization
usb_device_add
will uselibusb
async APIs to send a vendor-specific control message to the newly connected device, requesting for its current mode.usb_device_complete_initialization
, or send another vendor-specific control message to switch to the desired mode.usb_device_complete_initialization
will be called after validating the desired mode.The text was updated successfully, but these errors were encountered: