MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / hid_close

Function hid_close

dependencies/hidapi/hidapi.c:1104–1134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1102
1103
1104void HID_API_EXPORT hid_close(hid_device *dev)
1105{
1106 if (!dev)
1107 return;
1108
1109 /* Cause read_thread() to stop. */
1110 dev->shutdown_thread = 1;
1111 libusb_cancel_transfer(dev->transfer);
1112
1113 /* Wait for read_thread() to end. */
1114 //pthread_join(dev->thread, NULL);
1115
1116 /* Clean up the Transfer objects allocated in read_thread(). */
1117 free(dev->transfer->buffer);
1118 libusb_free_transfer(dev->transfer);
1119
1120 /* release the interface */
1121 libusb_release_interface(dev->device_handle, dev->interface);
1122
1123 /* Close the handle */
1124 libusb_close(dev->device_handle);
1125
1126 /* Clear out the queue of received reports. */
1127 //pthread_mutex_lock(&dev->mutex);
1128 while (dev->input_reports) {
1129 return_data(dev, NULL, 0);
1130 }
1131 //pthread_mutex_unlock(&dev->mutex);
1132
1133 free_hid_device(dev);
1134}
1135
1136
1137int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen)

Calls 2

return_dataFunction · 0.85
free_hid_deviceFunction · 0.85

Tested by

no test coverage detected