[Kubuntu 9.04] トラックポイントの最適化

2009/07/25PC::Linux/BSD

Kubuntu 9.04/amd64 環境下でトラックポイントデバイスをWindows環境下と同様に利用できるようにしたときのメモ。

環境

  • Kubuntu 9.04(Jaunty Jackalope)/amd64 Desktop
  • Space Saver II Keyboard

設定

HALのトラックポイント用設定ファイル

Kubuntu 8.04を利用していたときにはxorg.confにトラックポイントの設定を記述していたが、Kubuntu 9.04では、/etc/hal/fdi/policy/以下に設定ファイルを置くようになっている。

上記記事を参考に/etc/hal/fdi/policy/trackpoint.fdiを作成

<match key="info.product" string="TPPS/2 IBM TrackPoint">
   <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
   <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
   <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
   <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
   <merge key="input.x11_options.ZAxisMapping" type="string">4 5</merge>
   <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
</match>

これでセンターボタン押下時にトラックポイントを上下左右に動かすことで縦横のスクロールが可能となる。

トラックポイントの感度とスピードの調整

上記記事によると、/sys/devices/platform/i8042/serio? 以下にあるspeedとsensitivityの値を変更してやればいいらしい。が、再起動すると初期化されてしまうため、自動的に最適な値にしてやるようにします。

以下のような方針にて設定を行います。

  1. 私の環境では/sys/devices/platform/i8042/serio1/以下のspeedとsensitiveに対して設定をしてやる必要がありますが、serioの後の数字は固定とは限らないため、udevでマウスデバイスを固定する
  2. udevで固定されたデバイスに対してudevadmを使ってトラックポイントのserio?を調べる
  3. root権限で設定を行わなければならないのでrc.localに設定を記述する
トラックポイントデバイスのためのudevルールの作成

まずはdmesgでトラックポイントデバイスの情報を取得します。

$ dmesg | grep input | grep TPPS/2
[    9.004286] input: TPPS/2 IBM TrackPoint as /devices/platform/i8042/serio1/input/input10

続いて、この情報を元にudevadmを用いて*1デバイスの詳細情報を取得します。マウスの実態はinput10ディレクトリ以下のmouse?になるので、それに対する情報を取得する点に注意してください。

udevadm info -a -p /sys/devices/platform/i8042/serio1/input/input10/mouse3/

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device     
found, all possible attributes in the udev rules key format.         
A rule to match, can be composed by the attributes of the device     
and the attributes from one single parent device.                    

  looking at device '/devices/platform/i8042/serio1/input/input10/mouse3':
    KERNEL=="mouse3"                                                      
    SUBSYSTEM=="input"                                                    
    DRIVER==""                                                            

  looking at parent device '/devices/platform/i8042/serio1/input/input10':
    KERNELS=="input10"                                                    
    SUBSYSTEMS=="input"                                                   
    DRIVERS==""                                                           
    ATTRS{name}=="TPPS/2 IBM TrackPoint"                                  
    ATTRS{phys}=="isa0060/serio1/input0"                                  
    ATTRS{uniq}==""                                                       
    ATTRS{modalias}=="input:b0011v0002p000Ae0000-e0,1,2,k110,111,112,r0,1,amlsfw"

  looking at parent device '/devices/platform/i8042/serio1':
    KERNELS=="serio1"
    SUBSYSTEMS=="serio"
    DRIVERS=="psmouse"
    ATTRS{description}=="i8042 AUX port"
    ATTRS{modalias}=="serio:ty01pr00id00ex00"
    ATTRS{bind_mode}=="auto"
    ATTRS{sensitivity}=="192"
    ATTRS{speed}=="97"
    ATTRS{inertia}=="6"
    ATTRS{reach}=="10"
    ATTRS{draghys}=="255"
    ATTRS{mindrag}=="20"
    ATTRS{thresh}=="8"
    ATTRS{upthresh}=="255"
    ATTRS{ztime}=="38"
    ATTRS{jenks}=="135"
    ATTRS{press_to_select}=="0"
    ATTRS{skipback}=="0"
    ATTRS{ext_dev}=="1"
    ATTRS{protocol}=="TPPS/2"
    ATTRS{rate}=="100"
    ATTRS{resolution}=="200"
    ATTRS{resetafter}=="5"
    ATTRS{resync_time}=="0"

  looking at parent device '/devices/platform/i8042':
    KERNELS=="i8042"
    SUBSYSTEMS=="platform"
    DRIVERS=="i8042"
    ATTRS{modalias}=="platform:i8042"

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""

ここから、udevルールに使えそうな値を選んでルールを作ります。

/etc/udev/rules.d/99-local.rules

# udev rule for IBM TrackPoint IV
KERNEL=="mouse?", SUBSYSTEM=="input", ATTRS{name}=="TPPS/2 IBM TrackPoint", NAME="input/%k", SYMLINK+="input/tp4"

これで、/dev/input/tp4にトラックポイントデバイスが作成されます。

rc.localルールにトラックポイントの感度の調整を記述

udevで作成した/dev/input/tp4をudevadmを使用してディレクトリを抽出。その後、sensitivityとspeedを設定する。

/etc/rc.local

temp=`udevadm info -a -p \`udevadm info -q path -n /dev/input/tp4\` \
        | grep -v input \
        | grep looking \
        | sed -e 's/'\''/"/g' \
        | cut -d '"' -f 2 \
        | head -1`
Tp4Sensitivity=/sys/$temp/sensitivity
Tp4Speed=/sys/$temp/speed
# Configuare for TrackPoint Device
echo -n 192 > $Tp4Sensitivity
echo -n 97 > $Tp4Speed

上記の例ではsensitivityに192, speedに97を設定しています。

*1 : 他のディストリビューションではudevinfoの場合もあります。