diff --git a/base/device.py b/base/device.py
index 6d7add9..bf27307 100644
--- a/base/device.py
+++ b/base/device.py
@@ -2264,7 +2264,8 @@ class Device(object):
self.callback()
if total_bytes_to_write != bytes_out:
- raise Error(ERROR_DEVICE_IO_ERROR)
+ raise Error(ERROR_DEVICE_IO_ERROR, 'Number of written '
+ 'bytes by hpmudext mismatch with expected amount.')
return bytes_out
diff --git a/base/g.py b/base/g.py
index 9856662..0aa0e2e 100644
--- a/base/g.py
+++ b/base/g.py
@@ -398,9 +398,11 @@ ERROR_STRINGS = {
class Error(Exception):
- def __init__(self, opt=ERROR_INTERNAL):
+ def __init__(self, opt=ERROR_INTERNAL, msg=None):
self.opt = opt
self.msg = ERROR_STRINGS.get(opt, ERROR_STRINGS[ERROR_INTERNAL])
+ if msg:
+ self.msg = '{} - {}'.format(self.msg, msg)
log.debug("Exception: %d (%s)" % (opt, self.msg))
Exception.__init__(self, self.msg, opt)
diff --git a/prnt/ldl.py b/prnt/ldl.py
index e3f77f7..8b28e7f 100644
--- a/prnt/ldl.py
+++ b/prnt/ldl.py
@@ -145,7 +145,7 @@ def buildLIDILPacket(packet_type, command=0, operation=0, other={}):
p = '$\x00\x10\x00\x08\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff$'
elif packet_type == PACKET_TYPE_RESET_LIDIL:
- p = '$\x00\x10\x00\x06\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff$'
+ p = b'$\x00\x10\x00\x06\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff$'
elif packet_type == PACKET_TYPE_COMMAND: