2019年1月17日木曜日

lenovoのtrackpointのスピード調整

thinkpad x1 carbonにlinuxmint19を入れてみたらトラックポイントの感度がめちゃめちゃ良かったので変更しようと思ったお話.


linux mintともなればマウスのスピードとか感度を調整する方法がデフォルトで用意されているが,何故か今回は,それらがうまく行かなかったのでCUIから設定した.

ターミナルから

xinput list

とすると入力デバイス一覧が表示されるので,そこからトラックポイントのIDを探しましょう.

harumo@harumo-thinkpad-x1:~$ xinput list
⎡ Virtual core pointer                    id=2 [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              id=4 [slave  pointer  (2)]
⎜   ↳ TPPS/2 Elan TrackPoint                  id=12 [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              id=11 [slave  pointer  (2)]
⎣ Virtual core keyboard                    id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard              id=5 [slave  keyboard (3)]
    ↳ Power Button                            id=6 [slave  keyboard (3)]
    ↳ Video Bus                                id=7 [slave  keyboard (3)]
    ↳ Sleep Button                            id=8 [slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C          id=9 [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            id=10 [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                  id=13 [slave  keyboard (3)]

私のパソコンではid = 12なので,それを利用して

xinput list-props 12

とすると,

harumo@harumo-thinkpad-x1:~$ xinput list-props 12
Device 'TPPS/2 Elan TrackPoint':
Device Enabled (143): 1
Coordinate Transformation Matrix (145): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Natural Scrolling Enabled (286): 0
libinput Natural Scrolling Enabled Default (287): 0
libinput Scroll Methods Available (290): 0, 0, 1
libinput Scroll Method Enabled (291): 0, 0, 1
libinput Scroll Method Enabled Default (292): 0, 0, 1
libinput Button Scrolling Button (304): 2
libinput Button Scrolling Button Default (305): 2
libinput Middle Emulation Enabled (296): 0
libinput Middle Emulation Enabled Default (297): 0
libinput Accel Speed (298): 0.000000
libinput Accel Speed Default (299): 0.000000
libinput Accel Profiles Available (306): 1, 1
libinput Accel Profile Enabled (307): 1, 0
libinput Accel Profile Enabled Default (308): 1, 0
libinput Left Handed Enabled (300): 0
libinput Left Handed Enabled Default (301): 0
libinput Send Events Modes Available (263): 1, 0
libinput Send Events Mode Enabled (264): 0, 0
libinput Send Events Mode Enabled Default (265): 0, 0
Device Node (266): "/dev/input/event6"
Device Product ID (267): 2, 10
libinput Drag Lock Buttons (302): <no items>
libinput Horizontal Scroll Enabled (303): 1

が表示される.これは,トラックポイントで設定できる項目一覧なので
ここから,設定したい項目を下記のようにコマンドで設定する.

xinput set-prop [id] [property-id] [configuration]

とりあえず,スピードは以下の用にすると遅くできる.
harumo@harumo-thinkpad-x1:~$ xinput set-prop 12 145 1 0 0 0 1 0 0 0 3

再起動するとこの設定は消えてしまうので,.bashrcとかに
書き込んでおくといいと思うのです


また,センシティビティはxinputでは設定できなかったので
設定ファイルを作ることにより設定する.

   #! /bin/bash
   
   start() {
      echo -n 100 > /sys/devices/platform/i8042/serio1/serio2/sensitivity
   }
   
   stop() {
       echo "call when this service stopped"
   }
  
  case "$1" in
      start)
          start
          ;;
      stop)
          stop
          ;;
      restart)
          stop
          start
          ;;
      status)
          # code to check status of app comes here
          ;;
      *)
          echo "Usage: $0 {start|stop|status|restart}"
  esac
  
  exit 0

この設定を

/etc/init.d/trackpoint

ファイルを新しく作って,上の設定を書き込み,さらに

sudo /etc/init.d/trackpoint start

というコマンドを打つことで設定することができる.