irecv_error_t irecv_close(irecv_client_t client) { if (client != NULL) { if(client->disconnected_callback != NULL) { irecv_event_t event; event.size = 0; event.data = NULL; event.progress = 0; event.type = IRECV_DISCONNECTED; client->disconnected_callback(client, &event); } #ifndef WIN32 if (client->handle != NULL) { if (client->mode != kDfuMode) { libusb_release_interface(client->handle, client->interface); } libusb_close(client->handle); client->handle = NULL; } #else if (client->iBootPath!=NULL) { free(client->iBootPath); client->iBootPath = NULL; } if (client->DfuPath!=NULL) { free(client->DfuPath); client->DfuPath = NULL; } mobiledevice_closepipes(client); #endif free(client); client = NULL; } return IRECV_E_SUCCESS; }
irecv_error_t irecv_close(irecv_client_t client) { if (client != NULL) { if(client->disconnected_callback != NULL) { irecv_event_t event; event.size = 0; event.data = NULL; event.progress = 0; event.type = IRECV_DISCONNECTED; client->disconnected_callback(client, &event); } if (client->handle != NULL) { libusb_release_interface(client->handle, client->interface); libusb_close(client->handle); client->handle = NULL; } if (libirecovery_context != NULL) { libusb_exit(libirecovery_context); libirecovery_context = NULL; } free(client); client = NULL; } return IRECV_E_SUCCESS; }