On Wed, Jun 27, 2012 at 1:30 PM, Grigor Kolev wrote:
> Hi!
>
> I try to read data from USB Fingerprint reader
>
> I connect wit reader and it work
>
> import sys
>
> import usb.core
>
> import usb.util
>
>
>
> VENDOR_ID=0x045E
>
> PRODUCT_ID=0x00BD
>
> DATA_SIZE=64
>
>
>
> device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
>
>
>
>
>
>
>
> try:
>
>     device.set_configuration()
>
>
>
> except usb.core.USBError as e:
>
>     sys.exit("Could not set configuration: %s" % str(e))
>
>
>
> endpoint = device[0][(0,0)][0]
>
> print endpoint
>
>
>
> data = []
>
> swiped = False
>
> print "Send a code..."
>
> a = 0
>
> while 1:
>
>     try:
>
>         dev = device.read(endpoint.bEndpointAddress,
>
>                             endpoint.wMaxPacketSize)
>
>         data.append(dev.buffer_info())

This looks wrong to me. device.read() returns the data as an array.
The buffer_info() method return the address and length of this array.
You'd want to append the elements themselves of this array to your
"data" array:
 data.extend(dev)

Also, if you're not 100% sure you are using the right endpoint, please
show us the output from "lsusb -d 045E:00BD -v" and a link to any
documentation that you have on the device.

Tormod

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to