Pen/stylus digitizer HID descriptor feature needed

graydetroit

Well-known member
Hi, I need to emulate a pressure-sensitive drawing tablet, like a Wacom Intuos Pro. If it's just an experimental commit or branch to the core GitHub repository, I can utilize it that way, I don't need it to be part of an official release.

Paul, if you're willing, I can provide you with the Wacom tablet model I linked to above, as I recently acquired one. I wouldn't mind giving it to you it in return for a functional emulator, either. Or, if you'd prefer, I can send it to you for evaluation and I can make a donation as well. Whatever works. I imagine you're very busy, it's just that I'm really pressed for time to have this working in the next couple months, but I understand if that's unrealistic. I've tried several different HID libraries and implementations, but none provide an out of the box pressure sensitive stylus/pen and tablet combo that is compliant with standard art programs that recognize pen pressure sensitive tablets.

I need this for a device I'm designing that will use the Teensy hardware for prototyping, and it will have to be compatible with art programs like Photoshop. I can provide you with more information if need be.

Thanks.
 
Last edited:
The first step is to capture the USB descriptors from that tablet, and post them here. On a Mac, you would use Apple's "USB Prober" program, which comes with their X-code dev tools. I know there are Windows program too, but I don't use Windows much so I'm not personally familiar with any.
 
Thanks Paul. I've been trying to capture the USB descriptors using the USBlyzer tool for Windows, but I'm not getting the information I need, and I think the Wacom Tablet maybe obfuscates or has some sort of proprietary method of sending its reports/data. Otherwise I'm just confused about it and I don't have a Mac to test it with the USB Prober program as you mentioned. Pretty frustrating. I really would love to get this to work, but I imagine I'd have to find someone either at Wacom or Photoshop who would know about stylus/tablet hardware development in order for me to know exactly which descriptors I need to use and in what fashion.
 
True! :)

I'm kicking myself for selling my MacBook recently. I will try and borrow a Mac or see if a Mac user can help me out.
 
Welp, I borrowed a MacBook Air and tried running a version of USB Prober I found on the web, but it doesn't work for the current operating system (macOS Sierra 10.12.x).
 
Paul, I did find a document that I think would provide a descriptor that could be used. It's included in some Microsoft documentation, the link is here. Also, here is an example that might be helpful.

Here is the part related to the sample pen digitizer report:

---------------------------------------------------------------------------------------

Pen Digitizer Drivers


Starting with Windows Vista, devices that appear as HID pen devices are typically electromagnetic (EM) pen devices or devices that are intended to be used with a stylus. The operating system provides optimized behavior for different input methods. For example, pen devices receive gestures that are tuned for a stylus.

Required and Optional HID Usages

Pen digitizer drivers must implement the following HID usages:
X (page 0x01, usage 0x30) and Y (page 0x01, usage 0x31).
Tip switch (page 0x0D, usage 0x42).
In-range (page 0x0D, usage 0x32).


The following usages are optional, but we recommend that you implement them if the digitizer hardware supports them:

Pressure (page 0x0D, usage 0x30).
Tilt (page 0x0D, usages 0x3D and 0x3E).
Inverted (page 0x0D, usage 0x3C).
Barrel button (page 0x0D, usage 0x44).


You may need to add a second top-level collection for a mouse if the driver is used on slate Tablet PCs or other computers without a physical mouse. Starting with Windows Vista, if the operating system does not detect a mouse, it does not show a cursor. By adding a second collection for a mouse, you force Windows to show the cursor. The mouse collection should not send input.
For a sample pen digitizer driver, see the Wacom digitizer driver sample (Wacomopen.sys) in the Windows Driver Kit (WDK). Within the WDK installation directory, this sample driver is located at src\input\hiddigi.


Sample Report Descriptor for a Pen Digitizer Device


The following is a sample report descriptor for a pen digitizer device:


0x05, 0x0d, // USAGE_PAGE (Digitizers) 0
0x09, 0x02, // USAGE (Pen) 2
0xa1, 0x01, // COLLECTION (Application) 4
0x85, REPORTID_PEN, // 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, 0x45, // USAGE (Eraser Switch) 16
0x09, 0x3c, // USAGE (Invert) 18
0x09, 0x32, // USAGE (In Range) 20
0x15, 0x00, // LOGICAL_MINIMUM (0) 22
0x25, 0x01, // LOGICAL_MAXIMUM (1) 24
0x75, 0x01, // REPORT_SIZE (1) 26
0x95, 0x05, // REPORT_COUNT (5) 28
0x81, 0x02, // INPUT (Data,Var,Abs) 30
0x95, 0x0b, // REPORT_COUNT (11) 32
0x81, 0x03, // INPUT (Cnst,Var,Abs) 34
0x05, 0x01, // USAGE_PAGE (Generic Desktop) 36
0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) 38
0x75, 0x10, // REPORT_SIZE (16) 41
0x95, 0x01, // REPORT_COUNT (1) 43
0xa4, // PUSH 45
0x55, 0x0d, // UNIT_EXPONENT (-3) 46
0x65, 0x33, // UNIT (Inch,EngLinear) 48
0x09, 0x30, // USAGE (X) 50
0x35, 0x00, // PHYSICAL_MINIMUM (0) 52
0x46, 0x00, 0x00, // PHYSICAL_MAXIMUM (0) 54
0x81, 0x02, // INPUT (Data,Var,Abs) 57
0x09, 0x31, // USAGE (Y) 59
0x46, 0x00, 0x00, // PHYSICAL_MAXIMUM (0) 61
0x81, 0x02, // INPUT (Data,Var,Abs) 64
0xb4, // POP 66
0x05, 0x0d, // USAGE_PAGE (Digitizers) 67
0x09, 0x30, // USAGE (Tip Pressure) 69
0x81, 0x02, // INPUT (Data,Var,Abs) 71
0x09, 0x3d, // USAGE (X Tilt) 73
0x09, 0x3e, // USAGE (Y Tilt) 75
0x16, 0x01, 0x80, // LOGICAL_MINIMUM (-32767) 77
0x95, 0x02, // REPORT_COUNT (2) 80
0x81, 0x02, // INPUT (Data,Var,Abs) 82/84
#ifdef _CUSTOMVENDORUSAGE_
0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined) 0
0x09, 0x80, // USAGE (Vendor Usage 0x80) 3
0x09, 0x81, // USAGE (Vendor Usage 0x81) 5
0x15, 0x00, // LOGICAL_MINIMUM (0) 7
0x27, 0xff, 0xff, 0xff, 0xff, // LOGICAL_MAXIMUM (0xffffffff) 9
0x75, 0x20, // REPORT_SIZE (32) 14
0x95, 0x02, // REPORT_COUNT (2) 16
0x81, 0x02, // INPUT (Data,Var,Abs) 18/20
#endif
0xc0, // END_COLLECTION 0/1
0xc0, // END_COLLECTION 0/1

---------------------------------------------------------------------------------------
 
Last edited:
Glad you got it working! :)

If you have any code that can be shared, it might help anyone else who later finds this thread by searching.
 
Back
Top