Added that detach line back for 0 but left the dev.read() pointing to 1 and
now I get:
Traceback (most recent call last):
File "temper1.py", line 15, in <module>
ret = dev.read(0x82,8,1,500)
File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/core.py",
line 637, in read
self.__get_timeout(timeout)
File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/_debug.py",
line 52, in do_trace
return f(*args, **named_args)
File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/backend/libusb10.py",
line 511, in intr_read
timeout)
File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/backend/libusb10.py",
line 593, in __read
timeout))
File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/backend/libusb10.py",
line 357, in _check
raise USBError(_str_error[retval.value])
usb.core.USBError: Operation timed out
-----------
even if i increase the timeout to 5 seconds it is still the same.
On Fri, Feb 10, 2012 at 10:04 AM, Wander Lairson Costa <
wander.lair...@gmail.com> wrote:
> 2012/2/10 Lance R. Vick <la...@lrvick.net>:
> > Good call on checking the interfaces more carefully. It turns out
> interface
> > 0 is not being used at all and I updated the c accordingly.
> >
> > For clarity I simplified and combined all the c into one file. I
> verified it
> > compiles and that the binary dumps temperature from my device properly
> after
> > multiple disconnects/reconnects:
> >
> > http://pastie.org/3354572
> >
> >
> > From learning that only interface 1 is used I updated the python as
> follows:
> >
> > ------------------
> >
> > import usb.core
> >
> > dev = usb.core.find(idVendor=0x0c45,idProduct=0x7401)
> >
> > if dev.is_kernel_driver_active(1):
> > dev.detach_kernel_driver(1)
> >
> > dev.set_configuration()
> >
> > request = ''.join([chr(x) for x in
> > [0x01,0x80,0x33,0x01,0x00,0x00,0x00,0x00]])
> >
> > dev.ctrl_transfer(0x21,9,0x200,0x1,request,8)
> >
> > ret = dev.read(0x82,8,1,500)
> >
> > print(ret)
> >
> > ------------------
> >
> > I now get a Resource Busy error:
> >
> > ------------------
> >
> >
> > Traceback (most recent call last):
> > File "temper1.py", line 9, in <module>
> > dev.set_configuration()
> > File
> >
> "/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/core.py",
> > line 530, in set_configuration
> > self._ctx.managed_set_configuration(self, configuration)
> > File
> >
> "/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/core.py",
> > line 92, in managed_set_configuration
> > self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
> > File
> >
> "/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/_debug.py",
> > line 52, in do_trace
> > return f(*args, **named_args)
> > File
> >
> "/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/backend/libusb10.py",
> > line 455, in set_configuration
> > _check(_lib.libusb_set_configuration(dev_handle, config_value))
> > File
> >
> "/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/backend/libusb10.py",
> > line 357, in _check
> > raise USBError(_str_error[retval.value])
> > usb.core.USBError: Resource busy
> >
> > -------------------
> >
>
> Altough you are not using interface 0, you should detach it in order
> to the kernel driver to get unloaded.
>
> --
> Best Regards,
> Wander Lairson Costa
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>
--
Lance R. Vick
__________________________________________________
Cell - 407.283.7596
Gtalk - la...@lrvick.net
Website - http://lrvick.net
PGP Key - http://lrvick.net/0x36C8AAA9.asc
keyserver - subkeys.pgp.net
__________________________________________________
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users