Hi everybody, this is my first time in this list, so I apologize in advance
if this is not the way to contact you.

I am newer with pyusb and I am having a trouble that I am not able to solve
by myself, so I would appreciate any help you can give me.

I am trying to obtain diverse information from a USB device. I have the
communication protocol (so I know what commands I have to write) and I am
working under Ubuntu 10.04 The problem is that I am always getting
"Operation Timed Out" error after reading, so I am not able to read
anything.

This is my code: (any comment would be extra-appreciated)

import usb.core
import usb.util
import usb
import sys

command ="0x0000 0x0000 0x0000 0x0000 0x0000 0x0000"

dev = usb.core.find(idVendor=0x0590, idProduct=0x0028)

if dev is None:
    raise ValueError('Device not found')

dev.set_configuration()


#Find endpoints

ep_out = usb.util.find_descriptor(
        dev.get_interface_altsetting(),   # first interface
       # match the first OUT endpoint
        custom_match = \
            lambda e: \
                usb.util.endpoint_direction(e.bEndpointAddress) == \
                usb.util.ENDPOINT_OUT
    )

ep_in = usb.util.find_descriptor(
        dev.get_interface_altsetting(),   # first interface
        # match the first OUT endpoint
        custom_match = \
            lambda e: \
                usb.util.endpoint_direction(e.bEndpointAddress) == \
                usb.util.ENDPOINT_IN
    )


a=ep_out.write(st)
ret=ep_in.read(64, timeout=12000)

print ret


Thank you in advance!!

*
--
Begoña Fuentes*
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to