summaryrefslogtreecommitdiff
path: root/hidapi.py
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2013-10-26 14:43:35 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2013-10-26 14:43:48 +0200
commit5126039a1ca9a7715a06761a714d3e4e9d158e11 (patch)
treedbc33f12d8f00478766cda782f9d78956e99d03b /hidapi.py
parent9a09653330f2af11149b83e1df42a05a6cb018dc (diff)
Changed bootloader to use HID instead of DFU.
Diffstat (limited to 'hidapi.py')
-rw-r--r--hidapi.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/hidapi.py b/hidapi.py
new file mode 100644
index 0000000..22f94d8
--- /dev/null
+++ b/hidapi.py
@@ -0,0 +1,17 @@
+import ctypes, ctypes.util
+
+path = ctypes.util.find_library('hidapi')
+
+if not path:
+ raise ImportError('Cannot find hidapi library')
+
+hidapi = ctypes.CDLL(path)
+
+hidapi.hid_open.argtypes = [ctypes.c_ushort, ctypes.c_ushort, ctypes.c_wchar_p]
+hidapi.hid_open.restype = ctypes.c_void_p
+
+hidapi.hid_read_timeout.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t, ctypes.c_int]
+hidapi.hid_read.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
+hidapi.hid_write.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
+hidapi.hid_send_feature_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
+hidapi.hid_get_feature_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]