Add class that will pretty print hex numbers.
Mostly a throw away class but makes the numbers easier to manage in interactive terminals.
Do any math on the numbers and the magic disappears.
diff --git a/serial/tools/list_ports_osx.py b/serial/tools/list_ports_osx.py
index a451ae6..deb2fcf 100644
--- a/serial/tools/list_ports_osx.py
+++ b/serial/tools/list_ports_osx.py
@@ -66,6 +66,15 @@
cf.CFNumberGetValue.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_void_p]
cf.CFNumberGetValue.restype = ctypes.c_void_p
+
+class HexInt(int):
+
+ """Class to pretty print a integer in a hex representation."""
+
+ def __repr__(self):
+ return "0x{0:X}".format(self)
+
+
def get_string_property(device_t, property):
""" Search the given device for the specified string property