Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pybot/usb/legacy.py
diff options
context:
space:
mode:
Diffstat (limited to 'pybot/usb/legacy.py')
-rw-r--r--pybot/usb/legacy.py10
1 files changed, 6 insertions, 4 deletions
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))