美文网首页
Sample Report Descriptor for a T

Sample Report Descriptor for a T

作者: 施瓦辛格777 | 来源:发表于2018-07-07 12:02 被阅读0次

    来源:https://docs.microsoft.com/zh-cn/windows-hardware/design/component-guidelines/sample-report-descriptor-for-a-touch-digitizer-device

    0x05, 0x0d,                         // USAGE_PAGE (Digitizers)
        0x09, 0x04,                         // USAGE (Touch Screen)
        0xa1, 0x01,                         // COLLECTION (Application)
        0x85, REPORTID_TOUCH,               //   REPORT_ID (Touch)
        0x09, 0x20,                         //   USAGE (Stylus)
        0xa1, 0x00,                         //   COLLECTION (Physical)
        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)
        0x95, 0x03,                         //     REPORT_COUNT (3)
        0x81, 0x03,                         //     INPUT (Cnst,Ary,Abs)
        0x09, 0x32,                         //     USAGE (In Range)
        0x09, 0x47,                         //     USAGE (Confidence)
        0x95, 0x02,                         //     REPORT_COUNT (2)
        0x81, 0x02,                         //     INPUT (Data,Var,Abs)
        0x95, 0x0a,                         //     REPORT_COUNT (10)
        0x81, 0x03,                         //     INPUT (Cnst,Ary,Abs)
        0x05, 0x01,                         //     USAGE_PAGE (Generic Desktop)
        0x26, 0xff, 0x7f,                   //     LOGICAL_MAXIMUM (32767)
        0x75, 0x10,                         //     REPORT_SIZE (16)
        0x95, 0x01,                         //     REPORT_COUNT (1)
        0xa4,                               //     PUSH
        0x55, 0x0d,                         //     UNIT_EXPONENT (-3)
        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)
        0xb4,                               //     POP
        0x05, 0x0d,                         //     USAGE PAGE (Digitizers)
        0x09, 0x48,                         //     USAGE (Width)
        0x09, 0x49,                         //     USAGE (Height)
        0x95, 0x02,                         //     REPORT_COUNT (2)
        0x81, 0x02,                         //     INPUT (Data,Var,Abs)
        0x95, 0x01,                         //     REPORT_COUNT (1)
        0x81, 0x03,                         //     INPUT (Cnst,Ary,Abs)
        0xc0,                               //   END_COLLECTION
        0xc0,                               // END_COLLECTION
    

    Linux查看对应的可读的描述符:

    # cat /sys/kernel/debug/hid/0005:0000:0000.0002/rdesc
    05 0d 09 04 a1 01 85 01 09 20 a1 00 09 42 15 00 25 01 75 01 95 01 81 02 95 03 81 03 09 32 09 47 95 02 81 02 95 0a 81 03 05 01 26 ff 7f 75 10 95 01 a4 55 0d 65 00 09 30 35 00 46 00 00 81 02 09 31 46 00 00 81 02 b4 05 0d 09 48 09 49 95 02 81 02 95 01 81 03 c0 c0 
    
       INPUT(1)[INPUT]
         Field(0)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(1)
             Digitizers.TipSwitch
           Logical Minimum(0)
           Logical Maximum(1)
           Report Size(1)
           Report Count(1)
           Report Offset(0)
           Flags( Variable Absolute )
         Field(1)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(2)
             Digitizers.InRange
             Digitizers.Confidence
           Logical Minimum(0)
           Logical Maximum(1)
           Report Size(1)
           Report Count(2)
           Report Offset(4)
           Flags( Variable Absolute )
         Field(2)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(1)
             GenericDesktop.X
           Logical Minimum(0)
           Logical Maximum(32767)
           Unit Exponent(13)
           Report Size(16)
           Report Count(1)
           Report Offset(16)
           Flags( Variable Absolute )
         Field(3)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(1)
             GenericDesktop.Y
           Logical Minimum(0)
           Logical Maximum(32767)
           Unit Exponent(13)
           Report Size(16)
           Report Count(1)
           Report Offset(32)
           Flags( Variable Absolute )
         Field(4)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(2)
             Digitizers.Width
             Digitizers.Height
           Logical Minimum(0)
           Logical Maximum(32767)
           Report Size(16)
           Report Count(2)
           Report Offset(48)
           Flags( Variable Absolute )
    
    Digitizers.TipSwitch ---> Key.Touch
    Digitizers.InRange ---> Key.ToolPen
    Digitizers.Confidence ---> Key.Btn0
    GenericDesktop.X ---> Absolute.X
    GenericDesktop.Y ---> Absolute.Y
    Digitizers.Width ---> Absolute.Misc
    Digitizers.Height ---> Absolute.?
    

    整理出对应的事件应该是这样的:


    Selection_292.png

    但是手边没有一个刚好是输出这个事件的设备,没有现成的例子包含了这几个参数Digitizers.InRange Digitizers.Confidence``Digitizers.Width Digitizers.Height,模拟发送的时候就不知道如何填写,就改进一下把这几个参数去掉试试看。

    目前理想的是这样的:

    Selection_293.png
    这次就只包含了必要的要素,按下抬起,X,Y
    05 0d 09 04 a1 01 85 01 09 20 a1 00 09 42 15 00 25 01 75 08 95 01 81 02 95 03 81 03 05 01 26 ff 7f 75 10 95 01 a4 55 0d 65 00 09 30 35 00 46 00 00 81 02 09 31 46 00 00 81 02 b4 c0 c0 
    
       INPUT(1)[INPUT]
         Field(0)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(1)
             Digitizers.TipSwitch
           Logical Minimum(0)
           Logical Maximum(1)
           Report Size(8)
           Report Count(1)
           Report Offset(0)
           Flags( Variable Absolute )
         Field(1)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(1)
             GenericDesktop.X
           Logical Minimum(0)
           Logical Maximum(32767)
           Unit Exponent(13)
           Report Size(16)
           Report Count(1)
           Report Offset(32)
           Flags( Variable Absolute )
         Field(2)
           Physical(Digitizers.Stylus)
           Application(Digitizers.TouchScreen)
           Usage(1)
             GenericDesktop.Y
           Logical Minimum(0)
           Logical Maximum(32767)
           Unit Exponent(13)
           Report Size(16)
           Report Count(1)
           Report Offset(48)
           Flags( Variable Absolute )
    
    Digitizers.TipSwitch ---> Key.Touch
    GenericDesktop.X ---> Absolute.X
    GenericDesktop.Y ---> Absolute.Y
    
    IMG_2036.GIF

    SensorTile中的发送函数:

    #define REPORT_IP_LEN_0 6
    static int8_t ipRepVal[REPORT_IP_LEN_0] = {0};
    ipRepVal[0] = 0x01; //report id
    ipRepVal[1] = 0x01; // down
    ipRepVal[2] = 0x01; // x low
    ipRepVal[3] = 0x00; // x High
    ipRepVal[4] = 0x01; // y low
    ipRepVal[5] = 0x00; // y High
    HidDevice_Update_Input_Report(0,0,REPORT_IP_LEN_0,ipRepVal);
    
    HAL_Delay(1000);
    
    ipRepVal[0] = 0x01; //report id
    ipRepVal[1] = 0x00; // up
    ipRepVal[2] = 0x01; // x low
    ipRepVal[3] = 0x00; // x High
    ipRepVal[4] = 0x01; // y low
    ipRepVal[5] = 0x00; // y High
    HidDevice_Update_Input_Report(0,0,REPORT_IP_LEN_0,ipRepVal);
    
    Selection_299.png Selection_300.png

    相关文章

      网友评论

          本文标题:Sample Report Descriptor for a T

          本文链接:https://www.haomeiwen.com/subject/npqwuftx.html