[libhid-discuss] Getting started

Marian Aldenhoevel marian.aldenhoevel at marian-aldenhoevel.de
Fri Aug 22 19:47:05 UTC 2008


Hi,

I am trying to write a program that can use a Omron Smartcard-Reader
V4KU-01JF-001 (connected to the USB) to read, well, Smartcards.

I am starting fresh on a lot of subjects here, so please be gentle if
my questions do not immediately make sense. I am trying to learn this
stuff and will gladly follow any pointer given...

I tried to adapt the test-libhid.c program to my needs (my application
is being written in C++). I have sucessfully initialized the library,
can enumerate devices, and can finally hid_open() my device.

Next would be communicating with it. Frankly: I do not know how to
do that.

Documentation for the device is at:

   http://www.marian-aldenhoevel.de/tmp/V4KU-01.zip

Output from

   lsusb -d 0590:0034 -vvv

is at:

   http://www.marian-aldenhoevel.de/tmp/lsusb

Say I wanted to issue the very first command to the card-reader, that would
propably be "(00) Initial Reset", as described in section 7.1 of the "Data
transmission Spec" in the zip pointed to above.

I gather that I need to call hid_set_output_report with correct values for
PATHOUT, PATHLEN, PACKET and SEND_PACKET_LEN.

The data I would have to send would at the core, the level of the
device-command be ASCII 'C00', or (0x43,0x30,0x30). Prepended by 0x00, 0x03
for the LEN, described in section 4.1.1 that would be

   (0x00,0x03,0x43,0x30,0x30)

The first thing I don't understand is the Report-ID. Is that an integral part
of the PACKET I am constructing and passing to hid_set_output_report()? If
so, how do I find the ID needed? My first guess would be the table in Section
4.1.1 of the specs that just gives a Report-ID based on the length of the
command and it's parameters.

In case of "(00) Initial Reset" that length would be 4 and I would select
Report-ID 0x02, because it specifies a length of 11 bytes. So my packet would
be padded "Padding data so that the report length is satisfied" to 11 bytes
for a total of:

   (0x02,0x00,0x03,0x43,0x30,0x30,0x00,0x00,0x00,0x00,0x00);

Those 11 bytes would be my PACKET, and the SEND_PACKET_LEN is 11.

Does that make sense so far?

My second question is about the PATH. I cannot make sense of the description
in test_libhid.c under "How to write to and read from a device". Can someone
please take a look at my lsusb -vvv output (link above) and explain again
for dummies?

Ciao, MM




More information about the libhid-discuss mailing list