AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1044910
Accepted
MelBourbon
MelBourbon
Asked: 2018-06-09 12:13:26 +0800 CST2018-06-09 12:13:26 +0800 CST 2018-06-09 12:13:26 +0800 CST

在 Acer Travelmate Spin B1 的旋转屏幕中将触控笔(笔)与触摸屏对齐

  • 772

我找到了一个脚本来将我的屏幕和触摸板向左旋转并恢复正常:

#!/bin/sh 

# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. 

rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')" 

# Using current screen orientation proceed to rotate screen and input tools. 

case "$rotation" in 
normal) 
#    -rotate to the left 
xrandr -o left 
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axes Swap" 1
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axis Inversion" 1 0
xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 1 0
;;
left) 
#    -rotate to normal 
xrandr -o normal 
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axes Swap" 0
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axis Inversion" 0 0
xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 0 0
;; 
esac

工作正常。但是,如果屏幕旋转,手写笔不起作用。我通过更改笔的坐标变换矩阵找到了一个潜在的解决方案:

xinput set-prop 'ELAN Touchscreen Pen Pen (0)' "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1

这工作正常,意味着如果屏幕方向正常并且我运行此命令

xinput list-props 'ELAN Touchscreen Pen Pen (0)' | grep "Coordinate Transformation Matrix"

导致

Coordinate Transformation Matrix (144): 0.000000, 1.000000, 0.000000, -1.000000, 0.000000, 1.000000, 0.000000, 0.000000, 1.000000

但是每次我在脚本中使用它或者如果我在屏幕以纵向模式定向时运行它时都会重置它,这意味着如果我运行

xinput list-props 'ELAN Touchscreen Pen Pen (0)' | grep "Coordinate Transformation Matrix"

在我运行脚本或以“左”方向运行后,我得到

Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000

并且手写笔在此更改方向下无法正常工作(左上等)

touchscreen acer touchpad stylus xinput
  • 1 1 个回答
  • 1114 Views

1 个回答

  • Voted
  1. Best Answer
    MelBourbon
    2018-06-10T12:33:44+08:002018-06-10T12:33:44+08:00

    似乎在屏幕旋转时笔的坐标变换矩阵有一个“重置”,这会覆盖命令。所以我在执行这些命令之间添加了一个睡眠时间,现在它工作正常。2 秒没有影响,因为在屏幕最终旋转之前需要这个时间

    新脚本:

    #!/bin/sh 
    
    # Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. 
    
    rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')" 
    
    # Using current screen orientation proceed to rotate screen and input tools. 
    
    case "$rotation" in 
    normal) 
    #    -rotate to the left 
    xrandr -o left 
    xinput set-prop "ELAN Touchscreen" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
    sleep 2
    xinput set-prop "ELAN Touchscreen Pen Pen (0)" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
    ;;
    left) 
    #    -rotate to normal 
    xrandr -o normal 
    xinput set-prop "ELAN Touchscreen" --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
    sleep 2
    xinput set-prop "ELAN Touchscreen Pen Pen (0)" --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
    ;; 
    esac
    
    • 1

相关问题

  • 是否支持 Synaptics 触摸板?

  • 如何修复我的鼠标中键被识别为鼠标左键?

  • Acer Aspire 4740 上的多点触控

  • Acer Aspire 1551 挂起后不会唤醒

  • 设置 3M 串行触摸屏

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve