idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data) { event_cb = callback; int res = usbmuxd_subscribe(usbmux_event_cb, user_data); if (res != 0) { event_cb = NULL; debug_info("ERROR: usbmuxd_subscribe() returned %d!", res); return IDEVICE_E_UNKNOWN_ERROR; } return IDEVICE_E_SUCCESS; }
/** * Register a callback function that will be called when device add/remove * events occur. * * @param callback Callback function to call. * @param user_data Application-specific data passed as parameter * to the registered callback function. * * @return IPHONE_E_SUCCESS on success or an error value when an error occured. */ iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data) { event_cb = callback; int res = usbmuxd_subscribe(usbmux_event_cb, user_data); if (res != 0) { event_cb = NULL; log_debug_msg("%s: Error %d when subscribing usbmux event callback!\n", __func__, res); return IPHONE_E_UNKNOWN_ERROR; } return IPHONE_E_SUCCESS; }