| 996 | } |
| 997 | |
| 998 | HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bExclusive) |
| 999 | { |
| 1000 | LOGV( "hid_open_path( %s )", path ); |
| 1001 | |
| 1002 | hid_device_ref< CHIDDevice > pDevice; |
| 1003 | { |
| 1004 | hid_mutex_guard r( &g_DevicesRefCountMutex ); |
| 1005 | hid_mutex_guard l( &g_DevicesMutex ); |
| 1006 | for ( hid_device_ref<CHIDDevice> pCurr = g_Devices; pCurr; pCurr = pCurr->next ) |
| 1007 | { |
| 1008 | if ( strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 ) |
| 1009 | { |
| 1010 | hid_device *pValue = pCurr->GetDevice(); |
| 1011 | if ( pValue ) |
| 1012 | { |
| 1013 | ++pValue->m_nDeviceRefCount; |
| 1014 | LOGD("Incrementing device %d (%p), refCount = %d\n", pValue->m_nId, pValue, pValue->m_nDeviceRefCount); |
| 1015 | return pValue; |
| 1016 | } |
| 1017 | |
| 1018 | // Hold a shared pointer to the controller for the duration |
| 1019 | pDevice = pCurr; |
| 1020 | break; |
| 1021 | } |
| 1022 | } |
| 1023 | } |
| 1024 | if ( pDevice && pDevice->BOpen() ) |
| 1025 | { |
| 1026 | return pDevice->GetDevice(); |
| 1027 | } |
| 1028 | return NULL; |
| 1029 | } |
| 1030 | |
| 1031 | int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length) |
| 1032 | { |
nothing calls this directly
no test coverage detected