利用 HIDAPI library获取摇杆输入控制量:
demo(RIGHT HANDED)
main.c
#include <stdio.h>
#include <stdlib.h>
#include "hidapi.h"
#define MAX_STR 255
int main(int argc, char* argv[])
{
int res;
unsigned char buf[9] = {
0};
wchar_t wstr[MAX_STR] = L"unknown";
hid_device *handle;
res = hid_init();
if(res)
{
printf("init error!");
return -1;
}
//参数为设备VID,PID
handle = hid_open(0x044f, 0xb10a, NULL);
if(!handle)
{
printf("open error!");
return -1;
}
// Read the Manufacturer String
res = hid_get_manufacturer_string(handle, wstr, MAX_STR);
wprintf(L"Manufacturer String: %ls\n", wstr);
// Read the Product String
res =