31{
33 unsigned char buf[256];
34 #define MAX_STR 255
38
39#ifdef WIN32
40 UNREFERENCED_PARAMETER(argc);
41 UNREFERENCED_PARAMETER(argv);
42#endif
43
45
47 return -1;
48
50 cur_dev = devs;
51 while (cur_dev) {
53 printf("\n");
58 printf("\n");
59 cur_dev = cur_dev->
next;
60 }
62
63
67
68
69
70
71
74 printf("unable to open device\n");
75 return 1;
76 }
77
78
79 wstr[0] = 0x0000;
82 printf("Unable to read manufacturer string\n");
83 printf("Manufacturer String: %ls\n", wstr);
84
85
86 wstr[0] = 0x0000;
89 printf("Unable to read product string\n");
90 printf("Product String: %ls\n", wstr);
91
92
93 wstr[0] = 0x0000;
96 printf("Unable to read serial number string\n");
97 printf("Serial Number String: (%d) %ls", wstr[0], wstr);
98 printf("\n");
99
100
101 wstr[0] = 0x0000;
104 printf("Unable to read indexed string 1\n");
105 printf("Indexed String 1: %ls\n", wstr);
106
107
109
110
111
113
114
122 printf("Unable to send a feature report.\n");
123 }
124
126
127
131 printf("Unable to get a feature report.\n");
133 }
134 else {
135
136 printf("Feature Report\n ");
138 printf(
"%02hhx ",
buf[
i]);
139 printf("\n");
140 }
141
143
144
149 printf("Unable to write()\n");
151 }
152
153
154
159 printf("Unable to write() (2)\n");
160
161
162
163
168 printf("waiting...\n");
170 printf("Unable to read()\n");
171 #ifdef WIN32
172 Sleep(500);
173 #else
174 usleep(500*1000);
175 #endif
176 }
177
178 printf("Data read:\n ");
179
181 printf(
"%02hhx ",
buf[
i]);
182 printf("\n");
183
185
186
188
189#ifdef WIN32
190 system("pause");
191#endif
192
193 return 0;
194}
GLenum GLuint GLenum GLsizei const GLchar * buf
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
EGLImageKHR EGLint EGLint * handle
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_read(hid_device *device, unsigned char *data, size_t length)
Read an Input report from 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.
int HID_API_EXPORT HID_API_CALL hid_init(void)
Initialize the HIDAPI library.
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.
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.
HID_API_EXPORT const wchar_t *HID_API_CALL hid_error(hid_device *device)
Get a string describing the last error which occurred.
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.
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device)
Close a HID device.
struct hid_device_ 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.
struct hid_device_info HID_API_EXPORT *HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
Enumerate the HID Devices.
int HID_API_EXPORT HID_API_CALL hid_exit(void)
Finalize the HIDAPI library.
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 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 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_free_enumeration(struct hid_device_info *devs)
Free an enumeration Linked List.
unsigned short product_id
struct hid_device_info * next
wchar_t * manufacturer_string
unsigned short release_number