From 8cc54e346a649effe117f8b684a6b9a5693eed1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sat, 17 Mar 2018 13:38:14 +0000 Subject: fsoptium: add debug logging when sending commands. --- glucometerutils/drivers/fsoptium.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/glucometerutils/drivers/fsoptium.py b/glucometerutils/drivers/fsoptium.py index 5c57ae3..1e1a319 100644 --- a/glucometerutils/drivers/fsoptium.py +++ b/glucometerutils/drivers/fsoptium.py @@ -90,11 +90,15 @@ class Device(serial.SerialDevice): def _send_command(self, command): cmd_bytes = bytes('$%s\r\n' % command, 'ascii') + logging.debug('Sending command: %r', cmd_bytes) + self.serial_.write(cmd_bytes) self.serial_.flush() response = self.serial_.readlines() + logging.debug('Received response: %r', response) + # We always want to decode the output, and remove stray \r\n. Any failure in # decoding means the output is invalid anyway. decoded_response = [line.decode('ascii').rstrip('\r\n') -- cgit v1.2.3