comparison usb488.py @ 11:f588f5bc834a

Add a method to determine if the device is still connected. This is really ham strung by libusb (or the FreeBSD implementation).
author Daniel O'Connor <darius@dons.net.au>
date Sat, 16 May 2009 23:33:52 +0930
parents 154dab1e474f
children 5ff9130cc953
comparison
equal deleted inserted replaced
10:154dab1e474f 11:f588f5bc834a
276 if result[-1] == '\n': 276 if result[-1] == '\n':
277 result = result[0:-1] 277 result = result[0:-1]
278 278
279 return result 279 return result
280 280
281 def isConnected(self):
282 """Check if the device is present"""
283
284 # libusb makes it very hard (at least on FreeBSD) to determine if we're still connected.
285 # This is a reasonable proxy..
286 try:
287 self.handle.getString(self.dev.iManufacturer, 100)
288 except USBError, e:
289 return False
290
291 return True
292