开发者

Touch screen relative coordinates

I've rotated X environment with xrandr -o left|right|inverse|normal on touch screen device. Everything is working OK beside touch. When moving finger on the screen, it takes absolute coordinates of finger and moves cursor in opposite direction if the rotation is inverse. So if I slide up actually it slides down. So is there a way to configure Touch screen input to read relative coordinates not开发者_如何学运维 absolute. Touch screen driver is evdev.

Regards, Levon


Relative/Absolute still won't do what you want, so long as the orientation isn't changed too. There is no generic mechanism to tell the X server to interpret pointer devices in a different orientations. You'll need to somehow get the underlying device to report differently. There is a generic mechanism for communicating with the underlying device, however.

I have a Wacom stylus built in to my laptop. To restore normal orientation, I can do the following:

xsetwacom set "stylus" Rotate NONE

which directly talks to the underlying driver. I can also do the following:

xinput set-int-prop stylus 'Wacom Rotation' '8' 0

which communicates with the X driver via XInput "properties" to do the same thing.

The "evdev" is fortunately one that does allow such remapping.

xinput list, in addition to the stylus shows my laptop's trackpoint and an external mouse which are both run via evdev:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ stylus                                    id=6    [slave  pointer  (2)]
⎜   ↳ eraser                                    id=7    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=14   [slave  pointer  (2)]
⎜   ↳ HID 0430:0100                             id=11   [slave  pointer  (2)]
...

xinput list-props 'HID 0430:0100'

Device 'HID 0430:0100':
        Device Enabled (135):   1
        Device Accel Profile (251):     0
        Device Accel Constant Deceleration (252):       1.000000
        Device Accel Adaptive Deceleration (254):       1.000000
        Device Accel Velocity Scaling (255):    10.000000
        Evdev Reopen Attempts (299):    10
        Evdev Axis Inversion (301):     0, 0
        Evdev Axes Swap (303):  0
        Axis Labels (304):      "Rel X" (143), "Rel Y" (144)
        Button Labels (305):    "Button Left" (136), "Button Middle" (137), "Button Right" (138), "Button Wheel Up" (139), "Button Wheel Down" (140)
        Evdev Middle Button Emulation (306):    2
        Evdev Middle Button Timeout (307):      50
        Evdev Wheel Emulation (308):    0
        Evdev Wheel Emulation Axes (309):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (310):    10
        Evdev Wheel Emulation Timeout (311):    200
        Evdev Wheel Emulation Button (312):     4
        Evdev Drag Lock Buttons (313):  0

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 1 inverts my external mouse.

To set to normal:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 0 0
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 0

Rotated by 90 degrees:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 0
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 1

Inverted:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 1 1
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 0

Rotated by 90 degrees the other way:

xinput set-int-prop 'HID 0430:0100' 'Evdev Axis Inversion' 8 0 1
xinput set-int-prop 'HID 0430:0100' 'Evdev Axes Swap' 8 1

You will need some way of picking out what device to put the properties on, of course.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜