13 #define NAMESPACE HIDRAW 14 #include "../hidapi/hidapi.h" 18 #define NAMESPACE HIDUSB 19 #include "../hidapi/hidapi.h" 23 #include "../hidapi/hidapi.h" 25 #include "../../../public/tier1/utlvector.h" 26 #include "../../../public/tier1/utlhashmap.h" 32 pDst->
path = pSrc->path ? strdup( pSrc->path ) :
NULL;
40 pDst->
usage = pSrc->usage;
59 int iIndex = s_hashDeviceToAPI.Find( (
uintptr_t)pDevice );
62 return s_hashDeviceToAPI[ iIndex ];
70 struct HIDUSB::hid_device_info *usb_dev;
72 struct HIDRAW::hid_device_info *raw_dev;
75 for ( usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next )
78 for ( raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next )
80 if ( usb_dev->vendor_id == raw_dev->vendor_id && usb_dev->product_id == raw_dev->product_id )
107 for ( raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next )
111 new_dev->next =
NULL;
115 last->next = new_dev;
144 hid_device *pDevice =
NULL;
145 if ( ( pDevice = (hid_device *)
HIDRAW::hid_open( vendor_id, product_id, serial_number ) ) !=
NULL )
150 if ( ( pDevice = (hid_device *)
HIDUSB::hid_open( vendor_id, product_id, serial_number ) ) !=
NULL )
160 hid_device *pDevice =
NULL;
265 s_hashDeviceToAPI.Remove( (
uintptr_t)device );
HID_API_EXPORT const wchar_t *HID_API_CALL hid_error(hid_device *device)
Get a string describing the last error which occurred.
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
Free an enumeration Linked List.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
wchar_t * manufacturer_string
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length)
Write an Output report to a HID device.
int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen)
Get a string from a HID device, based on its string index.
static SDL_AudioDeviceID device
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds)
Read an Input report from a HID device with timeout.
struct hid_device_info * next
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock)
Set the device handle to be non-blocking.
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device)
Close a HID device.
int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen)
Get The Product String from a HID device.
unsigned short product_id
HID_API_EXPORT hid_device *HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number...
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length)
Get a feature report from a HID device.
int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen)
Get The Serial Number String from a HID device.
#define HID_API_EXPORT_CALL
static EHIDAPIType GetAPIForDevice(hid_device *pDevice)
unsigned short usage_page
HID_API_EXPORT hid_device *HID_API_CALL hid_open_path(const char *path, int bExclusive)
Open a HID device by its path name.
void CopyHIDDeviceInfo(T *pSrc, struct hid_device_info *pDst)
GLsizei const GLchar *const * path
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length)
Send a Feature report to the device.
int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen)
Get The Manufacturer String from a HID device.
GLuint GLsizei GLsizei * length
struct hid_device_info HID_API_EXPORT *HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
Enumerate the HID Devices.
unsigned short release_number
static CUtlHashMap< uintptr_t, EHIDAPIType > s_hashDeviceToAPI
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length)
Read an Input report from a HID device.