Supporting multiple tablet operating modes
Multi-Mode Configurations
Some tablets operate differently depending on whether the manufacturer's driver is installed. Blankslate supports multi-mode configurations that handle both scenarios.
Overview
The XP-Pen Deco 640, for example, can operate in two modes:
| Mode | Report ID | Resolution | When Active |
|---|---|---|---|
| Driver Mode | 2 | 31998 × 17998 | Driver software running |
| Driverless Mode | 7 | 15999 × 8999 | No driver installed |
A multi-mode config supports both, with automatic detection based on the Report ID.
Config File Format
{
"name": "XP Pen Deco 640 (Multi-Mode)",
"vendorId": "0x28bd",
"productId": "0x2904",
"deviceInfo": { ... },
"modes": [
{
"name": "Driver Mode",
"reportId": 2,
"capabilities": {
"resolution": { "x": 31998, "y": 17998 },
"pressureLevels": 16384
},
"byteCodeMappings": { ... }
},
{
"name": "Driverless Mode",
"reportId": 7,
"capabilities": {
"resolution": { "x": 15999, "y": 8999 },
"pressureLevels": 8192
},
"byteCodeMappings": { ... }
}
]
}
Mode Detection
When reading tablet data, Blankslate:
- Reads the first HID packet
- Extracts the Report ID from byte 0
- Finds the matching mode in the config
- Uses that mode's mappings for all subsequent packets
// Automatic mode selection
const reportId = packet[0];
const mode = config.modes.find(m => m.reportId === reportId);
Mode-Specific Differences
Resolution
Different modes may report different coordinate ranges:
// Driver mode
"capabilities": {
"resolution": { "x": 31998, "y": 17998 }
}
// Driverless mode
"capabilities": {
"resolution": { "x": 15999, "y": 8999 }
}
Pressure Levels
Pressure sensitivity may vary:
// Driver mode: 16384 levels
"pressure": {
"byteIndex": [6, 7],
"max": 16383,
"type": "multi-byte-range"
}
// Driverless mode: 8192 levels
"pressure": {
"byteIndex": [6, 7],
"max": 8191,
"type": "multi-byte-range"
}
Button Handling
Button data may come from different interfaces or use different scan codes:
// Driver mode: Buttons on separate interface
{
"reportId": 2,
"buttonInterfaceReportId": 6,
"byteCodeMappings": {
"tabletButtons": {
"byteIndex": [2],
"type": "bit-flags"
}
}
}
// Driverless mode: Buttons as scan codes
{
"reportId": 7,
"byteCodeMappings": {
"tabletButtons": {
"byteIndex": [2],
"type": "code",
"values": {
"1": { "button": 1 },
"2": { "button": 2 }
}
}
}
}
Creating Multi-Mode Configs
Option 1: Run Walkthrough Twice
- Run the config generator with the driver installed
- Save the config
- Uninstall/disable the driver
- Run the config generator again
- Manually merge the two configs into a
modesarray
Option 2: Manual Editing
If you understand the HID protocol:
- Generate a single-mode config
- Convert to multi-mode format
- Add the second mode with appropriate mappings
Best Practices
- Test both modes - Verify the config works with and without the driver
- Document mode names - Use descriptive names like "Driver Mode" and "Driverless Mode"
- Include all capabilities - Each mode should have complete capability information
- Match byte mappings - Ensure each mode's mappings are accurate for that mode
Fallback Behavior
If no mode matches the incoming Report ID:
- The viewer will use the first mode as a fallback
- A warning will be logged
- Data may be incorrectly interpreted
Always ensure your config includes modes for all Report IDs your tablet might send.