In order to communicate with HID (Human Interface Device),
We may need some API to help us to call the driver and send and receive data to/from HID
Necessary head file and library file as follow:
1. hidsdi.h / hid.lib
2. hidpi.h
3. setupapi.h / setupapi.lib
4. hidusage.h
The HID enumerate flow with visual C++ as follow:
1. use HidD_GetHidGuid to fetch the GUID of HID
2. use SetupDiGetClassDevs to fetch the HDEVINFO that contain the device list of HID
3. use SetupDiEnumDeviceInterfaces to get the device interface data
4. use SetupDiGetDeviceInterfaceDetail to get the SP_DEVICE_INTERFACE_DETAIL_DATA
5. Now we can use SP_DEVICE_INTERFACE_DETAIL_DATA to create file use CreateFile function and get a handle
6. Process step 3 - 5 repeatedly until the return value of SetupDiEnumDeviceInterfaces is false with different index
沒有留言:
張貼留言