Open xJonPx opened 5 years ago
usbmuxd uses libusb-win32. That said, you'll need specific patches/drivers so that you can change the USB configuration of the device.
What's your use case for using usbmuxd on Windows? It's much easier to use the Apple Mobile Device Service instead.
Hi qmfrederik,
Ref libusbmux-win32
I now see what you mean about the need to change the USB configuration of the device which is not possible with the libusb1.0 api and libusb0.sys under windows.
In this code it seems to fall back to the old libusb0 api to achieve this USB configuration change in the main usb discover thread.
However, to set the USB configuration with the old libusb0 api there is a need for the UDID serial.
The latest code here attempts to use the libusb1.0 api to get the necessary UDID serial but that is just not supported or possible.
I've pulled down the latest libimobiledevice-win32 binaries and usbmuxd seems to work fine under windows, the UDID serial gets read and the USB configuration changes.
Do you know if these binaries obtain the UDID serial in a different way in order to change the USB configuration?
Grateful for any advice as I'm keen to repeat what I see using the latest libimobiledevice-win32 release binaries.
Hopefully this makes some sense :-)
It's been a while since I last worked with usbmuxd on Windows (for the reasons above, the Apple Mobile Device Service is a good option in most cases).
That said, the bulk of the code which gets the UDID and changes the configuration comes from this patch: https://github.com/libimobiledevice-win32/usbmuxd/commit/8043f711b3ee3152e17e1ee50572629fdcd7f6f2 The idea was to use libusb-win32 instead of libusb on Windows.
However, I also submitted patches for libusb (https://github.com/libusb/libusb/pull/473) with which you can use libusb to set the configuration of an USB device on Windows, at the condition that you are using the libusb0.sys driver (i.e. the libusb-win32 kernel driver, but the 'standard' libusb user mode code).
To make things a bit more complicated, I also changed the build system for libimobiledevice-win32 to use a single repository with the Visual Studio project files and to us VCPKG for the dependencies (instead of CoApp).
You'll probably need to do some digging around in the code to get all the pieces together; but you should be able to make things work.
Let me know how it goes, and happy to review any patches you may send our way ;-).
qmfrederik
Thank you for coming back on this. I'm really keen to get this going on windows just to keep everything open source.
It's all a bit nasty using both the latest and legacy libusb API on Windows but it seems to work.
The problem in win32 seems to be line 430 of the patch: libimobiledevice-win32/usbmuxd@8043f71, i find it fails getting the serial (UDID).
If I hard code my serial (UDID) everything seem to works well and the configuration changes.
I'm really at a loss how the win32 binary seems to be working.
I'm currently exploring another win32 method to obtain serial for the found device. I'll post back if I can get a method that works.
Really great work with the VCPKG dependencies. There were a few more that I needed to pull down to get things working. I'll drop you a note of the extra ones I needed to pull through VCPKG so you have a complete list.
That's really odd, though; it used to work (at least when I tried it a couple of years ago).
Things you can look at:
devdesc.iSerialNumber
?
Error: usbmuxd won't link as there is a build configuration link library dependency with libusb0.lib. libusb0.lib does not appear to be part of the libusb library or the winusb ddk library.
What is the source of the mystery libusb0.lib?