From 1bd020d21533f928d0c8b6d48ac04d66f6a1aee4 Mon Sep 17 00:00:00 2001 From: Alan Aguiar Date: Wed, 16 Oct 2013 01:22:25 +0000 Subject: update pybot --- (limited to 'pybot/usb/legacy.py') diff --git a/pybot/usb/legacy.py b/pybot/usb/legacy.py index 9a9fb95..ebe9f4d 100644 --- a/pybot/usb/legacy.py +++ b/pybot/usb/legacy.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009-2011 Wander Lairson Costa +# Copyright (C) 2009-2013 Wander Lairson Costa # # The following terms apply to all files associated # with the software unless explicitly disclaimed in individual files. @@ -333,12 +333,14 @@ class Device(object): class Bus(object): r"""Bus object.""" - def __init__(self): + def __init__(self, devices): self.dirname = '' self.location = 0 - self.devices = [Device(d) for d in core.find(find_all=True)] + self.devices = [Device(d) for d in devices] def busses(): r"""Return a tuple with the usb busses.""" - return (Bus(),) + return (Bus(g) for k, g in _interop._groupby( + _interop._sorted(core.find(find_all=True), key=lambda d: d.bus), + lambda d: d.bus)) -- cgit v0.9.1