On Mon, Apr 5, 2010 at 8:21 PM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> On Mon, Apr 5, 2010 at 6:42 PM, Wander Lairson <wander.lair...@gmail.com> 
> wrote:
>> Please, try to find the device from python prompt, just do it:
>>
>> import usb.core
>> dev = usb.core.find(idVendor=0xFFFE)
>> assert dev is not None
>>
>
> It seems to be fine.
>
> [mc...@myfreebsd /usr/home/mcuee]$ python
> Python 2.6.4 (r264:75706, Feb 21 2010, 13:01:16)
> [GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import usb.core
>>>> dev = usb.core.find(idVendor=0xFFFE)
>>>> assert dev is not None
>>>> dev
> <usb.core.Device object at 0x2863d2ac>
>>>> ep =usb.util.find_descriptor(dev.get_interface_altsetting(),custom_match = 
>>>> lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == 
>>>> usb.util.ENDPOINT_OUT)
>>>> assert ep is not None
>>>> ep
> <usb.core.Endpoint object at 0x2863d40c>
>>>> ep.write('test')
> 4

More tests and it seems to work fine as well.

[mc...@myfreebsd /usr/home/mcuee]$ python
Python 2.6.4 (r264:75706, Feb 21 2010, 13:01:16)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> import usb.core
>>> import usb.util
>>> import usb.backend.libusb10 as libusb10
>>> dev = usb.core.find(idVendor=0xFFFE,idProduct=0x0001)
>>> dev
<usb.core.Device object at 0x2863d38c>
>>> ep1 =usb.util.find_descriptor(dev.get_interface_altsetting(),custom_match = 
>>> lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == 
>>> usb.util.ENDPOINT_OUT)
>>> ep81 =usb.util.find_descriptor(dev.get_interface_altsetting(),custom_match 
>>> = lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == 
>>> usb.util.ENDPOINT_IN)
>>> ep1.write('test')
4
>>> ep81.read(64)
array('B', [116, 101, 115, 116])
>>>





-- 
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to