libimobiledevice-win32 / imobiledevice-net

.NET (C#, VB.NET,...) bindings for libimobiledevice
GNU Lesser General Public License v2.1
306 stars 76 forks source link

'idevice_get_device_list' failing with "connect: No error" #79

Closed writzx closed 6 years ago

writzx commented 6 years ago

Just running through the basic setup snippet given in the readme, I into this problem. Please note that, I am using Windows.

The call to idevice.idevice_get_device_list is failing with connect: No error and a return value of iDeviceError.NoDevice.

However, this is only when iTunes is not installed. As soon as I install iTunes, I am able to get the whole code working perfectly.

Is there any way to run this without iTunes installed?

donaghy commented 6 years ago

You don't need iTunes but you do need the 2 components that are installed with iTunes. You can get these .exe files separately and install them. I can't remember their exact names but they are something like Apple Mobile Device Support or Service. If you download iTunes, change the exe file extension to zip you'll be able to extract them

writzx commented 6 years ago

Oh. I opened the iTunes installer exe with 7-zip and was able to find a *.msi package called AppleMobileDeviceSupport64.msi. I will have to try that and check if it works.

Is there any similar requirement for Linux? I take it macOS won't have this problem.

qmfrederik commented 6 years ago

Is there any similar requirement for Linux?

Yes, you need to install usbmuxd. You can build it from source, use the version that ships with your Linux distribution (it may be outdated - double check). For Ubuntu, we host a PPA: https://launchpad.net/~quamotion/+archive/ubuntu/ppa which you can use as well.

I take it macOS won't have this problem.

Correct. macOS ships with it's own copy of usbmuxd by default.

donaghy commented 6 years ago

Youll need the AppleMobileDevicsupport.msi as well as another. I can't remember the name, MobileDeviceDriver maybe, but ill check and confirm for you. It'll be packaged with the iTunes.exe as well.

I don't know the requirements for Linux or iOS to this regard but qmfrederik seems to have advised you well.

writzx commented 6 years ago

I have already tested the msi files on Windows. The two msi required are AppleApplicationSupport(64).msi and AppleMobileDeviceSupport.msi. I could not get the two msi distribution from Apple. I had to use the msi from extracted iTunes installer. I hope that won't cause any issue since I'm just using it for personal use.

writzx commented 6 years ago

I have another question.

Is there any reliable way to check at runtime if the problem is due to the above drivers or due to no device being connected?

I understand I could just check the windows registry if the drivers are installed but I would like to know if there is already an inbuilt way (or error code) in the library to do this?

qmfrederik commented 6 years ago

You'll need to perform these checks yourself. You can enumerate all USB devices, find those with the PID and VID of iOS devices, and check whether the list of devices returned by idevice_get_device_list contains that device.

LibUsbDotNet (another project) contains some code which may help you with that.