| 1102 | |
| 1103 | |
| 1104 | void 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 | |
| 1137 | int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) |
no test coverage detected