#include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <stdlib.h>
#include "hidapi.h"
#include <windows.h>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ MAX_STR
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 30 of file hidtest.cpp.
33 unsigned char buf[256];
40 UNREFERENCED_PARAMETER(argc);
41 UNREFERENCED_PARAMETER(argv);
59 cur_dev = cur_dev->
next;
74 printf(
"unable to open device\n");
82 printf(
"Unable to read manufacturer string\n");
83 printf(
"Manufacturer String: %ls\n", wstr);
89 printf(
"Unable to read product string\n");
90 printf(
"Product String: %ls\n", wstr);
96 printf(
"Unable to read serial number string\n");
97 printf(
"Serial Number String: (%d) %ls", wstr[0], wstr);
104 printf(
"Unable to read indexed string 1\n");
105 printf(
"Indexed String 1: %ls\n", wstr);
122 printf(
"Unable to send a feature report.\n");
131 printf(
"Unable to get a feature report.\n");
136 printf(
"Feature Report\n ");
138 printf(
"%02hhx ",
buf[
i]);
149 printf(
"Unable to write()\n");
159 printf(
"Unable to write() (2)\n");
168 printf(
"waiting...\n");
170 printf(
"Unable to read()\n");
178 printf(
"Data read:\n ");
181 printf(
"%02hhx ",
buf[
i]);
References hid_close(), hid_enumerate(), hid_error(), hid_exit(), hid_free_enumeration(), hid_get_feature_report(), hid_get_indexed_string(), hid_get_manufacturer_string(), hid_get_product_string(), hid_get_serial_number_string(), hid_init(), hid_open(), hid_read(), hid_send_feature_report(), hid_set_nonblocking(), hid_write(), i, hid_device_info::interface_number, hid_device_info::manufacturer_string, MAX_STR, memset, hid_device_info::next, NULL, hid_device_info::path, hid_device_info::product_id, hid_device_info::product_string, hid_device_info::release_number, hid_device_info::serial_number, and hid_device_info::vendor_id.
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.
EGLImageKHR EGLint EGLint * handle
int HID_API_EXPORT HID_API_CALL hid_exit(void)
Finalize the HIDAPI library.
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device)
Close a HID device.
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
Free an enumeration Linked List.
int HID_API_EXPORT HID_API_CALL hid_init(void)
Initialize the HIDAPI library.
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.
wchar_t * manufacturer_string
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.
struct hid_device_info * next
GLenum GLuint GLenum GLsizei const GLchar * buf
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 product_id
unsigned short release_number
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.
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 HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock)
Set the device handle to be non-blocking.
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_product_string(hid_device *device, wchar_t *string, size_t maxlen)
Get The Product String from a HID device.
struct hid_device_ hid_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.
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)