Mercurial > lcfOS
diff python/usb.py @ 130:654093a9a1e3
Added icons, improved device explorer
author | Windel Bouwman |
---|---|
date | Sat, 19 Jan 2013 18:16:04 +0100 |
parents | f42268da614f |
children |
line wrap: on
line diff
--- a/python/usb.py Fri Jan 18 12:52:11 2013 +0100 +++ b/python/usb.py Sat Jan 19 18:16:04 2013 +0100 @@ -107,7 +107,6 @@ buildfunc('libusb_set_configuration', [libusb_device_handle_p, c_int]) buildfunc('libusb_claim_interface', [libusb_device_handle_p, c_int]) - buildfunc('libusb_get_device_descriptor',\ [libusb_device_p, libusb_device_descriptor_p]) @@ -193,6 +192,12 @@ def __init__(self, device, handle_p): self.device = device self.handle_p = handle_p + def __del__(self): + self.close() + def close(self): + if self.handle_p: + libusb_close(self.handle_p) + self.handle_p = None def getConfiguration(self): config = c_int() r = libusb_get_configuration(self.handle_p, byref(config))