From 30389ab2bb476dcde8e2c10ce5f976a0d1a03650 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 26 Nov 2015 19:11:19 +0100 Subject: Port to latest PyUSB Signed-off-by: Michael Buesch --- libtoprammer/main.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libtoprammer/main.py') diff --git a/libtoprammer/main.py b/libtoprammer/main.py index 70899b5..59cdd45 100644 --- a/libtoprammer/main.py +++ b/libtoprammer/main.py @@ -71,8 +71,8 @@ class TOP(object): # Find the device devices = self.findDevices() if devIdentifier: - devices = filter(lambda d: d.devIdentifier == devIdentifier, - devices) + devices = [ d for d in devices + if d.devIdentifier.lower() == devIdentifier.lower() ] if not devices: raise TOPException("TOP programmer device not found!") foundDev = devices[0] # Select first @@ -168,10 +168,14 @@ class TOP(object): """Rescan all busses for TOP devices. Returns a list of FoundDev()""" usbFound = HardwareAccessUSB.scan(cls.__usbdev2toptype) - devices = [ FoundDev(cls.__usbdev2toptype(d.usbdev), - "usb:%03d:%03d" % (d.busNr, d.devNr), - d) - for d in usbFound ] + devices = [] + for i, ud in enumerate(usbFound): + toptype = cls.__usbdev2toptype(ud.usbdev) + devices.append( + FoundDev(toptype, + "usb:%s:%d" % (toptype, i), + ud) + ) return devices def initializeProgrammer(self, foundDev, noQueue): -- cgit v1.2.3