[mingw-hidapi] Add patch for increasing the input report buffer size

Scott Talbert swt2c at fedoraproject.org
Tue Mar 25 01:50:04 UTC 2014


commit f1229327373fbdca223fe184b26144b2dc60efff
Author: Scott Talbert <swt at techie.net>
Date:   Mon Mar 24 21:49:57 2014 -0400

    Add patch for increasing the input report buffer size

 increase_input_report_buffer_size.patch |   56 +++++++++++++++++++++++++++++++
 mingw-hidapi.spec                       |    8 ++++-
 2 files changed, 63 insertions(+), 1 deletions(-)
---
diff --git a/increase_input_report_buffer_size.patch b/increase_input_report_buffer_size.patch
new file mode 100644
index 0000000..b9a5b7d
--- /dev/null
+++ b/increase_input_report_buffer_size.patch
@@ -0,0 +1,56 @@
+From 68efac3baace41d36735fa8f25da1a1c7e39f806 Mon Sep 17 00:00:00 2001
+From: Scott Talbert <swt at techie.net>
+Date: Tue, 28 Jan 2014 23:35:06 -0500
+Subject: [PATCH] Set the Windows input report buffer size to 64 reports
+
+Resolves issues with dropped input reports when receiving a large amount of
+data.
+---
+ windows/hid.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/windows/hid.c b/windows/hid.c
+index 3dee05b..179f88e 100755
+--- a/windows/hid.c
++++ b/windows/hid.c
+@@ -106,6 +106,7 @@
+ 	typedef BOOLEAN (__stdcall *HidD_GetPreparsedData_)(HANDLE handle, PHIDP_PREPARSED_DATA *preparsed_data);
+ 	typedef BOOLEAN (__stdcall *HidD_FreePreparsedData_)(PHIDP_PREPARSED_DATA preparsed_data);
+ 	typedef NTSTATUS (__stdcall *HidP_GetCaps_)(PHIDP_PREPARSED_DATA preparsed_data, HIDP_CAPS *caps);
++	typedef BOOLEAN (__stdcall *HidD_SetNumInputBuffers_)(HANDLE handle, ULONG number_buffers);
+ 
+ 	static HidD_GetAttributes_ HidD_GetAttributes;
+ 	static HidD_GetSerialNumberString_ HidD_GetSerialNumberString;
+@@ -117,6 +118,7 @@
+ 	static HidD_GetPreparsedData_ HidD_GetPreparsedData;
+ 	static HidD_FreePreparsedData_ HidD_FreePreparsedData;
+ 	static HidP_GetCaps_ HidP_GetCaps;
++	static HidD_SetNumInputBuffers_ HidD_SetNumInputBuffers;
+ 
+ 	static HMODULE lib_handle = NULL;
+ 	static BOOLEAN initialized = FALSE;
+@@ -206,6 +208,7 @@ static int lookup_functions()
+ 		RESOLVE(HidD_GetPreparsedData);
+ 		RESOLVE(HidD_FreePreparsedData);
+ 		RESOLVE(HidP_GetCaps);
++		RESOLVE(HidD_SetNumInputBuffers);
+ #undef RESOLVE
+ 	}
+ 	else
+@@ -567,6 +570,13 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
+ 		goto err;
+ 	}
+ 
++	/* Set the Input Report buffer size to 64 reports. */
++	res = HidD_SetNumInputBuffers(dev->device_handle, 64);
++	if (!res) {
++		register_error(dev, "HidD_SetNumInputBuffers");
++		goto err;
++	}
++
+ 	/* Get the Input Report length for the device. */
+ 	res = HidD_GetPreparsedData(dev->device_handle, &pp_data);
+ 	if (!res) {
+-- 
+1.8.5.5
+
diff --git a/mingw-hidapi.spec b/mingw-hidapi.spec
index 5ec2f51..8ece733 100644
--- a/mingw-hidapi.spec
+++ b/mingw-hidapi.spec
@@ -6,13 +6,15 @@
 
 Name:           mingw-%{nativename}
 Version:        0.7.0
-Release:        2.%{shortcommit}%{?dist}
+Release:        3.%{shortcommit}%{?dist}
 Summary:        Library for communicating with USB and Bluetooth HID devices
 
 Group:          Development/Libraries
 License:        GPLv3 or BSD
 URL:            http://www.signal11.us/oss/hidapi/
 Source0:        https://github.com/signal11/hidapi/archive/%{commit}/%{nativename}-%{version}-%{shortcommit}.tar.gz
+# https://github.com/signal11/hidapi/pull/159
+Patch0:         increase_input_report_buffer_size.patch
 BuildArch:      noarch
 
 BuildRequires:  autoconf
@@ -79,6 +81,7 @@ development.
 
 %prep
 %setup -qn %{nativename}-%{commit}
+%patch0 -p1
 
 
 %build
@@ -118,6 +121,9 @@ rm -r %{buildroot}%{mingw64_datadir}/*
 
 
 %changelog
+* Thu Mar 20 2014 Scott Talbert <swt at techie.net> - 0.7.0-3.a88c724
+- Add patch for increasing the input report buffer size
+
 * Mon Nov 4 2013 Scott Talbert <swt at techie.net> - 0.7.0-2.a88c724
 - Incorporate fixes from package review
 


More information about the scm-commits mailing list