From: Er. J. V. <jay...@gm...> - 2012-04-22 15:41:13
|
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() #dev.write(2,'Hello') #dev.write(1,'g') #dev.write(2,'VER00',0) ret = dev.read(0x81,8,0) # read(size,interface) print '::::::::::::::', ret -- 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 |
From: Eddie A. G. <edd...@gm...> - 2017-03-18 23:43:23
|
Hello all: I am using a Raspberry PI 3 in attempts to control my Owi Robotic Arm via USB with Python scripting. I am intermittently getting a "Operation timed out" error which halts the code. 75% of the time the program runs from start to finish with no problems. Any ideas on how I can mitigate this? Is there a way to increase the timeout threshold? Many thanks in advance. *Error:* Traceback (most recent call last): File "arm2.py", line 59, in <module> MoveArm("ShoulderUp",4.2) File "arm2.py", line 47, in MoveArm RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) File "build/bdist.linux-armv7l/egg/usb/core.py", line 711, in ctrl_transfer File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 836, in ctrl_transfer File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 571, in _check usb.core.USBError: [Errno 110] Operation timed out *From my Python script:* import usb.core, usb.util, time, sys RoboArm = usb.core.find(idVendor=0x1267, idProduct=0x000) if RoboArm is None: raise ValueError("Arm not found") Duration=1 def MoveArm(ArmCmd,Duration): if ArmCmd == "Base+": print "M5-%s : Rotate base clockwise" % Duration ArmCmd=[0,1,0] elif ArmCmd == "Base-": print "M5+%s : Rotate base counter clockwise" % Duration ArmCmd=[0,2,0] elif ArmCmd == "ShoulderDown": print "M4-%s : Shoulder down" % Duration ArmCmd=[64,0,0] elif ArmCmd == "ShoulderUp": print "M4+%s : Shoulder up" % Duration ArmCmd=[128,0,0] elif ArmCmd == "ElbowDown": print "M3-%s : Elbow down" % Duration ArmCmd=[16,0,0] elif ArmCmd == "ElbowUp": print "M3+%s : Elbow up" % Duration ArmCmd=[32,0,0] elif ArmCmd == "WristDown": print "M2-%s : Wrist down" % Duration ArmCmd=[4,0,0] elif ArmCmd == "WristUp": print "M2+%s : Wrist up" % Duration ArmCmd=[8,0,0] elif ArmCmd == "GripClose": print "M1-%s : Grip close" % Duration ArmCmd=[2,0,0] elif ArmCmd == "GripOpen": print "M1+%s : Grip open" % Duration ArmCmd=[1,0,0] elif ArmCmd == "LightOff": print "L1-%s : Light off" % Duration ArmCmd=[0,0,1] elif ArmCmd == "LightOn": print "L1+%s : Light on" % Duration ArmCmd=[0,0,0] else: print "Unknown command" sys.exit() RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) time.sleep(Duration) ArmCmd=[0,0,0] RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) #MoveArm("ShoulderUp",.1) #sys.exit() MoveArm("Base+",7.7) MoveArm("ShoulderDown",4) MoveArm("ElbowDown",1) MoveArm("ElbowUp",1) MoveArm("ShoulderUp",4.2) MoveArm("Base-",8.4) sys.exit() Eddie A Goble |
From: Wander L. C. <wan...@gm...> - 2017-03-22 14:30:10
|
Hi Eddie, This looks like a firmware problem, at least most cases end up being a firmware bug. 2017-03-18 20:43 GMT-03:00 Eddie A. Goble <edd...@gm...>: > Hello all: > > I am using a Raspberry PI 3 in attempts to control my Owi Robotic Arm via > USB with Python scripting. I am intermittently getting a "Operation timed > out" error which halts the code. 75% of the time the program runs from > start to finish with no problems. Any ideas on how I can mitigate this? Is > there a way to increase the timeout threshold? Many thanks in advance. > > Error: > > Traceback (most recent call last): > > File "arm2.py", line 59, in <module> > > MoveArm("ShoulderUp",4.2) > > File "arm2.py", line 47, in MoveArm > > RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) > > File "build/bdist.linux-armv7l/egg/usb/core.py", line 711, in > ctrl_transfer > > File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 836, in > ctrl_transfer > > File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 571, in > _check > > usb.core.USBError: [Errno 110] Operation timed out > > > From my Python script: > > import usb.core, usb.util, time, sys > > RoboArm = usb.core.find(idVendor=0x1267, idProduct=0x000) > > if RoboArm is None: > > raise ValueError("Arm not found") > > Duration=1 > > def MoveArm(ArmCmd,Duration): > > if ArmCmd == "Base+": > > print "M5-%s : Rotate base clockwise" % Duration > > ArmCmd=[0,1,0] > > elif ArmCmd == "Base-": > > print "M5+%s : Rotate base counter clockwise" % Duration > > ArmCmd=[0,2,0] > > elif ArmCmd == "ShoulderDown": > > print "M4-%s : Shoulder down" % Duration > > ArmCmd=[64,0,0] > > elif ArmCmd == "ShoulderUp": > > print "M4+%s : Shoulder up" % Duration > > ArmCmd=[128,0,0] > > elif ArmCmd == "ElbowDown": > > print "M3-%s : Elbow down" % Duration > > ArmCmd=[16,0,0] > > elif ArmCmd == "ElbowUp": > > print "M3+%s : Elbow up" % Duration > > ArmCmd=[32,0,0] > > elif ArmCmd == "WristDown": > > print "M2-%s : Wrist down" % Duration > > ArmCmd=[4,0,0] > > elif ArmCmd == "WristUp": > > print "M2+%s : Wrist up" % Duration > > ArmCmd=[8,0,0] > > elif ArmCmd == "GripClose": > > print "M1-%s : Grip close" % Duration > > ArmCmd=[2,0,0] > > elif ArmCmd == "GripOpen": > > print "M1+%s : Grip open" % Duration > > ArmCmd=[1,0,0] > > elif ArmCmd == "LightOff": > > print "L1-%s : Light off" % Duration > > ArmCmd=[0,0,1] > > elif ArmCmd == "LightOn": > > print "L1+%s : Light on" % Duration > > ArmCmd=[0,0,0] > > else: > > print "Unknown command" > > sys.exit() > > > RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) > > time.sleep(Duration) > > ArmCmd=[0,0,0] > > RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) > > > #MoveArm("ShoulderUp",.1) > > #sys.exit() > > > MoveArm("Base+",7.7) > > MoveArm("ShoulderDown",4) > > MoveArm("ElbowDown",1) > > MoveArm("ElbowUp",1) > > MoveArm("ShoulderUp",4.2) > > MoveArm("Base-",8.4) > > sys.exit() > > Eddie A Goble > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > -- Best Regards, Wander Lairson Costa |
From: Cameron D. <fo...@da...> - 2017-03-23 04:05:34
|
Two points: 1. the core read, write and ctrl_transfer operations have optional timeout args. (timeout=nnn) value in milliseconds 2. If the timeout is not simply because the you need a longer timeout, then you might benefit from something like I had to resort to: trap the USBErorr exception and check the error code. If it a timeout then you can try to reset/clean up or whatever is available with your device. Unfortunately, the timeout code varies with backend, so you need to knows what that is. If libusb0 then you might have more problems. Cameron. On 19-Mar-2017 09:43, Eddie A. Goble wrote: > Hello all: > > I am using a Raspberry PI 3 in attempts to control my Owi Robotic Arm > via USB with Python scripting. I am intermittently getting a "Operation > timed out" error which halts the code. 75% of the time the program runs > from start to finish with no problems. Any ideas on how I can mitigate > this? Is there a way to increase the timeout threshold? Many thanks in > advance. > > *Error:* > > Traceback (most recent call last): > > File "arm2.py", line 59, in <module> > > MoveArm("ShoulderUp",4.2) > > File "arm2.py", line 47, in MoveArm > > RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) > > File "build/bdist.linux-armv7l/egg/usb/core.py", line 711, in > ctrl_transfer > > File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 836, > in ctrl_transfer > > File "build/bdist.linux-armv7l/egg/usb/backend/libusb1.py", line 571, > in _check > > usb.core.USBError: [Errno 110] Operation timed out > > > *From my Python script:* > > import usb.core, usb.util, time, sys > > RoboArm = usb.core.find(idVendor=0x1267, idProduct=0x000) > > if RoboArm is None: > > raise ValueError("Arm not found") > > Duration=1 > > def MoveArm(ArmCmd,Duration): > > if ArmCmd == "Base+": > > print "M5-%s : Rotate base clockwise" % Duration > > ArmCmd=[0,1,0] > > elif ArmCmd == "Base-": > > print "M5+%s : Rotate base counter clockwise" % Duration > > ArmCmd=[0,2,0] > > elif ArmCmd == "ShoulderDown": > > print "M4-%s : Shoulder down" % Duration > > ArmCmd=[64,0,0] > > elif ArmCmd == "ShoulderUp": > > print "M4+%s : Shoulder up" % Duration > > ArmCmd=[128,0,0] > > elif ArmCmd == "ElbowDown": > > print "M3-%s : Elbow down" % Duration > > ArmCmd=[16,0,0] > > elif ArmCmd == "ElbowUp": > > print "M3+%s : Elbow up" % Duration > > ArmCmd=[32,0,0] > > elif ArmCmd == "WristDown": > > print "M2-%s : Wrist down" % Duration > > ArmCmd=[4,0,0] > > elif ArmCmd == "WristUp": > > print "M2+%s : Wrist up" % Duration > > ArmCmd=[8,0,0] > > elif ArmCmd == "GripClose": > > print "M1-%s : Grip close" % Duration > > ArmCmd=[2,0,0] > > elif ArmCmd == "GripOpen": > > print "M1+%s : Grip open" % Duration > > ArmCmd=[1,0,0] > > elif ArmCmd == "LightOff": > > print "L1-%s : Light off" % Duration > > ArmCmd=[0,0,1] > > elif ArmCmd == "LightOn": > > print "L1+%s : Light on" % Duration > > ArmCmd=[0,0,0] > > else: > > print "Unknown command" > > sys.exit() > > > RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) > > time.sleep(Duration) > > ArmCmd=[0,0,0] > > RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3) > > > #MoveArm("ShoulderUp",.1) > > #sys.exit() > > > MoveArm("Base+",7.7) > > MoveArm("ShoulderDown",4) > > MoveArm("ElbowDown",1) > > MoveArm("ElbowUp",1) > > MoveArm("ShoulderUp",4.2) > > MoveArm("Base-",8.4) > > sys.exit() > > Eddie A Goble > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Wander L. C. <wan...@gm...> - 2012-04-22 16:02:15
|
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 |
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 |
From: Xiaofan C. <xia...@gm...> - 2012-04-22 23:23:40
|
On Mon, Apr 23, 2012 at 12:29 AM, Er. Jay Vora <jay...@gm...> wrote: > 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() Why do you do this? After reset, you may have to search the device again. Remove this and try again. > #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) > BTW, do you have access to the communication protocol? -- Xiaofan |
From: Wander L. C. <wan...@gm...> - 2012-04-22 17:51:19
|
2012/4/22 Er. Jay Vora <jay...@gm...>: > Thanks for the response. > > I am trying to read from pedometer device. > > After your advice, I removed claim code. > Still problematic? > > " > 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 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 |
From: Er. J. V. <jay...@gm...> - 2012-04-22 17:55:18
|
Yes. Do you think the problem could be in the device? I've heard my colleague tried with C and it worked! But we like to do it in Python. On Sun, Apr 22, 2012 at 10:16 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2012/4/22 Er. Jay Vora <jay...@gm...>: > > Thanks for the response. > > > > I am trying to read from pedometer device. > > > > After your advice, I removed claim code. > > > > Still problematic? > > > > > " > > 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 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 |
From: Xiaofan C. <xia...@gm...> - 2012-04-22 23:22:02
|
On Mon, Apr 23, 2012 at 1:55 AM, Er. Jay Vora <jay...@gm...> wrote: > Yes. Do you think the problem could be in the device? > > I've heard my colleague tried with C and it worked! But we > like to do it in Python. In that case, please post the C code to see if your pyusb codes are correct or not. -- Xiaofan |