From: Esha on
I have written a HID mini driver for touchscreen (My touch screen device
is a non-Hid class input device, I mean i have a custom mechanism for
reading the device).

I have used the vhidmini sample but have changed the input report.I have
registered with the HID class driver with the touch report as below -

(REPORTID_TOUCH is 4 and REPORTID_MOUSE is 2 - taken from usb.org HID
standard)
----------------------------------------------------------------------

HID_REPORT_DESCRIPTOR DefaultReportDescriptor[] = {
0x05, 0x0d, // USAGE_PAGE (Digitizers) 0
0x09, 0x02, // USAGE (Touch Screen) 2
0xa1, 0x01, // COLLECTION (Application) 4
//0x85, REPORTID_PEN, // REPORT_ID (Pen) 6
0x85, REPORTID_TOUCH, // REPORT_ID (Touch) 6
0x09, 0x20, // USAGE (Stylus) 8
0xa1, 0x00, // COLLECTION (Physical) 10
0x09, 0x42, // USAGE (Tip Switch) 12
0x09, 0x44, // USAGE (Barrel Switch) 14
0x09, 0x3c, // USAGE (Invert) 16
0x09, 0x45, // USAGE (Eraser Switch) 18
0x15, 0x00, // LOGICAL_MINIMUM (0) 20
0x25, 0x01, // LOGICAL_MAXIMUM (1) 22
0x75, 0x01, // REPORT_SIZE (1) 24
0x95, 0x04, // REPORT_COUNT (4) 26
0x81, 0x02, // INPUT (Data,Var,Abs) 28
0x95, 0x01, // REPORT_COUNT (1) 30
0x81, 0x03, // INPUT (Cnst,Var,Abs) 32
0x09, 0x32, // USAGE (In Range) 34
0x81, 0x02, // INPUT (Data,Var,Abs) 36
0x95, 0x02, // REPORT_COUNT (2) 38
0x81, 0x03, // INPUT (Cnst,Var,Abs) 40
0x05, 0x01, // USAGE_PAGE (Generic Desktop) 42
0x09, 0x30, // USAGE (X) 44
0x75, 0x10, // REPORT_SIZE (16) 46
0x95, 0x01, // REPORT_COUNT (1) 48
0xa4, // PUSH 50
0x55, 0x0d, // UNIT_EXPONENT (-3) 51
0x65, 0x33, // UNIT (Inch,EngLinear) 53
0x35, 0x00, // PHYSICAL_MINIMUM (0) 55
0x46, 0x3a, 0x20, // PHYSICAL_MAXIMUM (8250) 57
0x26, 0xf8, 0x52, // LOGICAL_MAXIMUM (21240) 60
0x81, 0x02, // INPUT (Data,Var,Abs) 63
0x09, 0x31, // USAGE (Y) 65
0x46, 0x2c, 0x18, // PHYSICAL_MAXIMUM (6188) 67
0x26, 0x6c, 0x3e, // LOGICAL_MAXIMUM (15980) 70
0x81, 0x02, // INPUT (Data,Var,Abs) 73
0xb4, // POP 75
0x05, 0x0d, // USAGE_PAGE (Digitizers) 76
0x09, 0x30, // USAGE (Tip Pressure) 78
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 80
0x81, 0x02, // INPUT (Data,Var,Abs) 83
0xc0, // END_COLLECTION 0
0xc0, / END_COLLECTION 1/2
//
// Dummy mouse collection starts here
//
0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0
0x09, 0x02, // USAGE (Mouse) 2
0xa1, 0x01, // COLLECTION (Application) 4
0x85, REPORTID_MOUSE, // REPORT_ID (Mouse) 6
0x09, 0x01, // USAGE (Pointer) 8
0xa1, 0x00, // COLLECTION (Physical) 10
0x05, 0x09, // USAGE_PAGE (Button) 12
0x19, 0x01, // USAGE_MINIMUM (Button 1) 14
0x29, 0x02, // USAGE_MAXIMUM (Button 2) 16
0x15, 0x00, // LOGICAL_MINIMUM (0) 18
0x25, 0x01, // LOGICAL_MAXIMUM (1) 20
0x75, 0x01, // REPORT_SIZE (1) 22
0x95, 0x02, // REPORT_COUNT (2) 24
0x81, 0x02, // INPUT (Data,Var,Abs) 26
0x95, 0x06, // REPORT_COUNT (6) 28
0x81, 0x03, // INPUT (Cnst,Var,Abs) 30
0x05, 0x01, // USAGE_PAGE (Generic Desktop) 32
0x09, 0x30, // USAGE (X) 34
0x09, 0x31, // USAGE (Y) 36
0x15, 0x81, // LOGICAL_MINIMUM (-127) 38
0x25, 0x7f, // LOGICAL_MAXIMUM (127) 40
0x75, 0x08, // REPORT_SIZE (8) 42
0x95, 0x02, // REPORT_COUNT (2) 44
0x81, 0x06, // INPUT (Data,Var,Rel) 46
0xc0, // END_COLLECTION 48
0xc0 // END_COLLECTION 49/50
};
---------------------------------------------------------------------
The HIDclass driver is polling the hidmini with IOCTL_HID_READ_REPORT.
In the completion routine of this IOCTL i'm reading the x,y and pressure
parameters from the hardware - I verified that these values are correct.
I'm updating the IRP buffer with the following

typedef struct _OEM_INPUT_REPORT
{
UCHAR ReportID;
union
{
struct
{
UCHAR bStatus;
USHORT wXData;
USHORT wYData;
USHORT wPressureData;
} InputReport;
UCHAR RawInput[7];
};
} OEM_INPUT_REPORT, *POEM_INPUT_REPORT;

But the cursor wont move to the place where i'm touching on the screen.
(cursor never moves, as if there are no inputs)

What could be the mistake ?

I have installed this as HID class, root enumerated (Using the sample
inf file from vhidmini with only the ReadFromRegistry setting is changed
to 0x00000000

Is there something else (system service etc) should be enabled so that
the input gets reflected on the monitor ? The usual mouse is working.

Regards
Esha
From: Esha on
Found out the reason.... for people who read this..
I'm trying to write a touch screen driver which is sitting behind a
SMBus controller and on XP professional.

The USAGE_PAGE Digitizers does not work - change this to Generic Desktop
and also, make sure all the physical and logical min and max are defined
properly.

-Esha


Esha wrote:
> I have written a HID mini driver for touchscreen (My touch screen device
> is a non-Hid class input device, I mean i have a custom mechanism for
> reading the device).
>
> I have used the vhidmini sample but have changed the input report.I have
> registered with the HID class driver with the touch report as below -
>
> (REPORTID_TOUCH is 4 and REPORTID_MOUSE is 2 - taken from usb.org HID
> standard)
> ----------------------------------------------------------------------
>
> HID_REPORT_DESCRIPTOR DefaultReportDescriptor[] = {
> 0x05, 0x0d, // USAGE_PAGE (Digitizers) 0
> 0x09, 0x02, // USAGE (Touch Screen) 2
> 0xa1, 0x01, // COLLECTION (Application) 4
> //0x85, REPORTID_PEN, // REPORT_ID (Pen) 6
> 0x85, REPORTID_TOUCH, // REPORT_ID (Touch) 6
> 0x09, 0x20, // USAGE (Stylus) 8
> 0xa1, 0x00, // COLLECTION (Physical) 10
> 0x09, 0x42, // USAGE (Tip Switch) 12
> 0x09, 0x44, // USAGE (Barrel Switch) 14
> 0x09, 0x3c, // USAGE (Invert) 16
> 0x09, 0x45, // USAGE (Eraser Switch) 18
> 0x15, 0x00, // LOGICAL_MINIMUM (0) 20
> 0x25, 0x01, // LOGICAL_MAXIMUM (1) 22
> 0x75, 0x01, // REPORT_SIZE (1) 24
> 0x95, 0x04, // REPORT_COUNT (4) 26
> 0x81, 0x02, // INPUT (Data,Var,Abs) 28
> 0x95, 0x01, // REPORT_COUNT (1) 30
> 0x81, 0x03, // INPUT (Cnst,Var,Abs) 32
> 0x09, 0x32, // USAGE (In Range) 34
> 0x81, 0x02, // INPUT (Data,Var,Abs) 36
> 0x95, 0x02, // REPORT_COUNT (2) 38
> 0x81, 0x03, // INPUT (Cnst,Var,Abs) 40
> 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 42
> 0x09, 0x30, // USAGE (X) 44
> 0x75, 0x10, // REPORT_SIZE (16) 46
> 0x95, 0x01, // REPORT_COUNT (1) 48
> 0xa4, // PUSH 50
> 0x55, 0x0d, // UNIT_EXPONENT (-3) 51
> 0x65, 0x33, // UNIT (Inch,EngLinear) 53
> 0x35, 0x00, // PHYSICAL_MINIMUM (0) 55
> 0x46, 0x3a, 0x20, // PHYSICAL_MAXIMUM (8250) 57
> 0x26, 0xf8, 0x52, // LOGICAL_MAXIMUM (21240) 60
> 0x81, 0x02, // INPUT (Data,Var,Abs) 63
> 0x09, 0x31, // USAGE (Y) 65
> 0x46, 0x2c, 0x18, // PHYSICAL_MAXIMUM (6188) 67
> 0x26, 0x6c, 0x3e, // LOGICAL_MAXIMUM (15980) 70
> 0x81, 0x02, // INPUT (Data,Var,Abs) 73
> 0xb4, // POP 75
> 0x05, 0x0d, // USAGE_PAGE (Digitizers) 76
> 0x09, 0x30, // USAGE (Tip Pressure) 78
> 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 80
> 0x81, 0x02, // INPUT (Data,Var,Abs) 83
> 0xc0, // END_COLLECTION 0
> 0xc0, / END_COLLECTION 1/2
> //
> // Dummy mouse collection starts here
> //
> 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0
> 0x09, 0x02, // USAGE (Mouse) 2
> 0xa1, 0x01, // COLLECTION (Application) 4
> 0x85, REPORTID_MOUSE, // REPORT_ID (Mouse) 6
> 0x09, 0x01, // USAGE (Pointer) 8
> 0xa1, 0x00, // COLLECTION (Physical) 10
> 0x05, 0x09, // USAGE_PAGE (Button) 12
> 0x19, 0x01, // USAGE_MINIMUM (Button 1) 14
> 0x29, 0x02, // USAGE_MAXIMUM (Button 2) 16
> 0x15, 0x00, // LOGICAL_MINIMUM (0) 18
> 0x25, 0x01, // LOGICAL_MAXIMUM (1) 20
> 0x75, 0x01, // REPORT_SIZE (1) 22
> 0x95, 0x02, // REPORT_COUNT (2) 24
> 0x81, 0x02, // INPUT (Data,Var,Abs) 26
> 0x95, 0x06, // REPORT_COUNT (6) 28
> 0x81, 0x03, // INPUT (Cnst,Var,Abs) 30
> 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 32
> 0x09, 0x30, // USAGE (X) 34
> 0x09, 0x31, // USAGE (Y) 36
> 0x15, 0x81, // LOGICAL_MINIMUM (-127) 38
> 0x25, 0x7f, // LOGICAL_MAXIMUM (127) 40
> 0x75, 0x08, // REPORT_SIZE (8) 42
> 0x95, 0x02, // REPORT_COUNT (2) 44
> 0x81, 0x06, // INPUT (Data,Var,Rel) 46
> 0xc0, // END_COLLECTION 48
> 0xc0 // END_COLLECTION 49/50
> };
> ---------------------------------------------------------------------
> The HIDclass driver is polling the hidmini with IOCTL_HID_READ_REPORT.
> In the completion routine of this IOCTL i'm reading the x,y and pressure
> parameters from the hardware - I verified that these values are correct.
> I'm updating the IRP buffer with the following
>
> typedef struct _OEM_INPUT_REPORT
> {
> UCHAR ReportID;
> union
> {
> struct
> {
> UCHAR bStatus;
> USHORT wXData;
> USHORT wYData;
> USHORT wPressureData;
> } InputReport;
> UCHAR RawInput[7];
> };
> } OEM_INPUT_REPORT, *POEM_INPUT_REPORT;
>
> But the cursor wont move to the place where i'm touching on the screen.
> (cursor never moves, as if there are no inputs)
>
> What could be the mistake ?
>
> I have installed this as HID class, root enumerated (Using the sample
> inf file from vhidmini with only the ReadFromRegistry setting is changed
> to 0x00000000
>
> Is there something else (system service etc) should be enabled so that
> the input gets reflected on the monitor ? The usual mouse is working.
>
> Regards
> Esha
From: Esha on
Found out the reason.... for people who read this..
I'm trying to write a touch screen driver for a touch screen controller,
which is sitting behind a SMBus controller and on XP professional.

The USAGE_PAGE Digitizers does not work - change this to Generic Desktop
and also, make sure all the physical and logical min and max are defined
properly.

-Esha

Esha wrote:
> I have written a HID mini driver for touchscreen (My touch screen device
> is a non-Hid class input device, I mean i have a custom mechanism for
> reading the device).
>
> I have used the vhidmini sample but have changed the input report.I have
> registered with the HID class driver with the touch report as below -
>
> (REPORTID_TOUCH is 4 and REPORTID_MOUSE is 2 - taken from usb.org HID
> standard)
> ----------------------------------------------------------------------
>
> HID_REPORT_DESCRIPTOR DefaultReportDescriptor[] = {
> 0x05, 0x0d, // USAGE_PAGE (Digitizers) 0
> 0x09, 0x02, // USAGE (Touch Screen) 2
> 0xa1, 0x01, // COLLECTION (Application) 4
> //0x85, REPORTID_PEN, // REPORT_ID (Pen) 6
> 0x85, REPORTID_TOUCH, // REPORT_ID (Touch) 6
> 0x09, 0x20, // USAGE (Stylus) 8
> 0xa1, 0x00, // COLLECTION (Physical) 10
> 0x09, 0x42, // USAGE (Tip Switch) 12
> 0x09, 0x44, // USAGE (Barrel Switch) 14
> 0x09, 0x3c, // USAGE (Invert) 16
> 0x09, 0x45, // USAGE (Eraser Switch) 18
> 0x15, 0x00, // LOGICAL_MINIMUM (0) 20
> 0x25, 0x01, // LOGICAL_MAXIMUM (1) 22
> 0x75, 0x01, // REPORT_SIZE (1) 24
> 0x95, 0x04, // REPORT_COUNT (4) 26
> 0x81, 0x02, // INPUT (Data,Var,Abs) 28
> 0x95, 0x01, // REPORT_COUNT (1) 30
> 0x81, 0x03, // INPUT (Cnst,Var,Abs) 32
> 0x09, 0x32, // USAGE (In Range) 34
> 0x81, 0x02, // INPUT (Data,Var,Abs) 36
> 0x95, 0x02, // REPORT_COUNT (2) 38
> 0x81, 0x03, // INPUT (Cnst,Var,Abs) 40
> 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 42
> 0x09, 0x30, // USAGE (X) 44
> 0x75, 0x10, // REPORT_SIZE (16) 46
> 0x95, 0x01, // REPORT_COUNT (1) 48
> 0xa4, // PUSH 50
> 0x55, 0x0d, // UNIT_EXPONENT (-3) 51
> 0x65, 0x33, // UNIT (Inch,EngLinear) 53
> 0x35, 0x00, // PHYSICAL_MINIMUM (0) 55
> 0x46, 0x3a, 0x20, // PHYSICAL_MAXIMUM (8250) 57
> 0x26, 0xf8, 0x52, // LOGICAL_MAXIMUM (21240) 60
> 0x81, 0x02, // INPUT (Data,Var,Abs) 63
> 0x09, 0x31, // USAGE (Y) 65
> 0x46, 0x2c, 0x18, // PHYSICAL_MAXIMUM (6188) 67
> 0x26, 0x6c, 0x3e, // LOGICAL_MAXIMUM (15980) 70
> 0x81, 0x02, // INPUT (Data,Var,Abs) 73
> 0xb4, // POP 75
> 0x05, 0x0d, // USAGE_PAGE (Digitizers) 76
> 0x09, 0x30, // USAGE (Tip Pressure) 78
> 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 80
> 0x81, 0x02, // INPUT (Data,Var,Abs) 83
> 0xc0, // END_COLLECTION 0
> 0xc0, / END_COLLECTION 1/2
> //
> // Dummy mouse collection starts here
> //
> 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0
> 0x09, 0x02, // USAGE (Mouse) 2
> 0xa1, 0x01, // COLLECTION (Application) 4
> 0x85, REPORTID_MOUSE, // REPORT_ID (Mouse) 6
> 0x09, 0x01, // USAGE (Pointer) 8
> 0xa1, 0x00, // COLLECTION (Physical) 10
> 0x05, 0x09, // USAGE_PAGE (Button) 12
> 0x19, 0x01, // USAGE_MINIMUM (Button 1) 14
> 0x29, 0x02, // USAGE_MAXIMUM (Button 2) 16
> 0x15, 0x00, // LOGICAL_MINIMUM (0) 18
> 0x25, 0x01, // LOGICAL_MAXIMUM (1) 20
> 0x75, 0x01, // REPORT_SIZE (1) 22
> 0x95, 0x02, // REPORT_COUNT (2) 24
> 0x81, 0x02, // INPUT (Data,Var,Abs) 26
> 0x95, 0x06, // REPORT_COUNT (6) 28
> 0x81, 0x03, // INPUT (Cnst,Var,Abs) 30
> 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 32
> 0x09, 0x30, // USAGE (X) 34
> 0x09, 0x31, // USAGE (Y) 36
> 0x15, 0x81, // LOGICAL_MINIMUM (-127) 38
> 0x25, 0x7f, // LOGICAL_MAXIMUM (127) 40
> 0x75, 0x08, // REPORT_SIZE (8) 42
> 0x95, 0x02, // REPORT_COUNT (2) 44
> 0x81, 0x06, // INPUT (Data,Var,Rel) 46
> 0xc0, // END_COLLECTION 48
> 0xc0 // END_COLLECTION 49/50
> };
> ---------------------------------------------------------------------
> The HIDclass driver is polling the hidmini with IOCTL_HID_READ_REPORT.
> In the completion routine of this IOCTL i'm reading the x,y and pressure
> parameters from the hardware - I verified that these values are correct.
> I'm updating the IRP buffer with the following
>
> typedef struct _OEM_INPUT_REPORT
> {
> UCHAR ReportID;
> union
> {
> struct
> {
> UCHAR bStatus;
> USHORT wXData;
> USHORT wYData;
> USHORT wPressureData;
> } InputReport;
> UCHAR RawInput[7];
> };
> } OEM_INPUT_REPORT, *POEM_INPUT_REPORT;
>
> But the cursor wont move to the place where i'm touching on the screen.
> (cursor never moves, as if there are no inputs)
>
> What could be the mistake ?
>
> I have installed this as HID class, root enumerated (Using the sample
> inf file from vhidmini with only the ReadFromRegistry setting is changed
> to 0x00000000
>
> Is there something else (system service etc) should be enabled so that
> the input gets reflected on the monitor ? The usual mouse is working.
>
> Regards
> Esha