djpnewton / vmulti

Virtual Multiple HID Driver (multitouch, mouse, digitizer, keyboard, joystick)
MIT License
401 stars 171 forks source link

How to create digitizer device with pressure #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
How to create digitizer device with pressure?

I changed the report in vmulti.h as follow, and add value "BYTE Pressure" to 
digitizer structure in vmulticommon.h but when i send a messages to the driver, 
pressure not work. I try to draw in Gimp and MyPaint.

The digitizer report:

/
// Digitizer report starts here
//
    0x05, 0x0d,                         // USAGE_PAGE (Digitizers)
    0x09, 0x02,                         // USAGE (Pen digitizer)
    0xa1, 0x01,                         // COLLECTION (Application)
    0x85, REPORTID_DIGI,                //   REPORT_ID (Digi)
    0x05, 0x0d,                         //   USAGE_PAGE (Digitizers)
    0x09, 0x20,                         //   USAGE (Stylus)
    0xa1, 0x00,                         //   COLLECTION (Physical)
    0x09, 0x42,                         //     USAGE (Tip Switch)
    0x09, 0x32,                         //     USAGE (In Range)
    0x15, 0x00,                         //     LOGICAL_MINIMUM (0)
    0x25, 0x01,                         //     LOGICAL_MAXIMUM (1)
    0x75, 0x01,                         //     REPORT_SIZE (1)
    0x95, 0x02,                         //     REPORT_COUNT (2)
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)
    0x75, 0x01,                         //     REPORT_SIZE (1)
    0x95, 0x06,                         //     REPORT_COUNT (6)
    0x81, 0x01,                         //     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)            
    0x55, 0x0F,                         //     UNIT_EXPONENT (-1)           
    0x65, 0x11,                         //     UNIT (cm,SI Linear)                  
    0x35, 0x00,                         //     PHYSICAL_MINIMUM (0)         
    0x45, 0x00,                         //     PHYSICAL_MAXIMUM (0)
    0x09, 0x30,                         //     USAGE (X)                    
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x09, 0x31,                         //     USAGE (Y)                    
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)

    0x05, 0x0d,                         //     USAGE_PAGE (Digitizers)      
    0x09, 0x30,                         //     USAGE (Tip Pressure)         
    0x26, 0xff, 0x00,                   //     LOGICAL_MAXIMUM (255)        
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0xc0,                               //   END_COLLECTION
    0xc0,                               // END_COLLECTION

//
// Digitizer specific report infomation
//

#define DIGI_TIPSWITCH_BIT    1
#define DIGI_IN_RANGE_BIT     2

#define DIGI_MIN_COORDINATE   0x0000
#define DIGI_MAX_COORDINATE   0x7FFF

#pragma pack(1)
typedef struct _VMULTI_DIGI_REPORT
{

    BYTE      ReportID;

    BYTE      Status;

    USHORT    XValue;

    USHORT    YValue;

    BYTE Pressure;

} VMultiDigiReport;
#pragma pack()

What wrong?

Original issue reported on code.google.com by alexjc...@gmail.com on 4 Sep 2013 at 6:32