Linux tablet: Issue with XInput/GHOST? #38190

Closed
opened 2014-01-13 13:01:56 +01:00 by Bastien Montagne · 8 comments

System Information
Debian testing amd64 (ATI HD5730m, radeon free driver 7.2, if that matters).

tablet: Genius G-Pen 450, with the wizardpen driver (0.8.2) and libxi6 (1.7.2).

Blender Version
Broken: current trunk (d785c64)
Worked: ???

Short description of error
Many "tablet" events have null pressure, even though the pen is down. The effects are not much noticeable, unless you disable all smoothing/simplifying of strokes in userprefs, and draw quick strokes - in these case, I get (converted) paths with zero-radius points in the middle of thick strokes (also visible as 'gaps' in 3D view GP drawing of strokes)!

Exact steps for others to reproduce the error
Attached (tmp.txt.zip) is an xtrace dump of a (very short) session of Blender, with this simple patch applied to X11's tablet event handling code:

index 3b12d91..e959014 100644
    - a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1154,6 +1154,10 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                                 * around tablet surface */
                          setTabletMode(this, window, data->deviceid);
 
+                               printf("%s: raw_x: %#010x, raw_y: %#010x, raw_p: %#010x\n",
+                                      __func__, data->axis_data- [x], data->axis_data- [x], data->axis_data[2]);
+                               fflush(stdout);
+
                          window->GetTabletData()->Pressure =
                                  data->axis_data[2] / ((float)m_xtablet.PressureLevels);```

In [tmp.txt.zip](https://archive.blender.org/developer/F67738/tmp.txt.zip), you can note correct tablet events handling, like eg:
```000:>:0167: Event MotionNotify(6) detail=Normal(0x00) time=0x045cf337 root=0x000002bb event=0x03600002 child=None(0x00000000) root-x=220 root-y=333 event-x=220 event-y=284 state=Mod2 same-screen=true(0x01)
000:<:0168:  8: XInputExtension-Request(131,30): QueryDeviceState device=0x0e
000:>:0168:84: Reply to QueryDeviceState: classes={class=button(0x01) #buttons=7 button states=0x00,- [x],0x00;},{class=valuator(0x02) mode=absolute, in proximity(0x01) valuator states=0x000014a9,0x000037a2,0x00000000;};
processEvent: raw_x: 0x000014a9, raw_y: 0x000037a2, raw_p: 0000000000```
…where values from `XDeviceMotionEvent.axis_data` (`processEvent` lines) match those of XInput replies (`valuator states=…`) - my device has no tilt nor wheel data, only x/y/pressure.

However, we have many lines where there are mismatches (either null values, or shifted values, like x having pressure value, and y and pressure being null in `XDeviceMotionEvent.axis_data`):
```000:<:0192:  8: XInputExtension-Request(131,30): QueryDeviceState device=0x0e
000:>:0192:84: Reply to QueryDeviceState: classes={class=button(0x01) #buttons=7 button states=0x02,- [x],0x00;},{class=valuator(0x02) mode=absolute, in proximity(0x01) valuator states=0x0000151d,0x0000378d,0x00000105;};
processEvent: raw_x: 0x00000105, raw_y: 0000000000, raw_p: 0000000000```

I don’t know how XInput is supposed to work, maybe this is normal, but at least to my newbie eyes it looks awkward!

Note I tried to use xtrace with Gimp/Inkscape, but these apps do not seem to use the same XInput (at least Gimp uses GDK3, which uses XIinput v2, xi2). Anyway, values returned by queries to the Xorg server seem always OK, so there is a glitch somewhere either in the client part of xinput, or in our own ghost code, imho.

PS: sorry for the long post!
**System Information** Debian testing amd64 (ATI HD5730m, radeon free driver 7.2, if that matters). tablet: Genius G-Pen 450, with the wizardpen driver (0.8.2) and libxi6 (1.7.2). **Blender Version** Broken: current trunk (d785c64) Worked: ??? **Short description of error** Many "tablet" events have null pressure, even though the pen is down. The effects are not much noticeable, unless you disable all smoothing/simplifying of strokes in userprefs, and draw quick strokes - in these case, I get (converted) paths with zero-radius points in the middle of thick strokes (also visible as 'gaps' in 3D view GP drawing of strokes)! **Exact steps for others to reproduce the error** Attached ([tmp.txt.zip](https://archive.blender.org/developer/F67738/tmp.txt.zip)) is an xtrace dump of a (very short) session of Blender, with this simple patch applied to X11's tablet event handling code: ```diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 3b12d91..e959014 100644 - a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1154,6 +1154,10 @@ GHOST_SystemX11::processEvent(XEvent *xe) * around tablet surface */ ``` setTabletMode(this, window, data->deviceid); ``` + printf("%s: raw_x: %#010x, raw_y: %#010x, raw_p: %#010x\n", + __func__, data->axis_data- [x], data->axis_data- [x], data->axis_data[2]); + fflush(stdout); + ``` window->GetTabletData()->Pressure = data->axis_data[2] / ((float)m_xtablet.PressureLevels);``` ``` In [tmp.txt.zip](https://archive.blender.org/developer/F67738/tmp.txt.zip), you can note correct tablet events handling, like eg: ```000:>:0167: Event MotionNotify(6) detail=Normal(0x00) time=0x045cf337 root=0x000002bb event=0x03600002 child=None(0x00000000) root-x=220 root-y=333 event-x=220 event-y=284 state=Mod2 same-screen=true(0x01) 000:<:0168: 8: XInputExtension-Request(131,30): QueryDeviceState device=0x0e 000:>:0168:84: Reply to QueryDeviceState: classes={class=button(0x01) #buttons=7 button states=0x00,- [x],0x00;},{class=valuator(0x02) mode=absolute, in proximity(0x01) valuator states=0x000014a9,0x000037a2,0x00000000;}; processEvent: raw_x: 0x000014a9, raw_y: 0x000037a2, raw_p: 0000000000``` …where values from `XDeviceMotionEvent.axis_data` (`processEvent` lines) match those of XInput replies (`valuator states=…`) - my device has no tilt nor wheel data, only x/y/pressure. However, we have many lines where there are mismatches (either null values, or shifted values, like x having pressure value, and y and pressure being null in `XDeviceMotionEvent.axis_data`): ```000:<:0192: 8: XInputExtension-Request(131,30): QueryDeviceState device=0x0e 000:>:0192:84: Reply to QueryDeviceState: classes={class=button(0x01) #buttons=7 button states=0x02,- [x],0x00;},{class=valuator(0x02) mode=absolute, in proximity(0x01) valuator states=0x0000151d,0x0000378d,0x00000105;}; processEvent: raw_x: 0x00000105, raw_y: 0000000000, raw_p: 0000000000``` I don’t know how XInput is supposed to work, maybe this is normal, but at least to my newbie eyes it looks awkward! Note I tried to use xtrace with Gimp/Inkscape, but these apps do not seem to use the same XInput (at least Gimp uses GDK3, which uses XIinput v2, xi2). Anyway, values returned by queries to the Xorg server seem always OK, so there is a glitch somewhere either in the client part of xinput, or in our own ghost code, imho. PS: sorry for the long post!
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'
Author
Owner

Added subscriber: @mont29

Added subscriber: @mont29
Author
Owner

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Can't redo this problem with Wacom Intuos 5

Can't redo this problem with Wacom Intuos 5

This issue was referenced by blender/blender-addons-contrib@75ab57efed

This issue was referenced by blender/blender-addons-contrib@75ab57efed93204659c626fa8d5aa94837984de4

This issue was referenced by 75ab57efed

This issue was referenced by 75ab57efed93204659c626fa8d5aa94837984de4
Author
Owner

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author
Owner

Closed by commit 75ab57efed.

Closed by commit 75ab57efed.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#38190
No description provided.