summaryrefslogtreecommitdiff
path: root/gr-fcd/lib/hid/hidwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'gr-fcd/lib/hid/hidwin.c')
-rw-r--r--gr-fcd/lib/hid/hidwin.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/gr-fcd/lib/hid/hidwin.c b/gr-fcd/lib/hid/hidwin.c
index 26d870fd8..5d34aadf4 100644
--- a/gr-fcd/lib/hid/hidwin.c
+++ b/gr-fcd/lib/hid/hidwin.c
@@ -8,7 +8,7 @@
8/22/2009
Copyright 2009, All Rights Reserved.
-
+
At the discretion of the user of this library,
this software may be licensed under the terms of the
GNU Public License v3, a BSD-Style license, or the
@@ -162,7 +162,7 @@ static void register_error(hid_device *device, const char *op)
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&msg, 0/*sz*/,
NULL);
-
+
// Get rid of the CR and LF that FormatMessage() sticks at the
// end of the message. Thanks Microsoft!
ptr = msg;
@@ -174,7 +174,7 @@ static void register_error(hid_device *device, const char *op)
ptr++;
}
- // Store the message off in the Device entry so that
+ // Store the message off in the Device entry so that
// the hid_error() function can pick it up.
LocalFree(device->last_error_str);
device->last_error_str = msg;
@@ -284,9 +284,9 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
// Get information for all the devices belonging to the HID class.
device_info_set = SetupDiGetClassDevsA(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
-
+
// Iterate over each device in the HID class, looking for the right one.
-
+
for (;;) {
HANDLE write_handle = INVALID_HANDLE_VALUE;
DWORD required_size = 0;
@@ -297,7 +297,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
&InterfaceClassGuid,
device_index,
&device_interface_data);
-
+
if (!res) {
// A return of FALSE from this function means that
// there are no more devices.
@@ -344,7 +344,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
// Unable to open the device.
//register_error(dev, "CreateFile");
goto cont_close;
- }
+ }
// Get the Vendor ID and Product ID for this device.
@@ -354,7 +354,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
// Check the VID/PID to see if we should add this
// device to the enumeration list.
- if ((vendor_id == 0x0 && product_id == 0x0) ||
+ if ((vendor_id == 0x0 && product_id == 0x0) ||
(attrib.VendorID == vendor_id && attrib.ProductID == product_id)) {
#define WSTR_LEN 512
@@ -388,7 +388,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
HidD_FreePreparsedData(pp_data);
}
-
+
/* Fill out the record */
cur_dev->next = NULL;
str = device_interface_detail_data->DevicePath;
@@ -488,7 +488,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
struct hid_device_info *devs, *cur_dev;
const char *path_to_open = NULL;
hid_device *handle = NULL;
-
+
devs = hid_enumerate(vendor_id, product_id);
cur_dev = devs;
while (cur_dev) {
@@ -514,7 +514,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
}
hid_free_enumeration(devs);
-
+
return handle;
}
@@ -550,7 +550,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
}
nt_res = HidP_GetCaps(pp_data, &caps);
if (nt_res != HIDP_STATUS_SUCCESS) {
- register_error(dev, "HidP_GetCaps");
+ register_error(dev, "HidP_GetCaps");
goto err_pp_data;
}
dev->input_report_length = caps.InputReportByteLength;
@@ -562,7 +562,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
err_pp_data:
HidD_FreePreparsedData(pp_data);
-err:
+err:
CloseHandle(dev->device_handle);
free(dev);
return NULL;
@@ -577,7 +577,7 @@ int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *
memset(&ol, 0, sizeof(ol));
res = WriteFile(dev->device_handle, data, length, NULL, &ol);
-
+
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// WriteFile() failed. Return error.
@@ -612,7 +612,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
dev->read_pending = TRUE;
ResetEvent(ev);
res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol);
-
+
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// ReadFile() has failed.
@@ -638,7 +638,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
// we are in non-blocking mode. Get the number of bytes read. The actual
// data has been copied to the data[] array which was passed to ReadFile().
res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, TRUE/*wait*/);
-
+
// Set pending back to false, even if GetOverlappedResult() returned error.
dev->read_pending = FALSE;
@@ -656,13 +656,13 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
memcpy(data, dev->read_buf, length);
}
}
-
+
end_of_function:
if (!res) {
register_error(dev, "GetOverlappedResult");
return -1;
}
-
+
return bytes_read;
}
@@ -805,7 +805,7 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
//#define PICPGM
//#define S11
#define P32
-#ifdef S11
+#ifdef S11
unsigned short VendorID = 0xa0a0;
unsigned short ProductID = 0x0001;
#endif
@@ -835,7 +835,7 @@ int __cdecl main(int argc, char* argv[])
memset(buf,0x00,sizeof(buf));
buf[0] = 0;
buf[1] = 0x81;
-
+
// Open the device.
int handle = open(VendorID, ProductID, L"12345");