»
S
I
D
E
B
A
R
«
Xorg 1.5 XInput Hotplug
October 4th, 2008 by kanru

之前寫過 Xorg 1.4 XInput Hotplug,提到 xorg, evdev 可以利用 hal 自動偵測硬體載入 driver 與設定參數,而即將 release 的 Xorg 1.5 又新增了一些可以在 hal policy 裡設定的參數:

  • input.x11_driver 可以設定這個 device 要使用的 driver,對應到 xorg.conf 的 Driver 選項
  • input.x11_options.

如今我的 /etc/hal/fdi/policy/10-x11-input.fdi 長這樣:

< ?xml version="1.0" encoding="ISO-8859-1"?>

  
      
          mouse
          
              evdev
          
      

<match key="info.capabilities" contains="input.keys">
    <merge key="input.x11_options.XkbRules" type="string">base</merge>
    <!-- If we're using Linux, we use evdev by default (falling back to
    keyboard otherwise). -->
    <merge key="input.x11_driver" type="string">keyboard</merge>
    <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
    <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
        string="Linux">
        <merge key="input.x11_driver" type="string">evdev</merge>
        <merge key="input.x11_options.XkbModel" type="string">evdev</merge>
    </match>
    <merge key="input.x11_options.XkbVariant" type="string" />
    <merge key="input.x11_options.XkbLayout" type="string">dvorak</merge>
    <merge key="input.x11_options.XkbOptions" type="string">ctrl:nocaps</merge>
</match>
<match key="info.capabilities" contains="input.touchpad">
    <merge key="input.x11_driver" type="string">synaptics</merge>
    <merge key="input.x11_options.Protocol" type="string">auto-dev</merge>
    <merge key="input.x11_options.SHMConfig" type="string">on</merge>
    <merge key="input.x11_options.LeftEdge" type="string">1100</merge>
    <merge key="input.x11_options.RightEdge" type="string">5800</merge>
    <merge key="input.x11_options.TopEdge" type="string">1600</merge>
    <merge key="input.x11_options.BottomEdge" type="string">4200</merge>
    <merge key="input.x11_options.HorizEdgeScroll" type="string">on</merge>
</match>

我的 /etc/X11/xorg.conf 只剩下必要的:

Section "Device"
    Identifier  "i915gm"
    Driver      "intel"
EndSection

Section "Screen" Identifier "Default Screen" Device "i915gm" DefaultDepth 24 SubSection "Display" Modes "1280x768" Virtual 1280 1792 EndSubSection EndSection

X 啟動的 log 如下:

(II) config/hal: Adding input device SynPS/2 Synaptics TouchPad
(II) LoadModule: "synaptics"

(II) Loading /usr/lib/xorg/modules/input//synaptics_drv.so (II) Module synaptics: vendor="X.Org Foundation" compiled for 1.4.99.906, module version = 0.15.0 Module class: X.Org XInput Driver ABI class: X.Org XInput driver, version 2.1 (II) Synaptics touchpad driver version 0.15.0 () Option "Device" "/dev/input/event8" () Option "SHMConfig" "on" () Option "LeftEdge" "1100" () Option "RightEdge" "5800" () Option "TopEdge" "1600" () Option "BottomEdge" "4200" () Option "HorizEdgeScroll" "on" (--) SynPS/2 Synaptics TouchPad touchpad found () SynPS/2 Synaptics TouchPad: always reports core events (II) XINPUT: Adding extended input device "SynPS/2 Synaptics TouchPad" (type: MOUSE) (--) SynPS/2 Synaptics TouchPad touchpad found

未來各 distro 可以提供預設的 fdi 檔,常見的 input device 都可以隨插即用 :)


Comments are closed

»  Substance: WordPress   »  Style: Ahren Ahimsa
© Copyright 2004-2009 Kan-Ru Chen