Fix tablet pressure sensitivity and tilt support by adding hidraw device passthrough
This update resolves the issue where pressure sensitivity and tilt weren't working in the distrobox container when using OpenTabletDriver (OTD). Key changes: - Added detection and passthrough of /dev/hidraw* devices to container - Created diagnostic script (test-tablet-pressure.sh) to verify device setup - Enhanced debug output in launch wrapper to show hidraw device status - Updated management script to test and diagnose hidraw passthrough - Added comprehensive documentation for troubleshooting Technical details: - OpenTabletDriver uses hidraw devices to access raw HID data including pressure (0-8191) and tilt (X/Y angles) information - Previous version only passed /dev/input/event* devices, which lack pressure/tilt data when kernel drivers (wacom, hid_uclogic) are blacklisted - Both hidraw and event devices are now passed to container for full tablet functionality Files modified: - paintstorm-install-distrobox.sh: Added hidraw detection (lines 50-100+) - test-tablet-pressure.sh: New diagnostic script for tablet testing - README.md: New comprehensive setup and troubleshooting guide - TABLET-PRESSURE-FIX.md: Detailed fix documentation and technical details Users must recreate their containers to apply these changes.
+979 −39 · 4 files changed
-
README.md+309 −0 -
TABLET-PRESSURE-FIX.md+318 −0 -
paintstorm-install-distrobox.sh+146 −39 -
test-tablet-pressure.sh+206 −0
@@ -0,0 +1,309 @@ +# Paintstorm Studio Distrobox Setup + +A complete setup script to run Paintstorm Studio v2.50 in an Ubuntu 20.04 distrobox container on modern Linux systems, with full tablet pressure and tilt support for OpenTabletDriver. + +## Features + +✅ **Complete Installation** +- Automated Ubuntu 20.04 container creation +- GLEW 1.13.0 built from source +- All required dependencies installed +- Font crash prevention configured + +✅ **Tablet Support** (NEW in v2.4) +- Full pressure sensitivity (0-8191 levels) +- Tilt support (X/Y angles) +- OpenTabletDriver (OTD) integration +- **Hidraw device passthrough** for pressure/tilt data +- Input device passthrough for basic tablet events + +✅ **Hardware Acceleration** +- Automatic NVIDIA GPU detection and support +- OpenGL acceleration + +✅ **Easy Management** +- Desktop launcher integration +- Management script for maintenance +- Diagnostic tools for troubleshooting + +## Quick Start + +### Prerequisites + +```bash +# Install distrobox and podman +sudo pacman -S distrobox podman + +# Install OpenTabletDriver (for tablet support) +# Follow instructions at: https://opentabletdriver.net/ +# Then start it: +otd-daemon & +otd detect # Detect your tablet +``` + +### Installation + +1. **Clone or download this repository** + +2. **Download Paintstorm Studio** + - Get `Paintstorm_linux_v2.50.run` from the official website + - Place it in the same directory as the script + +3. **Run the installation script** + ```bash + chmod +x paintstorm-install-distrobox.sh + ./paintstorm-install-distrobox.sh + ``` + +4. **Launch Paintstorm** + - From application menu: Graphics → Paintstorm Studio + - Or from terminal: `~/paintstorm` + +## Tablet Pressure & Tilt Support + +### Important for Tablet Users + +If you're using a graphics tablet with OpenTabletDriver, you **MUST** ensure hidraw devices are passed to the container for pressure and tilt to work. + +### Quick Check + +```bash +# Run the diagnostic script +./test-tablet-pressure.sh +``` + +This will check: +- ✅ OpenTabletDriver status +- ✅ Kernel driver blacklist +- ✅ Hidraw devices on host +- ✅ Hidraw devices in container +- ✅ Input device configuration + +### If Pressure/Tilt Doesn't Work + +See **[TABLET-PRESSURE-FIX.md](TABLET-PRESSURE-FIX.md)** for detailed troubleshooting guide. + +**TL;DR:** +1. Make sure OpenTabletDriver is running: `otd-daemon &` +2. Recreate the container with the latest script (it will pass hidraw devices) +3. Run diagnostic: `./test-tablet-pressure.sh` + +## What's Included + +### Scripts + +- **`paintstorm-install-distrobox.sh`** - Main installation script +- **`test-tablet-pressure.sh`** - Tablet diagnostic tool (NEW) +- **`~/paintstorm`** - Launch wrapper (created during install) +- **`~/paintstorm-manage.sh`** - Container management (created during install) + +### Container Contents + +- Ubuntu 20.04 base +- GLEW 1.13.0 (required for Paintstorm) +- X11 libraries and tools +- Input device libraries (xinput, evtest, etc.) +- Font packages (crash prevention) +- Paintstorm Studio v2.50 + +### Device Passthrough (v2.4) + +The script automatically detects and passes: +- `/dev/input/event*` - Input event devices +- `/dev/input/js*` - Joystick devices +- `/dev/input/*wacom*` - Wacom tablet devices +- `/dev/input/*tablet*` - Generic tablet devices +- **`/dev/hidraw*`** - Raw HID devices (pressure/tilt data) ← **NEW** +- X11 sockets and Xauthority +- NVIDIA GPU (if detected) + +## Management + +### Container Management + +```bash +~/paintstorm-manage.sh +``` + +Options: +1. Export container (for backup/sharing) +2. Import container +3. Container info +4. **Test tablet input** (check device passthrough) +5. Fix tablet permissions +6. Exit + +### Troubleshooting + +#### Check Container Status +```bash +distrobox list +``` + +#### Enter Container Manually +```bash +distrobox enter paintstorm-legacy +``` + +#### Test Tablet in Container +```bash +distrobox enter paintstorm-legacy -- xinput list +distrobox enter paintstorm-legacy -- ls -la /dev/hidraw* +``` + +#### View Debug Output +```bash +~/paintstorm +# Check the debug output for device information +``` + +#### Full Diagnostic +```bash +./test-tablet-pressure.sh +``` + +## Known Issues & Solutions + +### 1. Pressure/Tilt Not Working + +**Problem**: Tablet works but no pressure sensitivity or tilt + +**Solution**: See [TABLET-PRESSURE-FIX.md](TABLET-PRESSURE-FIX.md) + +**Quick fix**: +```bash +# Make sure OTD is running +otd-daemon & + +# Recreate container with latest script +./paintstorm-install-distrobox.sh +# Answer 'y' to recreate + +# Verify hidraw passthrough +./test-tablet-pressure.sh +``` + +### 2. Font Crash on Startup + +**Solution**: Already fixed! The script creates empty font directories to prevent this crash. + +### 3. GLEW Library Error + +**Solution**: The script builds GLEW 1.13.0 from source and patches RPATH automatically. + +### 4. Permission Denied on /dev/hidraw* + +**Solution**: +```bash +# Add user to input group +sudo usermod -a -G input $USER +# Logout/login to apply + +# Or temporarily fix +sudo chmod a+rw /dev/hidraw* +``` + +### 5. Container Already Exists + +The script will detect existing containers and offer to recreate. This is **required** when updating device passthrough settings. + +## Technical Details + +### Why Distrobox? + +Paintstorm Studio v2.50 requires: +- Old GLEW version (1.13.0) +- Old library versions +- Specific font configuration + +Running in Ubuntu 20.04 container avoids conflicts with modern system libraries. + +### Why Hidraw Passthrough? + +OpenTabletDriver communicates directly with tablet hardware via `/dev/hidraw*` to: +- Read raw HID reports (pressure, tilt, buttons, battery) +- Bypass kernel drivers (wacom, hid_uclogic are blacklisted) +- Create virtual input device with processed data +- Support advanced features not in kernel drivers + +Without hidraw passthrough, only basic pointer movement works. + +### Device Architecture + +``` +Tablet Hardware + ↓ +/dev/hidraw* (raw HID data) ← OpenTabletDriver reads here + ↓ +otd-daemon (processes data) + ↓ +Virtual Input Device (processed events) + ↓ +/dev/input/event* ← Applications read here + ↓ +Paintstorm Studio +``` + +Both hidraw and event devices must be available in the container. + +## System Requirements + +- Linux system with X11 (Wayland may work but untested) +- Distrobox installed +- Podman or Docker +- For tablets: OpenTabletDriver +- For NVIDIA: nvidia-container-toolkit (optional, auto-detected) + +## Tested Configurations + +- ✅ Arch Linux + Podman + OpenTabletDriver +- ✅ NVIDIA GPU with proprietary drivers +- ✅ X11 desktop environment +- ✅ Huion/Wacom/XP-Pen tablets (via OpenTabletDriver) + +## Version History + +### v2.4 (2026-01-23) - **CURRENT** +- ✅ Added hidraw device detection and passthrough +- ✅ Created tablet diagnostic script +- ✅ Enhanced debug output for troubleshooting +- ✅ Updated management script with hidraw testing +- ✅ Improved error messages and user guidance +- ✅ **Fixed pressure sensitivity and tilt support** + +### v2.3 +- Pen tablet support with event device passthrough +- X11 input libraries +- Debug output for tablet devices + +### v2.0-2.2 +- Initial distrobox implementation +- GLEW building +- Font crash prevention +- NVIDIA support + +## Contributing + +Found an issue? Have improvements? Please open an issue or pull request. + +## License + +This setup script is provided as-is for use with legally obtained copies of Paintstorm Studio. + +## Credits + +- Paintstorm Studio by Sergey Kolesov +- Distrobox by Luca Di Maio +- OpenTabletDriver by OpenTabletDriver Contributors + +## Support + +For issues specific to: +- **Paintstorm Studio**: Contact Paintstorm support +- **Distrobox**: See https://distrobox.it/ +- **OpenTabletDriver**: See https://opentabletdriver.net/ +- **This setup script**: Open an issue in this repository + +--- + +**Happy painting! 🎨** @@ -0,0 +1,318 @@ +# Tablet Pressure & Tilt Fix for Paintstorm Distrobox + +## Problem Summary + +The original distrobox setup script only passed `/dev/input/event*` devices to the container, which is insufficient for tablet pressure and tilt support when using OpenTabletDriver (OTD). + +### Root Cause + +- **Missing hidraw devices**: OpenTabletDriver uses `/dev/hidraw*` devices to access raw HID data including pressure and tilt information +- **Device passthrough limitation**: The original script only detected devices in `/dev/input/` directory +- **Kernel driver blacklisting**: The system correctly blacklists `wacom` and `hid_uclogic` kernel drivers (via `/etc/modprobe.d/99-opentabletdriver.conf`), allowing OTD to handle the tablet directly + +## Solution + +The updated `paintstorm-install-distrobox.sh` script now: + +1. ✅ Detects and passes `/dev/hidraw*` devices to the container +2. ✅ Detects and passes `/dev/input/event*` devices to the container +3. ✅ Provides better diagnostics and error messages +4. ✅ Includes a dedicated diagnostic script (`test-tablet-pressure.sh`) +5. ✅ Shows hidraw device status in debug output + +## Changes Made + +### 1. Device Detection (Line ~50-100) + +**Before:** +```bash +INPUT_DEVICES=$(find /dev/input -name 'event*' -o -name 'js*' ...) +``` + +**After:** +```bash +# Detect /dev/input devices +INPUT_DEVICES=$(find /dev/input -name 'event*' ...) + +# Detect hidraw devices (CRITICAL for pressure/tilt) +HIDRAW_DEVICES=$(ls /dev/hidraw* 2>/dev/null || true) +for dev in $HIDRAW_DEVICES; do + if [ -c "$dev" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --device $dev" + fi +done +``` + +### 2. Container Setup (Line ~230-260) + +Added hidraw device verification in container setup: +- Checks for hidraw devices in container +- Adds user to `input` group for proper permissions +- Provides clear diagnostic messages + +### 3. Launch Wrapper (Line ~375-416) + +Enhanced debug output to show: +- Hidraw devices on host +- Hidraw devices in container +- Clear warning if devices are missing + +### 4. Management Script (Line ~509-577) + +Updated "Test tablet input" option to: +- Show hidraw devices on both host and container +- Provide diagnosis of device passthrough status +- Suggest fixes if devices are missing + +## How to Use + +### Step 1: Verify Prerequisites + +Make sure OpenTabletDriver is installed and running on the **host** system: + +```bash +# Check if otd-daemon is running +pgrep otd-daemon + +# If not running, start it +otd-daemon & + +# Detect your tablet +otd detect +``` + +### Step 2: Run Diagnostic Script + +Before recreating the container, run the diagnostic script to verify hidraw devices exist: + +```bash +./test-tablet-pressure.sh +``` + +**Expected output:** +- ✅ otd-daemon is running +- ✅ wacom/hid_uclogic drivers are NOT loaded +- ✅ hidraw devices found on host (e.g., `/dev/hidraw0`, `/dev/hidraw1`) +- ❌ No hidraw devices in container (this is expected before recreating) + +### Step 3: Recreate the Container + +**IMPORTANT**: You must recreate the container to apply the hidraw passthrough: + +```bash +# Run the updated install script +./paintstorm-install-distrobox.sh + +# When prompted, choose to recreate the container +# Answer 'y' to "Remove and recreate?" +``` + +The script will now: +1. Detect hidraw devices on host +2. Pass them to the container with `--device` flags +3. Verify they're accessible in the container + +### Step 4: Verify After Recreation + +Run the diagnostic again to confirm devices are passed through: + +```bash +./test-tablet-pressure.sh +``` + +**Expected output:** +- ✅ Hidraw devices on host: 2 (or more) +- ✅ Hidraw devices in container: 2 (or more) +- ✅ "Hidraw devices are present in container" + +### Step 5: Test in Paintstorm + +Launch Paintstorm and test pressure sensitivity: + +```bash +~/paintstorm +``` + +The debug output will show: +``` +=== Paintstorm Launch Debug === +... +Hidraw devices (pressure/tilt): + /dev/hidraw0 + /dev/hidraw1 +... +Container hidraw devices (pressure/tilt): + /dev/hidraw0 + /dev/hidraw1 +``` + +## Troubleshooting + +### Problem: No hidraw devices on host + +**Symptoms:** +```bash +$ ls /dev/hidraw* +ls: cannot access '/dev/hidraw*': No such file or directory +``` + +**Solutions:** +1. Make sure your tablet is connected +2. Start OpenTabletDriver: `otd-daemon &` +3. Detect tablet: `otd detect` +4. Check if wacom/hid_uclogic drivers are interfering: `lsmod | grep -E "wacom|hid_uclogic"` +5. Verify modprobe blacklist: `cat /etc/modprobe.d/99-opentabletdriver.conf` + +### Problem: Hidraw devices on host but not in container + +**Symptoms:** +- Host has hidraw devices +- Container does NOT have hidraw devices +- Diagnostic shows "0 hidraw devices in container" + +**Solution:** +You need to **recreate the container** with the updated script: +```bash +./paintstorm-install-distrobox.sh +# Choose 'y' to recreate when prompted +``` + +The container is created with device passthrough flags that cannot be changed after creation. + +### Problem: Permission denied on hidraw devices + +**Symptoms:** +- Hidraw devices exist but show permission errors +- Applications can't read from hidraw + +**Solutions:** +1. Add your user to the input group: + ```bash + sudo usermod -a -G input $USER + ``` +2. Logout and login for group changes to take effect +3. Temporarily fix permissions (until reboot): + ```bash + sudo chmod a+rw /dev/hidraw* + ``` +4. Create a udev rule for permanent fix: + ```bash + echo 'KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666", GROUP="input"' | sudo tee /etc/udev/rules.d/99-hidraw.rules + sudo udevadm control --reload-rules + sudo udevadm trigger + ``` + +### Problem: Pressure works on host but not in container + +**Checklist:** +1. ✅ Verify hidraw devices are in container: `distrobox enter paintstorm-legacy -- ls -la /dev/hidraw*` +2. ✅ Check OpenTabletDriver is running on host: `pgrep otd-daemon` +3. ✅ Verify tablet is detected: `otd detect` +4. ✅ Test with xinput in container: `distrobox enter paintstorm-legacy -- xinput list` +5. ✅ Check application-specific settings in Paintstorm (brush dynamics, pressure curve) + +## Additional Tools (Optional) + +You mentioned wondering about additional tools. Here's the verdict: + +### ❌ NOT Needed (will conflict with OTD): +- `libwacom` - Conflicts with OpenTabletDriver +- `wacom-tools` (xsetwacom, etc.) - Only for kernel wacom driver, not compatible with OTD +- `xf86-input-wacom` - X11 driver, conflicts with OTD + +### ✅ Already Included: +- `xinput` - For testing X11 input devices (already in script) +- `evtest` - For testing input events (already in script) +- `libxi6`, `libxtst6` - X11 input libraries (already in script) + +### ✅ Useful for Debugging: +```bash +# Install on host (not in container) +sudo pacman -S evtest input-utils + +# Test pressure events on host +sudo evtest /dev/input/by-id/*tablet* + +# Monitor hidraw data +sudo cat /dev/hidraw0 | hexdump -C +``` + +## Technical Details + +### Why hidraw is necessary + +OpenTabletDriver bypasses the kernel input subsystem and communicates directly with the tablet hardware via hidraw: + +1. **Kernel drivers disabled**: `wacom` and `hid_uclogic` are blacklisted +2. **OTD handles tablet**: otd-daemon reads raw HID reports from `/dev/hidraw*` +3. **Virtual input device**: OTD creates a virtual input device with processed data +4. **Pressure/tilt data**: Full pressure (0-8191) and tilt (X/Y angles) from raw HID reports + +### Device types explained + +- **`/dev/input/event*`**: Processed input events (keyboard, mouse, basic tablet) +- **`/dev/hidraw*`**: Raw HID device access (pressure, tilt, buttons, battery, etc.) +- **`/dev/input/by-id/*`**: Symlinks to event devices by hardware ID + +For full tablet functionality, **both** event and hidraw devices must be available in the container. + +## Testing Pressure & Tilt + +### Quick Test Commands + +```bash +# 1. Check devices exist +ls -la /dev/hidraw* +ls -la /dev/input/by-id/*tablet* + +# 2. Run diagnostic +./test-tablet-pressure.sh + +# 3. Test in container +distrobox enter paintstorm-legacy -- xinput list + +# 4. Monitor events (requires sudo) +sudo evtest /dev/input/by-id/*tablet* +# Move pen and check for: +# - ABS_PRESSURE (0-8191) +# - ABS_TILT_X (-64 to 63) +# - ABS_TILT_Y (-64 to 63) +``` + +### In Paintstorm Studio + +1. Create a new canvas +2. Select a brush with pressure dynamics +3. Draw with varying pressure +4. Check if line thickness/opacity changes with pressure + +If pressure doesn't work: +- Check brush settings (enable pressure sensitivity) +- Verify pressure curve in brush dynamics +- Try different brushes to isolate the issue + +## Summary Checklist + +Before reporting issues, verify: + +- [ ] OpenTabletDriver is installed and running (`pgrep otd-daemon`) +- [ ] Tablet is detected (`otd detect`) +- [ ] Kernel drivers are blacklisted (`lsmod | grep -E "wacom|hid_uclogic"` returns nothing) +- [ ] Hidraw devices exist on host (`ls /dev/hidraw*`) +- [ ] Container was recreated with updated script +- [ ] Hidraw devices exist in container (`distrobox enter paintstorm-legacy -- ls /dev/hidraw*`) +- [ ] User is in input group (`groups | grep input`) +- [ ] Diagnostic script passes all checks (`./test-tablet-pressure.sh`) + +## References + +- OpenTabletDriver: https://opentabletdriver.net/ +- Distrobox Documentation: https://distrobox.it/ +- HID Protocol: https://www.usb.org/hid +- Issue thread: This repository + +--- + +**Version**: 2.4 (with hidraw support) +**Date**: 2026-01-23 +**Status**: ✅ Fixed @@ -50,36 +50,72 @@ fi # Detect input devices for pen tablet support echo "" echo -e "${BLUE}Detecting input devices...${NC}" + +# Build additional flags for container +ADDITIONAL_FLAGS="" + +# 1. Detect /dev/input devices (event*, js*, wacom*, tablet*) INPUT_DEVICES=$(find /dev/input -name 'event*' -o -name 'js*' -o -name '*wacom*' -o -name '*tablet*' 2>/dev/null | head -10) if [ -n "$INPUT_DEVICES" ]; then - echo -e "${GREEN}Found input devices:${NC}" - echo "$INPUT_DEVICES" - - # Build additional flags for container - ADDITIONAL_FLAGS="" + echo -e "${GREEN}Found /dev/input devices:${NC}" + echo "$INPUT_DEVICES" | sed 's/^/ /' + for dev in $INPUT_DEVICES; do if [ -c "$dev" ]; then ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --device $dev" fi done - - # Also add X11 socket - X11_SOCKET="/tmp/.X11-unix/X$(echo $DISPLAY | cut -d: -f2 | cut -d. -f1)" - if [ -S "$X11_SOCKET" ]; then - ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $X11_SOCKET:$X11_SOCKET" - fi - - # Add Xauthority if exists - if [ -f "$XAUTHORITY" ]; then - ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $XAUTHORITY:$XAUTHORITY" - elif [ -f "$HOME/.Xauthority" ]; then - ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $HOME/.Xauthority:$HOME/.Xauthority" - fi - - echo -e "${GREEN}Additional flags:${NC} $ADDITIONAL_FLAGS" else - echo -e "${YELLOW}No input devices found (check /dev/input/*)${NC}" - ADDITIONAL_FLAGS="" + echo -e "${YELLOW}No input devices found in /dev/input/${NC}" +fi + +# 2. Detect hidraw devices (CRITICAL for pressure/tilt with OpenTabletDriver) +echo "" +echo -e "${BLUE}Detecting hidraw devices (pressure/tilt data)...${NC}" +HIDRAW_DEVICES=$(ls /dev/hidraw* 2>/dev/null || true) +if [ -n "$HIDRAW_DEVICES" ]; then + echo -e "${GREEN}Found hidraw devices:${NC}" + echo "$HIDRAW_DEVICES" | sed 's/^/ /' + + for dev in $HIDRAW_DEVICES; do + if [ -c "$dev" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --device $dev" + echo -e "${GREEN} → Will pass $dev to container${NC}" + fi + done +else + echo -e "${YELLOW}⚠ No hidraw devices found!${NC}" + echo " This is normal if:" + echo " - Tablet is not connected" + echo " - OpenTabletDriver is not running (otd-daemon)" + echo "" + echo " If your tablet IS connected:" + echo " 1. Start OpenTabletDriver: otd-daemon" + echo " 2. Detect tablet: otd detect" + echo " 3. Re-run this script" +fi + +# 3. Add X11 socket +X11_SOCKET="/tmp/.X11-unix/X$(echo $DISPLAY | cut -d: -f2 | cut -d. -f1)" +if [ -S "$X11_SOCKET" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $X11_SOCKET:$X11_SOCKET" +fi + +# 4. Add Xauthority if exists +if [ -f "$XAUTHORITY" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $XAUTHORITY:$XAUTHORITY" +elif [ -f "$HOME/.Xauthority" ]; then + ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS --volume $HOME/.Xauthority:$HOME/.Xauthority" +fi + +# Summary +echo "" +if [ -n "$ADDITIONAL_FLAGS" ]; then + echo -e "${GREEN}Device passthrough configured successfully${NC}" + echo -e "${BLUE}Flags:${NC} $ADDITIONAL_FLAGS" | head -c 200 + echo "..." +else + echo -e "${YELLOW}No devices to pass through${NC}" fi echo "" @@ -227,17 +263,44 @@ sudo mkdir -p /usr/share/fonts/truetype sudo touch /usr/share/fonts/opentype/.paintstorm sudo touch /usr/share/fonts/truetype/.paintstorm -# Create input device symlinks if needed +# Check device access in container echo "" -echo "Checking input devices..." +echo "Checking device access..." + +# Check input devices if [ -d "/dev/input" ]; then echo "Input devices in container:" - ls -la /dev/input/by-id/ 2>/dev/null || echo "No input devices found" - + ls -la /dev/input/by-id/ 2>/dev/null || echo " No input devices found" + # Test xinput echo "" echo "Testing xinput..." - xinput list 2>/dev/null || echo "xinput not available or no devices" + xinput list 2>/dev/null || echo " xinput not available or no devices" +fi + +# Check hidraw devices (critical for pressure/tilt) +echo "" +echo "Checking hidraw devices (pressure/tilt data)..." +if ls /dev/hidraw* &> /dev/null; then + ls -la /dev/hidraw* | sed 's/^/ /' + echo "" + echo "✓ Hidraw devices are available in container!" + echo " This enables pressure/tilt support with OpenTabletDriver" +else + echo "⚠ No hidraw devices found in container" + echo " Pressure/tilt may not work" + echo " Make sure OpenTabletDriver (otd-daemon) is running on host" +fi + +# Add user to input group for device access +echo "" +echo "Configuring device permissions..." +if ! groups | grep -q input; then + sudo usermod -a -G input $USER + echo "✓ Added user to 'input' group" + echo " You may need to logout/login for group changes to take effect" +else + echo "✓ User already in 'input' group" fi echo "" @@ -389,8 +452,12 @@ export XINPUT_GXI=1 echo "=== Paintstorm Launch Debug ===" echo "DISPLAY: $DISPLAY" echo "XAUTHORITY: ${XAUTHORITY:-$HOME/.Xauthority}" -echo "Input devices available:" -ls -la /dev/input/by-id/ 2>/dev/null || echo "No input devices found" +echo "" +echo "Input devices:" +ls -la /dev/input/by-id/ 2>/dev/null | grep -i -E "(tablet|wacom|pen|huion)" || echo " No tablet devices found" +echo "" +echo "Hidraw devices (pressure/tilt):" +ls -la /dev/hidraw* 2>/dev/null || echo " No hidraw devices (pressure/tilt won't work!)" echo "===============================" # Launch Paintstorm @@ -406,10 +473,15 @@ distrobox-enter -n paintstorm-legacy -- bash -c " export XINPUT_GXI=1 # Debug container devices + echo '' echo 'Container input devices:' - ls -la /dev/input/by-id/ 2>/dev/null || echo 'No input devices in container' + ls -la /dev/input/by-id/ 2>/dev/null | grep -i -E '(tablet|wacom|pen|huion)' || echo ' No tablet devices in container' + echo '' + echo 'Container hidraw devices (pressure/tilt):' + ls -la /dev/hidraw* 2>/dev/null || echo ' No hidraw devices (pressure/tilt will NOT work!)' + echo '' echo 'xinput list:' - xinput list 2>/dev/null || echo 'xinput not available' + xinput list 2>/dev/null | grep -i -E '(tablet|wacom|pen|huion|stylus)' || echo ' No tablet in xinput' cd /usr/share/paintstorm exec ./Paintstorm \"\$@\" @@ -491,9 +563,16 @@ EOF fi echo "" echo -e "${BLUE}Debugging Tablet Support:${NC}" - echo " 1. Check input devices: ls -la /dev/input/by-id/" - echo " 2. Test xinput: xinput list" - echo " 3. Run with debug: WACOMDEBUG=1 $WRAPPER_SCRIPT" + echo " 1. Run diagnostic: ./test-tablet-pressure.sh" + echo " 2. Check input devices: ls -la /dev/input/by-id/" + echo " 3. Check hidraw devices: ls -la /dev/hidraw*" + echo " 4. Test xinput: xinput list" + echo " 5. Run with debug: WACOMDEBUG=1 $WRAPPER_SCRIPT" + echo "" + echo -e "${YELLOW}Important for Pressure/Tilt:${NC}" + echo " • Make sure OpenTabletDriver is running: otd-daemon" + echo " • Hidraw devices must be present on host AND in container" + echo " • Run './test-tablet-pressure.sh' to diagnose issues" echo "" else @@ -553,14 +632,42 @@ case $choice in 4) echo "=== Testing tablet input ===" echo "" - echo "Host system devices:" - ls -la /dev/input/by-id/ 2>/dev/null || echo "No input devices found" + echo "HOST SYSTEM:" + echo "------------" + echo "Input devices:" + ls -la /dev/input/by-id/ 2>/dev/null | grep -i -E "(tablet|wacom|pen|huion)" || echo " No tablet devices found" + echo "" + echo "Hidraw devices (pressure/tilt):" + ls -la /dev/hidraw* 2>/dev/null || echo " No hidraw devices found" + echo "" + echo "CONTAINER:" + echo "----------" + echo "Input devices:" + distrobox enter $CONTAINER_NAME -- bash -c "ls -la /dev/input/by-id/ 2>/dev/null | grep -i -E '(tablet|wacom|pen|huion)' || echo ' No tablet devices found'" echo "" - echo "Container devices:" - distrobox enter $CONTAINER_NAME -- bash -c "ls -la /dev/input/by-id/ 2>/dev/null || echo 'No input devices found'" + echo "Hidraw devices (pressure/tilt):" + distrobox enter $CONTAINER_NAME -- bash -c "ls -la /dev/hidraw* 2>/dev/null || echo ' No hidraw devices found'" echo "" echo "XInput in container:" - distrobox enter $CONTAINER_NAME -- bash -c "xinput list 2>/dev/null || echo 'XInput not available'" + distrobox enter $CONTAINER_NAME -- bash -c "xinput list 2>/dev/null | grep -i -E '(tablet|wacom|pen|huion)' || echo ' No tablet in xinput'" + echo "" + echo "DIAGNOSIS:" + HOST_HIDRAW=$(ls /dev/hidraw* 2>/dev/null | wc -l) + CONTAINER_HIDRAW=$(distrobox enter $CONTAINER_NAME -- bash -c "ls /dev/hidraw* 2>/dev/null | wc -l" 2>/dev/null || echo 0) + echo " Host hidraw count: $HOST_HIDRAW" + echo " Container hidraw count: $CONTAINER_HIDRAW" + if [ "$HOST_HIDRAW" -gt 0 ] && [ "$CONTAINER_HIDRAW" -eq 0 ]; then + echo "" + echo " ✗ PROBLEM: Hidraw devices on host but not in container!" + echo " You need to recreate the container to pass hidraw devices" + elif [ "$HOST_HIDRAW" -eq 0 ]; then + echo "" + echo " ✗ PROBLEM: No hidraw devices on host" + echo " Make sure OpenTabletDriver is running: otd-daemon" + elif [ "$CONTAINER_HIDRAW" -gt 0 ]; then + echo "" + echo " ✓ Hidraw devices present in container - pressure/tilt should work!" + fi ;; 5) echo "=== Fixing tablet permissions ===" @@ -0,0 +1,206 @@ +#!/bin/bash +# Tablet Pressure & Tilt Diagnostic Script +# Tests if pressure sensitivity and tilt are being reported on host and container + +set -e + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +CONTAINER_NAME="paintstorm-legacy" + +echo "==========================================" +echo "Tablet Pressure & Tilt Diagnostic" +echo "==========================================" +echo "" + +# Check if running as root +if [ "$EUID" -eq 0 ]; then + echo -e "${RED}Error: Don't run this as root${NC}" + exit 1 +fi + +echo -e "${BLUE}=== HOST SYSTEM CHECK ===${NC}" +echo "" + +# 1. Check for OpenTabletDriver +echo -e "${YELLOW}1. Checking OpenTabletDriver status...${NC}" +if pgrep -x "otd-daemon" > /dev/null; then + echo -e "${GREEN}✓ otd-daemon is running${NC}" +else + echo -e "${RED}✗ otd-daemon is NOT running${NC}" + echo " Start it with: otd-daemon" +fi + +if command -v otd &> /dev/null; then + echo -e "${GREEN}✓ OpenTabletDriver is installed${NC}" + otd detect 2>/dev/null || echo " Run 'otd detect' to detect your tablet" +else + echo -e "${YELLOW}⚠ OpenTabletDriver CLI not found${NC}" +fi + +echo "" + +# 2. Check kernel drivers +echo -e "${YELLOW}2. Checking kernel driver status...${NC}" +if lsmod | grep -q "wacom"; then + echo -e "${RED}⚠ wacom kernel driver is loaded (should be blacklisted)${NC}" +else + echo -e "${GREEN}✓ wacom driver is not loaded${NC}" +fi + +if lsmod | grep -q "hid_uclogic"; then + echo -e "${RED}⚠ hid_uclogic kernel driver is loaded (should be blacklisted)${NC}" +else + echo -e "${GREEN}✓ hid_uclogic driver is not loaded${NC}" +fi + +if [ -f "/etc/modprobe.d/99-opentabletdriver.conf" ]; then + echo -e "${GREEN}✓ OpenTabletDriver modprobe config exists${NC}" + cat /etc/modprobe.d/99-opentabletdriver.conf | sed 's/^/ /' +else + echo -e "${YELLOW}⚠ No modprobe config found at /etc/modprobe.d/99-opentabletdriver.conf${NC}" +fi + +echo "" + +# 3. List all input devices +echo -e "${YELLOW}3. Host input devices:${NC}" +echo "" +echo " /dev/input/event* devices:" +ls -la /dev/input/event* 2>/dev/null | head -10 | sed 's/^/ /' || echo " None found" + +echo "" +echo " /dev/input/by-id/ (tablet devices):" +ls -la /dev/input/by-id/ 2>/dev/null | grep -i -E "(tablet|wacom|huion|xp-pen|gaomon)" | sed 's/^/ /' || echo " No tablet devices found" + +echo "" + +# 4. List hidraw devices (CRITICAL for pressure/tilt) +echo -e "${YELLOW}4. Host hidraw devices (contains pressure/tilt data):${NC}" +if ls /dev/hidraw* &> /dev/null; then + ls -la /dev/hidraw* | sed 's/^/ /' + echo "" + echo " Detailed hidraw info:" + for dev in /dev/hidraw*; do + if [ -c "$dev" ]; then + echo " $dev:" + # Try to get device name + if [ -d "/sys/class/hidraw/$(basename $dev)/device" ]; then + NAME=$(cat /sys/class/hidraw/$(basename $dev)/device/uevent 2>/dev/null | grep "HID_NAME=" | cut -d'=' -f2) + if [ -n "$NAME" ]; then + echo " Name: $NAME" + fi + fi + fi + done +else + echo -e "${RED} ✗ No hidraw devices found!${NC}" + echo " This is the main issue - OpenTabletDriver needs hidraw devices for pressure/tilt" +fi + +echo "" + +# 5. Test evtest if available +echo -e "${YELLOW}5. Testing event devices with evtest...${NC}" +if command -v evtest &> /dev/null; then + echo " Available tablet event devices:" + TABLET_EVENTS=$(ls /dev/input/by-id/*tablet* /dev/input/by-id/*pen* 2>/dev/null | head -3) + if [ -n "$TABLET_EVENTS" ]; then + echo "$TABLET_EVENTS" | sed 's/^/ /' + echo "" + echo " To test pressure manually:" + echo " sudo evtest /dev/input/by-id/[your-tablet-device]" + echo " Then move the pen and check for ABS_PRESSURE events" + else + echo " No tablet event devices found in /dev/input/by-id/" + fi +else + echo -e "${YELLOW} evtest not installed. Install with: sudo pacman -S evtest${NC}" +fi + +echo "" + +# 6. Check xinput on host +echo -e "${YELLOW}6. Host XInput devices:${NC}" +if command -v xinput &> /dev/null; then + xinput list 2>/dev/null | grep -i -E "(tablet|wacom|huion|pen|stylus|xp-pen|gaomon)" | sed 's/^/ /' || echo " No tablet devices found in xinput" +else + echo " xinput not available on host" +fi + +echo "" +echo "" + +# Container checks +echo -e "${BLUE}=== CONTAINER CHECK ===${NC}" +echo "" + +if ! distrobox list | grep -q "$CONTAINER_NAME"; then + echo -e "${RED}Container '$CONTAINER_NAME' not found!${NC}" + echo "Run paintstorm-install-distrobox.sh first" + exit 1 +fi + +echo -e "${YELLOW}7. Container input devices:${NC}" +echo "" +echo " /dev/input/event* devices in container:" +distrobox enter "$CONTAINER_NAME" -- bash -c "ls -la /dev/input/event* 2>/dev/null | head -10" | sed 's/^/ /' || echo " None found" + +echo "" +echo " /dev/input/by-id/ in container:" +distrobox enter "$CONTAINER_NAME" -- bash -c "ls -la /dev/input/by-id/ 2>/dev/null | grep -i -E '(tablet|wacom|huion|xp-pen|gaomon)'" | sed 's/^/ /' || echo " No tablet devices found" + +echo "" + +echo -e "${YELLOW}8. Container hidraw devices (CRITICAL):${NC}" +distrobox enter "$CONTAINER_NAME" -- bash -c "ls -la /dev/hidraw* 2>/dev/null" | sed 's/^/ /' || echo -e "${RED} ✗ No hidraw devices in container!${NC}\n This is the problem - hidraw devices are not being passed through" + +echo "" + +echo -e "${YELLOW}9. Container XInput devices:${NC}" +distrobox enter "$CONTAINER_NAME" -- bash -c "xinput list 2>/dev/null | grep -i -E '(tablet|wacom|huion|pen|stylus|xp-pen|gaomon)'" | sed 's/^/ /' || echo " No tablet devices found in container xinput" + +echo "" +echo "" + +# Summary +echo -e "${BLUE}=== DIAGNOSIS SUMMARY ===${NC}" +echo "" + +HOST_HIDRAW=$(ls /dev/hidraw* 2>/dev/null | wc -l) +CONTAINER_HIDRAW=$(distrobox enter "$CONTAINER_NAME" -- bash -c "ls /dev/hidraw* 2>/dev/null | wc -l" || echo 0) + +echo "Host hidraw devices: $HOST_HIDRAW" +echo "Container hidraw devices: $CONTAINER_HIDRAW" +echo "" + +if [ "$HOST_HIDRAW" -gt 0 ] && [ "$CONTAINER_HIDRAW" -eq 0 ]; then + echo -e "${RED}✗ PROBLEM IDENTIFIED:${NC}" + echo " Hidraw devices exist on host but are NOT passed to container" + echo " This is why pressure/tilt doesn't work!" + echo "" + echo -e "${YELLOW}SOLUTION:${NC}" + echo " Update paintstorm-install-distrobox.sh to pass hidraw devices:" + echo " 1. Add hidraw device detection (around line 53)" + echo " 2. Pass them with --device flag to container" + echo " 3. Ensure proper permissions" +elif [ "$HOST_HIDRAW" -eq 0 ]; then + echo -e "${RED}✗ NO HIDRAW DEVICES ON HOST:${NC}" + echo " Your tablet might not be connected or OpenTabletDriver isn't detecting it" + echo " Try: otd detect" +elif [ "$CONTAINER_HIDRAW" -gt 0 ]; then + echo -e "${GREEN}✓ Hidraw devices are present in container${NC}" + echo " If pressure still doesn't work, the issue is elsewhere (app config, etc.)" +fi + +echo "" +echo -e "${BLUE}Next steps:${NC}" +echo " 1. Connect your tablet and ensure otd-daemon is running" +echo " 2. Run this script again to verify hidraw devices exist" +echo " 3. Update the distrobox script to pass hidraw devices" +echo " 4. Recreate the container with the updated script" +echo ""