summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-06-15 23:19:57 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-06-15 23:19:57 +0200
commit7885b25e012d7ba022c72298866f7d1034643165 (patch)
tree61b60234fdc086355429288ceb631b8d21e40a90
parentfsprecisionneo: FreeStyle Optium Neo H has been tested working (diff)
downloadglucometerutils-7885b25e012d7ba022c72298866f7d1034643165.tar
glucometerutils-7885b25e012d7ba022c72298866f7d1034643165.tar.gz
glucometerutils-7885b25e012d7ba022c72298866f7d1034643165.tar.bz2
glucometerutils-7885b25e012d7ba022c72298866f7d1034643165.tar.lz
glucometerutils-7885b25e012d7ba022c72298866f7d1034643165.tar.xz
glucometerutils-7885b25e012d7ba022c72298866f7d1034643165.tar.zst
glucometerutils-7885b25e012d7ba022c72298866f7d1034643165.zip
-rw-r--r--glucometerutils/support/hiddevice.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/glucometerutils/support/hiddevice.py b/glucometerutils/support/hiddevice.py
index a1af95a..86203ba 100644
--- a/glucometerutils/support/hiddevice.py
+++ b/glucometerutils/support/hiddevice.py
@@ -33,14 +33,14 @@ class HidDevice(object):
Optional parameters available:
- TIMEOUT_MS: (int, default: 1000) the read timeout in milliseconds, used
- for hidapi reads only.
+ TIMEOUT_MS: (int, default: NOne) the read timeout in milliseconds, used
+ for hidapi reads only. If -1, hidapi will be provided no timeout.
"""
USB_VENDOR_ID = None
USB_PRODUCT_ID = None
- TIMEOUT_MS = 1000
+ TIMEOUT_MS = None
def __init__(self, device):
if None in (self.USB_VENDOR_ID, self.USB_PRODUCT_ID) and not device:
@@ -85,7 +85,7 @@ class HidDevice(object):
This is important as it handles the one incompatible interface between
hidraw devices and hidapi handles.
"""
- if self.handle_mode_ == 'hidraw':
- return self.handle_.read(size)
+ if self.handle_mode_ == 'hidraw' or self.TIMEOUT_MS is None:
+ return bytes(self.handle_.read(size))
else:
return bytes(self.handle_.read(size, timeout_ms=self.TIMEOUT_MS))