From 0f1df1799d57113e7557c85ce5a7c7df59b50be8 Mon Sep 17 00:00:00 2001
From: lucidusdev <122585528+lucidusdev@users.noreply.github.com>
Date: Tue, 24 Jun 2025 19:23:49 -0700
Subject: [PATCH 1/4] add get_report_descriptor for hid_get_report_descriptor

---
 hid/__init__.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hid/__init__.py b/hid/__init__.py
index 067fcbc..45ac360 100644
--- a/hid/__init__.py
+++ b/hid/__init__.py
@@ -130,6 +130,8 @@ def as_dict(self):
 hidapi.hid_send_feature_report.restype = ctypes.c_int
 hidapi.hid_get_feature_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
 hidapi.hid_get_feature_report.restype = ctypes.c_int
+hidapi.hid_get_report_descriptor.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
+hidapi.hid_get_report_descriptor.restype = ctypes.c_int
 hidapi.hid_close.argtypes = [ctypes.c_void_p]
 hidapi.hid_close.restype = None
 hidapi.hid_get_manufacturer_string.argtypes = [ctypes.c_void_p, ctypes.c_wchar_p, ctypes.c_size_t]
@@ -233,6 +235,12 @@ def get_feature_report(self, report_id, size):
             hidapi.hid_get_feature_report, self.__dev, data, size)
         return data.raw[:size]
 
+    def get_report_descriptor(self, size = 255):
+        data = ctypes.create_string_buffer(size)
+        size = self.__hidcall(
+            hidapi.hid_get_report_descriptor, self.__dev, data, size)
+        return data.raw[:size]
+    
     def close(self):
         if self.__dev:
             hidapi.hid_close(self.__dev)

From db3482fb3e786f7bc91bc35cf4071e6aaabbf098 Mon Sep 17 00:00:00 2001
From: lucidusdev <122585528+lucidusdev@users.noreply.github.com>
Date: Tue, 24 Jun 2025 19:31:32 -0700
Subject: [PATCH 2/4] use 4096 for preallocated size

---
 hid/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hid/__init__.py b/hid/__init__.py
index 45ac360..0ce76d8 100644
--- a/hid/__init__.py
+++ b/hid/__init__.py
@@ -235,7 +235,7 @@ def get_feature_report(self, report_id, size):
             hidapi.hid_get_feature_report, self.__dev, data, size)
         return data.raw[:size]
 
-    def get_report_descriptor(self, size = 255):
+    def get_report_descriptor(self, size = 4096):
         data = ctypes.create_string_buffer(size)
         size = self.__hidcall(
             hidapi.hid_get_report_descriptor, self.__dev, data, size)

From fa7287c4d5efaf7b28f8254e7c9c49afdf0a805a Mon Sep 17 00:00:00 2001
From: lucidusdev <122585528+lucidusdev@users.noreply.github.com>
Date: Wed, 25 Jun 2025 10:46:53 -0700
Subject: [PATCH 3/4] add >=0.14.0 guard

---
 hid/__init__.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hid/__init__.py b/hid/__init__.py
index 0ce76d8..394f300 100644
--- a/hid/__init__.py
+++ b/hid/__init__.py
@@ -130,8 +130,9 @@ def as_dict(self):
 hidapi.hid_send_feature_report.restype = ctypes.c_int
 hidapi.hid_get_feature_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
 hidapi.hid_get_feature_report.restype = ctypes.c_int
-hidapi.hid_get_report_descriptor.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
-hidapi.hid_get_report_descriptor.restype = ctypes.c_int
+if version >= (0, 14, 0):
+    hidapi.hid_get_report_descriptor.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
+    hidapi.hid_get_report_descriptor.restype = ctypes.c_int
 hidapi.hid_close.argtypes = [ctypes.c_void_p]
 hidapi.hid_close.restype = None
 hidapi.hid_get_manufacturer_string.argtypes = [ctypes.c_void_p, ctypes.c_wchar_p, ctypes.c_size_t]

From 9896e2a4ec5c765b29d0cfe5a62f25f736bea72a Mon Sep 17 00:00:00 2001
From: Austin Morton <apmorton@users.noreply.github.com>
Date: Sat, 28 Jun 2025 11:10:58 -0500
Subject: [PATCH 4/4] Update hid/__init__.py

---
 hid/__init__.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/hid/__init__.py b/hid/__init__.py
index 394f300..752ddf5 100644
--- a/hid/__init__.py
+++ b/hid/__init__.py
@@ -236,12 +236,13 @@ def get_feature_report(self, report_id, size):
             hidapi.hid_get_feature_report, self.__dev, data, size)
         return data.raw[:size]
 
-    def get_report_descriptor(self, size = 4096):
-        data = ctypes.create_string_buffer(size)
-        size = self.__hidcall(
-            hidapi.hid_get_report_descriptor, self.__dev, data, size)
-        return data.raw[:size]
-    
+    if version >= (0, 14, 0):
+        def get_report_descriptor(self, size = 4096):
+            data = ctypes.create_string_buffer(size)
+            size = self.__hidcall(
+                hidapi.hid_get_report_descriptor, self.__dev, data, size)
+            return data.raw[:size]
+
     def close(self):
         if self.__dev:
             hidapi.hid_close(self.__dev)