Kanru’s 探險日誌

這裡應該會放一些我每日遊覽的站台及一些心得,就當作是我的學習筆記吧^^。

Archive for the ‘xorg’ tag

Xorg 1.5 XInput Hotplug

without comments

之前寫過 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"?>
<deviceinfo version="0.2">
  <device>
      <match key="info.capabilities" contains="input.mouse">
          <merge key="input.x11_driver" type="string">mouse</merge>
          <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
              string="Linux">
              <merge key="input.x11_driver" type="string">evdev</merge>
          </match>
      </match>

    <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>
  </device>
</deviceinfo>

我的 /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 都可以隨插即用 :)

Written by Kanru Chen

October 4th, 2008 at 7:58 pm

Posted in 爬網探險

Tagged with , ,

X-Server 1.5.0 very sluggish

without comments

最近升到 xorg 1.5.0,某些操作 (terminal 快速更新) 會使 xserver 佔用非常多 cpu,看來是這個問題

Working on it … right now it looks like:

  • XShm pixmaps got accidentally reenabled in the course of Adam’s changes

  • Someone (maybe GTK, having tracked it down yet) is taking advantage
    of that by creating a shared pixmap and using it as the source for a composite operation.

  • That is not handled well in EXA and triggers migration of the destination back to system memory. (*)

– Owen

(*) One of the many cases where we’d be better off creating temporaries in video memory to avoid migration.

測測..

Written by Kanru Chen

September 18th, 2008 at 8:56 am

Posted in Programming, 爬網探險

Tagged with ,

Xorg 1.4 XInput Hotplug

with one comment

Xorg 1.4 開始支援 hal based 的 xinput hotplug,也就是說滑鼠跟鍵盤這些設備可以拔來拔去而不用在 xorg.conf 裡面設定,再加上越來越多 driver 可以 auto-configuration,xorg.conf 裡面的東西越來越少了。

xorg 的 evdev driver 是利用 linux kernel 的 evdev 支援,來使用滑鼠、鍵盤等多種設備,我的 Logitech V450 就一定要用 evdev 才能支援所有的按鍵。

無奈 Debian Sid 中的 Xorg 以及 evdev 都非常的新,但是一些升級的配套措施跟文件跟不上,導致最近發生許多問題,相關的 bug report 有 #443292#442316

今天終於把滑鼠鍵盤都設定好了,關鍵在於 hal 的設定跟 gnome 的設定。

首先是設定 hal,因為 hal 預設只設定了使用 evdev,但是沒有顧慮到非使用 us layout 的人,導致升級之後鍵盤 layout 大亂,目前暫時取消了這項設定,我們可以從 /usr/share/doc/hal/examples/10-x11-input.fdi 把設定撿回 /etc/hal/fdi/policy/,內容如下:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <!-- FIXME: Support tablets too. -->
    <match key="info.capabilities" contains="input.mouse">
      <merge key="input.x11_driver" type="string">mouse</merge>
      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
             string="Linux">
        <merge key="input.x11_driver" type="string">evdev</merge>
      </match>
    </match>

    <match key="info.capabilities" contains="input.keys">
      <!-- If we're using Linux, we use evdev by default (falling back to
           keyboard otherwise). -->
      <merge key="input.x11_driver" type="string">keyboard</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.xkb.rules" type="string">xorg</merge>
        <merge key="input.xkb.model" type="string">evdev</merge>
        <merge key="input.xkb.layout" type="string">dvorak</merge>
      </match>
    </match>

  </device>
</deviceinfo>

其中關於鍵盤 layout、model、rules 的設定是我加上去的。滑鼠不需更動即可 hotplug 使用。

接下來關鍵的地方是,如果你使用 gnome 的話,記得把 keyboard model 改成 evdev,如圖:

gnome keyboard setting

最後,xorg.conf 就可以清乾淨了:

Section "Device"
        Identifier      "intel"
        Driver          "intel"
        Option          "AccelMethod"     "XAA"
        Option          "XAANoOffScreenPixmaps" "True"
EndSection

Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/event9"
        Option          "Protocol"              "auto-dev"
        Option          "SHMConfig"             "on"
        Option          "LeftEdge"              "1100"
        Option          "RightEdge"             "5800"
        Option          "TopEdge"               "1600"
        Option          "BottomEdge"    "4200"
        Option          "HorizEdgeScroll" "on"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
        Option          "DPMS"
        DisplaySize     330 200
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        DefaultDepth    24
        SubSection "Display"
                Modes           "1280x768" "1024x768"
        EndSubSection
EndSection

Written by Kanru Chen

November 16th, 2007 at 2:55 am

Posted in Linux

Tagged with , , ,