Page 1 of 1

Problem in HID report structure

Posted: Fri Aug 03, 2012 6:02 pm
by sohrab
hi,
sorry for bad English,
i've run HID mouse successfully and i understand the structure that is used for sending data.(that consist 1 uchar for buttons and 3 char for dx , dy and wheel)
i'm trying to run an HID multitouch and i don't know how many variable i have to use in report structure.
Can somebody write the structure?
HID multitouch have a descriptor like this:(according to a document by microsoft)

0x05, 0x0d, // USAGE_PAGE (Digitizers)
0x09, 0x04, // USAGE (Touch Screen)
0xa1, 0x01, // COLLECTION (Application)
0x85, REPORTID_MTOUCH, // REPORT_ID (Touch)
0x09, 0x22, // USAGE (Finger)
0xa1, 0x02, // COLLECTION (Logical)
0x09, 0x42, // USAGE (Tip Switch)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x32, // USAGE (In Range)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x47, // USAGE (Touch Valid)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x05, // REPORT_COUNT (5)
0x81, 0x03, // INPUT (Cnst,Ary,Abs)
0x75, 0x08, // REPORT_SIZE (
0x09, 0x51, // USAGE (Contact Identifier)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desk..
0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767)
0x75, 0x10, // REPORT_SIZE (16)
0x55, 0x00, // UNIT_EXPONENT (0)
0x65, 0x00, // UNIT (None)
0x09, 0x30, // USAGE (X)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0x00, 0x00, // PHYSICAL_MAXIMUM (0)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x31, // USAGE (Y)
0x46, 0x00, 0x00, // PHYSICAL_MAXIMUM (0)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xa1, 0x02, // COLLECTION (Logical)
0x05, 0x0d, // USAGE_PAGE (Digitizers)
0x09, 0x42, // USAGE (Tip Switch)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x32, // USAGE (In Range)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x47, // USAGE (Touch Valid)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x05, // REPORT_COUNT (5)
0x81, 0x03, // INPUT (Cnst,Ary,Abs)
0x75, 0x08, // REPORT_SIZE (
0x09, 0x51, // USAGE ( Cotact Identifier)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desk..
0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767)
0x75, 0x10, // REPORT_SIZE (16)
0x55, 0x00, // UNIT_EXPONENT (0)
0x65, 0x00, // UNIT (None)
0x09, 0x30, // USAGE (X)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0x00, 0x00, // PHYSICAL_MAXIMUM (0)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x31, // USAGE (Y)
0x46, 0x00, 0x00, // PHYSICAL_MAXIMUM (0)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0x05, 0x0d, // USAGE_PAGE (Digitizers)
0x09, 0x54, // USAGE (Contact Count)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x08, // REPORT_SIZE (
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x08, // LOGICAL_MAXIMUM (
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x55, // USAGE(Contact Count Maximum)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0xc0, // END_COLLECTION

Re: Problem in HID report structure

Posted: Sat Aug 04, 2012 2:25 pm
by ulao
Get your self the HID Descriptor Tool...
http://www.usb.org/developers/hidpage#HID Descriptor Tool

Re: Problem in HID report structure

Posted: Sat Aug 04, 2012 3:57 pm
by sohrab
thanks fro reply, my problem is about the structure that is used to send data to computer.
for example for an hid mouse we use sth like this:
typedef struct{
uchar buttonMask;
char dx;
char dy;
char dWheel;
}report_t;

1 variable for buttons and 3 variables for dx,dy and wheel.

and my question is what is the relation between report descriptor and report structure?
(i think we need a variable in structure for every "INPUT (Data,Var,...)" in descriptor.)
and what will be the structure for digitizer?

Re: Problem in HID report structure

Posted: Sat Aug 04, 2012 4:12 pm
by ulao
I see, well its document out there in the waste lands... but the way I always did that was to send a unique report and then see what it effects. Obviously it have nothing to do with your struct but more so the data packet. For example here is a basic gamepad

reportBuffer[1]=128;//X-Axis ( main stick )
reportBuffer[2]=128;//Y-Axis
reportBuffer[3]=128;//Z-Axis
reportBuffer[4]=128;//X-rotate
reportBuffer[5]=128;//Y-rotate
reportBuffer[6]=128;//Z-rotate
reportBuffer[7]=128;//slider( right trig )
reportBuffer[8]=128;//dial ( left trig )
reportBuffer[9] =0;//buttons 1
reportBuffer[10]=0;//buttons 2
reportBuffer[11]=0;//buttons 3


Now to figure out what byte 6 was I'd do this reportBuffer[6]=0xff; then I watch my hid device on the PC end and look for ff. Then I can see that report 6 goes to Z-rotate.That the easy way IMO. The hard way is to look up the HID digitize on Microsoft knowledge base.

I dont have any experience with digitizes but maybe this helps?
http://sourceforge.net/apps/mediawiki/l ... B_Protocol