Share via


Touch and pen support

This topic describes how to report touch and pen support for touch devices. If your device includes a digitizer that provides both touch and pen functionality, you must report touch and pen collections separately. If your digitizer might be installed on a slate Tablet PC or other computer that has no mouse, you should also report a mouse collection.

To facilitate palm rejection, the pen device should report data at a vertical distance higher than it normally would. It is highly recommended that this distance be 50 mm (or as close to this as possible), as this produces a better user experience. This will allow the host to handle touch input differently when it's aware that the pen is in range. Since most devices that are able to detect the pen at a higher vertical distance won't be able to accurately detect the coordinates of the pen, NULL coordinates should be reported by the device. The report descriptor below shows how NULL values can be supported for X and Y. When delivering NULL data, the device simply needs to set values that are outside the specified logical range for X and Y. Both values must be NULL for the host to recognize this reporting mode.

0x05, 0x0d,                         // USAGE_PAGE (Digitizers)          0
    0x09, 0x02,                         // USAGE (Pen)                      2
    0xa1, 0x01,                         // COLLECTION (Application)         4
    0x85, 02,                           //   REPORT_ID (Pen)                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, 0x13,                         //     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, 0x42,                         //     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, 0x42,                         //     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
    0x75, 0x08,                         //     REPORT_SIZE (8)              85
    0x09, 0x3d,                         //     USAGE (X Tilt)               87
    0x65, 0x14,                         //     UNIT (Degrees,EngRotation)        
    0x55, 0x0e,                         //     UNIT_EXPONENT (-2)
    0x36, 0xd8, 0xdc,                   //     PHYSICAL_MINIMUM (-9000)         
    0x46, 0x28, 0x23,                   //     PHYSICAL_MAXIMUM (9000)      
    0x15, 0x00,                         //     LOGICAL_MINIMUM (0)      
    0x26, 0x50, 0x46,                   //     LOGICAL_MAXIMUM (18000)        
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x09, 0x3e,                         //     USAGE (Y Tilt)               
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x55, 0x0e,                         //     UNIT_EXPONENT (-2)
    0x35, 0x00,                         //     PHYSICAL_MINIMUM (0)         
    0x47, 0xa0, 0x8c, 0x00, 0x00,        //    PHYSICAL_MAXIMUM (36000)      
    0x15, 0x00,                         //     LOGICAL_MINIMUM (0)      
    0x27, 0xa0, 0x8c, 0x00, 0x00,       //     LOGICAL_MAXIMUM (36000)        
    0x09, 0x41,                         //     USAGE (Twist)               
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)  
    0xc0,                               //   END_COLLECTION                
    0xc0,                               // END_COLLECTION                   

 

 

Send comments about this topic to Microsoft