Add pressure data verification diagnostic
New diagnostic tool to verify if OTD virtual device is actually sending pressure data to applications. - test-pressure-data.sh: Tests if OTD virtual device sends pressure values * Captures xinput test output for 10 seconds * Extracts pressure values (a[2]=) from motion events * Shows min/max/unique pressure levels * Diagnoses if pressure data is present or missing * Provides specific recommendations based on findings This helps determine if the issue is: - OTD not sending pressure data (OTD problem) - Paintstorm not recognizing the device (app problem) - Configuration issue Expected outcome: If this shows pressure data IS being sent, but Paintstorm still doesn't work, then Paintstorm likely doesn't recognize OTD virtual devices. In that case, native HID is the only solution.
+153 · 1 file changed
-
test-pressure-data.sh+153 −0
@@ -0,0 +1,153 @@ +#!/bin/bash +# Test if pressure data is actually being sent by the OTD virtual device + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +BOLD='\033[1m' +NC='\033[0m' + +echo "==========================================" +echo "Pressure Data Test" +echo "==========================================" +echo "" + +# Find OTD virtual device +VIRTUAL_ID=$(xinput list | grep "OpenTabletDriver.*stylus" | head -1 | grep -o 'id=[0-9]*' | cut -d= -f2) + +if [ -z "$VIRTUAL_ID" ]; then + echo -e "${RED}ERROR: OTD virtual device not found${NC}" + echo "" + echo "Make sure otd-daemon is running:" + echo " otd-daemon &" + exit 1 +fi + +echo -e "Testing device: ${BOLD}OpenTabletDriver Virtual Artist Tablet stylus${NC}" +echo "Device ID: $VIRTUAL_ID" +echo "" + +echo "Press your pen on the tablet with varying pressure for 10 seconds..." +echo "Watch for lines with 'a[2]=' - this is the pressure value" +echo "" +echo "Expected pressure range: 0 (no pressure) to 8191 (max pressure)" +echo "" +echo "==========================================" +echo "Starting test..." +echo "==========================================" +echo "" + +# Capture xinput test output +OUTPUT=$(timeout 10 xinput test "$VIRTUAL_ID" 2>&1) + +# Check if we got any events +if ! echo "$OUTPUT" | grep -q "motion"; then + echo -e "${RED}✗ NO EVENTS DETECTED${NC}" + echo "" + echo "The OTD virtual device is not receiving any input!" + echo "" + echo "Troubleshooting:" + echo "1. Make sure otd-daemon is running: pgrep -fa otd-daemon" + echo "2. Check if OTD detected your tablet: otd detect" + echo "3. Verify hidraw devices are accessible: ls -la /dev/hidraw*" + exit 1 +fi + +# Extract pressure values +PRESSURE_VALUES=$(echo "$OUTPUT" | grep "motion" | grep -o 'a\[2\]=[0-9]*' | cut -d= -f2 | sort -n | uniq) + +if [ -z "$PRESSURE_VALUES" ]; then + echo -e "${RED}✗ NO PRESSURE DATA FOUND${NC}" + echo "" + echo "The device is sending motion events, but NO pressure data (a[2]=)!" + echo "" + echo "Sample output:" + echo "$OUTPUT" | head -10 | sed 's/^/ /' + echo "" + echo "This means:" + echo "- The OTD virtual device is working" + echo "- But it's not reporting pressure values" + echo "- This could be an OTD configuration issue" + echo "" + echo "Try:" + echo "1. Check OTD settings in otd-gui" + echo "2. Restart OTD: pkill otd-daemon && otd-daemon &" + echo "3. Use native HID instead (it has pressure)" + exit 1 +fi + +# Analyze pressure range +MIN_PRESSURE=$(echo "$PRESSURE_VALUES" | head -1) +MAX_PRESSURE=$(echo "$PRESSURE_VALUES" | tail -1) +UNIQUE_VALUES=$(echo "$PRESSURE_VALUES" | wc -l) + +echo -e "${GREEN}✓ PRESSURE DATA DETECTED${NC}" +echo "" +echo "Pressure statistics:" +echo " Minimum pressure: $MIN_PRESSURE" +echo " Maximum pressure: $MAX_PRESSURE" +echo " Unique pressure levels: $UNIQUE_VALUES" +echo "" + +if [ "$MAX_PRESSURE" -gt 1000 ]; then + echo -e "${GREEN}✓ Good pressure range (max > 1000)${NC}" + echo " This indicates proper pressure sensitivity" +else + echo -e "${YELLOW}⚠ Low maximum pressure ($MAX_PRESSURE)${NC}" + echo " You might not have pressed hard enough during the test" + echo " Or OTD might not be configured for full pressure range" +fi + +echo "" +echo "Sample events (showing pressure values):" +echo "$OUTPUT" | grep "motion" | head -10 | grep --color=always 'a\[2\]=[0-9]*' | sed 's/^/ /' + +echo "" +echo "==========================================" +echo "CONCLUSION" +echo "==========================================" +echo "" + +if [ "$MAX_PRESSURE" -gt 100 ]; then + echo -e "${GREEN}✓ OTD virtual device IS sending pressure data${NC}" + echo "" + echo "The problem is NOT with OTD or the device." + echo "The issue is with Paintstorm." + echo "" + echo "Paintstorm is probably not using the OTD virtual device," + echo "even though it's the only active tablet device." + echo "" + echo "Possible causes:" + echo "1. Paintstorm cached the device ID from a previous run" + echo "2. Paintstorm has specific device requirements" + echo "3. Paintstorm doesn't recognize the OTD virtual device" + echo "" + echo "Solutions to try:" + echo "" + echo "A) Clear Paintstorm's configuration:" + echo " rm -rf ~/.config/Paintstorm" + echo " rm -rf ~/.cache/Paintstorm" + echo "" + echo "B) Check Paintstorm's input settings:" + echo " Look for tablet/input device settings in Paintstorm's preferences" + echo "" + echo "C) Use native HID (RECOMMENDED):" + echo " pkill otd-daemon" + echo " xinput enable 11 && xinput enable 24" + echo " ~/paintstorm" + echo " Pressure works perfectly with native HID!" +else + echo -e "${YELLOW}⚠ Pressure data exists but range is limited${NC}" + echo "" + echo "The OTD virtual device is sending some pressure data," + echo "but the range seems limited." + echo "" + echo "This could mean:" + echo "- You didn't press hard enough during the test" + echo "- OTD configuration issue" + echo "" + echo "Run this test again and press HARD on the tablet." +fi + +echo ""