From: Er. J. V. <jay...@gm...> - 2012-04-22 16:29:15
|
Thanks for the response. I am trying to read from pedometer device. After your advice, I removed claim code. " dev = usb.core.find(idVendor=0x0590, idProduct=0x0028) if dev is None: print "Device not found" else: print "Device found" if dev.is_kernel_driver_active(0) is True: dev.detach_kernel_driver(0) print 'Now reading data' #dev.attach_kernel_driver(0) dev.set_configuration() dev.reset() #dev.write(2,'Hello') endpoint = dev[0][(0,0)][0] print "EEEEEE",endpoint #dev.write(1,'g') dev.write(endpoint.bEndpointAddress,'VER00',0) ret = dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize) # read(size,interface) " On Sun, Apr 22, 2012 at 9:31 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2012/4/22 Er. Jay Vora <jay...@gm...>: > > Hello Experts, > >> > >> Thanks for PyUSB. > >> > >> I've been trying to read data from USB device. > >> Everything goes right, but I am not able to read anything from it. > >> > >> Any help would be greatly appreciated. > >> > >> File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb10.py", > >> line 403, in _check > >> raise USBError(_str_error[ret], ret, _libusb_errno[ret]) > >> > >> Thanks. > >> > > > > My code: > > dev = usb.core.find(idVendor=0x0590, idProduct=0x0028) > > if dev is None: > > print "Device not found" > > else: > > print "Device found" > > if dev.is_kernel_driver_active(0) is True: > > print "but we need to detach kernel driver" > > dev.detach_kernel_driver(0) > > print "claiming device" > > usb.util.claim_interface(dev, 0) > > print "release claimed interface" > > > > usb.util.release_interface(dev, 0) > > print 'Now reading data' > > #dev.attach_kernel_driver(0) > > > > dev.set_configuration() > > You must claim the interface *after* set_configuration > > > > > #dev.write(2,'Hello') > > #dev.write(1,'g') > > #dev.write(2,'VER00',0) > > > > ret = dev.read(0x81,8,0) # read(size,interface) > > print '::::::::::::::', ret > > > > Isn't there any command you should send to get a responde? > > > -- > > > > Thanks, > > Regards, > > > > Er. Jay Vora > > M : 91 - 9879354457. > > (Not miles, just an email away...) > > Twitter Facebook LinkedIn Blogger > > "No Seconds to be Wasted for Formalities, I have a lot to Execute !" - > Jay > > Vora > > > > > ------------------------------------------------------------------------------ > > For Developers, A Lot Can Happen In A Second. > > Boundary is the first to Know...and Tell You. > > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > > http://p.sf.net/sfu/Boundary-d2dvs2 > > _______________________________________________ > > pyusb-users mailing list > > pyu...@li... > > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > -- Thanks, Regards, *Er. Jay Vora* M : 91 - 9879354457. (Not miles, just an email away...) Twitter <http://twitter.com/#%21/jaynvora> Facebook<http://www.facebook.com/jaynvora> LinkedIn <http://www.linkedin.com/in/jaynvora> Blogger<http://jayvora.blogspot.com> "No Seconds to be Wasted for Formalities, I have a lot to Execute !" - Jay Vora |