From: Tormod Volden <debian.tor...@gmail.com>

Signed-off-by: Tormod Volden <debian.tor...@gmail.com>
---

Hi,

I have encountered a couple of issues when trying out the legacy
compatibility layer. Here is a first patch but I hope to come up with
some more soon.

Let me know if you have any release plans, I will try to get all
my test cases to work by then.

Best regards,
Tormod

 usb/legacy.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/usb/legacy.py b/usb/legacy.py
index 0da01d2..fa12617 100644
--- a/usb/legacy.py
+++ b/usb/legacy.py
@@ -303,7 +303,11 @@ class Device(object):
         self.deviceClass = dev.bDeviceClass
         self.deviceSubClass = dev.bDeviceSubClass
         self.deviceProtocol = dev.bDeviceProtocol
-        self.deviceVersion = dev.bcdDevice
+        self.deviceVersion = str((dev.bcdDevice >> 12) & 0xf) + \
+                            str((dev.bcdDevice >> 8) & 0xf) + \
+                            '.' + \
+                            str((dev.bcdDevice >> 4) & 0xf) + \
+                            str(dev.bcdDevice & 0xf)
         self.devnum = None
         self.filename = ''
         self.iManufacturer = dev.iManufacturer
@@ -312,7 +316,11 @@ class Device(object):
         self.idProduct = dev.idProduct
         self.idVendor = dev.idVendor
         self.maxPacketSize = dev.bMaxPacketSize0
-        self.usbVersion = dev.bcdUSB
+        self.usbVersion = str((dev.bcdUSB >> 12) & 0xf) + \
+                         str((dev.bcdUSB >> 8) & 0xf) + \
+                         '.' + \
+                         str((dev.bcdUSB >> 4) & 0xf) + \
+                         str(dev.bcdUSB & 0xf)
         self.configurations = [Configuration(c) for c in dev]
         self.dev = dev
 
-- 
1.7.0.4


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to