Thanks for the tips. I may have been selling myself short. I'm not
completely clueless about USB, just very new. I've tinkers with USB
microcontrollers a bit. In any case, I've spent a lot of time in the USB
spec and the specs for my device. I've now been able to read from it using
hiddev and both branches of pyUSB. Having to catch a "No error" exception
when using interruptRead() on the 0.x branch tripped me up for quite a while
before I found a bug report about it. I must say, PyUSB 1.0 is very nice.
Well done developers.

I posted what I've learned and my final test program, which uses PyUSB 1.0,
on my Blog. This is for a MagTek USB HID Swipe Reader which is relatively
common: http://www.micahcarrick.com/credit-card-reader-pyusb.html

Thanks again.

- Micah

On Tue, Nov 2, 2010 at 8:50 AM, wander.lairson <wander.lair...@gmail.com>wrote:

> Hi Micah,
>
> First of all you do better getting some knowledge about USB. USB is
> not just like another serial protocol, it is a complete computer bus,
> with so many details. Later, maybe you want to give a try to PyUSB
> 1.0, which besides having an easier API, has a tutorial available on
> PyUSB website. Although still in alpha stage, many people have been
> using it successfully.
>
> 2010/11/2 Micah Carrick <mi...@greentackle.com>:
> > Hey,
> >
> > I'm a bit new to USB. I have a MagTek credit card reader that I'm
> > interfacing with Python.
> >
> > When you swipe a card, the card data is sent on the "Interrupt In" pipe
> > using an 'Interrupt Report".
> >
> > Now, I have already been able to read and parse the card data by using
> > open(), read(), and close() on /dev/usb/hiddev0, however, I would prefer
> to
> > interface using the USB library so that I can verify the right device is
> > connected and can reset the device. I also have the specs from the
> > manufacturer's website. I can't quite figure out how to use the usb
> module
> > though. This is all I have:
> >
> > VENDOR_ID = 0x0801
> > PRODUCT_ID = 0x0002
> >
> > buses = usb.busses()
> > for bus in buses:
> >     for device in bus.devices:
> >         if device.idVendor == VENDOR_ID and device.idProduct ==
> PRODUCT_ID:
> >             print "Found MagTek card reader"
> >             # now how do I wait for a read?
> >
> >
> > So I can find my device using the usb module but I do not know how to
> wait
> > for and then read from the device. Can anybody point me in the right
> > direction?
> >
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> > Create new apps & games for the Nokia N8 for consumers in  U.S. and
> Canada
> > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
> marketing
> > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> > http://p.sf.net/sfu/nokia-dev2dev
> > _______________________________________________
> > pyusb-users mailing list
> > pyusb-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/pyusb-users
> >
> >
>
>
>
> --
> Best Regards,
> Wander Lairson Costa
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>
------------------------------------------------------------------------------
Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware, 
phishing sites, and compromised hosts - saving your company time, 
money, and embarrassment.   Learn More! 
http://p.sf.net/sfu/hpdev2dev-nov
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to