diff --git a/README.txt b/README.txt index 0ac8641..9297fb6 100644 --- a/README.txt +++ b/README.txt @@ -46,7 +46,9 @@ which communicates with a heavily hacked up version of the Microchip USB Generic HID sample looks like this (with error checking removed for simplicity): +#ifdef WIN32 #include +#endif #include #include #include "hidapi.h" @@ -61,6 +63,9 @@ int main(int argc, char* argv[]) hid_device *handle; int i; + // Initialize the hidapi library + res = hid_init(); + // Open the device using the VID, PID, // and optionally the Serial number. handle = hid_open(0x4d8, 0x3f, NULL); @@ -92,12 +97,15 @@ int main(int argc, char* argv[]) res = hid_write(handle, buf, 65); // Read requested state - hid_read(handle, buf, 65); + res = hid_read(handle, buf, 65); // Print out the returned buffer. for (i = 0; i < 4; i++) printf("buf[%d]: %d\n", i, buf[i]); + // Finalize the hidapi library + res = hid_exit(); + return 0; }