多座配置/evdev
此頁面介紹了使用 evdev 的多終端的工作原理以及如何實現它。這種方法消除了對核心補丁的使用,並使用 evdev 協議配置了w:多終端。
Debian Sarge(但您也可以輕鬆使用其他 Linux 發行版)
影片介面卡
- 4 個 SiS 顯示卡(您也可以使用其他顯示卡,但它們並不總是與其他顯示卡組合工作)
輸入裝置
- 1 個 PS/2 鍵盤
- 1 個 PS/2 滑鼠
- 3 個 USB 鍵盤
- 3 個 USB 滑鼠
確保您的核心已編譯包含 evdev 模組。
您還需要安裝 udev,它提供了動態的 /dev 目錄,其中包含當前可用裝置的更新資訊。
apt-get install udev
udev 系統需要 2.6.12 或更高版本的核心。
1. 將以下行新增到 /etc/apt/sources.list 檔案中
http://www.winischhofer.net/sis/debian/stable ./
2. 更新軟體包資訊資料庫並安裝 x-driver-sis 軟體包
apt-get update apt-get install x-driver-sis
安裝熱插拔軟體包
apt-get update apt-get install hotplug
在繼續之前,我們需要確保輸入裝置(鍵盤和滑鼠)已正確檢測到。閱讀 /proc/bus/input/devices 檔案的內容,該檔案包含有關核心檢測到的裝置的詳細資訊。下面顯示了該檔案中的示例。我們只關注兩個欄位:裝置名稱,包含在以“N: Name=”開頭的行中,以及物理地址,顯示在以“P: Phys=”開頭的行中。
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41 N: Name="AT Translated Set 2 keyboard" P: Phys=isa0060/serio0/input0 H: Handlers=kbd event0 B: EV=120013 B: KEY=4 2000000 3802078 f840d001 f2ffffdf ffefffff ffffffff fffffffe B: MSC=10 B: LED=7 I: Bus=0011 Vendor=0002 Product=0005 Version=0000 N: Name="ImPS/2 Generic Wheel Mouse" P: Phys=isa0060/serio1/input0 H: Handlers=mouse0 event1 B: EV=7 B: KEY=70000 0 0 0 0 0 0 0 0 B: REL=103 I: Bus=0003 Vendor=0a81 Product=0101 Version=0110 N: Name="CHESEN USB Keyboard" P: Phys=usb-0000:00:10.2-1/input0 H: Handlers=kbd event2 B: EV=120003 B: KEY=10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe B: LED=7 I: Bus=0003 Vendor=0a81 Product=0101 Version=0110 N: Name="CHESEN USB Keyboard" P: Phys=usb-0000:00:10.2-1/input1 H: Handlers=kbd event3 B: EV=3 B: KEY=1f 0 20000 3878 d801d101 1e0000 0 0 0 I: Bus=0003 Vendor=04fc Product=0013 Version=06b0 N: Name="USB OpticalWheel Mouse" P: Phys=usb-0000:00:10.2-2/input0 H: Handlers=mouse1 event4 B: EV=7 B: KEY=70000 0 0 0 0 0 0 0 0 B: REL=103
請注意,該檔案似乎顯示了三個鍵盤的存在,即使在測量的系統上只有兩個鍵盤。產生額外裝置的原因是,許多 USB 鍵盤包含特殊鍵(例如多媒體控制鍵或網際網路快捷鍵),核心會將這些鍵檢測為屬於第二個鍵盤。輔助鍵盤的物理地址以“input1”結尾。我們將只處理主鍵盤,其地址以“input0”結尾。因此,關於物理地址為“usb-0000:00:10.2-1/input1”的輔助鍵盤的部分將被忽略。
下一步是安裝 XOrg 伺服器。
1. 備份並刪除 /etc/init.d/xfree-common 檔案。 2. 將以下行新增到 /etc/apt/sources.list 檔案中
deb http://people.debian.org/~nobse/xorg-x11/ sarge main deb-src http://people.debian.org/~nobse/xorg-x11/ sarge main
3. 安裝 xserver-xorg 軟體包
apt-get update apt-get install xserver-xorg apt-get upgrade
此配置將在多終端執行時使用。該檔案將根據終端數量新增額外的部分。對於每個終端,我們將建立滑鼠、鍵盤、圖形裝置、監視器、螢幕和佈局部分。例如,在具有四個終端的多終端中,該檔案將包含四個滑鼠部分、四個鍵盤部分,等等。
“Identifier”值不是必需的。它們可以更改為任何內容,只要名稱在整個檔案中保持一致即可。
物理地址(“Dev Phys”選項)可以從 /proc/bus/input/devices 檔案中獲取,如前所述。
以下是每種型別的部分的示例。
Section "InputDevice"
Identifier "Generic Keyboard 0"
Driver "kbd"
# Change the value of the "Dev Phys" option to the physical
# address of the corresponding keyboard, found in the file
# /proc/bus/input/devices .
Option "Protocol" "evdev"
Option "Dev Phys" "isa0060/serio0/input0"
# Configure your keyboard as usual
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
Option "CoreKeyboard"
EndSection
Section "InputDevice"
Identifier "Configured Mouse 0"
Driver "mouse"
# Change the value of the "Dev Phys" option to the physical
# address of the corresponding mouse, found in the file
# /proc/bus/input/devices .
Option "Protocol" "evdev"
Option "Dev Phys" "isa0060/serio1/input0"
# All mice should have "CorePointer"
Option "CorePointer"
Option "ZAxisMapping" "4 5"
EndSection
Section "Device"
Identifier "Generic Device 0"
Driver "sis"
Screen 0
# All cards must have an explicit BusID. The addresses may be
# obtained with "lspci | grep VGA". Be careful with the
# values, since lscpi displays hexadecimal addresses and XOrg
# expects decimal. For conversion, use
# "echo $((0xVALOR_HEXADECIMAL))".
BusID "PCI:1:0:0"
# This option disables VGA and VBE calls on IRQ 10, to avoid
# calls for a card interfering with the others. See also the
# file "xorg.conf.probe".
Option "NoInt10" "Yes"
# This SiS driver options prevent problems when switching
# virtual terminals or finishing the X server.
Option "RestoreBySetMode" "no"
EndSection
# These are default values. Configure your monitors as usual.
Section "Monitor"
Identifier "Generic Monitor 0"
HorizSync 30-60
VertRefresh 50-75
Option "DPMS"
EndSection
# The screen configuration is also illustrative, change it to your
# preference.
Section "Screen"
Identifier "Default Screen 0"
Device "Generic Device 0"
Monitor "Generic Monitor 0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Section "ServerLayout"
# The Identifier value will be used in the command-line call.
Identifier "Layout0"
Screen "Default Screen 0"
InputDevice "Generic Keyboard 0"
InputDevice "Configured Mouse 0"
Option "SingleCard"
EndSection
除了標準的 xorg.conf 外,我們還需要另一個配置檔案 xorg.conf.probe。在多終端執行時,我們停用了通道 10(IRQ 10)上的中斷,以避免 VGA(和 VESA VBE)對板的呼叫干擾其他板。但是,如果沒有這些呼叫,輔助板將不會初始化。為了解決這個問題,在系統啟動期間,XOrg 伺服器將使用 xorg.conf.probe 檔案執行。它將在測試期間使用啟用的 IRQ 10 呼叫探測這些卡,從而初始化它們。
要建立 xorg.conf.probe,請將 xorg.conf 作為基礎,刪除與主顯示卡相關的部分(主顯示卡在計算機啟動時由 BIOS 初始化)並將所有 NoInt10 選項切換為“No”。一個佈局就足夠了,只要它包含所有輔助卡。為了說明,以下是來自先前 xorg.conf 的 xorg.conf.probe 檔案的一些部分
# In all Device (graphics card) sections, toggle NoInt10 to:
Option "NoInt10" "no"
# Declare only one layout, and without the "SingleCard" option.
# All the secondary screens should be present. Their position
# (LeftOf, etc.) is not significant, nor the input devices.
Section "ServerLayout"
Identifier "probe"
Screen "Default Screen 1"
Screen "Default Screen 2" LeftOf "Default Screen 1"
Screen "Default Screen 3" LeftOf "Default Screen 2"
InputDevice "Generic Keyboard 1"
InputDevice "Configured Mouse 1"
EndSection
要執行探測,我們提供了 xorg-multiterminal 指令碼。它以 probeonly 模式執行 X 伺服器(檢查影片介面卡並退出),使用 xorg.conf.probe 作為配置檔案。如前所述,此步驟初始化了輔助影片卡。該檔案的內容為
file=/etc/X11/xorg.conf.probe [[ -f "$file" ]] && /usr/X11R6/bin/X -config "$file" -probeonly 2>/dev/null
將它儲存並設定可執行位,並將啟動系統配置為執行該指令碼。在 Debian 上,路徑應該是 /etc/init.d/xorg-multiterminal,有兩種配置系統的方法
- 透過 update-rc.d 命令。這對預設 Debian 初始化系統(sysv-rc)和 file-rc 軟體包的使用者都有效。
update-rc.d xorg-multiterminal start 70 S .
- 手動
在具有預設初始化系統的 Debian 系統上,建立一個符號連結
ln -s /etc/init.d/xorg-multiterminal /etc/rcS.d/S70xorg-multiterminal
在具有 file-rc 軟體包的 Debian 系統上,在 /etc/init.d/runlevel.conf 檔案的適當位置新增以下行
70 - S /etc/init.d/xorg-multiterminal
最後一步是配置登入管理器以啟動所有 X 伺服器。我們只配置 GDM。其他登入管理器,如 XDM 和 KDM,可以以類似的方式配置。
/etc/gdm/gdm.conf 檔案的“[servers]”部分應該有多個條目,如下面的四終端示例所示
[servers]
0=XServer0
1=XServer1
2=XServer2
3=XServer3
伺服器的名稱是任意的。必須為每個伺服器新增一個部分,其內容如下所示
[server-XServer0]
name=Standard server
command=/usr/X11R6/bin/X -br -audit 0 -layout Layout0 :0 vt7 -sharevts
flexible=true
[server-XServer1]
name=Standard server
command=/usr/X11R6/bin/X -br -audit 0 -layout Layout1 :1 vt8 -sharevts
flexible=true
[server-XServer2]
name=Standard server
command=/usr/X11R6/bin/X -br -audit 0 -layout Layout2 :2 vt9 -sharevts
flexible=true
[server-XServer3]
name=Standard server
command=/usr/X11R6/bin/X -br -audit 0 -layout Layout3 :3 vt10 -sharevts
flexible=true
啟動多終端時遇到的問題將記錄在 /var/log/Xorg.*.log 檔案中。每個終端的 X 伺服器都會建立自己的日誌檔案。