Package: python-hidapi / 0.9.0.post3-2

0001-Revert-upstream-cd2b287.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
From: Tristan Seligmann <mithrandi@debian.org>
Date: Fri, 24 Jul 2020 19:21:23 +0200
Subject: Revert upstream cd2b287

---
 chid.pxd   |  1 -
 hid.pyx    | 24 ------------------------
 hidraw.pyx | 24 ------------------------
 3 files changed, 49 deletions(-)

diff --git a/chid.pxd b/chid.pxd
index d544478..dcc7b96 100644
--- a/chid.pxd
+++ b/chid.pxd
@@ -29,7 +29,6 @@ cdef extern from "hidapi.h":
   int hid_set_nonblocking(hid_device* device, int value)
   int hid_send_feature_report(hid_device* device, unsigned char *data, int length) nogil
   int hid_get_feature_report(hid_device* device, unsigned char *data, int length) nogil
-  int hid_get_input_report(hid_device* device, unsigned char *data, int length) nogil
 
   int hid_get_manufacturer_string(hid_device*, wchar_t *, size_t)
   int hid_get_product_string(hid_device*, wchar_t *, size_t)
diff --git a/hid.pyx b/hid.pyx
index 66d34bf..e1efed8 100644
--- a/hid.pyx
+++ b/hid.pyx
@@ -206,30 +206,6 @@ cdef class device:
           free(cbuff)
       return res
 
-  def get_input_report(self, int report_num, int max_length):
-      if self._c_hid == NULL:
-          raise ValueError('not open')
-      cdef hid_device * c_hid = self._c_hid
-      cdef unsigned char lbuff[16]
-      cdef unsigned char* cbuff
-      cdef size_t c_max_length = max_length
-      cdef int n
-      if max_length <= 16:
-          cbuff = lbuff
-      else:
-          cbuff = <unsigned char *>malloc(max_length)
-      cbuff[0] = report_num
-      with nogil:
-          n = hid_get_input_report(c_hid, cbuff, c_max_length)
-      res = []
-      if n < 0:
-          raise IOError('read error')
-      for i in range(n):
-          res.append(cbuff[i])
-      if max_length > 16:
-          free(cbuff)
-      return res
-
   def error(self):
       if self._c_hid == NULL:
           raise ValueError('not open')
diff --git a/hidraw.pyx b/hidraw.pyx
index 66d34bf..e1efed8 100644
--- a/hidraw.pyx
+++ b/hidraw.pyx
@@ -206,30 +206,6 @@ cdef class device:
           free(cbuff)
       return res
 
-  def get_input_report(self, int report_num, int max_length):
-      if self._c_hid == NULL:
-          raise ValueError('not open')
-      cdef hid_device * c_hid = self._c_hid
-      cdef unsigned char lbuff[16]
-      cdef unsigned char* cbuff
-      cdef size_t c_max_length = max_length
-      cdef int n
-      if max_length <= 16:
-          cbuff = lbuff
-      else:
-          cbuff = <unsigned char *>malloc(max_length)
-      cbuff[0] = report_num
-      with nogil:
-          n = hid_get_input_report(c_hid, cbuff, c_max_length)
-      res = []
-      if n < 0:
-          raise IOError('read error')
-      for i in range(n):
-          res.append(cbuff[i])
-      if max_length > 16:
-          free(cbuff)
-      return res
-
   def error(self):
       if self._c_hid == NULL:
           raise ValueError('not open')