summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-06-06 09:34:39 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-06-06 09:34:39 +0200
commit52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a (patch)
treeefe2a00582d6f1b937448a6343d29b873dc407f0
parentAdd new model name to list of supported devices. (diff)
downloadglucometerutils-52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a.tar
glucometerutils-52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a.tar.gz
glucometerutils-52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a.tar.bz2
glucometerutils-52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a.tar.lz
glucometerutils-52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a.tar.xz
glucometerutils-52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a.tar.zst
glucometerutils-52f1892d8a6b3cc674196e8cbcaa9e0f42cc4d5a.zip
-rw-r--r--glucometerutils/support/hiddevice.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/glucometerutils/support/hiddevice.py b/glucometerutils/support/hiddevice.py
index b360841..a1af95a 100644
--- a/glucometerutils/support/hiddevice.py
+++ b/glucometerutils/support/hiddevice.py
@@ -30,11 +30,18 @@ class HidDevice(object):
If the VID/PID pair is not provided, the driver will require a device path
to be used.
+
+ Optional parameters available:
+
+ TIMEOUT_MS: (int, default: 1000) the read timeout in milliseconds, used
+ for hidapi reads only.
"""
USB_VENDOR_ID = None
USB_PRODUCT_ID = None
+ TIMEOUT_MS = 1000
+
def __init__(self, device):
if None in (self.USB_VENDOR_ID, self.USB_PRODUCT_ID) and not device:
raise exceptions.CommandLineError(
@@ -81,4 +88,4 @@ class HidDevice(object):
if self.handle_mode_ == 'hidraw':
return self.handle_.read(size)
else:
- return bytes(self.handle_.read(size, timeout_ms=1000))
+ return bytes(self.handle_.read(size, timeout_ms=self.TIMEOUT_MS))