diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2020-01-25 12:05:06 +0100 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2020-01-25 12:05:06 +0100 |
commit | d62c6d8b427c26756ccd5253bad69bb00a4463f1 (patch) | |
tree | 2890384619a4982a2557ac71919d2d6295e270db | |
parent | extract_freestyle: add an option to not print keepalive messages. (diff) | |
download | glucometerutils-d62c6d8b427c26756ccd5253bad69bb00a4463f1.tar glucometerutils-d62c6d8b427c26756ccd5253bad69bb00a4463f1.tar.gz glucometerutils-d62c6d8b427c26756ccd5253bad69bb00a4463f1.tar.bz2 glucometerutils-d62c6d8b427c26756ccd5253bad69bb00a4463f1.tar.lz glucometerutils-d62c6d8b427c26756ccd5253bad69bb00a4463f1.tar.xz glucometerutils-d62c6d8b427c26756ccd5253bad69bb00a4463f1.tar.zst glucometerutils-d62c6d8b427c26756ccd5253bad69bb00a4463f1.zip |
-rw-r--r-- | glucometerutils/support/freestyle.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py index 6019fa7..ea2ac14 100644 --- a/glucometerutils/support/freestyle.py +++ b/glucometerutils/support/freestyle.py @@ -19,9 +19,7 @@ import construct from glucometerutils import exceptions from glucometerutils.support import hiddevice -# Sequence of initialization messages sent to the device to establish HID -# protocol. -_INIT_SEQUENCE = (0x01,) +_INIT_COMMAND = 0x01 _FREESTYLE_MESSAGE = construct.Struct( 'hid_report' / construct.Const(0, construct.Byte), @@ -95,12 +93,8 @@ class FreeStyleHidDevice(hiddevice.HidDevice): def connect(self): """Open connection to the device, starting the knocking sequence.""" - for message in _INIT_SEQUENCE: - self._send_command(message, b'') - # Ignore the returned values, they are not generally useful. The - # Serial Number as returned may not actually match the device's - # serial number (e.g. in the FreeStyle Precision Neo). - self._read_response() + self._send_command(_INIT_COMMAND, b'') + self._read_response() # Only expect non-error result. def disconnect(self): """Disconnect the device, nothing to be done.""" |