Discussion:
[libhid-discuss] Usage Path Question
Christopher Moore
2008-10-02 17:25:32 UTC
Permalink
Hey everyone,

I have a question about usage path and formatting a
hid_set_output/input_report.

Given the output below, I'm trying to:

send a report to: Report ID #4, I believe the Path to be:
PATHLEN = 2
PATH_OUT = [0x000B0001,0x0014002C] or is it [0x0B01,0x142C]?
SEND_PACKET_LEN = 8

receive a report from: Report ID #3 (same as above ... which seems wierd...)
PATHLEN = 2
PATH_OUT = [0x000B0001,0x0014002C] or is it [0x0B01,0x142C]?
RECEIVE_PACKET_LEN = 7

Is my assumption/formatting correct?

Given this Report Structure:

/* USAGE_PAGE (Telephony Devices) */ 0x05, 0x0B,
/* USAGE (Phone) */ 0x09, 0x01,
/* COLLECTION (Application) */ 0xA1, 0x01,
/* REPORT_ID (1) */ 0x85, 0x01,
/* USAGE (Telephony Key Pad) */ 0x09, 0x06,
/* COLLECTION (Logical) */ 0xA1, 0x02,
/* USAGE_MINIMUM (Phone Key 0) */ 0x19, 0xB0,
/* USAGE_MAXIMUM (Phone Key Pound) */ 0x29, 0xBB,
/* LOGICAL_MINIMUM (0) */ 0x15, 0x00,
/* LOGICAL_MAXIMUM (12) */ 0x25, 0x0C,
/* REPORT_SIZE (4) */ 0x75, 0x04,
/* REPORT_COUNT (1) */ 0x95, 0x01,
/* INPUT (Data,Ary,Abs) */ 0x81, 0x00,
/* END_COLLECTION */ 0xC0,
/* USAGE (Hook Switch) */ 0x09, 0x20,
/* LOGICAL_MINIMUM (0) */ 0x15, 0x00,
/* LOGICAL_MAXIMUM (1) */ 0x25, 0x01,
/* REPORT_SIZE (1) */ 0x75, 0x01,
/* REPORT_COUNT (1) */ 0x95, 0x01,
/* INPUT (Data,Var,Abs) */ 0x81, 0x02,
/* USAGE (Handset) */ 0x09, 0x04,
/* COLLECTION (Logical) */ 0xA1, 0x02,
/* USAGE_PAGE (Consumer Devices) */ 0x05, 0x0C,
/* USAGE (Volume) */ 0x09, 0xE0,
/* LOGICAL_MINIMUM (-1) */ 0x15, 0xFF,
/* LOGICAL_MAXIMUM (1) */ 0x25, 0x01,
/* REPORT_SIZE (2) */ 0x75, 0x02,
/* REPORT_COUNT (1) */ 0x95, 0x01,
/* INPUT (Data,Var,Rel) */ 0x81, 0x06,
/* USAGE (Mute) */ 0x09, 0xE2,
/* LOGICAL_MINIMUM (0) */ 0x15, 0x00,
/* LOGICAL_MAXIMUM (1) */ 0x25, 0x01,
/* REPORT_SIZE (1) */ 0x75, 0x01,
/* REPORT_COUNT (1) */ 0x95, 0x01,
/* INPUT (Data,Var,Abs) */ 0x81, 0x02,
/* END_COLLECTION */ 0xC0,
/* REPORT_ID (2) */ 0x85, 0x02,
/* LOGICAL_MINIMUM (0) */ 0x15, 0x00,
/* LOGICAL_MAXIMUM (1) */ 0x25, 0x01,
/* REPORT_SIZE (1) */ 0x75, 0x01,
/* REPORT_COUNT (1) */ 0x95, 0x01,
/* USAGE_PAGE (Telephony Devices) */ 0x05, 0x0B,
/* USAGE (Hook Switch) */ 0x09, 0x20,
/* FEATURE (Data,Var,Abs) */ 0xB1, 0x02,
/* USAGE_PAGE (Telephony Devices) */ 0x05, 0x0B,
/* USAGE (Unassigned) */ 0x09, 0x18,
/* FEATURE (Data,Var,Abs) */ 0xB1, 0x02,
/* REPORT_SIZE (6) */ 0x75, 0x06,
/* FEATURE (Cnst,Var,Rel) */ 0xB1, 0x07,
/* USAGE_PAGE (Alphnumeric Display) */ 0x05, 0x14,
/* USAGE (Alphanumeric Display) */ 0x09, 0x01,
/* LOGICAL_MAXIMUM (255) */ 0x26, 0xFF, 0x00,
/* REPORT_SIZE (8) */ 0x75, 0x08,
/* REPORT_COUNT (1) */ 0x95, 0x01,
/* USAGE (Display Data) */ 0x09, 0x2C,
/* FEATURE (Data,Var,Abs) */ 0xB1, 0x02,
/* REPORT_COUNT (15) */ 0x95, 0x0F,
/* USAGE (Display Data) */ 0x09, 0x2C,
/* FEATURE (Data,Var,Abs) */ 0xB1, 0x02,
/* REPORT_ID (3) */ 0x85, 0x03,
/* USAGE_PAGE (Alphnumeric Display) */ 0x05, 0x14,
/* USAGE (Alphanumeric Display) */ 0x09, 0x01,
/* LOGICAL_MINIMUM (0) */ 0x15, 0x00,
/* LOGICAL_MAXIMUM (255) */ 0x26, 0xFF, 0x00,
/* REPORT_SIZE (8) */ 0x75, 0x08,
/* REPORT_COUNT (7) */ 0x95, 0x07,
/* USAGE (Display Data) */ 0x09, 0x2C, <==============
/* INPUT (Data,Ary,Abs) */ 0x81, 0x00, <==============
/* REPORT_ID (4) */ 0x85, 0x04,
/* USAGE_PAGE (Alphnumeric Display) */ 0x05, 0x14,
/* USAGE (Alphanumeric Display) */ 0x09, 0x01,
/* LOGICAL_MINIMUM (0) */ 0x15, 0x00,
/* LOGICAL_MAXIMUM (255) */ 0x26, 0xFF, 0x00,
/* REPORT_SIZE (8) */ 0x75, 0x08,
/* REPORT_COUNT (8) */ 0x95, 0x08,
/* USAGE (Display Data) */ 0x09, 0x2C, <==============
/* FEATURE (Data,Ary,Abs) */ 0xB1, 0x00, <==============
/* END_COLLECTION


Thanks

Christopher
Charles Lepple
2008-10-03 01:54:37 UTC
Permalink
Post by Christopher Moore
Hey everyone,
I have a question about usage path and formatting a
hid_set_output/input_report.
PATHLEN = 2
PATH_OUT = [0x000B0001,0x0014002C] or is it [0x0B01,0x142C]?
SEND_PACKET_LEN = 8
(By the way, if you're using Python, it calculates the length of the
list/tuple before passing that to the C portion of libhid. So PATHLEN
is not needed.)

It's the first one - 0x000B0001 etc.

The elements of the usage path are 32-bit numbers, composed of the
usage page in the upper 16 bits, and the usage in the lower 16 bits.
Post by Christopher Moore
receive a report from: Report ID #3 (same as above ... which seems wierd...)
PATHLEN = 2
PATH_OUT = [0x000B0001,0x0014002C] or is it [0x0B01,0x142C]?
RECEIVE_PACKET_LEN = 7
Is my assumption/formatting correct?
I think so.

It's OK to have the same path for inputs, outputs and features. (For
instance, with a file, you can read or write to it.)

You just have to use the proper function for each item.
--
Charles Lepple
Christopher Moore
2008-10-03 10:53:31 UTC
Permalink
Thanks Charles, I'll give it a try.
Post by Charles Lepple
Post by Christopher Moore
Hey everyone,
I have a question about usage path and formatting a
hid_set_output/input_report.
PATHLEN = 2
PATH_OUT = [0x000B0001,0x0014002C] or is it [0x0B01,0x142C]?
SEND_PACKET_LEN = 8
(By the way, if you're using Python, it calculates the length of the
list/tuple before passing that to the C portion of libhid. So PATHLEN
is not needed.)
It's the first one - 0x000B0001 etc.
The elements of the usage path are 32-bit numbers, composed of the
usage page in the upper 16 bits, and the usage in the lower 16 bits.
Post by Christopher Moore
receive a report from: Report ID #3 (same as above ... which seems wierd...)
PATHLEN = 2
PATH_OUT = [0x000B0001,0x0014002C] or is it [0x0B01,0x142C]?
RECEIVE_PACKET_LEN = 7
Is my assumption/formatting correct?
I think so.
It's OK to have the same path for inputs, outputs and features. (For
instance, with a file, you can read or write to it.)
You just have to use the proper function for each item.
Loading...