[libhid-discuss] Issues trying to work with USB HID Swipe Reader

Charles Lepple clepple at ghz.cc
Fri Feb 22 22:52:11 UTC 2008


On Feb 22, 2008, at 3:50 PM, George Marshall wrote:

> I've spent the past 2 days attempting to get some form of  
> communication
> going with my Magtek Mini swipe reader. I've skimmed over the  
> entire mailing
> list archives to see if I could find some answers as well as dozen of
> articles on the internet.

[...]

> hid.set_output_report([0xff000000 + item1, 0xff000000 + item2],  
> '\x01\x02\x10\x00\x02')

For the commands, it looks like the first element of the path should  
be 0xff000001 (the collection) and the second element should be  
0xff000020.

Also, part of the reason why that may not have worked is that the  
report descriptor calls out a 24-byte long field for commands. You  
probably need to zero-pad the string that you send.

A third issue is that you are using set_output_report, but the table  
on page 14(20) of the manual only lists Inputs and Features. So you  
probably want to stick with get_feature_report and set_feature_report  
for commands, and get_input_report for status.

If I were doing this, I would probably try something like this as the  
2nd argument to set_feature_report:

   struct.pack('B 22p', command_number, data)

The '22p' adds the length byte and data to the string.

Likewise, the documentation leads me to believe that you want to  
request 24 bytes via get_input_feature to get the response to commands.

>     #~ hid.interrupt_read(0xff000001, 5)

The first argument is an endpoint number. The end of lsusb says 'EP 1  
IN' so you probably want to try 0x81 (USB_ENDPOINT_IN | 0x80). Again,  
because HID firmware is usually sensitive to the amount of data  
requested, you might want to try reading the full length (337 bytes)  
at first, and then whittle that down using the status from some of  
the other Input reports.

Hope that helps.

-- 
Charles Lepple





More information about the libhid-discuss mailing list