hidapi库使用示例
			 2021-09-14
			  本文链接为:http://www.usbzh.com/article/detail-572.html ,欢迎转载,转载请附上本文链接。
	
			
			
			
			
		
			GitHub上已经封装好的HidApi库来进行开发,下载地址是https://github.com/yigityuce/HidApi
这里弄了一个简单的测试程序:
#include <stdio.h>
#include <stdlib.h>
#include "hidapi.h"
int main(int argc, char* argv[])
{
    if (hid_init())
        return -1;
    // Open the device using the VID, PID,
    // and optionally the Serial number.
    handle = hid_open(0x01234, 0x4567, NULL);
    if (!handle)
    {
        printf("unable to open device\n");
        return 1;
    }
    UCHAR data[65] = { 0 };
    data[0] = 0x01;
    data[1] = 0x82;
    res = hid_write(handle, data, 65);
    memset(data, 0, sizeof(data));
    while (1)
    {
        res = hid_read(handle, data, 64);
        printf("%d\n", res);
    }
    return 0;
}
			
			本文链接为:http://www.usbzh.com/article/detail-572.html ,欢迎转载,转载请附上本文链接。
HID人机交互QQ群:564808376   
UAC音频QQ群:218581009   
UVC相机QQ群:331552032   
BOT&UASP大容量存储QQ群:258159197   
STC-USB单片机QQ群:315457461   
USB技术交流QQ群2:580684376   
USB技术交流QQ群:952873936    
		
			自定义HID应用程序开发(Windows)
			




