On 16. 07. 2014 12:52, Wander Lairson Costa wrote: > 2014-07-16 7:39 GMT-03:00 Slavko Kocjancic <esla...@gmail.com>: >> On 16. 07. 2014 12:33, Wander Lairson Costa wrote: >>> 2014-07-16 6:05 GMT-03:00 Slavko Kocjancic <esla...@gmail.com>: >>>> Hello... >>>> >>>> Attached is simple example. The problem is that it's works in linux but >>>> not in windows. And I wan't to be portable. Can someone tell me what I >>>> do wrong? >>>> seems that <class 'usb.core.Device'> is handeled different in win (it >>>> return long string?!) >>>> >>>> >>>> >>>> >>>> #there is current only one device with correct vid/pid attached >>>> import usb >>>> def openUsb(vid,pid,name=''): >>>> try: >>>> devices = usb.core.find(idVendor=vid, idProduct=pid, >>>> find_all=True) >>>> for dev in devices: >>>> print type (dev) >>>> print dev >>>> if (usb.util.get_string(dev,256,2)==name): >>>> dev.set_configuration() >>>> return dev >>>> except Exception as e: >>>> print e >>>> >>>> >>>> USBdev=openUsb(0x16d0,0x06ad,'Q_ANALISER') >>>> if not USBdev: >>>> print "Device not found" >>>> exit(0) >>>> print "Device found ",USBdev >>>> >>>> >>>> ''' >>>> ####OUTPUT on LINUX##### >>>> <class 'usb.core.Device'> >>>> <usb.core.Device object at 0x7ff2647f7290> >>>> Device found <usb.core.Device object at 0x7ff2647f7290> >>>> >>>> >>>> >>>> ####OUTPUT on WINDOWS##### >>>> <class 'usb.core.Device'> >>>> DEVICE ID 16d0:06ad on Bus 000 Address 001 ================= >>>> bLength : 0x12 (18 bytes) >>>> bDescriptorType : 0x1 Device >>>> bcdUSB : 0x110 USB 1.1 >>>> bDeviceClass : 0x0 Specified at interface >>>> bDeviceSubClass : 0x0 >>>> bDeviceProtocol : 0x0 >>>> bMaxPacketSize0 : 0x8 (8 bytes) >>>> idVendor : 0x16d0 >>>> idProduct : 0x06ad >>>> bcdDevice : 0x1 Device 0.01 >>>> iManufacturer : 0x1 CAA >>>> iProduct : 0x2 Q_ANALISER >>>> iSerialNumber : 0x0 >>>> bNumConfigurations : 0x1 >>>> CONFIGURATION 1: 400 mA ================================== >>>> bLength : 0x9 (9 bytes) >>>> bDescriptorType : 0x2 Configuration >>>> wTotalLength : 0x1b (27 bytes) >>>> bNumInterfaces : 0x1 >>>> bConfigurationValue : 0x1 >>>> iConfiguration : 0x0 >>>> bmAttributes : 0xc0 Self Powered >>>> bMaxPower : 0xc8 (400 mA) >>>> INTERFACE 0: Human Interface Device ==================== >>>> bLength : 0x9 (9 bytes) >>>> bDescriptorType : 0x4 Interface >>>> bInterfaceNumber : 0x0 >>>> bAlternateSetting : 0x0 >>>> bNumEndpoints : 0x0 >>>> bInterfaceClass : 0x3 Human Interface Device >>>> bInterfaceSubClass : 0x0 >>>> bInterfaceProtocol : 0x0 >>>> iInterface : 0x0 >>>> Device not found >>>> Press any key to continue . . . >>>> >>>> >>> Hi, >>> >>> It feels like you are using different git revisions for Windows and >>> Linux, aren't you? >>> >> It's should be same. >> But don't know how to check wich backend pyusb use at linux and win... >> In win there should be only one, but in linux I have at least 3 and need >> all... (for other things) >> > I said that because you have different results when you do "print dev" > on Linux and Windows. You can do a "git pull origin master" on both > repositories to make sure you are using git HEAD. > That different result confuse me too. And I do install same pyusb-1.0.0.b1 in both systems. The only difference can be the libusb driver itself. for win probably libusb-win and for linux probably libusb1.0 but don't know wich one the pyusb pick.
------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users