libimobiledevice

Is it possible to listen to device connections via libimobiledevice?


I am trying to do something every time my iPhone is connected (via USB or wifi). Current alternative is polling list_devices and wait to see my device listed. Is there something better or polling is the only option? This is platform independent, but I am testing on Windows


Solution

  • You can subscribe for notifications which are sent by iTunes/usbmuxd whenever a new device is connected. If you're using libimobiledevice, you can use idevice_event_subscribe to register a callback which is invoked whenever a device is added or removed.