XFree 本地多用户 HOWTO

Svetoslav Slavtchev

2004 年 8 月

修订历史
修订版 1.42004-08-14修订者:SS
添加关于新的 IsolateDevice XFree/X.org 的一些信息,删除一些关于 ruby-2.6 的过时评论(必须删除更多 - linux-2.6 现在已稳定)
修订版 1.32003-11-11修订者:SS
Ruby-2.6 正在工作 :),同步到新的 BRuby,为 Gentoo 添加配置文件路径
修订版 1.22003-09-17修订者:SS
很多,很多东西。最主要的事情:XFree-PrefBusID v3,input.rc(和实验性服务 ruby_init),添加“已知限制”
修订版 1.12003-07-14修订者:SS
同步输入代理与示例,更多关于 ruby 的内容,更少的 Fix-Me,添加到视频兼容性
修订版 1.02003-05-13修订者:TP
初始版本,由 LDP 审阅。

本 HOWTO 解释了一种为最多 16 个用户获取可工作的、多用户的本地 X 用户 PC 系统的方法。它基于使用修改后的 Linux 内核,该内核支持多个独立用户。第二种方法不在此处介绍,但在其作者,先驱 Miguel Freitas 的网页上介绍。


目录
1. 简介
1.1. 关于 Backstreet Ruby/ Ruby
1.2. 关于本文档
1.3. 相关文档
1.4. 本文档的新版本
1.5. 版权和许可
1.6. 免责声明
1.7. 致谢/贡献者
1.8. 反馈/错误报告
2. 开始之前
2.1. 已知限制
2.2. XFree 配置文件
2.3. 重用 Xinerama 配置的 XFree
2.4. 二进制软件包
3. 安装内核
3.1. 安装 Backstreet Ruby/ Ruby-2.6 内核
3.2. 关于构建自己的内核的说明
3.3. 创建所需的设备文件
3.4. 关于使用多个 VT 和 VGA 控制台的说明
3.5. 键盘编号(检测顺序)
4. 设置 X 服务器
4.1. 我需要修改后的 X 服务器吗?
4.2. 安装和配置 XFree-PrefBusID
4.3. 创建符号链接
4.4. 将独立键盘与 XFree 一起使用
4.5. 将独立鼠标与 XFree 一起使用
4.6. 对于没有 DRI 的显卡
4.7. Nvidia GLX 和 DRI
5. 更多关于配置输入设备的信息
5.1. 查找真实设备
5.2. 将 hotplug 与 input.agentinput.rc 一起使用
5.3. 将 XFree 与事件接口支持一起使用
5.4. 使用 "Phys" 描述符和 USB 设备
6. 配置显示管理器
6.1. 配置 xdm 和 kdm
6.2. 配置 gdm
7. 调整
7.1. 使用独立的声卡
7.2. 自定义登录屏幕
7.3. 第一个 X 服务器配置文件
7.4. 显示管理器启动的 X 服务器数量
7.5. 动态切换 X 服务器的数量
8. 已知问题
8.1. 硬件问题
8.2. 软件问题
9. 关于一些发行版的特别说明
9.1. Mandrake
9.2. Red Hat
9.3. Debian
9.4. SuSE
10. 结束语
A. 视频兼容性列表
A.1. 完美工作的显卡对/三显卡组合
A.2. 可以工作,但存在一些小问题的显卡对/三显卡组合
B. 示例配置文件
B.1. XFree86
B.2. 显示管理器
B.3. 输入代理的配置文件
C. 脚本
C.1. hotplug: input.agent
C.2. hotplug: input.rc
C.3. hotplug & 支持事件设备的 XFree: input.agent
C.4. 使用 Nvidia libGL.so 启动 X 的包装器
C.5. 用于安装 Nvidia 驱动程序以便与 DRI 并行使用
D. 实验性 Backstreet Ruby 配置脚本/服务
D.1. README.ruby_init 解释了如何配置和使用该服务。
D.2. 全局配置文件 /etc/sysconfig/ruby.conf
D.3. ruby_init 服务 /etc/init.d/ruby_init
D.4. 修改后的 hotplug input.agent /etc/hotplug/input.agent

第 1 章。 简介

1.1. 关于 Backstreet Ruby/ Ruby

Backstreet Ruby 是 Linux 内核的内核补丁。它是 Ruby 内核树 到 Linux-2.4 的反向移植,Ruby 内核树由 Linux 控制台项目开发。Linux 控制台开发人员的目标是增强和重组 Linux 内核中的输入、控制台和帧缓冲子系统,以便它们可以彼此独立工作,并允许进行多桌面操作。所有这些都在基于开发 Linux-2.5 内核的 Ruby 内核树中完成。新的输入子系统和新的帧缓冲层已集成到 Linux-2.5 内核中,但由于 Linux 控制台项目的主要开发人员 James Simmons 正忙于完成 Linux-2.5 中帧缓冲层的重写,因此多桌面操作将不会集成到下一个稳定的 Linux 内核(Linux-2.6)中。

因此,Backstreet Ruby 将增强的输入子系统以及独立使用多个显卡和多个键盘的能力带到当前稳定的 Linux 内核(Linux-2.4),以便在单个 PC 系统上实现多个本地 XFree 用户。

您可以拥有多个独立的显卡和多个独立的鼠标,但是为了让多个用户与系统交互,他们也确实需要独立的键盘。多个独立的键盘是 Linux-2.4(以及未来的 Linux-2.6)所缺乏的功能,而这正是 Backstreet Ruby 为稳定的 Linux 内核 Linux-2.4 添加的功能。

将 Ruby 反向移植到 Linux-2.4 的全部工作由 Aivils Stoss 完成。

Aivils 最近开始接触 Ruby,现在 Ruby 也已完全可用[1],因此如果您更喜欢 Linux-2.6 内核,则可以使用 Ruby 而不是 Linux-2.4 + Backstreet Ruby。

访问他的网站以获取有关补丁本身、当前状态、如何使用他的补丁构建内核或如何构建修改后的 XFree86 服务器的更多信息。

您可以在这里找到它: http://startx.times.lv

还有几个镜像站点

  1. 在美国

    http://people.debian.org/~andreas/aivils/

  2. 在德国

    http://www.schuldei.org/aivils/

  3. 在英国

    http://karlovo.demon.co.uk/~svetlio/aivils/

Linux 控制台项目的地址是: http://linuxconsole.sf.net


1.2. 关于本文档

本文档解释了如何使用 Backstreet Ruby/ Ruby-2.6 内核中增强的控制台/输入子系统为多个本地 XFree 用户配置您的系统。

我将使用

  • “Backstreet Ruby”或“BRuby”来指代到 Linux 2.4 的反向移植

  • “Ruby”或“Ruby-2.6”来指代 Linux 2.6 的原始 Ruby 内核树

除非另有说明,否则对 Backstreet Ruby 的每次提及都应可替换为 Ruby/ Ruby-2.6。

Note注意
 

目前,无法为多个控制台用户设置系统。

设置多个本地 XFree 用户有两种方法

  1. 修改内核以忽略来自 USB 键盘的输入,并将 USB 键盘的处理添加到修改后的 Xserver。此解决方案由 Miguel Freitas 开发。访问他的主题页面:http://cambuca.ldhs.cetuc.puc-rio.br/multiuser/,以获取有关如何设置此类系统的说明。

  2. 使用支持独立键盘的 Backstreet Ruby 内核。

我将专注于使用 Backstreet Ruby 内核为多个本地 XFree 用户配置系统,但是其中某些部分也可以在使用 Miguel Freitas 解决方案的系统上使用。

Note注意
 

本文档并非旨在替代 Backstreet Ruby 主页(http://startx.times.lv)上的现有文档,而是一个 HOWTO,解释了通往可工作的 X 多用户 PC 系统的道路。如果您遇到任何问题,可能需要查阅那里的更详细的信息。

本文档基于 Mandrake-Linux 发行版的文件系统布局,但我尝试使其与发行版无关,方法是包含有关与其他主流发行版(如 Debian、Red Hat 和 SuSE Linux)的差异的信息。


1.3. 相关文档


1.4. 本文档的新版本

您可以在 Linux 文档项目网站上找到本 How-To 的最新稳定版本

https://tldp.cn/HOWTO/XFree-Local-multi-user-HOWTO/

以及最新的不稳定版本

http://karlovo.demon.co.uk/~svetlio/ruby-contrib/how-to/XFree_local_multi-user-HOWTO/


1.5. 版权和许可

本文档,XFree-本地多用户-HOWTO,版权归 Svetoslav Slavtchev 所有,© 2003 年。

根据自由软件基金会发布的 GNU 自由文档许可证 1.1 版或任何更高版本的条款,允许复制、分发和/或修改本文档;不包含不变章节,不包含封面文本,也不包含封底文本。许可证副本可在 https://gnu.ac.cn/copyleft/fdl.html 获取。

Linux 是 Linus Torvalds 的注册商标。

NVIDIA 是 NVIDIA Corporation 的注册商标。


1.6. 免责声明

对于本文档的内容,概不承担任何责任。使用文中的概念、示例和信息,风险自负。其中可能存在错误和不准确之处,可能会对您的系统造成损害。请谨慎操作,尽管这种情况极不可能发生,但作者不承担任何责任。

所有版权均归其各自所有者所有,除非另有明确说明。本文档中术语的使用不应被视为影响任何商标或服务标记的有效性。特定产品或品牌的命名不应被视为认可。


1.7. 致谢/贡献者

在本文档中,我很高兴地感谢


1.8. 反馈/错误报告

非常欢迎您对本文档提出反馈。请将您的补充、评论和批评发送至以下电子邮件地址.

如果您在配置系统时遇到问题,请随时与我或 linuxcosnole 邮件列表联系。

请尽可能发送详细信息,最重要的信息将是(来自正在运行的 Backstreet Ruby 内核)

  • dmesg 的输出

  • lsmod 的输出

  • cat /proc/bus/console/*/* 的输出

  • 以下内容/proc/bus/input/devices

  • 以下内容/proc/bus/usb/devices

  • XFree 配置文件的内容/etc/X11/XF86Config(-4)

  • XFree86 日志文件的内容/var/log/XFree86.[n].log


第 2 章。 开始之前


2.1. 已知限制

XFree 不支持在多个显卡上进行 DRI 加速。获取多个加速 X 会话的唯一方法是使用 Nvidia 的闭源驱动程序和 GL 库,或者使用单张显卡使用 DRI,多张显卡使用 Nvidia 的闭源驱动程序。不依赖于 DRI 的 XFree 扩展应该可以工作。

大多数多头显卡只能用于单个用户/显示器。为了启动独立的 X 服务器,必须显式寻址头(大多数显卡都无法做到这一点)。应该可以使用具有显式可寻址头的显卡用于独立显示,但这尚未经过测试。

在以下情况下,可能会使用单张多头显卡用于多个独立显示器

  • 显卡的每个头都有不同的 PCI 总线 ID

    (例如 Matrox MMS G200/G450)

  • 显卡为每个头注册帧缓冲设备(仅适用于 Linux-2.5/2.6 补丁)

    请记住,XFree 帧缓冲驱动程序不支持加速和大多数 XFree 扩展。

    (例如 Matrox G400DH、G450DH、G550DH)

为独立屏幕/用户使用/配置独立设备非常困难或未被探索。输入设备、显卡和声卡 artsd 是例外。此类未探索领域的一些示例

  • 外部存储设备(USB/火线硬盘驱动器、CD/DVD 驱动器、ZIP/软盘驱动器、记忆棒...。

  • USB/火线打印机、扫描仪、相机...

如果您成功配置了此类设备以供多个用户独立使用,请与我们分享您是如何做到的。

Note注意
 

这并不意味着这些设备无法工作,而是每个用户都可以访问所有设备。

目前,在 Backstreet Ruby/ Ruby 下,您最多可以拥有 16 个虚拟终端(对于 2003 年 10 月 7 日之前发布的 Backstreet Ruby,则为 8 个)。这意味着,如果不配置 hotplug,如果您使用带有花哨键的 USB 键盘,则最多只能有 8 个独立用户(对于旧版本的 Backstreet Ruby - 4 个用户)。因此,如果您要为 4 个以上的用户设置系统,请务必使用 hotplug(即使是连接了 2 个 USB 键盘的系统,使用 hotplug 也会受益)。

如果您使用 hotplug,则 Backstreet Ruby / Ruby-2.6 的最大独立用户数为 16 个,旧版本 Backstreet Ruby 的最大独立用户数为 8 个。


2.2. XFree 配置文件

您应该配置每个显卡,使其与单个 X 服务器正常工作,这实际上超出了本文档的范围。您应该参考发行版附带的文档,但一些一般提示可能会有所帮助。

最简单的方法是使用相同类型的显示器和显卡,然后您可以仅配置第一个显卡/显示器对,为您拥有的显卡数量制作此配置文件的副本,然后仅调整配置文件中的 BusID “PCI:x:xx:x”字段。您可以在 lspci、XFree86 -scanpci -verbose 或其他类似的特定于发行版的工具的帮助下完成此操作。

如果您只有相同类型的显示器或显卡,则可以使用类似的方法。

大多数现代发行版还具有用于更轻松地配置 Xinerama 的高级工具。您可以使用这些工具来为 Xinerama 设置系统,然后使用此配置文件为不同的 X 服务器生成配置文件。您可以使用示例配置文件,用 Xinerama 中的相应部分替换显卡和显示器部分XFConfig-4文件。

其他有用的资源


2.3. 重用 Xinerama 配置的 XFree

如果您有一个为 Xinerama 配置的系统,则可以轻松调整 XFree 配置文件,以便您可以将其用于多个用户。

这将使您可以轻松地在多用户环境和 Xinerama 多显示器环境之间切换。

什么是 Xinerama,以及使用本 HOWTO 配置的系统与使用 XFree 中的 Xinerama 扩展的系统有何不同?

Xinerama 扩展在 4.0 版本中引入到 XFree86 系统中。Xinerama 是 XFree86 Release 6 Version 4.0 (X4.0) 的扩展,它允许应用程序和窗口管理器将两个(或多个)物理显示器用作一个大型虚拟显示器。如果未使用 Xinerama,则应用程序只能驻留在其中一个显示器上,并且无法在两者之间移动。窗口管理器必须经过专门编写才能支持两个显示器。借助 Xinerama,窗口管理器和应用程序不必经过专门编写即可支持 Xinerama 创建的更大的 “虚拟桌面”

恰恰相反,根据本 HOWTO 配置的系统的主要目标是为单个 PC 系统上的多个用户提供多个独立的显示器。

有关 Xinerama 的更多信息,请阅读


2.4. 二进制软件包

修改后的 XFree 服务器的二进制 rpm 目前可用于 Mandrake 8.2/ 9/ 9.1/ 9.2、Red Hat 8/ 9、SuSE 8.1。如果您正在运行其他基于 rpm 的发行版,请帮助我准备和重建软件包,以便其他用户可以获得预编译的二进制文件。目前,二进制 rpm 软件包未镜像,仅可从 http://karlovo.demon.co.uk/~svetlio/ruby-contrib 获取。

感谢 Andreas Schuldei,Debian Sid 的二进制软件包也可在 http://www.schuldei.org/debian/bruby 上获得,或作为 apt 存储库 “deb http://www.schuldei.org/debian/bruby ./ ”。


第 3 章。 安装内核

Note

Ruby-2.6 的安装并未完全涵盖,部分原因是与 Linux-2.6 内核的安装几乎没有差异,部分原因是我尚未收集到足够的 Ruby-2.6 经验,因此欢迎任何评论和问题。

如果您要使用 Ruby-2.6,请先安装不带 Ruby-2.6 补丁的 Linux-2.6,并为其配置您的系统,以避免跟踪实际上是由于 Linux-2.4 -> Linux-2.6 更改导致系统配置不正确的“Ruby-2.6 错误”。一个好的起点可能是 http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt"


3.1. 安装 Backstreet Ruby/ Ruby-2.6 内核

现在是安装内核的时候了。

最简单的方法是拉取已准备好的二进制内核;有一些发行版(目前只有 Mandrake 和 Debian)的软件包或源代码包,并在您的系统上重建它。

如果由于某种原因您无法使用它们或在使用它们时遇到问题,您也可以使用 Backstreet Ruby/ Ruby-2.6 补丁构建自己的内核。有关如何执行此操作的更多信息,请访问 Backstreet Ruby 页面,了解有关构建和安装内核的信息:http://startx.times.lv (或某些镜像站点) -> 文档 -> 快速内核。

(如果您是 Linux 新手,阅读 “Linux 内核 HOWTO”https://tldp.cn/HOWTO/Kernel-HOWTO.html,可能会非常有帮助。)

您可以在 http://karlovo.demon.co.uk/~svetlio/ruby-contrib/ 上找到 Mandrake 的二进制内核软件包。

Debian 二进制内核软件包可在 http://www.schuldei.org/debian/bruby 上获得,或作为 apt 存储库 “deb http://www.schuldei.org/debian/bruby ./ ”

Note注意
 

  • 如果您要使用 USB 输入设备,建议使用 hid 驱动程序而不是 usbkbd/ usbmouse。

  • 加载 hid 驱动程序后,您可能会收到以下错误消息

    [root@svetljo RPM]# modprobe hid
    modprobe: Can't locate module keybdev which is needed for hid
    [root@svetljo RPM]#

    原因是,在某些版本的 module-utils 软件包中,此依赖项是硬编码的,但可以覆盖,因此您应该通过将 “above hid usbcore” 添加到您的/etc/modules.conf


3.2. 关于构建自己的内核的说明

我想提一些事情,尽管我不会详细介绍,因为 Backstreet Ruby 页面上关于编译内核的内容讨论了此主题。

  1. 您必须遵循此顺序

    Input support
    Virtual Terminal support
    Console drivers
                

    才能使所有必需的选项都可用/可选。

  2. 您必须使用内置输入支持

    Input device support --> Input devices (needed for keyboard, mouse,..)
    Input device support --> Mouse support
                
  3. 我还建议您至少包含一个键盘(内置 - 而不是作为模块)。您也可以使用模块,但我发现能够使用键盘而不是尝试查找具有 ssh(或类似工具)的 PC 来加载所需的模块更安全。

    对于 AT/PS2 键盘,请启用(而不是模块)

    Input device support --> Serial i/o support
    Input device support --> i8042 PC Keyboard controller
    Input device support --> Keyboards
    Input device support --> AT keyboard support
                

    对于 USB 键盘,请启用(而不是模块)

    Input device support --> Keyboards
    USB support --> support for USB
    USB support --> USB Host Controller Drivers
    USB support --> USB Human Interface Device (full HID) support
    USB support --> HID input layer support
                
  4. 如果您是 Linux 新手,请不要尝试修补已修补的内核(像大多数发行版附带的内核这样的重度修补内核)。使用来自 www.kernel.org 的内核,并查看 Linux 内核 HOWTO

Note注意
 

在 Backstreet Ruby 中(Linux 2.4 内核的补丁)不支持帧缓冲设备,因此被禁用。

在 Ruby 中(Linux 2.6 内核的补丁)如果您想禁用/更改为 PS2 输入设备的模块支持,则必须首先激活/启用“常规设置 --> 删除内核功能(用于嵌入式系统)”


3.3. 创建所需的设备文件

如果您未使用 devfs 文件系统,则可能需要创建 Backstreet Ruby 内核中新的输入子系统所需的多个设备文件

Note注意
 

大多数当前的发行版应该已经提供了必要的设备文件,因此请尝试在不创建设备文件的情况下启动 Backstreet Ruby,如果您不缺少输入设备,请忽略此部分。任何附带 XFree-4.3.0 和 linux-2.4.20 的发行版都应该提供这些设备文件。

cd /dev
mkdir input.old
mv mouse js? input.old
mkdir input
cd input
mknod js0 c 13 0
mknod js1 c 13 1
mknod js2 c 13 2
mknod js3 c 13 3
mknod mouse0 c 13 32
mknod mouse1 c 13 33
mknod mouse2 c 13 34
mknod mouse3 c 13 35
mknod mice c 13 63
mknod event0 c 13 64
mknod event1 c 13 65
mknod event2 c 13 66
mknod event3 c 13 67
cd ..
ln -s input/js0 js0
ln -s input/js1 js1
ln -s input/mice mouse
      

如果您使用 devfs,则所有必需的设备将由 devfs 自动创建。

Mandrake 是使用 devfs 的发行版的一个示例。Debian 默认不使用 devfs,但内核支持 devfs;为了激活 devfs,您必须将 “devfs=mount” 添加到引导加载程序的 “append” 行,并安装 devfsd(devfs 守护程序)。不使用 devfs 的发行版是 Red Hat 和 SuSE。

您可以通过发出以下命令来检查是否使用了 devfs

  • 检查您的内核中是否启用了对 devfs 的支持

    cat /proc/filesystems | grep devfs

  • 检查是否使用/挂载了 devfs

    mount | grep devfs

如果您得到一个空字符串,则表示未使用 devfs;如果您得到类似以下输出的内容,则表示已激活 devfs

[root@mc contrib]# cat /proc/filesystems | grep devfs
nodev   devfs
nodev   usbdevfs
[root@mc contrib]# mount | grep devfs
none on /proc/bus/usb type usbdevfs (rw)
none on /dev type devfs (rw)
[root@mc contrib]#
      

3.4. 关于使用多个 VT 和 VGA 控制台的说明

由于帧缓冲层未反向移植到 Linux-2.4,因此在启动过程中仅初始化主显卡。辅助显卡只能由 X 服务器初始化,因此在 Backstreet Ruby 下,您将在主显卡上拥有一个 VGA 文本控制台。

用于 Linux-2.6 的 Ruby 支持帧缓冲设备和单个帧缓冲控制台(它接管 VGA 控制台),但通过帧缓冲控制台对多个 VT 的支持尚未准备就绪。

为了使 VGA 控制台正常工作,重要的是首先启动将驱动用于 VGA 控制台的显卡的 XFree 实例(BIOS 中定义为主显卡的显卡)。


3.5. 键盘编号(检测顺序)

在以下章节中,您将读到关于第一个键盘、第二个键盘等等的内容,因此在这里我将解释 n 个键盘的含义。

当找到键盘设备时,它会绑定到空闲的 VT(前提是有空闲的 VT)。找到的第一个键盘将绑定到 VT0 (tty1-tty16),第二个键盘绑定到 VT1 (tty17),第三个键盘绑定到 VT2 (tty18)。

Note注意
 

较旧版本的 bruby 补丁(在 2003 年 10 月 7 日之前发布)使用

找到的第一个键盘 => VT0 (tty0-tty7)

第二个 => VT1 (tty8-tty15)

第三个 => VT2 (tty16-tty23)

检测键盘的顺序取决于您的内核配置

  • 如果您使用的内核集成了 USB 输入,则 USB 键盘设备将首先注册,然后当加载模块时,AT/PS2 键盘将随之注册

  • 如果您使用的内核集成了 PS2 输入,则 AT/PS2 键盘设备将首先注册,然后当加载模块时,USB 键盘将随之注册

  • 如果您使用的内核集成了 PS2 和 USB 输入,则 AT/PS2 键盘设备将首先注册,然后 USB 键盘将随之注册

但有一些注意事项

大多数 USB 键盘将其自身表示为多个键盘;常见的是,多媒体键或数字小键盘将自身标识为不同的键盘设备。因此,如果您运行的内核集成了 USB 输入,并且有一个带有多媒体键的 USB 键盘和一个 PS2 键盘,则 USB 键盘将绑定到 VT0(真实键盘)和 VT1(多媒体键),PS2 键盘将绑定到 VT2(如果您有足够的 DUMB 控制台)。

有几种方法可以解决这些问题。在这里,我将解释最容易遵循的方法。这绝对不是最好的方法,但解释最短,我只是想向您明确说明问题并不大。更好的解决方案将在后面的章节中介绍。

您需要做的就是使用 dumbcon=n 启动 Backstreet Ruby/ Ruby 内核,其中 n 是您的 AT/PS2 键盘的总和加上您的 USB 键盘的总和乘以 2(我认为这是 USB 键盘注册的最大接口数),因此所有键盘都将绑定到 VT。现在您应该找出真实键盘绑定到的 VT(不包括多媒体键的键盘),并使用适当的 tty 范围启动 X。感谢 Backstreet Ruby 中集成的 proc 接口,您可以轻松找到键盘到 VT 的分配。每个 VT 创建一个文件/proc/bus/console/[n]/keyboard(n 是 VT 的编号,对于 VT0,n 为 00,对于 VT1,n 为 01,...,对于 VT11,n 为 11);读取此文件将为您提供分配的键盘。

[root@svetljo root]# cat /proc/bus/console/*/*
usb-00:10.1-1.1/input0
usb-00:10.1-1.1/input1
isa0060/serio0/input0
告诉我们

  • USB 键盘(真实键盘)绑定到 VT0

  • USB 键盘(多媒体键)绑定到 VT1

  • PS2 键盘绑定到 VT2

现在我们可以在带有真实键盘的 VT 上启动 X,在本例中为 VT0 和 VT2。

当然,在这个简单的示例中,只有 2 个键盘(一个 USB 键盘和一个 PS2 键盘),通过使用主 PS2 输入支持的内核可以轻松避免该问题。PS2 键盘将首先被找到并绑定到 VT0,USB 键盘将随之而来,并且它的真实键盘接口将绑定到 VT1,因此无需额外的哑终端(用于 USB 键盘的多媒体接口)。


第 4 章。 设置 X 服务器

现在是配置 XFree 的时候了。


4.1. 我需要修改后的 X 服务器吗?

Note注意
 

对于某些显卡,您可以跳过此部分。在安装修改后的 X 服务器之前,请查看视频兼容性列表,以确定您是否需要修改后的 X 服务器。目前,有报告称,对于 Voodoo Graphics 作为主显卡,Voodoo3 或 Nvidia TNT2 作为辅助显卡,无需使用修改后的 X 服务器即可工作。

“为什么要使用修改后的 X 服务器?” - 原因是 XFree 设计为服务于单个用户,并且此设计要求单个 X 服务器驱动所有可用的显卡。因此,当未修改的 X 服务器启动时,它会禁用其他 X 服务器对显卡的访问。因此,我们必须修改 XFree,以使多个 X 服务器可以同时运行。

  • “实验性方法”:您可以使用 Backstreet Ruby 内核的“hackvideo”(忽略 pci_disable XFree 命令)功能。这将允许您使用发行版附带的 XFree 服务器(无需安装修改后的 XFree 服务器)。

    问:“为什么是实验性的?”

    答:嗯,您必须找出它是否适用于您的显卡组合。有些组合可以完美地工作,但是大多数经过测试的组合在此设置中都存在问题。

  • “更可靠的方法”:您必须安装使用首选总线 ID 补丁修改的 XFree 服务器。

    问:“为什么更可靠?”

    答:因为它适用于所有“受支持的显卡”,解决了许多稳定性问题,并使在主显卡上使用 VGA 控制台成为可能。

如果您决定首先尝试不安装修改后的 X 服务器,请按照以下步骤操作

  1. 要启用此功能,您必须将此添加到您的 XFree 配置文件中

    Section "ServerFlags"
    ...
    Option "PciOsConfig" "1"
    ...
    EndSection

  2. 并通知内核过滤不必要的 PCI 命令

    [root@mc contrib]#echo  "1"> /proc/bus/pci/hackvideo

  3. 如果您希望在每次启动时自动执行此操作,则必须添加

    if [ -x /proc/bus/pci/hackvideo ];then
          /bin/echo "1"> /proc/bus/pci/hackvideo
    fi

    到您的 init 脚本,最好在 /etc/rc.d/rc.sysinit 的末尾的某个位置(以便在启动 X 之前执行该命令)

  4. 如果要禁用此功能,则必须

    [root@mc contrib]# echo "0"> /proc/bus/pci/hackvideo

Note注意
 

此功能自 2003 年 5 月 15 日起存在于 Backstreet Ruby 内核中,自 2003 年 9 月 29 日起存在于 Ruby-2.6 中,但永远不会添加到官方 linux 内核中,因为它只是一个小技巧,可以省去您安装修改后的 X 服务器的麻烦。

仍然建议安装修改后的 X 服务器。


4.2. 安装和配置 XFree-PrefBusID

  1. 安装修改后的 XFree 服务器。

    • 安装已构建但未打包的修改后的 X 服务器,并创建必要的符号链接。您可以从 Backstreet Ruby 主页 http://startx.times.lv 获取此类二进制文件。

    • 帮助我们(以及使用您的发行版的其他人)为您的发行版构建 rpm 或二进制文件(我们缺少安装了所有可用发行版的系统,因此我们无法为每个发行版构建软件包)。

    • 使用 Backstreet Ruby 页面上的说明从源代码修补和重建 XFree。转到文档部分,网址为 http://startx.times.lv (或某些镜像站点) -> 文档 -> 快速 XFree。

  2. 查找您的显卡的 BusID

    Note注意
     

    对于 AGP 显卡,类似于 “1:0:0”

    对于 PCI 显卡,类似于 “0:xx:0”

    • 在大多数情况下,您会在 XFree 配置文件的设备部分中找到已设置的 BusID。

      (在为 Xinerama 配置 XFree 的情况下几乎总是如此。)

    • 如果缺少它,您可以使用 lspciXFree86 -scanpci -verbose 或您的发行版附带的其他类似工具。

      使用 lspci 查找 “VGA 兼容控制器” 或您的发行版附带的其他类似工具。

      root@svetljo mnt]# lspci | grep "VGA compatible controller"
      00:0d.0 VGA compatible controller: nVidia Corporation NV17 [GeForce4 MX 420] (rev a3)
      01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV200 QW [Radeon 7500]
      [root@svetljo mnt]#

      使用 XFree86 -scanpci -verbose ,或者在 XFree 已经运行时使用 XFree86 :1 -scanpci -verbose 并查找您的显卡

      [root@svetljo mnt]# XFree86 :1 -scanpci -verbose
      ......
      (0:13:0) unknown card (0x1462/0x8852) using a nVidia Corporation NV17 [GeForce4 MX 420]
      ......
      (1:0:0) unknown card (0x1002/0x0f2a) using a ATI Technologies Inc Radeon RV200 QW [Radeon 7500]

  3. 配置 XFree-PrefBusID。您可以使用以下具有相同效果的选项:

    • 使用 XFree 配置文件选项 "SingleCard",需要一个布尔值(true/false)作为参数,在补丁版本 3 中添加。

      在多用户环境中使用时设置为 true,对于标准的 XFree 行为(允许单个 X 服务器)设置为 false 或注释/删除该行。

      Note

      此功能包含在 Mandrake 的 xorg-x11 软件包和 Debian Sid XFree86 软件包中。

    • 使用 XFree 配置文件选项 "PrefBusID",需要一个有效的 BusID 作为参数,在补丁版本 2 中添加。

      在多用户环境中使用时,包含此选项并使用有效的 BusID,对于标准的 XFree 行为(允许单个 X 服务器)注释或删除该行。

      Note

      此功能包含在 Mandrake 的 xorg-x11 软件包和 Debian Sid XFree86 软件包中,但选项名称已更改为 "IsolateDevice"

    • 使用 XFree 命令行选项 -prefbusid x:x:x,需要一个有效的 BusID 作为参数,补丁的初始版本。

      在多用户环境中使用时,在启动时将此选项与有效的 BusID 传递给 XFree,对于标准的 XFree 行为(允许单个 X 服务器)请勿指定此选项。

      Note

      此功能包含在 Mandrake 的 xorg-x11 软件包和 Debian Sid XFree86 软件包中,但选项名称已更改为 -isolateDevice x:x:x

    Note注意
     

    • 对于 Mandrake 和 Debian 用户

      XFree 配置文件通常是 /etc/X11/XF86Config-4

    • 对于 Red Hat、Gentoo、SuSE 用户

      XFree 配置文件通常是 /etc/X11/XF86Config

    • 使用 "SingleCard" 选项

      Section "ServerLayout"
              Identifier     "X0"
              Screen      0  "Screen0" 0 0
              InputDevice    "Mouse0" "CorePointer"
              InputDevice    "Keyboard0" "CoreKeyboard"
              Option         "SingleCard" "true"
      EndSection 
      Section "ServerLayout"
              Identifier     "X1"
              Screen      0  "Screen1" 0 0
              InputDevice    "Mouse1" "CorePointer"
              InputDevice    "Keyboard0" "CoreKeyboard"
              Option         "SingleCard" "true"
      EndSection  

      Note注意
       

      BusID 必须在 XFree 配置文件的 "Device" 区段中指定。

      Section "Device"
          Identifier  "nv"
          VendorName  ""
          BoardName   ""
          Driver      "nvidia"
          # Clock lines
      
          # Uncomment following option if you see a big white block
          # instead of the cursor!
          #    Option      "sw_cursor"
          Option	"NoLogo" "On"
          BusID       "PCI:0:13:0"
      EndSection
      	      
    • 使用 "PrefBusID/IsolateDevice" 选项(需要一个有效的 BusID 作为参数)

      Section "ServerLayout"
              Identifier     "X0"
              Screen      0  "Screen0" 0 0
              InputDevice    "Mouse0" "CorePointer"
              InputDevice    "Keyboard0" "CoreKeyboard"
              Option "PrefBusID" "1:0:0"
      EndSection 
      Section "ServerLayout"
              Identifier     "X1"
              Screen      0  "Screen1" 0 0
              InputDevice    "Mouse1" "CorePointer"
              InputDevice    "Keyboard0" "CoreKeyboard"
              Option "PrefBusID" "0:13:0"
      EndSection 
      	    

      或对于 Debian Sid 的 XFree86 和 Mandrake 的 xorg-x11

      Section "ServerLayout"
              Identifier     "X0"
              Screen      0  "Screen0" 0 0
              InputDevice    "Mouse0" "CorePointer"
              InputDevice    "Keyboard0" "CoreKeyboard"
              Option "IsolateDevice" "1:0:0"
      EndSection 
      Section "ServerLayout"
              Identifier     "X1"
              Screen      0  "Screen1" 0 0
              InputDevice    "Mouse1" "CorePointer"
              InputDevice    "Keyboard0" "CoreKeyboard"
              Option "IsolateDevice" "0:13:0"
      EndSection 
      	    
    • 在 XFree 启动时使用 "-prefbusid" 选项(需要一个有效的 BusID 作为参数)

      或对于 Debian Sid 的 XFree86 和 Mandrake 的 xorg-x11,请使用 "-isolateDevice" 代替

      Caution注意
       

      对于较旧的(版本 1)首选总线 ID XFree 服务器,仅此选项有效。

      例如在命令行中

      [root@svetljo mnt]# startx -- /usr/X11R6/bin/X0 :0 -prefbusid 1:0:0 vt7
      ,或从显示管理器 (gdm)
      ..............................
      # Definition of the standard X server.
      [server-Standard]
      name=Standard server
      command=/usr/X11R6/bin/X0 :0 -layout first-Xserver -deferglyphs 16 -ac -prefbusid 1:0:0 vt7
      flexible=true
      
      [server-Second]
      name=Second server
      command=/usr/X11R6/bin/X1 :1 -layout second-Xserver -deferglyphs 16 -prefbusid 0:13:0 vt17
      flexible=true
      .............................. 
      以及对于 xdm/kdm
      :0 local /bin/nice -n -10 /usr/X11R6/bin/X0 :0 -deferglyphs 16 -prefbusid 1:0:0 vt7
      :1 local /bin/nice -n -10 /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4.TNT2 -prefbusid 0:13:0 vt17


4.3. 创建符号链接

符号链接是正确启动多个 XFree 实例以及正确退出 X 会话所必需的。这适用于从控制台启动 X 和显示管理器(kdm、gdm、xdm)自动启动 X。

您需要创建尽可能多的指向修改后的 X 服务器二进制文件(或者如果您不需要修改后的,则指向原始 X 服务器)的符号链接,数量与您的显卡/X 会话数量相同。

我假设您将必须使用修改后的 X 服务器,但是如果您不需要它,请使用以下命令创建指向原始 X 服务器的链接

cd /usr/X11R6/bin/
ln -s XFree[modified] X0
ln -s XFree[modified] X1
ln -s XFree[modified] X2
      

如果您使用提供的 rpm 软件包,则只有当您想要运行超过 4 个并行运行的 X 服务器/X 会话时才需要此操作,因为 rpm 会创建 4 个指向 X 服务器二进制文件的符号链接。


4.4. 将独立键盘与 XFree 一起使用

一旦您安装了 Backstreet Ruby/Ruby-2.6 内核并使用以下命令启动它:dumbcon=n,您将获得 n + 1 个独立的控制台 [1 个 VGA(或 Ruby-2.6 下的帧缓冲)+ n 个 DUMB]。 如果您连接了足够多的键盘到您的 PC,则这些控制台中的每一个都与给定的键盘关联。 这使您能够在每个控制台上启动多个 X 服务器,使用与相应控制台关联的键盘进行输入。 因此,您将获得具有独立键盘的多个独立 X 服务器,这反过来使得一台 PC 可以同时被多个本地 X 用户使用。

要在给定控制台上(使用给定的独立键盘)启动 X,您需要传递参数 vt[N],其中 N 是给定 tty 范围内的数字。

  • VGA(或 Ruby-2.6 的帧缓冲):tty1 到 tty16

  • DUMB1:tty17

  • DUMB2:tty18

如果您有 3 个显卡、3 个键盘,并且您使用 dumbcon=2 启动了 Backstreet Ruby 内核,则可以使用以下命令为 3 个并发用户启动 3 个独立的 X 服务器

Note注意
 

  • 对于 Mandrake 和 Debian 用户

    XFree 配置文件通常是 /etc/X11/XF86Config-4

  • 对于 Red Hat、Gentoo、SuSE 用户

    XFree 配置文件通常是 /etc/X11/XF86Config

Caution注意
 

请记住,对于较旧的首选总线 ID XFree 服务器(版本 1),您必须使用参数 "-prefbusid x:x:x" 指定所需的显卡,其中 x:x:x 是所需显卡的 Bus ID。 只需在最后一个参数 vt[x] 之前附加 "-prefbusid x:x:x" 以及您要启动的显卡的正确 Bus ID。 如果您省略此选项,修改后的 X 服务器将充当未修改/标准的 XFree 服务器,并且您将无法同时运行多个 XFree 实例。

对于第一个 X 服务器和第一个键盘

$ startx -- /usr/X11R6/bin/X0 :0 -xf86config /etc/X11/XF86Config-4[用于您的第一个显卡] vt7

对于第二个 X 服务器和第二个键盘

$ startx -- /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4[用于您的第二个显卡] vt17

对于第三个 X 服务器和第三个键盘

$ startx -- /usr/X11R6/bin/X2 :2 -xf86config /etc/X11/XF86Config-4[用于您的第三个显卡] vt18

对于第一个 X 服务器,您可以跳过-xf86config /etc/X11/XF86Config-4[用于您的第一个显卡]参数。 在这种情况下,将使用默认配置文件/etc/X11/XF86Config-4

Note注意
 

  • VGA:tty0 到 tty7

  • DUMB1:tty8 到 tty15

  • DUMB2:tty16 到 tty23

这意味着您必须为额外的 X 服务器使用不同的 vt 参数。

对于第二个 X 服务器和第二个键盘

$ startx -- /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4[用于您的第二个显卡] vt8

对于第三个 X 服务器和第三个键盘

$ startx -- /usr/X11R6/bin/X2 :2 -xf86config /etc/X11/XF86Config-4[用于您的第三个显卡] vt16

您还可以设置显示管理器以启动独立的 X 服务器,一旦一切都正确配置。 但是在配置完成之前不要急于设置显示管理器,因为这可能会给您带来严重的问题。 当您准备好所需的配置后,您将到达关于配置显示管理器的章节。


4.5. 将独立鼠标与 XFree 一起使用

要为每个独立的 X 服务器/会话使用独立的鼠标,您只需修改 XFree 配置文件的输入区段,使其指向正确的设备文件即可。

使用/dev/input/mouse[n],其中 n 是您的鼠标编号,从 0 开始

  • 第一个鼠标 -->/dev/input/mouse0

  • 第二个鼠标 -->/dev/input/mouse1

  • 第三个鼠标 -->/dev/input/mouse2

  • 第四个鼠标 -->/dev/input/mouse3

您不应该使用/dev/input/mice因为它会合并来自所有鼠标设备的输入。

这是我修改前的配置

------------------------------------------------------------------------------------------------

# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/psaux"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection

------------------------------------------------------------------------------------------------
      

修改后,对于第一个 X 服务器

------------------------------------------------------------------------------------------------

# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection

-----------------------------------------------------------------------------------------------
      

对于第二个 X 服务器

-----------------------------------------------------------------------------------------------  
# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
-----------------------------------------------------------------------------------------------
      

等等 ...


4.6. 对于没有 DRI 的显卡

(或重用 Xinerama 配置的 XFree)

可能存在几个不使用 DRI 的原因

  • 据我所知,系统中只有一张显卡可以使用 DRI。

  • Nvidia 闭源驱动程序不支持 DRI。

如果这些原因之一适用于您的系统,则不同的显示器不需要不同的 XFree 配置文件。

您可以使用您的发行版提供的工具并阅读 Xinerama-HOWTO 来配置您的系统以使用 Xinerama,这样当系统被单个用户使用时,他/她可以切换到 Xinerama 桌面并使用所有可用的显示器来获得更大的桌面。

一旦配置了 Xinerama,只需要进行少量添加即可实现多个独立的桌面。 您所要做的就是添加新的布局,这些布局使用单屏幕定义并具有独立的输入设备(嗯,这实际上仅对于鼠标设备是必需的,因为键盘是通过vt[n]选项管理的)。

如果您以以下方式配置了 Xinerama

Section "ServerLayout"
    Identifier  "Simple Layout"
    Screen "Screen 2"
    Screen "Screen 1" RightOf "Screen 2"
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

要实现多个独立的桌面,您只需为单屏幕添加布局定义

Section "ServerLayout"
    Identifier  "first-Xserver"
    Screen "Screen 1"
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

Section "ServerLayout"
    Identifier  "second-Xserver"
    Screen "Screen 2"
    InputDevice "Mouse2" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

这将导致以下布局定义

Section "ServerLayout"
    Identifier  "Xinerama"
    Screen "Screen 2"
    Screen "Screen 1" RightOf "Screen 2"
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

Section "ServerLayout"
    Identifier  "first-Xserver"
    Screen "Screen 1"
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

Section "ServerLayout"
    Identifier  "second-Xserver"
    Screen "Screen 2"
    InputDevice "Mouse2" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

现在,您可以使用选项启动单个 X 服务器-layout Xinerama并享受 Xinerama 桌面,或者

您可以使用以下命令启动 2 个独立的 X 服务器-layout first-Xserver用于第一个服务器,以及-layout second-Xserver用于第二个服务器。

由于您将为所有 X 服务器使用单个 XFree 配置文件,

  • 为了使用独立的键盘,您必须使用以下命令

    对于第一个 X 服务器和第一个键盘

    $ startx -- /usr/X11R6/bin/X0 :0 -layout first-Xserver vt7

    对于第二个 X 服务器和第二个键盘

    $ startx -- /usr/X11R6/bin/X1 :1 -layout second-Xserver vt17

    如果您想使用 Xinerama

    $ startx -- /usr/X11R6/bin/X -layout Xinerama vt7

  • Note注意
     

    对于旧版本的 Backstreet Ruby,您必须使用

    对于第一个 X 服务器和第一个键盘

    $ startx -- /usr/X11R6/bin/X0 :0 -layout first-Xserver vt7

    对于第二个 X 服务器和第二个键盘

    $ startx -- /usr/X11R6/bin/X1 :1 -layout second-Xserver vt8

  • 鼠标也必须具有不同的标识符

    ------------------------------------------------------------------------------------------------
    
    # **********************************************************************
    # Pointer section
    # **********************************************************************
    
    Section "InputDevice"
    
        Identifier  "Mouse1"
        Driver      "mouse"
        Option "Protocol"    "IMPS/2"
        Option "Device"      "/dev/input/mouse0"
        Option "ZAxisMapping" "4 5"
    
    # ChordMiddle is an option for some 3-button Logitech mice
        Option "Emulate3Buttons"
    #    Option "ChordMiddle"
    
    EndSection
    
    Section "InputDevice"
    
        Identifier  "Mouse2"
        Driver      "mouse"
        Option "Protocol"    "IMPS/2"
        Option "Device"      "/dev/input/mouse1"
        Option "ZAxisMapping" "4 5"
    
    # ChordMiddle is an option for some 3-button Logitech mice
        Option "Emulate3Buttons"
    #    Option "ChordMiddle"
    
    EndSection
    -----------------------------------------------------------------------------------------------

4.7. Nvidia GLX & DRI

Note注意
 

在这里,您将学习如何配置您的系统以并行使用 Nvidia 的 GLX 和 XFree 的 DRI。 如果您没有 Nvidia 显卡,或者您只有 Nvidia 显卡,则无需阅读本节。 在第一种情况下,您根本不需要 Nvidia GLX,在第二种情况下,您可以使用标准程序安装 GLX。

为什么选择 Nvidia? 为什么选择闭源驱动程序?

一个有点混乱的答案

  1. 使用开源驱动程序几乎不可能启动辅助显卡,因此我们应该使用闭源驱动程序。

  2. 为什么选择 Nvidia 显卡? 目前,这些是唯一可用的、价格实惠的、具有一些加速功能的 PCI 视频卡。

  3. 我尝试在 2 个并行 X 服务器上使用 DRI,但它没有奏效。 我向 XFree、DRI 和 lkml 列表发送了电子邮件,但我只收到一个回复,其中没有关于我的问题的有价值的信息。 我尝试在 Matrox G550 DH AGP 和 SiS63xx PCI 上运行 DRI,但是当为这两张显卡启用时,我得到了 AGP 错误。 当仅为其中一张显卡启用时,我成功运行了 DRI。 请有人确认或证明我错了!

我将解释几种使 Nvidia GLX 和 XFree86 DRI 配置都能工作的方法。 可能还有很多其他可能性,也许这些不是最简单的,但它们是我知道可以工作的方法。

需要这样做的原因

  1. Nvidia 应该为 xf86 使用不同的模块路径:来自 Nvidia 的 glx 扩展模块与来自 XFree86 的模块不兼容。

  2. Nvidia 应该使用不同的 XF86Config 文件:因为应该为 Nvidia 禁用 DRI,而为其他显卡启用 DRI。

如果您找到更简单的方法,请给我发电子邮件,我会将其包含在内。

Caution注意
 

这不能按原样在 SuSE Linux 上使用。 为了方便用户在 Mesa、XFree 和 Nvidia GL 库之间切换,SuSE 对 GL 库使用了非常复杂的设置。 要使用此设置,您必须将配置切换到 XFree86 的 GL 库。


4.7.1. 示例 1

这是我在我的系统(ATI AIW Radeon 7500 AGP 和 Nvidia TNT2 M64 PCI)上使用的配置,XFree 配置文件

  1. 创建一个目录/usr/X11R6/libNV:

    mkdir /usr/X11R6/libNV

  2. 创建指向原始目录的链接/usr/X11R6/lib:

    cd /usr/X11R6/libNV

    lndir -silent -ignorelinks ../lib

  3. 将 Nvidia 驱动程序和库安装到/usr/X11R6/libNV.

  4. 安装 Nvidia 的libGLcore.so.1.0[驱动程序版本],或者更好的是,libGLcore.so.1,在/usr/lib中。 从/usr/X11R6/libNV/libGLcore.so.1/usr/lib/libGLcore.so.1创建一个符号链接(这将允许您轻松更新 Nvidia 驱动程序)

    cd /usr/lib

    ln -s ../X11R6/libNV/libGLcore.so.1 ./

    注意:Nvidia 的libGL.so已安装/usr/X11R6/libNV,因此除非您告诉系统存在/usr/X11R6/libNV,否则系统看不到它。 对于此设置,您一定不要这样做,因为它会破坏标准的 X 服务器启动。 但是您可以将 XFree GL 库与 Nvidia 显卡和 Nvidia 闭源驱动程序一起使用,也可以将 XFree 的 DRI 与非 Nvidia 显卡一起使用,而 Nvidia 的 GL 库无法做到这一点。

  5. 在 Nvidia 显卡的 XFree 配置文件中添加一行,以将 X 服务器指向库和模块路径的正确位置

    Section "Files"
    
    ..........
    ModulePath  "/usr/X11R6/libNV/modules"
    ..........
    
    EndSection
                

  6. 安装 Nvidia 内核驱动程序。

现在一切都应该正常,您应该能够同时使用 DRI 和 Nvidia GLX。 与使用 Nvidia 的 libGL & libGLcore 的设置相比,性能会稍低一些,但在我的 PC 上差异并不大。


4.7.2. 示例 2

此示例将为您提供 Nvidia 显卡和非 Nvidia 显卡的完整性能,因为 XFree 的 libGL 用于非 Nvidia 显卡,而 Nvidia 的 libGL 用于 Nvidia 显卡。 但是这将需要一个额外的 X 服务器才能精确; 一个简单的包装器,用于添加 Nvidia 库的路径,以及指向它的符号链接,用于额外的 Nvidia 显卡。

它与之前的方案几乎相同,不同之处在于 Nvidia 显卡的 X 服务器应该在 Nvidia 的 libGL 已知的环境中启动,而非 Nvidia 显卡的 X 服务器不应知道任何关于 Nvidia libGL 的信息。 这需要一个包装器来用于启动驱动 Nvidia 显卡的 X 服务器。

像前面的示例一样安装 Nvidia 库和内核驱动程序。 您可以跳过步骤 4,因为libGLcore.so.1已安装在/usr/X11R6/libNV中,我们将告知驱动 Nvidia 显卡的 X 服务器关于 Nvidia 库的正确路径。

缺失的部分 - 包装器

#!/bin/bash
export LD_LIBRARY_PATH=/usr/X11R6/libNV
exec /usr/X11R6/bin/X0 $*
          

将这些行复制到您最喜欢的编辑器中,并将文件另存为XNV。 使其可执行

chmod +x XNV

将文件复制到/usr/X11R6/bin并为额外的 Nvidia 显卡创建指向它的符号链接(对于额外的显卡,只需添加更多链接)

cp XNV /usr/X11R6/bin
cd /usr/X11R6/bin
ln -s XNV Xnv0
ln -s XNV Xnv1
ln -s XNV Xnv2
        

记住要使用/usr/X11R6/bin/Xnv0, /usr/X11R6/bin/Xnv1...,而不是/usr/X11R6/bin/X0, /usr/X11R6/bin/X1... 用于您的 Nvidia 显卡,当在下一章中配置显示管理器时,或者当从控制台启动 Nvidia 显卡上的 X 时。


4.7.3. 轻松安装 Nvidia 库

使用新的 Nvidia 安装程序(注意,这是一个正在进行的工作,如果您不明白这里发生了什么,请不要使用。 待办事项:编写一个脚本来执行步骤 1-4。 请在附录->脚本中提供关于脚本的一些反馈)

手动

  1. 备份您的 XFree GL 库

    cd  [XFree prefix]
                  

    在我的 Mandrake 系统上,我可以使用

    cd $OPENWINHOME
    find lib -name "libGL.*" -o -name "libGLcore*" -o -name "libglx.*" | xargs tar  rpfv   libGL-backup.tar
                  
  2. 然后运行 Nvidia 安装程序

    ./NVIDIA-Linux-x86-1.0-4349.run --no-opengl-headers --xfree86-prefix=/usr/X11R6NV --opengl-prefix=/usr/X11R6NV
                  
  3. 将安装的文件复制到/usr/X11R6/libNV:

    cd /usr/X11R6NV/lib &&  tar cv * | tar xvC /usr/X11R6/libNV/
                  
  4. 恢复备份的 GL 库

    cd [XFree prefix]
    tar xvfp libGL-backup.tar && ldconfig
                  


第五章. 关于配置输入设备的更多信息

在这里,您将找到关于配置输入设备和处理 USB 多媒体键盘中发现的辅助键盘接口的更多详细信息。

如果您对 Linux 感到满意,请查看并测试实验性服务 ruby_init。 该服务、配置文件和 README 可以在附录 D 中找到。 任何类型的反馈都非常感谢。 (请留下您的评论。 :-) )

Note注意
 

如果您正在配置具有两个显示器(2 个键盘,2 个鼠标)的系统,您可能可以跳到 第六章 "配置显示管理器",但是如果您想为一个系统供更多用户使用,您将在本章中找到非常有用的信息。


5.1. 查找真实设备

稍后我们将需要此信息,以便能够将给定的键盘/鼠标分配给给定的 X 服务器/显示器。

要查找输入设备的 PHYS ID(地址)或名称(通常与设备上标记的名称不同),您必须读取文件/proc/bus/input/devices.

这是我的信息

[svetljo@svetljo How-To]# cat /proc/bus/input/devices 
I: Bus=0011 Vendor=0002 Product=0002 Version=0034
N: Name="PS2++ Logitech Wheel Mouse"
P: Phys=isa0060/serio1/input0
H: Handlers=mouse0 ts0 
B: EV=7 
B: KEY=f0000 0 0 0 0 0 0 0 0 
B: REL=103 

I: Bus=0011 Vendor=0001 Product=0002 Version=ab02
N: Name="AT Set 2 keyboard"
P: Phys=isa0060/serio0/input0
H: Handlers=kbd 
B: EV=120003 
B: KEY=4 2000000 8061f9 fbc9d621 efdfffdf ffefffff ffffffff fffffffe 
B: LED=7 

I: Bus=0003 Vendor=046d Product=c303 Version=0700
N: Name="Logitech    USB Keyboard"
P: Phys=usb-00:10.1-1.1/input0
H: Handlers=kbd 
B: EV=120003 
B: KEY=10000 7f ffe00000 7ff ffbeffdf ffffffff ffffffff fffffffe 
B: LED=7 

I: Bus=0003 Vendor=046d Product=c303 Version=0700
N: Name="Logitech    USB Keyboard"
P: Phys=usb-00:10.1-1.1/input1
H: Handlers=kbd 
B: EV=100003 
B: KEY=1078 1800d100 1e0000 0 0 0 

I: Bus=0003 Vendor=05fe Product=0011 Version=0000
N: Name="Cypress Sem. PS2/USB Browser Combo Mouse"
P: Phys=usb-00:10.1-1.2/input0
H: Handlers=mouse1 ts1 
B: EV=7 
B: KEY=1f0000 0 0 0 0 0 0 0 0 
B: REL=103 

Note注意
 

  • /proc/bus/input/devices将为除 USB 多媒体/办公键盘之外的所有设备提供所需的信息。

  • 对于此类 USB 多媒体/办公键盘,您将必须收集更多信息,例如借助 lsusb

  • 在 Ruby-2.6 下,对于 usb 设备,它看起来像 "usb-0000:00:10.x" 而不是 "usb-00:10.x"

  • 首先,我们必须找到 USB 键盘的地址

    [root@svetljo How-To]# lsusb
    Bus 004 Device 001: ID 0000:0000  
    Bus 003 Device 001: ID 0000:0000  
    Bus 003 Device 002: ID 0409:55ab NEC Corp. Hub [iMac kbd]
    Bus 003 Device 003: ID 046d:c303 Logitech, Inc. 
    Bus 003 Device 004: ID 05fe:0011 Chic Technology Corp. Browser Mouse
    Bus 002 Device 001: ID 0000:0000  
    Bus 001 Device 001: ID 0000:0000  

    在这里,我的 USB Logitech 键盘是总线 003 上的设备 003。

  • 现在我们使用参数运行 lsusb-v -s [您的 USB 键盘设备 ID,格式为 总线:设备],在我的情况下,lsusb -v -s 003:003

    ........
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         3 Human Interface Devices
          bInterfaceSubClass      1 Boot Interface Subclass
          bInterfaceProtocol      1 Keyboard
          iInterface              0 
    ........
    
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        1
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         3 Human Interface Devices
          bInterfaceSubClass      0 No Subclass
          bInterfaceProtocol      0 None
          iInterface              0 
    ........
    

因此,我的 USB 键盘有两个接口(参见 bInterfaceNumber); 第一个是真正的键盘(bInterfaceProtocol 1 键盘),第二个(bInterfaceProtocol 0 无) - 附加键。 因此,真正的 USB 键盘是

.....
N: Name="Logitech    USB Keyboard"
P: Phys=usb-00:10.1-1.1/input0
H: Handlers=kbd 
.....

"P: Phys=" 字段(物理描述符/地址)由以下部分组成

  1. 总线类型:"usb"

  2. USB 控制器的 PCI 功能:"00:10.1 "(对于 Ruby-2.6,为 "0000:00:10.1")

  3. USB 设备 ID:"1.1"

  4. 字符串:"/input"

  5. 接口编号:"0"


5.2. 将热插拔与input.agentinput.rc

一起使用

使用 input.agent 将允许您根据输入设备的 PHYS ID 管理它们。


5.2.1. input.agent

input.rc 脚本将使用适当的参数运行 input.agent,用于内置在内核中或在热插拔可用之前加载的驱动程序。

  • 输入代理使用 3 个配置文件

  • /etc/hotplug/kbd.conf

  • /etc/hotplug/mouse.conf

Note注意
 

/etc/hotplug/event.conf

这里的解释使用了 Backstreet Ruby(usb 设备的 PHYS_ID 为 "usb-00:xx.x-..."),如果您正在运行 Ruby-2.6,则 usb 设备的 PHYS_ID 应该是 "usb-0000:00:xx.x-....",但是您应该可以通过指定 "usb-0*:xx.x-..." 在 Backstreet Ruby 和 Ruby-2.6 下使用相同的配置文件。输入代理使用 3 个配置文件

要配置键盘,您必须调整

#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	isa0060/serio0/input0
VT1	usb-00:10.1-1.1/input0
        

如果我想将 PS2 键盘用于主显示器和 VGA 控制台,我将使用

#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	usb-00:10.1-1.1/input0
VT1	isa0060/serio0/input0
        

或者,如果我想将 USB 键盘用于主显示器和 VGA 控制台

#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	usb-*.*-1.1/input0
VT1	isa0060/serio0/input0
      

您也可以使用 "*.*" 代替 USB 控制器的 pci 功能/etc/hotplug/kbd.conf

#
# mouse device configuration
#
# sym_link device_physicaly_location
mouse0br	usb-00:10.1-1.2/input0
mouse1br	usb-*.*-2.7.*/input0
mouse2br	isa0060/serio1/*
        

对于鼠标设备,您必须编辑

并调整 XFree 配置文件。

......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0"
    Option "ZAxisMapping" "4 5"
......
      

对于第一个鼠标,更改

......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0br"
    Option "ZAxisMapping" "4 5"
......
      

......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1"
    Option "ZAxisMapping" "4 5"
......
      

对于第一个鼠标,更改

......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1br"
    Option "ZAxisMapping" "4 5"
......
      

对于第二个鼠标,更改

等等。/etc/hotplug/mouse.conf

#
# input event device config file
#
# symbolic_link device_physicaly_location
event0br	isa0060/serio0/*
event1br	isa0060/serio1/input0
event2br	usb-*.*-3/input0
      

对于事件设备,编辑


5.2.2. input.rc

并配置使用它们的应用程序以使用符号链接而不是真实设备input.rc如果您正在使用内置到内核中的输入驱动程序,请确保

Note注意
 

脚本在系统启动时启动/执行。 如果脚本未执行,您将发现热插拔无法配置这些输入设备。

此区域需要用户反馈。 目前,我只有关于 Mandrake 的信息,其中热插拔未作为服务运行。

如果您的发行版将热插拔作为服务运行,则这将自动完成。input.rc如果您的发行版未将热插拔作为服务运行,则您必须修改您的 init 脚本以在 XFree 启动之前为您运行

您可以在您的/etc/rc.d/rc.sysinit

if [[ -f /proc/bus/console -o -n tmp=`uname -r | sed -n 's:ruby::p'` ]]; then
   if [ -x /etc/hotplug/input.rc ]; then	
      /etc/hotplug/input.rc start
      if [ $? = 0 ]; then
      	action "Configuring cold plugged input devices" /bin/true
      else
	action "Configuring cold plugged input devices" /bin/false
      fi
   else if [ -f /etc/hotplug/input.rc ]; then
     	   action "Input: input.rc installed, but not executable. Please check the file permissions." /bin/false
	else 
	   action "Input: Failed to configure cold plugged devices - input.rc missing"  /bin/false
        fi
   fi
fi


末尾添加此行。

5.3. 将 XFree 与事件接口支持一起使用

  • 这将允许您

  • 如果您的输入设备具有不同的名称,则无论您在哪里插入或重新插入它们,都可以将它们与相同的 X 服务器/屏幕一起使用。

  • 如果您的输入设备具有相同的名称,则可以根据您插入或重新插入它们的 USB 端口将它们与相同的 X 服务器/屏幕一起使用。

Caution注意
 

能够使用通配符,例如 "*""?"

Warning目前,热插拔似乎无法正常工作。 我收到报告说,当使用 "Dev Name" 选项时它可以工作,但我的主要目的是使其与 "Dev Phys" 一起工作,而这目前似乎不起作用。 "为什么选择 “Dev Phys”?" - 因为如果有人想为一个系统设置 4、5 个或更多用户,那么获得 4、5 个或更多相同的键盘/鼠标会更容易,而不是找到相同数量但来自不同制造商或具有不同名称的键盘或鼠标,并且我发现当使用 "Dev Phys" 时,为如此多的用户配置 XFree 更简单。
 

警告

本节在某种程度上已被弃用,并且未在 Ruby-2.6 下进行测试,因为它对我来说无法可靠地工作。

为了使其工作,您必须使用带有 Zephaniah Hull 开发的事件接口支持补丁的 XFree。 您可以在以下网址找到它们:http://people.debian.org/~warp/evdev/

  • 要从源代码构建,您将需要以下补丁029_lnx_evdev.diff

  • :evdev 核心补丁。030_lnx_evdev_mouse.diff

  • :补丁的鼠标端。031_lnx_evdev_keyboard.diff

:补丁的键盘端。

Debian 的二进制文件包含这些补丁。对于热插拔,您还需要/etc/hotplug/input.agent

,您可以在上述地址和附录脚本中找到它。

然后您必须配置 XFree 以使用事件设备。

Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Name"      "A4Tech USB Optical Mouse"
    Option      "Dev Phys"      "usb-*/input0"
    Option      "Buttons"       "9"

    Option      "ZAxisMapping"  "6 7 8 9"
EndSection

鼠标的配置区段应如下所示

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Name"      "SILITEK USB Keyboard"
    Option      "Dev Phys"      "usb-*/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection

键盘的配置区段应如下所示


对于 Dev Name 和 Dev Phys,通配符 "?""*" 有效,您必须至少有一个,如果您两者都有,则设备必须在两者上都匹配,不存在的条目与由 "*" 组成的条目相同。

5.4. 使用 "Phys" 描述符和 USB 设备

在 XFree 中使用输入设备的 "Phys" 描述符大大简化了输入设备的配置,尤其是在使用更多显示器时。

Note注意
 

由于 USB 设备以树状形式连接,因此您可以非常轻松地指定键盘和鼠标设备绑定到指定 X 显示器的方式。 您必须使用一个 USB 集线器,其端口数等于(或大于)X 显示器的数量,较小的(2-4 端口)集线器(或带有集成集线器的键盘)连接到此集线器。 键盘连接到较小的(集成)集线器的第一个端口,鼠标连接到第二个端口(如果存在空闲端口,您可以将 usb-音频设备连接到它们:))。 如果主 USB 集线器是第一个 USB 设备,则这会导致 usb-id 具有以下布局

  • 在以下解释和示例中,我将辅助(集成)集线器上的第一个设备用于键盘设备,因为我的键盘在内部连接到集成集线器的第一个端口。 我假设这适用于大多数带有集成集线器的键盘,但是如果您拥有的键盘使用不同的端口,您将必须进行少量调整。

    • 在主集线器的第一个端口上

    • 1.1 USB 集线器(集成)

    • 1.1.1 USB 键盘

    • 1.1.2 USB 鼠标

  • (1.1.3 usb-音频/其他 usb 设备)

    • 在第二个端口上

    • 1.2 USB 集线器(集成)

    • 1.2.1 USB 键盘

    • 1.2.2 USB 鼠标

  • (1.2.3 usb-音频/其他 usb 设备)

    • 在第三个端口上

    • 1.3 USB 集线器(集成)

    • 1.3.1 USB 键盘

    • 1.3.2 USB 鼠标

  • (1.3.3 usb-音频/其他 usb 设备)

    • 在第四个端口上

    • 1.4 USB 集线器(集成)

    • 1.4.1 USB 键盘

    • 1.4.2 USB 鼠标

(1.4.3 usb-音频/其他 usb 设备)


基于此,我们可以将连接到指定 USB 端口的所有设备绑定到给定的 X 服务器。

5.4.1. ... 使用输入代理

Note注意
 

一个使用 "Phys" 描述符、输入代理和 USB 输入设备的 4 用户系统示例。

这里 USB 控制器的 PCI 功能被 *.* 掩盖,因此它应该在 Backstreet Ruby 和 Ruby-2.6 下都能工作。 如果您使用多个 USB 控制器,则必须使用不同的掩码(例如 "usb-0*:xx.x-...")或指定完整的 PHYS_ID:。

对于 Backstreet Ruby,您应该具有 PHYS_ID "usb-00:xx.x-..."

对于 Ruby-2.6,您应该具有 PHYS_ID "usb-0000:00:xx.x-...."输入代理使用 3 个配置文件 ):

#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	usb-*.*-1.1.1/input0
VT1	usb-*.*-1.2.1/input0
VT2	usb-*.*-1.3.1/input0
VT3	usb-*.*-1.4.1/input0
      

我们将在启动 X 时使用 "vt[n]" 参数,以及以下键盘的配置文件(/etc/hotplug/kbd.conf对于鼠标设备,配置文件 (

#
# mouse device configuration
#
# sym_link device_physicaly_location
mouse0br	usb-*.*-1.1.2/input0
mouse1br	usb-*.*-1.2.2/input0
mouse2br	usb-*.*-1.3.2/input0
mouse3br	usb-*.*-1.4.2/input0
        

)将如下所示

我们必须调整 XFree 配置文件,以便 XFree 使用符号链接而不是实际设备。 如果您已经配置了独立的鼠标,则只需在每个鼠标设备后附加 "br"

将每个 "/dev/input/mouse[n]" 更改为 "/dev/input/mouse[n]br"

......
# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
......
      

对于第一个显示器

......
# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
......
      

对于第二个鼠标,更改

对于第二个显示器

......
# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
Section "InputDevice"

    Identifier  "Mouse2"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
......
      

或者,如果使用单个 XFree 配置文件

5.4.2. ... 将 XFree 与事件接口支持一起使用

Note注意
 

将 XFree 的 "Dev Phys" 选项与事件设备支持和 USB 输入设备一起使用,使我们能够为所有 X 服务器使用几乎相同的输入设备配置。 唯一的区别将是在 usb-id 的一部分,它反映了主 USB 集线器的端口。

以下示例适用于多个 XFree 配置文件,如果您使用单个 XFree 配置文件,则必须调整标识符。

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.1.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.1.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

第一个显示器的输入设备配置将如下所示

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.2.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.2.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

第二个显示器的配置如下所示

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.3.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.3.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

对于第二个鼠标,更改

第三个显示器的配置如下所示

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-?.1.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-?.1.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

您也可以使用 "?",这样无论您将主集线器插入到哪里,所有显示器仍将具有所需的配置。

第六章. 配置显示管理器

除了图形界面的差异之外,xdm/kdm 和 gdm 处理 X 服务器的方式也不同。Gdm 将按照其配置文件中指定的顺序启动 X 服务器(并以相反的顺序停止它们)。Xdm/kdm 将同时启动和停止所有 X 服务器(如果没有打开的 X 会话)。此外,重启 gdm 守护进程意味着所有 X 会话的结束,但是如果您在 X 环境下重启 xdm/kdm,您的会话将不会被关闭。

Note注意
 

请记住,对于较旧的 Preferred Bus ID XFree Server(版本 1),您必须使用参数 "-prefbusid x:x:x" 指定所需的显卡,其中 x:x:x 是所需显卡的 Bus ID。只需在最后一个参数 vt[x] 之前,添加 "-prefbusid x:x:x" 以及您要启动的卡的正确 Bus ID。


6.1. 配置 xdm 和 kdm

如果一切正常,现在是时候设置在所有显示器上自动启动 X 了。对于 xdm 和 kdm,您必须修改一个单独的文件。对于类似 Red Hat 的系统,这将是/etc/X11/xdm/Xservers; 对于其他发行版,请检查此文件是否存在。如果不存在,请找到您的 XFree86 配置文件目录,您将在其中找到xdm/Xservers.

Note注意
 

  • SuSE 使用

    • /etc/X11/XF86Config

    • /etc/X11/xdm/Xservers用于 xdm

    • /etc/opt/kde3/share/config/kdm/Xservers用于 kdm

    您可以制作一个备份副本/etc/opt/.../kdm/Xservers并从/etc/X11/xdm/Xservers/etc/opt/../kdm/Xservers创建一个符号链接,以便为 xdm 和 kdm 使用相同的配置文件。

  • Debian 使用

    • /etc/kde3/kdm/Xservers用于 kdm

    您可以制作一个备份副本/etc/kde3/kdm/Xservers并从/etc/X11/xdm/Xservers/etc/kde3/kdm/Xservers创建一个符号链接,以便为 xdm 和 kdm 使用相同的配置文件。

  • Red Hat 和 Gentoo 使用

    • /etc/X11/XF86Config

对于每个额外的 X 服务器,您都应该添加一行。您可以复制现有的行,更改 X 服务器二进制文件和显示编号,并附加-xf86config[您的配置文件]。我的原始 xdm/Xservers

#####################################################################

# $XConsortium: Xserv.ws.cpp,v 1.3 93/09/28 14:30:30 gildea Exp $
#
#
# $XFree86: xc/programs/xdm/config/Xserv.ws.cpp,v 1.1.1.1.12.2 1998/10/04 15:23:14 hohndel Exp $
#
# Xservers file, workstation prototype
#
# This file should contain an entry to start the server on the
# local display; if you have more than one display (not screen),
# you can add entries to the list (one per line).  If you also
# have some X terminals connected which do not support XDMCP,
# you can add them here as well.  Each X terminal line should
# look like:
#	XTerminalName:0 foreign
#
:0 local /bin/nice -n -10 /usr/X11R6/bin/X :0 -deferglyphs 16 vt7

######################################################################
      

和修改后的版本

######################################################################

# $XConsortium: Xserv.ws.cpp,v 1.3 93/09/28 14:30:30 gildea Exp $
#
#
# $XFree86: xc/programs/xdm/config/Xserv.ws.cpp,v 1.1.1.1.12.2 1998/10/04 15:23:14 hohndel Exp $
#
# Xservers file, workstation prototype
#
# This file should contain an entry to start the server on the
# local display; if you have more than one display (not screen),
# you can add entries to the list (one per line).  If you also
# have some X terminals connected which do not support XDMCP,
# you can add them here as well.  Each X terminal line should
# look like:
#	XTerminalName:0 foreign
#

:0 local /bin/nice -n -10 /usr/X11R6/bin/X0 :0 -deferglyphs 16 vt7
:1 local /bin/nice -n -10 /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4.TNT2 vt17

#######################################################################
      

如果您有更多显卡,只需添加更多行

:2 local /bin/nice -n -10 /usr/X11R6/bin/X2 :2 -xf86config /etc/X11/XF86Config-4.[your 3rd card] vt18
:3 local .....
      

如果您使用单个 XFree 配置文件

######################################################################

# $XConsortium: Xserv.ws.cpp,v 1.3 93/09/28 14:30:30 gildea Exp $
#
#
# $XFree86: xc/programs/xdm/config/Xserv.ws.cpp,v 1.1.1.1.12.2 1998/10/04 15:23:14 hohndel Exp $
#
# Xservers file, workstation prototype
#
# This file should contain an entry to start the server on the
# local display; if you have more than one display (not screen),
# you can add entries to the list (one per line).  If you also
# have some X terminals connected which do not support XDMCP,
# you can add them here as well.  Each X terminal line should
# look like:
#	XTerminalName:0 foreign
#

:0 local /bin/nice -n -10 /usr/X11R6/bin/X0 :0 -layout first-Xserver -deferglyphs 16 vt7
:1 local /bin/nice -n -10 /usr/X11R6/bin/X1 :1 -layout second-Xserver vt17

#######################################################################

Note注意
 

在 Backstreet Ruby 的旧版本(2003 年 10 月 7 日之前发布)中,每个控制台由 8 个 tty 表示,因此您应该使用

.....
:0 local /bin/nice -n -10 /usr/X11R6/bin/X0 :0 -deferglyphs 16 vt7
:1 local /bin/nice -n -10 /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4.TNT2 vt9
.....

或者如果您有更多显卡,只需添加更多行

:2 local /bin/nice -n -10 /usr/X11R6/bin/X2 :2 -xf86config /etc/X11/XF86Config-4.[your 3rd card] vt16
:3 local .....
      

如果您使用单个 XFree 配置文件

................
:0 local /bin/nice -n -10 /usr/X11R6/bin/X0 :0 -layout first-Xserver -deferglyphs 16 vt7
:1 local /bin/nice -n -10 /usr/X11R6/bin/X1 :1 -layout second-Xserver vt9
................


6.2. 配置 gdm

Gdm 作为 xdm 的完全重写版本,使用其自己的配置文件,/etc/X11/gdm/gdm.conf。您应该找到本地 X 服务器的定义,并为您拥有的显卡数量添加额外的 X 服务器。

Note注意
 

  • SuSE 使用

    • /etc/X11/XF86Config

    • /etc/opt/gnome2/gdm/gdm.conf用于 gdm2

  • Debian 使用

    • /etc/gdm/gdm.conf用于 gdm

      /etc/X11/gdm/是一个指向/etc/gdm/的符号链接,因此您可以同时使用这两个路径。

  • Red Hat 和 Gentoo 使用

    • /etc/X11/XF86Config

修改


6.2.1. 更改,第 1 部分

.......
[servers]
# These are the standard servers.  You can add as many you want here
# and they will always be started.  Each line must start with a unique
# number and that will be the display number of that server.  Usually just
# the 0 server is used.
0=Standard
1=Second
.......
        
在这里,您将只有 0=Standard。对于每个额外的 X 服务器,您都应该添加一个定义,例如这里的 1=Second。


6.2.2. 更改,第 2 部分

..............................
# Definition of the standard X server.
[server-Standard]
name=Standard server
command=/usr/X11R6/bin/X0 :0 -deferglyphs 16 -ac vt7
flexible=true

[server-Second]
name=Second server
command=/usr/X11R6/bin/X1 :1 -deferglyphs 16 -xf86config /etc/X11/XF86Config-4.[your card] vt17
flexible=true
..............................   
        
在这里,是启动 X 服务器的命令行的确切定义,与/etc/X11/xdm/Xservers中的定义非常相似([server-Second] 的定义是额外添加的)。

如果您使用单个 XFree 配置文件

..............................
# Definition of the standard X server.
[server-Standard]
name=Standard server
command=/usr/X11R6/bin/X0 :0 -layout first-Xserver -deferglyphs 16 -ac vt7
flexible=true

[server-Second]
name=Second server
command=/usr/X11R6/bin/X1 :1 -layout second-Xserver -deferglyphs 16 vt17
flexible=true
..............................   

Note注意
 

在 Backstreet Ruby 的旧版本(2003 年 10 月 7 日之前发布)中,每个控制台由 8 个 tty 表示,因此您应该使用

..............................
name=Standard server
command=/usr/X11R6/bin/X0 :0 -deferglyphs 16 -ac vt7
..............................
name=Second server
command=/usr/X11R6/bin/X1 :1 -deferglyphs 16 -xf86config /etc/X11/XF86Config-4.[your card] vt9
..............................

如果您使用单个 XFree 配置文件

..............................
name=Standard server
command=/usr/X11R6/bin/X0 :0 -layout first-Xserver -deferglyphs 16 -ac vt7
......
name=Second server
command=/usr/X11R6/bin/X1 :1 -layout second-Xserver -deferglyphs 16 vt9
..............................


第七章. 调整

添加自定义和自动化。


7.1. 使用独立的声卡

Note注意
 

如果您不使用 devfs,您可能需要创建额外的设备文件。请查看 Linux Sound HOWTO,以获取有关如何设置额外声卡的信息。


7.1.1. 使用 aRts 守护进程

我们必须为不同的 X 会话/显示器指定不同的声音设备。这可以通过使用 aRts 守护进程的以下选项来完成(http://www.arts-project.org/

  • 通过 OSS-free 声音驱动程序

    -D /dev/dsp[n]

    其中 n 是声卡的编号。

  • 通过 Alsa 声音驱动程序

    -a alsa -D hw:[n],0

    其中 n 是声卡 ID。

将这些行添加到您的窗口管理器启动脚本中(当然,要使用适合您设置的参数)

real_display=`echo $DISPLAY | sed "s/://" | sed "s/\..*//"`
case "$real_display" in
        0)
        artsd -F 10 -S 4096 -D /dev/dsp -s 5 -m artsmessage -l 3 -f &
        ;;
        1)
        artsd -F 10 -S 4096 -D /dev/dsp1 -s 5 -m artsmessage -l 3 -f &
        ;;
        2)
        artsd -F 10 -S 4096 -a alsa -D hw:4,0 -s 5 -m artsmessage -l 3 -f &
        ;;
esac
        

并在文件末尾

artsshell -q terminate

这是一个示例,适用于/usr/X11R6/bin/startenlightenment:

#!/bin/sh
#   License: GPL

real_display=`echo $DISPLAY | sed "s/://" | sed "s/\..*//"`
case "$real_display" in
        0)
        artsd -F 10 -S 4096 -D /dev/dsp -s 5 -m artsmessage -l 3 -f &
        ;;
        1)
        artsd -F 10 -S 4096 -D /dev/dsp1 -s 5 -m artsmessage -l 3 -f &
        ;;
        2)
        artsd -F 10 -S 4096 -a alsa -D hw:2,0 -s 5 -m artsmessage -l 3 -f &
        ;;
esac

/usr/X11R6/bin/enlightenment
artsshell -q terminate
        

这将为 3 个 X 服务器启动 3 个 aRts 守护进程。

  1. 守护进程将为第一个 X 服务器使用第一个 OSS 声音设备。

  2. 守护进程将为第二个 X 服务器使用第二个 OSS 声音设备。

  3. 守护进程将为第三个 X 服务器使用 Alsa 声音设备(需要反馈)。


7.2. 自定义登录屏幕

7.2.1. 使用 xdm

复制/etc/X11/xdm/Xsetup_0/etc/X11/xdm/Xsetup_1。对于额外的 X 服务器,创建文件/etc/X11/xdm/Xsetup_[n],其中 n 是 X 服务器的编号,从 0 开始。

  1. 修改包含背景图像的行,以调整第二个 X 服务器的图像路径

    ....
    if [ -r /usr/share/mdk/backgrounds/default.png -a -x /usr/bin/qiv ]; then
        /usr/bin/qiv -z /usr/share/mdk/backgrounds/default.png
    else
        /usr/X11R6/bin/xsetroot -solid "#21449C"
    fi
    ....
                

    已修改

    ....
    if [ -r /usr/share/mdk/backgrounds/flower.jpg -a -x /usr/bin/qiv ]; then
        /usr/bin/qiv -z /usr/share/mdk/backgrounds/flower.jpg
    else
        /usr/X11R6/bin/xsetroot -solid "#21449C"
    fi
    ....
                

    您还可以使用以下命令指定不同的背景颜色:

    ....
    #if [ -r /usr/share/mdk/backgrounds/flower.jpg -a -x /usr/bin/qiv ]; then
    #    /usr/bin/qiv -z /usr/share/mdk/backgrounds/flower.jpg
    #else
        /usr/X11R6/bin/xsetroot -solid "[your color]"
    #fi
    ....
                
  2. 注释掉可能影响主 X 服务器的行,从

    ....
    if [ -x /etc/X11/xinit.d/numlock ]; then
        /etc/X11/xinit.d/numlock &
    fi
    ....
                

    ....
    #if [ -x /etc/X11/xinit.d/numlock ]; then
    #    /etc/X11/xinit.d/numlock &
    #fi
    ....
                
  3. 通过修改/etc/X11/xdm/xdm-config:

    ......
    ! The following three resources set up display :0 as the console.
    DisplayManager._0.setup:        /etc/X11/xdm/Xsetup_0
    DisplayManager._0.startup:      /etc/X11/xdm/GiveConsole
    DisplayManager._0.reset:        /etc/X11/xdm/TakeConsole
    DisplayManager._0.startAttempts: 1
    !
    ......
                

    已修改

    ......
    ! The following three resources set up display :0 as the console.
    DisplayManager._1.setup:        /etc/X11/xdm/Xsetup_1
    DisplayManager._0.setup:        /etc/X11/xdm/Xsetup_0
    DisplayManager._0.startup:      /etc/X11/xdm/GiveConsole
    DisplayManager._0.reset:        /etc/X11/xdm/TakeConsole
    DisplayManager._0.startAttempts: 1
    !
    ......
                
  4. 来通知 xdm Xsetup_1 的存在。

  5. 请在此处查看其他自定义选项:Linux-Journal Issue 68: Linux Apprentice: Customising the XDM Login Screen


7.2.2. 使用 kdm

  • 我不太确定。这方面需要反馈。

    修改/usr/share/config/kdm/kdmrc,从

    ......
    [X-:0-Core]
    Authorize=true
    AutoLogin1st=true
    AutoLoginEnable=false
    Reset=/etc/X11/xdm/TakeConsole
    Setup=/etc/X11/xdm/Xsetup_0
    Startup=/etc/X11/xdm/GiveConsole
    
    [X-:1-Core]
    Authorize=true
    ......
                

    ......
    [X-:0-Core]
    Authorize=true
    AutoLogin1st=true
    AutoLoginEnable=false
    Reset=/etc/X11/xdm/TakeConsole
    Setup=/etc/X11/xdm/Xsetup_0
    Startup=/etc/X11/xdm/GiveConsole
    
    [X-:1-Core]
    Authorize=true
    #AutoLogin1st=true
    #AutoLoginEnable=false
    #Reset=/etc/X11/xdm/TakeConsole
    Setup=/etc/X11/xdm/Xsetup_1
    #Startup=/etc/X11/xdm/GiveConsole
    
    #[X-:1-Core]
    #Authorize=true
    ......
                
  • 请在 KDE 帮助中心查看其他自定义选项。


7.2.3. 使用 gdm

这需要gdmlogin代替gdmgreater,因为 gdm 尚未实现在不同显示器上使用不同主题的功能。如果您想使用 gdm 主题,则所有显示器上都将使用相同的主题。

  1. 通过在/etc/X11/gdm/gdm.conf

    中进行此更改来切换到 gdmlogin

    .....
    # Greeter for local (non-xdmcp) logins.  Change gdmlogin to gdmgreeter to
    # get the new graphical greeter.
    Greeter=/usr/bin/gdmgreeter
    .....
    

    .....
    # Greeter for local (non-xdmcp) logins.  Change gdmlogin to gdmgreeter to
    # get the new graphical greeter.
    Greeter=/usr/bin/gdmlogin
    .....
  2. 复制文件/etc/X11/gdm/Init/Default/etc/X11/gdm/Init/:0,和/etc/X11/gdm/Init/:1

  3. 添加以下行以使用 kdm 使用的背景(您也可以使用另一个图像文件,只需更改其完整路径)

    if [ -r /usr/share/mdk/backgrounds/default.png -a -x /usr/bin/qiv ]; then
        /usr/bin/qiv -z /usr/share/mdk/backgrounds/default.png
    else
        /usr/X11R6/bin/xsetroot -solid "#21449C"
    fi
                

    您还可以使用以下命令指定不同的背景颜色:

    /usr/X11R6/bin/xsetroot -solid "[your color]"

    已修改

    /etc/X11/gdm/Init/:0

    #!/bin/sh
    
    if [ -r /usr/share/mdk/backgrounds/default.png -a -x /usr/bin/qiv ]; then
        /usr/bin/qiv -z /usr/share/mdk/backgrounds/default.png
    else
        /usr/X11R6/bin/xsetroot -solid "#21449C"
    fi
    if [ -x /etc/X11/xinit/fixkeyboard ]; then
        /etc/X11/xinit/fixkeyboard
    fi
    
    exit 0
                

    /etc/X11/gdm/Init/:1

    #!/bin/sh
    
    if [ -r /usr/share/mdk/backgrounds/flower.jpg -a -x /usr/bin/qiv ]; then
        /usr/bin/qiv -z /usr/share/mdk/backgrounds/flower.jpg
    else
        /usr/X11R6/bin/xsetroot -solid "#21449C"
    fi
    
    if [ -x /etc/X11/xinit/fixkeyboard ]; then
        /etc/X11/xinit/fixkeyboard
    fi
    
    exit 0
                
  4. 对每个额外的 X 服务器重复此过程,使用文件/etc/X11/gdm/Init/:[n],其中 n 是显示的编号。

  5. 请在此处查看其他自定义选项:Gnome Display Manager Reference Manual


7.3. 第一个 X 服务器配置文件

Mandrake init 脚本的一小部分/etc/rc.d/rc.sysinit(如果缺少类似的内容,您可以将其附加到您的脚本中)

-----------------------------------------------------------------------------------
# (pixel) a kind of profile for XF86Config
# if no XFree=XXX given on kernel command-line, restore XF86Config.standard
for i in XF86Config XF86Config-4; do
    if [ -L "/etc/X11/$i" ]; then
        XFree=`sed -n 's/.*XFree=\(\w*\).*/\1/p' /proc/cmdline`
        [ -n "$XFree" ] || XFree=standard
        [ -r "/etc/X11/$i.$XFree" ] && ln -sf "$i.$XFree" "/etc/X11/$i"
    fi
done
-----------------------------------------------------------------------------------
      

移动您的XF86Config-4文件(用于标准内核的文件)到XF86Config-4.standard,从中创建一个符号链接XF86Config-4,并移动XF86Config-4文件(用于 Backstreet Ruby 的文件)到XF86Config-4.bruby。对于 Ruby/Backstreet Ruby 内核,添加到/etc/lilo.conf中的 append 行,或在启动提示符下输入 "XFree=bruby",保持标准内核不变。

结果

使用 "XFree=standard" 或不使用 "XFree=" 启动(启动提示符或lilo.conf)将导致链接XF86Config-4.standardXF86Config-4; 使用 "XFree=bruby" 启动将链接XF86Config-4.brubyXF86Config-4,因此在这两种情况下,XFree 都可以使用第一个 X 服务器的正确配置文件启动。

那么其他 X 服务器呢?

在标准内核下,您不能使用多个独立的 X 服务器,因此您应该仅在 Ruby/Backstreet Ruby 下使用其他 XFree 配置文件 - 在标准内核和 bruby 内核下,不需要不同的配置文件。


7.4. 显示管理器启动的 X 服务器数量

这是先前方法的修改版本。将其添加到您的 init 脚本中(我敢肯定它丢失了!)

---------------------------------------------------------------------------------------
#
#the same like XF86Config but for gdm.conf & Xservers
#
for i in xdm/Xservers gdm/gdm.conf; do
    if [ -L "/etc/X11/$i" ]; then
        DumbCon=`sed -n 's/.*dumbcon=\([0-9]*\).*/\1/p' /proc/cmdline`
        [ -n "$DumbCon" ] || DumbCon=0
        [ -r "/etc/X11/$i.$DumbCon" ] && ln -sf "/etc/X11/$i.$DumbCon" "/etc/X11/$i"
    fi
done
echo "Setting up display managers for `expr $DumbCon + 1` Xservers"
---------------------------------------------------------------------------------------
      

这将根据启动行参数 dumbcon=n 调整正确的/etc/X11/xdm/Xservers/etc/X11/gdm/gdm.config(记住 n+1= X 用户/会话的数量)。

您必须按照以下假设创建配置文件

"i" 仅代表/etc/X11/xdm/Xserver/etc/X11/gdm/gdm.conf.

  • "i.0" 用于单个 X 服务器,当未指定 dumbcon=n 或 dumbcon=0 时。

  • "i.1" 由显示管理器在指定 dumbcon=1 时使用。

  • "i.2" 由显示管理器在指定 dumbcon=2 时使用。

  • "i.3" 由显示管理器在指定 dumbcon=3 时使用。

...等等。

因此

  • "i.0" 应该仅包含原始标准 X 服务器的定义。

  • "i.1" 应该包含 2 个 X 服务器的定义。

  • "i.2" 应该包含 3 个 X 服务器的定义。

  • ...等等。

如果您在没有 dumbcon=n 或 dumbcon=0 的情况下启动(例如标准内核),您的显示管理器将使用相应的 XF86Config 文件启动单个 X 服务器。

如果您使用 dumbcon=1 启动,显示管理器将自动启动 2 个 X 服务器。

如果您使用 dumbcon=2 启动,当启动完成后,您将在 3 个显示器上获得 3 个登录提示。

请记住,每个 X 服务器都应该有自己的配置文件,并且应该在显示管理器配置文件中正确指定。在重新启动并激活显示管理器以及向 init 脚本添加此内容之前,请查看配置文件。

如果您只有一个 XFree 配置文件,也可以使用此方法(请参阅 第 4.6 节"对于没有 DRI 的显卡")。在这种情况下,您将必须指定正确的布局而不是正确的 XFree 配置文件。


7.5. 动态切换 X 服务器的数量

有一个非常实验性的 GUI/CLI,用于动态切换正在运行的 X 服务器的数量。它使用显示管理器的自动配置(在 第 7.4 节 中提到),Python,CLI 的对话框和 GUI 的 Xdialog。

一旦经过更多测试且没有错误,您就可以例如在 Backstreet Ruby 下使用它在 2 个、3 个或更多 X 服务器与使用 Xinerama 的单个 X 服务器之间切换。因此,当您的 PC 不被多个用户使用时,您可以在 Xinerama 下使用其他显示器。或者一个更有趣的例子:您正在使用一些朋友在您的 bruby Linux PC 上模拟网络游戏,您在额外的显卡上投入了更多资金,该显卡已经配置好,但是您现在没有足够的钱再购买一台显示器和键盘/鼠标对。您的一个朋友过来并说,“嘿,伙计们,这太酷了。我可以加入吗?”您会怎么回答?使用 GUI 可能会导致您这边给出以下回答:“没问题,只需带上您的显示器、键盘和鼠标即可。”

如果您感觉自己像个黑客,并且想尝试这个有缺陷的 GUI/CLI,请查看 http://karlovo.demon.co.uk/~svetlio/ruby-contrib/bruby-python/ 上的当前状态。但请记住,它未经充分测试,如果配置不当,可能会给您带来严重麻烦。如果您不太熟悉 Linux,请等待它更稳定后再使用。如果您对 Linux 足够熟悉,并且认为自己是黑客,请帮助测试它,使其更好、无错误且易于配置。


第八章. 已知问题

8.1. 硬件问题

虽然不完全是问题,但有些显卡在多用户环境中无法正常工作,甚至根本无法工作。

如果您从头开始构建这样的系统,请在购买视频硬件之前查看视频兼容性列表。

有时,辅助显卡(目前仅由 Nvidia 所有者报告)将拒绝启动,即使它们已经流畅地工作了几个月。以下解决方案之一应该可以解决该问题

  • 在主显卡上初始化/启动 XFree 之前,在辅助显卡上运行 /usr/X11R6/bin/X -probeonly

    一些例子

    /usr/X11R6/bin/X -probeonly -layout X2

    /usr/X11R6/bin/X -probeonly -layout X1

    /usr/X11R6/bin/X -probeonly -xf86config /etc/X11/XF86Config-4.X2

    /usr/X11R6/bin/X -probeonly -xf86config /etc/X11/XF86Config-4.X1

  • 将辅助显卡切换为主显卡,启动系统(以将该卡初始化为主显卡),然后将该卡恢复为辅助显卡。

  • 如果这是唯一的辅助显卡,您可以尝试永久切换显卡的顺序。


8.2. 软件问题

有关解决软件问题的详细信息,请参阅 第九章"关于某些发行版的特殊说明。"


8.2.1. 不兼容的用户空间程序:

  1. gpm - 在 XFree86 下鼠标冻结。使用当前的 XFree86,您无论如何都会丢失 VGA 虚拟控制台。

    建议:禁用。

  2. RedHat 8.0/9 -/bin/sysfont:

    您可以使用 RedHat 7.3consolechars代替。

  3. SuSE 8.1 -/etc/init.d/hwscan:

    建议:禁用。如果您必须安装新硬件并想使用此服务,请使用标准内核启动并手动启动它。

  4. 直接写入 tty 的程序,例如vcstime,无法使用。


8.2.2. 需要调整

  1. Mandrake 9.1 -/etc/init.d/numlock:

    您应该将包含 "/dev/tty[0-8]" 的行更改为 "/dev/tty[0-7]"

  2. SuSE 8.1 -/etc/init.d/kbd:

    在文件开头添加此行

    KBD_TTY="tty0 tty2 tty3 tty4 tty5 tty6 tty7"

第九章. 关于某些发行版的特殊说明

9.1. Mandrake

几乎所有事情都很容易完成(可能是因为我至少使用了 2-3 年)。

  1. 只是在/etc/init.d/numlock:

    --- /etc/init.d/numlock.orig	2003-04-11 00:58:55.000000000 +0200
    +++ /etc/init.d/numlock	2003-03-19 13:03:30.000000000 +0100
    @@ -21,14 +21,14 @@
     	echo
     	touch $SYSCONF_FILE
     	
    -	for tty in /dev/tty[0-8]; do
    +	for tty in /dev/tty[0-7]; do
     		setleds -D +num < $tty
     	done
    
     	;;
       stop)
     	gprintf "Disabling numlocks on ttys: "
    -	for tty in /dev/tty[0-8]; do
    +	for tty in /dev/tty[0-7]; do
     		setleds -D -num < $tty
     	done
     	echo_success
              

9.2. Red Hat

  1. 替换sysfontconsolechars.

    < 需要编写 >

    重建console-tools-19990829-40.src.rpm使用 rpmbuild --rebuild console-tools-19990829-40.src.rpm。您可以在 http://www.rpmfind.net 上找到源 rpm)。

    然后安装它

    rpm -Uvh /usr/src/redhat/RPMS/i386/console-tools-19990829-40.i386.rpm

    我似乎仍然遇到一些问题,因为在控制台上我总是得到

    findfont no such file or directory unable to setfont xxx

    但其他一切似乎都正常。


9.3. Debian

没有已知问题。


9.4. SuSE

  1. /etc/init.d/kbd中,在文件开头添加此行

    KBD_TTY="tty0 tty2 tty3 tty4 tty5 tty6 tty7"

    修改后

    #! /bin/sh
    # Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany.
    #
    # Author:   Burchard Steinbild <bs@suse.de>
    #           Werner Fink <werner@suse.de>
    #
    # /etc/init.d/kbd
    #
    #   and symbolic its link
    #
    # /sbin/rckbd
    #
    ### BEGIN INIT INFO
    # Provides:       kbd
    # Required-Start: $remote_fs
    # Required-Stop:
    # X-SuSE-Should-Start:  fbset serial
    # X-SuSE-Should-Stop:
    # Default-Start:  1 2 3 5 S
    # Default-Stop:
    # Description:    Keyboard settings (don't disable!)
    ### END INIT INFO
    
    . /etc/rc.status
    . /etc/sysconfig/console
    . /etc/sysconfig/keyboard
    
    MACHINE=`/bin/uname -m 2> /dev/null`
    if [ "$MACHINE" = "sparc" -o "$MACHINE" = "sparc64" ]; then
       # Test if we have a serial console.
       (test -c /dev/tty1 && > /dev/tty1 ) > /dev/null 2>&1 || exit 0
    fi
    
    # The variable NON_SUSE_KERNEL determines whether we need to chvt
    # to a console before some console settings apply.
    # We have no magic to find out about this (at boot time), so we
    # leave it to the user to read this comment and put NON_SUSE_KERNEL="yes"
    # into /etc/sysconfig/console
    
    KBDBASE="/usr/share/kbd"
    
    KBD_TTY="tty0 tty2 tty3 tty4 tty5 tty6 tty7"
    KTABLE=${KEYTABLE%.map*}
    KTABLE=${KTABLE##*/}
    #
    # first search the wanted keytable.
    #
    if [ $MACHINE = ppc -o $MACHINE = ppc64 ]; then
            test -f /proc/cpuinfo || mount -n -t proc proc /proc 2>/dev/null
            while read line; do
    ......
    ......
              
  2. 硬件扫描有时会导致问题。

    建议:禁用。如果您必须安装新硬件并想使用此服务,请使用标准内核启动并手动启动它。


第十章. 结语

有任何意见吗?发送给 Svetoslav Slavtchev,.

难以理解 HOWTO?某些部分不清楚?请发送邮件至上述地址。

如果您在配置系统时遇到问题,请随时与我或 linuxconsole 邮件列表联系。

请尽可能发送详细信息,最重要的信息将是(来自正在运行的 Backstreet Ruby 内核)

您运行成功了吗?恭喜!请发送邮件,提供有关您配置的一些详细信息,并附上您的 XFree 配置文件。


附录 A. 视频兼容性列表

这是 Backstreet Ruby 主页上视频兼容性列表的摘录。


A.1. 完美工作的显卡对/三卡组合

A.1.1. 不需要修改后的 X 服务器

Voodoo Graphics (glide) + Voodoo 3 (pci)(tdfx)

Voodoo Graphics (glide) + Riva TNT2 M64 (agp)(nvidia)


A.1.2. 需要修改后的 X 服务器

ATI Radeon 7000(AGP)+ Matrox Mystique (PCI)

AGP S3 Inc. 86c368[Trio 3D/2X]+Matrox MGA1064SG[Mystique] (PCI)

Nvidia 显卡

Riva TNT (PCI+PCI+AGP)

Riva TNT2 M64 (pci)(nvidia) + Riva TNT2 M64 (pci)(nvidia)

Riva TNT2 M64 (agp)(nvidia) + GeForce4MX(PCI)

Nvidia GeForce2MX(PCI) + GeForce2MX(PCI) + GeForce2MX(PCI) + GeForce2MX(PCI)

工作正常。DRI + Nvidia GLX 也工作正常。

Voodoo 3 (pci)(tdfx) + Riva TNT2 M64 (agp)(nvidia)

ATI Radeon 7500(AGP) + Nvidia TNT2(PCI)


A.2. 工作但有一些小故障的显卡对/三卡组合

  • 通常,驱动 AGP 卡的 X 服务器必须首先启动。

    这可以通过手动启动 X 或使用 gdm 作为桌面管理器来完成。您将不得不避免使用 xdm 或 kdm,因为它们同时启动 X 服务器。

  • AGP 服务器重启会导致系统崩溃。在gdm.conf中,设置AlwaysRestartServer=false.

  • XFree-4.3-prefbusid 补丁/二进制文件修复了大多数问题。如果 X 服务器以正确的顺序启动,则不会发生锁死。

Nvidia TNT2(AGP) + Matrox Mystique(PCI)

Nvidia TNT2(AGP) + S3 VIRGE/DX(PCI)

Nvidia GeForce4MX440(AGP) + TNT2M64(PCI) + TNT2M64(PCI)

Matrox MGAG400(AGP) + Matrox MGA1064SG[Mystique]PCI

Matrox MGAG450DH(AGP) + ATI Mach 64(PCI)

Matrox MGAG550DH(AGP) + Riva TNT2-M64(PCI)

Matrox MGAG550DH(AGP) + Geforce4 420(PCI)


附录 B. 配置文件示例

有关更多示例,请访问 http://karlovo.demon.co.uk/~svetlio/examples/


B.1. XFree86


B.1.1. 第一个 XFree 服务器配置文件

# File generated by XFdrake.

# **********************************************************************
# Refer to the XF86Config(4/5) man page for details about the format of
# this file.
# **********************************************************************

Section "Files"

    RgbPath	"/usr/X11R6/lib/X11/rgb"

# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Mandrake 6.0 and later now use a font server independent of
# the X server to render fonts.


EndSection

# **********************************************************************
# Server flags section.
# **********************************************************************

Section "ServerFlags"

    # Uncomment this to cause a core dump at the spot where a signal is
    # received.  This may leave the console in an unusable state, but may
    # provide a better stack trace in the core dump to aid in debugging
    #NoTrapSignals

    # Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
    # This allows clients to receive this key event.
    #DontZap

    # Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
    # sequences.  This allows clients to receive these key events.
    #DontZoom

    # This  allows  the  server  to start up even if the
    # mouse device can't be opened/initialised.
    AllowMouseOpenFail

EndSection

# **********************************************************************
# Input devices
# **********************************************************************

# **********************************************************************
# Keyboard section
# **********************************************************************

Section "InputDevice"

    Identifier "Keyboard1"
    Driver      "Keyboard"
    Option "AutoRepeat"  "250 30"

    Option "XkbRules" "xfree86"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "de(nodeadkeys)"

EndSection

# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
#    Option "Device"      "/dev/psaux"
    Option "Device"      "/dev/input/mouse1"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection



Section "Module"

# This loads the DBE extension module.
    Load	"dbe"
    Load	"GLcore"
#    Load	"dga"
    Load	"glx"
    Load	"extmod"
    Load	"dri"
# pass two from mga mailing-lists
#    Load	"pex5"
#    Load	"xie"
    Load	"bitmap"
    Load	"record"
    Load	"vbe"
    Load	"int10"
# end pass two mga mailing-lists


# This loads the Video for Linux module.
    Load        "v4l"


# This loads the miscellaneous extensions module, and disables
# initialisation of the XFree86-DGA extension within that module.

    SubSection	"extmod"
	#Option	"omit xfree86-dga"
    EndSubSection

# This loads the Type1 and FreeType font modules

    Load	"type1"
    Load	"freetype"
EndSection

Section "DRI"
    Mode	0666
EndSection

# **********************************************************************
# Monitor section
# **********************************************************************

# Any number of monitor sections may be present

Section "Monitor"
    Identifier "Generic|Monitor that can do 1600x1200 at 70 Hz"
    VendorName "Unknown"
    ModelName  "Unknown"


# HorizSync is in kHz unless units are specified.
# HorizSync may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
    HorizSync  30-98


# VertRefresh is in Hz unless units are specified.
# VertRefresh may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
    VertRefresh 50-160


# This is a set of extended mode timings typically used for laptop,
# TV fullscreen mode or DVD fullscreen output.
# These are available along with standard mode timings.

# Sony Vaio C1(X,XS,VE,VN)?
# 1024x480 @ 85.6 Hz, 48 kHz hsync
ModeLine "1024x480"    65.00 1024 1032 1176 1344   480  488  494  563 -hsync -vsync

# 768x576 @ 79 Hz, 50 kHz hsync
ModeLine "768x576"     50.00  768  832  846 1000   576  590  595  630
# 768x576 @ 100 Hz, 61.6 kHz hsync
ModeLine "768x576"     63.07  768  800  960 1024   576  578  590  616


EndSection


Section "Monitor"
    Identifier "monitor2"
    VendorName "Unknown"
    ModelName  "Unknown"

    HorizSync   30-98
    VertRefresh 50-160
EndSection


Section "Monitor"
    Identifier "monitor3"
    VendorName "Unknown"
    ModelName  "Unknown"

    HorizSync   31.5-60.0
    VertRefresh 56.0-75.0
EndSection



# **********************************************************************
# Graphics device section
# **********************************************************************

Section "Device"
    Identifier "Generic VGA"
    Driver     "vga"
EndSection


Section "Device"
    Identifier  "g550_1"
    VendorName  ""
    BoardName   ""
    Driver      "mga"
    # Clock lines


    # Uncomment following option if you see a big white block        
    # instead of the cursor!
    #    Option      "sw_cursor"
    Option	"AGPMode" "4"
#    Option      "HWCursor" "Off"
    Option      "HWCursor" "On"
    Option	"MGASDRAM" "On"
    Option      "DPMS"  "Off"
    # Screen 0
    BusID       "PCI:1:0:0"
EndSection


Section "Device"
    Identifier  "g550_2"
    VendorName  ""
    BoardName   ""
    Driver      "mga"
    # Clock lines


    # Uncomment following option if you see a big white block        
    # instead of the cursor!
    #    Option      "sw_cursor"
    Option	"AGPMode" "4"
    Option	"MGASDRAM" "On"
#    Option      "HWCursor" "Off"
    Option      "HWCursor" "On"
    Option      "DPMS"  "Off"
    # Screen 1
    BusID       "PCI:1:0:0"
EndSection



# **********************************************************************
# Screen sections
# **********************************************************************

Section "Screen"
    Identifier "screen1"
    Device      "g550_1"
    Monitor     "monitor2"
    DefaultColorDepth 16
    Subsection "Display"
        Depth       8
        Modes       "1280x1024" "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       15
        Modes       "1280x1024" "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes       "1280x1024" "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "1280x1024" "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
EndSection


Section "ServerLayout"
    Identifier "layout1"
    Screen     "screen1"
    Option      "SingleCard" "true"

    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection
        

B.1.2. 第二个 XFree 服务器配置文件

# File generated by XFdrake.

# **********************************************************************
# Refer to the XF86Config(4/5) man page for details about the format of
# this file.
# **********************************************************************

Section "Files"

    RgbPath	"/usr/X11R6/lib/X11/rgb"
    ModulePath  "/usr/X11R6/libNV/modules"
# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Mandrake 6.0 and later now use a font server independent of
# the X server to render fonts.


EndSection

# **********************************************************************
# Server flags section.
# **********************************************************************

Section "ServerFlags"

    # Uncomment this to cause a core dump at the spot where a signal is
    # received.  This may leave the console in an unusable state, but may
    # provide a better stack trace in the core dump to aid in debugging
    #NoTrapSignals

    # Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
    # This allows clients to receive this key event.
    #DontZap

    # Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
    # sequences.  This allows clients to receive these key events.
    #DontZoom

    # This  allows  the  server  to start up even if the
    # mouse device can't be opened/initialised.
    AllowMouseOpenFail

EndSection

# **********************************************************************
# Input devices
# **********************************************************************

# **********************************************************************
# Keyboard section
# **********************************************************************

Section "InputDevice"

    Identifier "Keyboard1"
    Driver      "Keyboard"
    Option "AutoRepeat"  "250 30"

    Option "XkbRules" "xfree86"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "de(nodeadkeys)"

EndSection

# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "PS/2"
    Option "Device"      "/dev/input/mouse0"
    Option "Emulate3Buttons"
#    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice

#    Option "ChordMiddle"

EndSection


Section "Module"

# This loads the DBE extension module.
    Load	"dbe"
    Load	"glx"
    Load	"vbe"
    Load	"int10"

# This loads the Video for Linux module.
#    Load        "v4l"


# This loads the miscellaneous extensions module, and disables
# initialisation of the XFree86-DGA extension within that module.

    SubSection	"extmod"
	#Option	"omit xfree86-dga"
    EndSubSection

# This loads the Type1 and FreeType font modules

    Load	"type1"
    Load	"freetype"
EndSection

#Section "DRI"
#    Mode	0666
#EndSection

# **********************************************************************
# Monitor section
# **********************************************************************

# Any number of monitor sections may be present

Section "Monitor"
    Identifier "Generic|Monitor that can do 1600x1200 at 70 Hz"
    VendorName "Unknown"
    ModelName  "Unknown"


# HorizSync is in kHz unless units are specified.
# HorizSync may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
    HorizSync  30-98


# VertRefresh is in Hz unless units are specified.
# VertRefresh may be a comma separated list of discrete values, or a
# comma separated list of ranges of values.
# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
# USER MANUAL FOR THE CORRECT NUMBERS.
    VertRefresh 50-160


# This is a set of extended mode timings typically used for laptop,
# TV fullscreen mode or DVD fullscreen output.
# These are available along with standard mode timings.

# Sony Vaio C1(X,XS,VE,VN)?
# 1024x480 @ 85.6 Hz, 48 kHz hsync
ModeLine "1024x480"    65.00 1024 1032 1176 1344   480  488  494  563 -hsync -vsync

# 768x576 @ 79 Hz, 50 kHz hsync
ModeLine "768x576"     50.00  768  832  846 1000   576  590  595  630
# 768x576 @ 100 Hz, 61.6 kHz hsync
ModeLine "768x576"     63.07  768  800  960 1024   576  578  590  616


EndSection


Section "Monitor"
    Identifier "monitor2"
    VendorName "Unknown"
    ModelName  "Unknown"

#    HorizSync   30-98
#    VertRefresh 50-160

    HorizSync   30-50
    VertRefresh 50-120
EndSection



# **********************************************************************
# Graphics device section
# **********************************************************************

Section "Device"
    Identifier "Generic VGA"
    Driver     "vga"
EndSection

Section "Device"
    Identifier  "nv"
    VendorName  ""
    BoardName   ""
    Driver      "nvidia"
    # Clock lines


    # Uncomment following option if you see a big white block
    # instead of the cursor!
    #    Option      "sw_cursor"
    Option	"UseInt10Module" "off"
    Option	"ConnectedMonitor" "CRT"
    Option	"IgnoreEDID" "off"
    Option	"HWCursor" "on"

    Option      "DPMS"  "Off"
    Option	"NoLogo" "On"
    BusID       "PCI:0:10:0"
EndSection


# **********************************************************************
# Screen sections
# **********************************************************************

Section "Screen"
    Identifier "screen1"
    Device      "nv"
    Monitor     "monitor2"
    DefaultColorDepth 24
    Subsection "Display"
        Depth       8
        Modes       "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       15
        Modes       "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes       "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       32
        Modes       "1280x1024" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
EndSection


Section "ServerLayout"
    Identifier "layout1"
    Screen     "screen1"
    Option      "SingleCard" "true"

    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"

EndSection
        

B.2. 显示管理器


B.2.1. xdm 和 kdm

/etc/X11/xdm/Xservers.0

# $XConsortium: Xserv.ws.cpp,v 1.3 93/09/28 14:30:30 gildea Exp $
#
#
# $XFree86: xc/programs/xdm/config/Xserv.ws.cpp,v 1.1.1.1.12.2 1998/10/04 15:23:14 hohndel Exp $
#
# Xservers file, workstation prototype
#
# This file should contain an entry to start the server on the
# local display; if you have more than one display (not screen),
# you can add entries to the list (one per line).  If you also
# have some X terminals connected which do not support XDMCP,
# you can add them here as well.  Each X terminal line should
# look like:
#	XTerminalName:0 foreign
#
:0 local /bin/nice -n -10 /usr/X11R6/bin/X -deferglyphs 16 vt7
        

/etc/X11/xdm/Xservers.1

# $XConsortium: Xserv.ws.cpp,v 1.3 93/09/28 14:30:30 gildea Exp $
#
#
# $XFree86: xc/programs/xdm/config/Xserv.ws.cpp,v 1.1.1.1.12.2 1998/10/04 15:23:14 hohndel Exp $
#
# Xservers file, workstation prototype
#
# This file should contain an entry to start the server on the
# local display; if you have more than one display (not screen),
# you can add entries to the list (one per line).  If you also
# have some X terminals connected which do not support XDMCP,
# you can add them here as well.  Each X terminal line should
# look like:
#	XTerminalName:0 foreign
#
:0 local /bin/nice -n -10 /usr/X11R6/bin/X0 :0 -deferglyphs 16 vt7
:1 local /bin/nice -n -10 /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4.X1 -deferglyphs 16 vt17
        

(我实际上没有使用过。)

/etc/X11/xdm/Xservers.2

# $XConsortium: Xserv.ws.cpp,v 1.3 93/09/28 14:30:30 gildea Exp $
#
#
# $XFree86: xc/programs/xdm/config/Xserv.ws.cpp,v 1.1.1.1.12.2 1998/10/04 15:23:14 hohndel Exp $
#
# Xservers file, workstation prototype
#
# This file should contain an entry to start the server on the
# local display; if you have more than one display (not screen),
# you can add entries to the list (one per line).  If you also
# have some X terminals connected which do not support XDMCP,
# you can add them here as well.  Each X terminal line should
# look like:
#	XTerminalName:0 foreign
#
:0 local /bin/nice -n -10 /usr/X11R6/bin/X0 :0 -deferglyphs 16 vt7
:1 local /bin/nice -n -10 /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4.X1 -deferglyphs 16 vt17
:2 local /bin/nice -n -10 /usr/X11R6/bin/X2 :2 -xf86config /etc/X11/XF86Config-4.X2 -deferglyphs 16 vt18
        

B.2.2. gdm

/etc/X11/gdm/gdm.conf.0

# GDM Configuration file.  You can use gdmsetup program to graphically
# edit this, or you can optionally just edit this file by hand.  Note that
# gdmsetup does not tweak every option here, just the ones most users
# would care about.  Rest is for special setups and distro specific
# tweaks.  If you edit this file, you should send the HUP or USR1 signal to
# the daemon so that it restarts: (Assuming you have not changed PidFile)
#   kill -USR1 `cat /var/run/gdm.pid`
# (HUP will make gdm restart immediately while USR1 will make gdm not kill
# existing sessions and will only restart gdm after all users log out)
#
# You can also use the gdm-restart and gdm-safe-restart scripts which just
# do the above for you.
#
# Have fun! - George

[daemon]
# Automatic login, if true the first local screen will automatically logged
# in as user as set with AutomaticLogin key.
AutomaticLoginEnable=false
AutomaticLogin=
# Timed login, useful for kiosks.  Log in a certain user after a certain
# amount of time
TimedLoginEnable=false
TimedLogin=
TimedLoginDelay=30
# A comma separated list of users that will be logged in without having
# to authenticate on local screens (not over xdmcp).  Note that 'root'
# is ignored and will always have to authenticate.
LocalNoPasswordUsers=
# If you are having trouble with using a single server for a long time and
# want gdm to kill/restart the server, turn this on
AlwaysRestartServer=false
# The gdm configuration program that is run from the login screen, you should
# probably leave this alone
Configurator=/usr/sbin/gdmsetup --disable-sound --disable-crash-dialog
GnomeDefaultSession=/usr/share/gnome/default.session
# The chooser program.  Must output the chosen host on stdout, probably you
# should leave this alone
Chooser=/usr/bin/gdmchooser
# Default path to set.  The profile scripts will likely override this
DefaultPath=/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/usr/bin
# Default path for root.  The profile scripts will likely override this
RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/usr/bin
DisplayInitDir=/etc/X11/gdm/Init
# Greeter for local (non-xdmcp) logins.  Change gdmlogin to gdmgreeter to
# get the new graphical greeter.
Greeter=/usr/bin/gdmgreeter
# Greeter for xdmcp logins, usually you want a less graphically intensive
# greeter here so it's better to leave this with gdmlogin
RemoteGreeter=/usr/bin/gdmlogin
# User and group that gdm should run as.  Probably should be gdm and gdm and
# you should create these user and group.  Anyone found running this as
# someone too privilaged will get a kick in the ass.  This should have
# access to only the gdm directories and files.
User=gdm
Group=gdm
# To try to kill all clients started at greeter time or in the Init script.
# doesn't always work, only if those clients have a window of their own
KillInitClients=true
LogDir=/var/lib/gdm
# You should probably never change this value unless you have a weird setup
PidFile=/var/run/gdm.pid
PostSessionScriptDir=/etc/X11/gdm/PostSession/
PreSessionScriptDir=/etc/X11/gdm/PreSession/
# Distributions:  If you have some script that runs an X server in say
# VGA mode, allowing a login, could you please send it to me?
FailsafeXServer=
# if X keeps crashing on us we run this script.  The default one does a bunch
# of cool stuff to figure out what to tell the user and such and can
# run an X configuration program.
XKeepsCrashing=/etc/X11/gdm/XKeepsCrashing
# Reboot, Halt and suspend commands, you can add different commands
# separated by a semicolon and gdm will use the first one it can find
RebootCommand=/sbin/shutdown -r now;/usr/sbin/shutdown -r now
HaltCommand=/usr/bin/poweroff;/sbin/poweroff;/sbin/shutdown -h now;/usr/sbin/shutdown -h now
SuspendCommand=
# Probably should not touch the below this is the standard setup
ServAuthDir=/var/lib/gdm
SessionDir=/etc/X11/gdm/Sessions/
# Better leave this blank and HOME will be used.  You can use syntax ~/ below
# to indicate home directory of the user
UserAuthDir=
# Fallback if home directory not writable
UserAuthFBDir=/tmp
UserAuthFile=.Xauthority
# The X server to use if we can't figure out what else to run.
StandardXServer=/usr/X11R6/bin/X
# The maximum number of flexible X servers to run.
FlexibleXServers=5
# the X nest command
Xnest=/usr/X11R6/bin/Xnest -name Xnest
# Automatic VT allocation.  Right now only works on Linux.  This way
# we force X to use specific vts.  turn VTAllocation to false if this
# is causing problems.
FirstVT=7
VTAllocation=false

[security]
# If any distributions ship with this one off, they should be shot
# this is only local, so it's only for say kiosk use, when you
# want to minimize possibility of breakin
AllowRoot=true
# If you want to be paranoid, turn this one off
AllowRemoteRoot=true
# This will allow remote timed login
AllowRemoteAutoLogin=false
# 0 is the most anal, 1 allows group write permissions, 2 allows all write permissions
RelaxPermissions=0
RetryDelay=3
# Maximum size of a file we wish to read.  This makes it hard for a user to DoS us
# by using a large file.
UserMaxFile=65536
# Maximum size of the session file.  This is larger because it matters less as we
# never keep it all in memory.  Just has an upper limit so that we don't go into too
# long of a loop
SessionMaxFile=524388

# XDMCP is the protocol that allows remote login.  If you want to log into
# gdm remotely (I'd never turn this on on open network, use ssh for such
# remote usage that).  You can then run X with -query <thishost> to log in,
# or -indirect <thishost> to run a chooser.  Look for the 'Terminal' server
# type at the bottom of this config file.
[xdmcp]
# Distributions: Ship with this off.  It is never a safe thing to leave
# out on the net.  Alternatively you can set up /etc/hosts.allow and
# /etc/hosts.deny to only allow say local access.
Enable=false
# Honour indirect queries, we run a chooser for these, and then redirect
# the user to the chosen host.  Otherwise we just log the user in locally.
HonorIndirect=true
# Maximum pending requests
MaxPending=4
MaxPendingIndirect=4
# Maximum open XDMCP sessions at any point in time
MaxSessions=16
# Maximum wait times
MaxWait=15
MaxWaitIndirect=15
# How many times can a person log in from a single host.  Usually better to
# keep at 1 to fend off DoS attacks by running many logins from a single
# host
DisplaysPerHost=1
# The port.  177 is the standard port so better keep it that way
Port=177
# Willing script, none is shipped and by default we'll send
# hostname system id.  But if you supply something here, the
# output of this script will be sent as status of this host so that
# the chooser can display it.  You could for example send load,
# or mail details for some user, or some such.
Willing=/etc/X11/gdm/Xwilling

[gui]
# The 'theme'.  By default we're using the default gtk theme
# Of course assuming that gtk got installed in the same prefix,
# if not change this.
GtkRC=/usr/share/themes/Default/gtk/gtkrc
# Maximum size of an icon, larger icons are scaled down
MaxIconWidth=128
MaxIconHeight=128

[greeter]
# Greeter has a nice title bar that the user can move
TitleBar=true
# Configuration is available from the system menu of the greeter
ConfigAvailable=true
# Face browser is enabled.  This only works currently for the
# standard greeter as it is not yet enabled in the graphical greeter.
Browser=true
# The default picture in the browser
DefaultFace=/usr/share/mdk/faces/default.png
# These are things excluded from the face browser, not from logging in
Exclude=bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm,rpm
# As an alternative to the above this is the minimum uid to show
MinimalUID=500
# If user or user.png exists in this dir it will be used as his picture
GlobalFaceDir=/usr/share/faces/
# Icon we use
Icon=/usr/share/pixmaps/gdm.png
# File which contains the locale we show to the user.  Likely you want to use
# the one shipped with gdm and edit it.  It is not a standard locale.alias file,
# although gdm will be able to read a standard locale.alias file as well.
LocaleFile=/etc/X11/gdm/locale.alias
# Logo shown in the standard greeter
Logo=/usr/share/pixmaps/gdm-screen.png
# The standard greeter should shake if a user entered the wrong username or
# password.  Kind of cool looking
Quiver=true
# The system menu is shown in the greeter
SystemMenu=true
# Note to distributors, if you wish to have a different Welcome string
# and wish to have this translated you can have entries such as
# Welcome[cs]=Vitejte na %n
# Just make sure the string is in utf-8
Welcome=Welcome to %n
# Don't allow user to move the standard greeter window.  Only makes sense
# if TitleBar is on
LockPosition=false
# Set a position rather then just centering the window.  If you enter
# negative values for the position it is taken as an offset from the
# right or bottom edge.
SetPosition=false
PositionX=0
PositionY=0
# Xinerama screen we use to display the greeter on.  Not for true
# multihead, currently only works for Xinerama.
XineramaScreen=0
# Background settings for the standard greeter:
# Type can be 0=None, 1=Image, 2=Color
BackgroundType=2
BackgroundImage=
BackgroundScaleToFit=true
BackgroundColor=#21449c
# XDMCP session should only get a color, this is the sanest setting since
# you don't want to take up too much bandwidth
BackgroundRemoteOnlyColor=true
# Program to run to draw the background in the standard greeter.  Perhaps
# something like an xscreensaver hack or some such.
BackgroundProgram=
# if this is true then the background program is run always, otherwise
# it is only run when the BackgroundType is 0 (None)
RunBackgroundProgramAlways=false
# Show the chooser (you can choose a specific saved gnome session) session
ShowGnomeChooserSession=false
# Show the Failsafe sessions.  These are much MUCH nicer (focus for xterm for
# example) and more failsafe then those supplied by scripts so distros should
# use this rather then just running an xterm from a script.
ShowGnomeFailsafeSession=false
ShowXtermFailsafeSession=false
# Always use 24 hour clock no matter what the locale.
Use24Clock=false
# Use circles in the password field.  Looks kind of cool actually
UseCirclesInEntry=false
# These two keys are for the new greeter.  Circles is the standard
# shipped theme
GraphicalTheme=mdk
GraphicalThemeDir=/usr/share/gdm/themes/

# The chooser is what's displayed when a user wants an indirect XDMCP
# session
[chooser]
# Default image for hosts
DefaultHostImg=/usr/share/pixmaps/nohost.png
# Directory with host images, they are named by the hosts: host or host.png
HostImageDir=/usr/share/hosts/
# Time we scan for hosts (well only the time we tell the user we are
# scanning actually)
ScanTime=3
# A comma separated lists of hosts to automatically add (if they answer to
# a query of course).  You can use this to reach hosts that broadcast cannot
# reach.
Hosts=
# Broadcast a query to get all hosts on the current network that answer
Broadcast=true

[debug]
# This will enable debugging into the syslog, usually not neccessary
# and it creates a LOT of spew of random stuff to the syslog.  However it
# can be useful in determining when something is going very wrong.
Enable=false

[servers]
# These are the standard servers.  You can add as many you want here
# and they will always be started.  Each line must start with a unique
# number and that will be the display number of that server.  Usually just
# the 0 server is used.
0=Standard
#1=Standard
# Note the VTAllocation and FirstVT keys on Linux.  Don't add any vt<number>
# arguments if VTAllocation is on, and set FirstVT to be the first vt
# available that your gettys don't grab (gettys are usually dumb and grab
# even a vt that has already been taken).  Using 7 will work pretty much for
# all Linux distributions.  VTAllocation is not currently implemented on
# anything but Linux since I don't own any non-Linux systems.  Feel free to
# send patches.  X servers will just not get any extra arguments then.
#
#Note: If you want to run an X terminal you could add an X server such as this
#0=Terminal -query serverhostname
# or for a chooser (optionally serverhostname could be localhost)
#0=Terminal -indirect serverhostname

# Definition of the standard X server.
[server-Standard]
name=Standard server
command=/usr/X11R6/bin/X0 :0 -deferglyphs 16 vt7

flexible=true

# To use this server type you should add -query host or -indirect host
# to the command line
[server-Terminal]
name=Terminal server
# Add -terminate to make things behave more nicely
command=/usr/X11R6/bin/X -terminate
# Make this not appear in the flexible servers (we need extra params
# anyway, and terminate would be bad for xdmcp)
flexible=false
# Not local, we do not handle the logins for this X server
handled=false
        

/etc/X11/gdm/gdm.conf.1

# GDM Configuration file.  You can use gdmsetup program to graphically
# edit this, or you can optionally just edit this file by hand.  Note that
# gdmsetup does not tweak every option here, just the ones most users
# would care about.  Rest is for special setups and distro specific
# tweaks.  If you edit this file, you should send the HUP or USR1 signal to
# the daemon so that it restarts: (Assuming you have not changed PidFile)
#   kill -USR1 `cat /var/run/gdm.pid`
# (HUP will make gdm restart immediately while USR1 will make gdm not kill
# existing sessions and will only restart gdm after all users log out)
#
# You can also use the gdm-restart and gdm-safe-restart scripts which just
# do the above for you.
#
# Have fun! - George

[daemon]
# Automatic login, if true the first local screen will automatically logged
# in as user as set with AutomaticLogin key.
AutomaticLoginEnable=false
AutomaticLogin=
# Timed login, useful for kiosks.  Log in a certain user after a certain
# amount of time
TimedLoginEnable=false
TimedLogin=
TimedLoginDelay=30
# A comma separated list of users that will be logged in without having
# to authenticate on local screens (not over xdmcp).  Note that 'root'
# is ignored and will always have to authenticate.
LocalNoPasswordUsers=
# If you are having trouble with using a single server for a long time and
# want gdm to kill/restart the server, turn this on
AlwaysRestartServer=false
# The gdm configuration program that is run from the login screen, you should
# probably leave this alone
Configurator=/usr/sbin/gdmsetup --disable-sound --disable-crash-dialog
GnomeDefaultSession=/usr/share/gnome/default.session
# The chooser program.  Must output the chosen host on stdout, probably you
# should leave this alone
Chooser=/usr/bin/gdmchooser
# Default path to set.  The profile scripts will likely override this
DefaultPath=/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/usr/bin
# Default path for root.  The profile scripts will likely override this
RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/usr/bin
DisplayInitDir=/etc/X11/gdm/Init
# Greeter for local (non-xdmcp) logins.  Change gdmlogin to gdmgreeter to
# get the new graphical greeter.
Greeter=/usr/bin/gdmgreeter
# Greeter for xdmcp logins, usually you want a less graphically intensive
# greeter here so it's better to leave this with gdmlogin
RemoteGreeter=/usr/bin/gdmlogin
# User and group that gdm should run as.  Probably should be gdm and gdm and
# you should create these user and group.  Anyone found running this as
# someone too privilaged will get a kick in the ass.  This should have
# access to only the gdm directories and files.
User=gdm
Group=gdm
# To try to kill all clients started at greeter time or in the Init script.
# doesn't always work, only if those clients have a window of their own
KillInitClients=true
LogDir=/var/lib/gdm
# You should probably never change this value unless you have a weird setup
PidFile=/var/run/gdm.pid
PostSessionScriptDir=/etc/X11/gdm/PostSession/
PreSessionScriptDir=/etc/X11/gdm/PreSession/
# Distributions:  If you have some script that runs an X server in say
# VGA mode, allowing a login, could you please send it to me?
FailsafeXServer=
# if X keeps crashing on us we run this script.  The default one does a bunch
# of cool stuff to figure out what to tell the user and such and can
# run an X configuration program.
XKeepsCrashing=/etc/X11/gdm/XKeepsCrashing
# Reboot, Halt and suspend commands, you can add different commands
# separated by a semicolon and gdm will use the first one it can find
RebootCommand=/sbin/shutdown -r now;/usr/sbin/shutdown -r now
HaltCommand=/usr/bin/poweroff;/sbin/poweroff;/sbin/shutdown -h now;/usr/sbin/shutdown -h now
SuspendCommand=
# Probably should not touch the below this is the standard setup
ServAuthDir=/var/lib/gdm
SessionDir=/etc/X11/gdm/Sessions/
# Better leave this blank and HOME will be used.  You can use syntax ~/ below
# to indicate home directory of the user
UserAuthDir=
# Fallback if home directory not writable
UserAuthFBDir=/tmp
UserAuthFile=.Xauthority
# The X server to use if we can't figure out what else to run.
StandardXServer=/usr/X11R6/bin/X0
# The maximum number of flexible X servers to run.
FlexibleXServers=5
# the X nest command
Xnest=/usr/X11R6/bin/Xnest -name Xnest
# Automatic VT allocation.  Right now only works on Linux.  This way
# we force X to use specific vts.  turn VTAllocation to false if this
# is causing problems.
FirstVT=7
VTAllocation=false

[security]
# If any distributions ship with this one off, they should be shot
# this is only local, so it's only for say kiosk use, when you
# want to minimize possibility of breakin
AllowRoot=true
# If you want to be paranoid, turn this one off
AllowRemoteRoot=true
# This will allow remote timed login
AllowRemoteAutoLogin=false
# 0 is the most anal, 1 allows group write permissions, 2 allows all write permissions
RelaxPermissions=0
RetryDelay=3
# Maximum size of a file we wish to read.  This makes it hard for a user to DoS us
# by using a large file.
UserMaxFile=65536
# Maximum size of the session file.  This is larger because it matters less as we
# never keep it all in memory.  Just has an upper limit so that we don't go into too
# long of a loop
SessionMaxFile=524388

# XDMCP is the protocol that allows remote login.  If you want to log into
# gdm remotely (I'd never turn this on on open network, use ssh for such
# remote usage that).  You can then run X with -query <thishost> to log in,
# or -indirect <thishost> to run a chooser.  Look for the 'Terminal' server
# type at the bottom of this config file.
[xdmcp]
# Distributions: Ship with this off.  It is never a safe thing to leave
# out on the net.  Alternatively you can set up /etc/hosts.allow and
# /etc/hosts.deny to only allow say local access.
Enable=false
# Honour indirect queries, we run a chooser for these, and then redirect
# the user to the chosen host.  Otherwise we just log the user in locally.
HonorIndirect=true
# Maximum pending requests
MaxPending=4
MaxPendingIndirect=4
# Maximum open XDMCP sessions at any point in time
MaxSessions=16
# Maximum wait times
MaxWait=15
MaxWaitIndirect=15
# How many times can a person log in from a single host.  Usually better to
# keep at 1 to fend off DoS attacks by running many logins from a single
# host
DisplaysPerHost=1
# The port.  177 is the standard port so better keep it that way
Port=177
# Willing script, none is shipped and by default we'll send
# hostname system id.  But if you supply something here, the
# output of this script will be sent as status of this host so that
# the chooser can display it.  You could for example send load,
# or mail details for some user, or some such.
Willing=/etc/X11/gdm/Xwilling

[gui]
# The 'theme'.  By default we're using the default gtk theme
# Of course assuming that gtk got installed in the same prefix,
# if not change this.
GtkRC=/usr/share/themes/Default/gtk/gtkrc
# Maximum size of an icon, larger icons are scaled down
MaxIconWidth=128
MaxIconHeight=128

[greeter]
# Greeter has a nice title bar that the user can move
TitleBar=true
# Configuration is available from the system menu of the greeter
ConfigAvailable=true
# Face browser is enabled.  This only works currently for the
# standard greeter as it is not yet enabled in the graphical greeter.
Browser=true
# The default picture in the browser
DefaultFace=/usr/share/mdk/faces/default.png
# These are things excluded from the face browser, not from logging in
Exclude=bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm,rpm
# As an alternative to the above this is the minimum uid to show
MinimalUID=500
# If user or user.png exists in this dir it will be used as his picture
GlobalFaceDir=/usr/share/faces/
# Icon we use
Icon=/usr/share/pixmaps/gdm.png
# File which contains the locale we show to the user.  Likely you want to use
# the one shipped with gdm and edit it.  It is not a standard locale.alias file,
# although gdm will be able to read a standard locale.alias file as well.
LocaleFile=/etc/X11/gdm/locale.alias
# Logo shown in the standard greeter
Logo=/usr/share/pixmaps/gdm-screen.png
# The standard greeter should shake if a user entered the wrong username or
# password.  Kind of cool looking
Quiver=true
# The system menu is shown in the greeter
SystemMenu=true
# Note to distributors, if you wish to have a different Welcome string
# and wish to have this translated you can have entries such as
# Welcome[cs]=Vitejte na %n
# Just make sure the string is in utf-8
Welcome=Welcome to %n
# Don't allow user to move the standard greeter window.  Only makes sense
# if TitleBar is on
LockPosition=false
# Set a position rather then just centering the window.  If you enter
# negative values for the position it is taken as an offset from the
# right or bottom edge.
SetPosition=false
PositionX=0
PositionY=0
# Xinerama screen we use to display the greeter on.  Not for true
# multihead, currently only works for Xinerama.
XineramaScreen=0
# Background settings for the standard greeter:
# Type can be 0=None, 1=Image, 2=Color
BackgroundType=2
BackgroundImage=
BackgroundScaleToFit=true
BackgroundColor=#21449c
# XDMCP session should only get a color, this is the sanest setting since
# you don't want to take up too much bandwidth
BackgroundRemoteOnlyColor=true
# Program to run to draw the background in the standard greeter.  Perhaps
# something like an xscreensaver hack or some such.
BackgroundProgram=
# if this is true then the background program is run always, otherwise
# it is only run when the BackgroundType is 0 (None)
RunBackgroundProgramAlways=false
# Show the chooser (you can choose a specific saved gnome session) session
ShowGnomeChooserSession=false
# Show the Failsafe sessions.  These are much MUCH nicer (focus for xterm for
# example) and more failsafe then those supplied by scripts so distros should
# use this rather then just running an xterm from a script.
ShowGnomeFailsafeSession=false
ShowXtermFailsafeSession=false
# Always use 24 hour clock no matter what the locale.
Use24Clock=false
# Use circles in the password field.  Looks kind of cool actually
UseCirclesInEntry=false
# These two keys are for the new greeter.  Circles is the standard
# shipped theme
GraphicalTheme=mdk
GraphicalThemeDir=/usr/share/gdm/themes/

# The chooser is what's displayed when a user wants an indirect XDMCP
# session
[chooser]
# Default image for hosts
DefaultHostImg=/usr/share/pixmaps/nohost.png
# Directory with host images, they are named by the hosts: host or host.png
HostImageDir=/usr/share/hosts/
# Time we scan for hosts (well only the time we tell the user we are
# scanning actually)
ScanTime=3
# A comma separated lists of hosts to automatically add (if they answer to
# a query of course).  You can use this to reach hosts that broadcast cannot
# reach.
Hosts=
# Broadcast a query to get all hosts on the current network that answer
Broadcast=true

[debug]
# This will enable debugging into the syslog, usually not neccessary
# and it creates a LOT of spew of random stuff to the syslog.  However it
# can be useful in determining when something is going very wrong.
Enable=false

[servers]
# These are the standard servers.  You can add as many you want here
# and they will always be started.  Each line must start with a unique
# number and that will be the display number of that server.  Usually just
# the 0 server is used.
0=Standard
1=2nd

# Note the VTAllocation and FirstVT keys on Linux.  Don't add any vt<number>
# arguments if VTAllocation is on, and set FirstVT to be the first vt
# available that your gettys don't grab (gettys are usually dumb and grab
# even a vt that has already been taken).  Using 7 will work pretty much for
# all Linux distributions.  VTAllocation is not currently implemented on
# anything but Linux since I don't own any non-Linux systems.  Feel free to
# send patches.  X servers will just not get any extra arguments then.
#
#Note: If you want to run an X terminal you could add an X server such as this
#0=Terminal -query serverhostname
# or for a chooser (optionally serverhostname could be localhost)
#0=Terminal -indirect serverhostname

# Definition of the standard X server.
[server-Standard]
name=Standard server
command=/usr/X11R6/bin/X0 :0 -deferglyphs 16 vt7
flexible=true

# Definition of the second X server.
[server-2nd]
name=2nd server
command=/usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4.X1 -deferglyphs 16 vt17
flexible=true

# To use this server type you should add -query host or -indirect host
# to the command line
[server-Terminal]
name=Terminal server
# Add -terminate to make things behave more nicely
command=/usr/X11R6/bin/X -terminate
# Make this not appear in the flexible servers (we need extra params
# anyway, and terminate would be bad for xdmcp)
flexible=false
# Not local, we do not handle the logins for this X server
handled=false
        

B.3. Input Agent 的配置文件

B.3.1. 键盘配置

输入代理使用 3 个配置文件

#
# keyboard configuretion
#
# vt_name device_physicaly_location
VT0	usb-00:10.1-1.1/input0
VT1	isa0060/serio0/input0
#VT2	usb-*.*-1/input0

B.3.2. 鼠标配置

/etc/hotplug/kbd.conf

# mouse device configuration
#
# sym_link device_physicaly_location
mouse0br	usb-00:10.1-1.2/input0
mouse2br	usb-00:10.1-2.7.*/input0
mouse1br	usb-00:10.1-2.2/input0

B.3.3. 事件设备配置

/etc/hotplug/mouse.conf

#
# input event device config file
#
# symbolic_link device_physicaly_location
#event0br	isa0060/serio0/*
#event0br	isa0060/serio1/input0
#event3br	usb-*.*-1.3/*

附录 C. 脚本

C.1. hotpluginput.agent

对于热插拔,您还需要

#!/bin/sh
# Please place this file /etc/hotplug
#
# input-specific hotplug policy agent.
#
# Kernel Input params are:
#	
#	ACTION=add
#	PHYS=pysical location of device
#	NAME=Name of the device
#
# HISTORY:
#       15-JUN-2003     removed paste
#       07-MAY-2003     remake by Aivils Stoss
#                       /proc manipulation added
#                       parse kbd.conf event.conf mouse.conf.
#			create necessary symbolic links
#	28-SEP-2002	Initial version from Andreas Schuldei
#			 andreas (at) schuldei.org 
#
cd /etc/hotplug
. hotplug.functions
DEBUG=yes export DEBUG

KBD_CONFIG="./kbd.conf"
EVENT_CONFIG="./event.conf"
MOUSE_CONFIG="./mouse.conf"

setup_kbd ()
{
    while read VT_NUM PHYS_PATTERN NAME_PATTERN
    do
	if [ `echo "$VT_NUM" | grep "^#"` ]; then
	    continue;
	fi
	if [ `echo "$PHYS" | grep $PHYS_PATTERN 2>/dev/null` ]; then
	    VT=`echo "$VT_NUM" | sed 's/VT//' | awk '{printf "%02d", $0}'`
            if [ -d /proc/bus/console/$VT ]; then
                echo "$PHYS" > "/proc/bus/console/$VT/keyboard"
                debug_mesg "Input device $NAME on $PHYS mapping as secondary to VT$VT"
                return;
	    else
		debug_mesg "Trying to configure keyboard for VT$VT , but not enough VT's available"
	    fi
	fi
    done
    debug_mesg "Found no fitting VT"
}

setup_event ()
{
    while read SYM_LINK PHYS_PATTERN NAME_PATTERN
    do
	if [ `echo "$SYM_LINK" | grep "^#"` ]; then
	    continue;
	fi
	if [ `echo "$PHYS" | grep $PHYS_PATTERN 2>/dev/null` ]; then
	    case $ACTION in
	    add)
		cd /dev/input
                rm -f $SYM_LINK
		ln -s $DEV_EVENT $SYM_LINK
    		debug_mesg "Input event device $NAME on $PHYS linked to $SYM_LINK"
	    ;;
	    remove)
		rm -f /dev/input/$SYM_LINK
    		debug_mesg "Input event device link $SYM_LINK removed"
	    ;;
	    esac
	    return;
	fi
    done
    debug_mesg "Found no fitting event device"
}

setup_mouse ()
{
    while read SYM_LINK PHYS_PATTERN NAME_PATTERN
    do
	if [ `echo "$SYM_LINK" | grep "^#"` ]; then
	    continue;
	fi
	if [ `echo "$PHYS" | grep $PHYS_PATTERN 2>/dev/null` ]; then
	    case $ACTION in
	    add)
                cd /dev/input
		rm -f $SYM_LINK
		ln -s $DEV_MOUSE $SYM_LINK
    		debug_mesg "Input mouse device $NAME on $PHYS linked to $SYM_LINK"
	    ;;
	    remove)
		rm -f /dev/input/$SYM_LINK
    		debug_mesg "Input mouse device link $SYM_LINK removed"
	    ;;
	    esac
	    return;
	fi
    done
    debug_mesg "Found no fitting mouse device"
}

if [ "$ACTION" = "" ]; then
    mesg Bad input agent invocation
    exit 1
fi

DEV_HANDLERS=`grep -E 'Phys|Handlers' /proc/bus/input/devices | \
    awk '{ if(count == 0) { printf("%s\t",$0); count++; } else { print $0; count=0; } }' | \
    grep $PHYS | awk -F\t '{print $2}' | sed 's/^.*=//'`

# older grep do not support -o :-(
#DEV_EVENT=`echo $MATCHED | grep -oE event[0-9]+`
#DEV_MOUSE=`echo $MATCHED | grep -oE mouse[0-9]+`
#DEV_KBD=`echo $MATCHED | grep -o kbd`

DEV_EVENT=`echo $DEV_HANDLERS | \
	    awk -F" " '{for(n=1;$n;n=n+1) if($n ~ /event/) print $n}'`
DEV_MOUSE=`echo $DEV_HANDLERS | \
	    awk -F" " '{for(n=1;$n;n=n+1) if($n ~ /mouse/) print $n}'`
DEV_KBD=`echo $DEV_HANDLERS | \
	    awk -F" " '{for(n=1;$n;n=n+1) if($n ~ /kbd/) print $n}'`

#
# What to do with this input device event?
#
case "$ACTION" in

add)
    if [ -n "$DEV_KBD" ]; then
	setup_kbd < $KBD_CONFIG
    fi
    if [ -n "$DEV_EVENT" ]; then
	setup_event < $EVENT_CONFIG
    fi
    if [ -n "$DEV_MOUSE" ]; then
	setup_mouse < $MOUSE_CONFIG
    fi
    ;;
remove)
    #setup_event < $EVENT_CONFIG
    #setup_mouse < $MOUSE_CONFIG
    ;;
*)
    debug_mesg "Input '$ACTION' event not supported"
    return 1
    ;;

esac
      

C.2. hotpluginput.rc

/etc/hotplug/input.rc

#!/bin/bash
#
# input.rc	This loads handlers for those input devices
#		that have drivers compiled in kernel
#		Currently stopping is not supported
#
# Best invoked via /etc/init.d/hotplug or equivalent, with
# writable /tmp, /usr mounted, and syslogging active.
#


PATH=/sbin:/bin:/usr/sbin:/usr/bin
PROCDIR=/proc/bus/input

# source function library
if [ -f /etc/init.d/functions ]; then
	. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
	. /etc/rc.d/init.d/functions
fi

if [ -f /etc/hotplug/hotplug.functions ]; then
	. /etc/hotplug/hotplug.functions
fi

input_reset_state () {

    PRODUCT=
    NAME=
    PHYS=
    EV=
    KEY=
    REL=
    ABS=
    MSC=
    LED=
    SND=
    FF=

}

#
# "COLD PLUG" ... load input handlers for compile-in input drivers loaded
# before the OS could really handle hotplug, perhaps because /sbin or
# $HOTPLUG_DIR wasn't available or /tmp wasn't writable.  When/if the
# /sbin/hotplug program is invoked then, hotplug event notifications
# get dropped.  To make up for such "cold boot" errors, we synthesize
# all the hotplug events we expect to have seen already.  They can be
# out of order, and some might be duplicates.
#
input_boot_events ()
{
    if [ ! -r $PROCDIR/devices ]; then
	    echo $"** can't synthesize input events - $PROCDIR/devices missing"
	    return
    fi

    ACTION=add
    export ACTION

    export PRODUCT NAME PHYS EV KEY REL ABS MSC LED SND FF
    input_reset_state

    declare line

    #
    # the following reads from /proc/bus/input/devices. It is inherently
    # racy (esp. as this file may be changed by input.agent invocation)
    # but so far input devices do not appear in sysfs
    #
    while read line; do
	case "$line" in
	    I:* )	# product ID
		eval "${line#I: }"
		PRODUCT=$Bus/$Vendor/$Product/$Version
	    ;;
	    N:* )	# name
		eval "${line#N: }"
		NAME="$Name"
	    ;;
	    P:* )	# Physical
		eval "${line#P: }"
		PHYS=$Phys
	;;
	    B:* )	# Controls supported
		line="${line#B: }"
		eval "${line%%=*}=\"${line#*=}\""
	    ;;
	    "" )	# End of block
		debug_mesg "Invoking input.agent"
		debug_mesg "PRODUCT=$PRODUCT"
		debug_mesg "NAME=$NAME"
		debug_mesg "PHYS=$PHYS"
		debug_mesg "EV=$EV"
		debug_mesg "KEY=$KEY"
		debug_mesg "REL=$REL"
		debug_mesg "ABS=$ABS"
		debug_mesg "MSC=$MSC"
		debug_mesg "LED=$LED"
		debug_mesg "SND=$SND"
		debug_mesg "FF=$FF"
		/etc/hotplug/input.agent < /dev/null
		input_reset_state
	    ;;
	esac
    done < $PROCDIR/devices
}


# See how we were called.
case "$1" in
  start)
	input_boot_events
        ;;
  stop)
	: not supported currently
        ;;
  status)
	echo $"INPUT status for kernel: " `uname -srm`
	echo ''

	echo "INPUT devices:"
	if [ -r $PROCDIR/devices ]; then
	    grep "^[INHP]:" $PROCDIR/devices
	else
	    echo "$PROCDIR/devices not available"
	fi
	echo ''

	echo "INPUT handlers:"
	if [ -r $PROCDIR/handlers ]; then
	    cat $PROCDIR/handlers
	else
	    echo "$PROCDIR/handlers not available"
	fi

	echo ''

	;;
  restart)
	# always invoke by absolute path, else PATH=$PATH:
	$0 stop && $0 start
	;;
  *)
        echo $"Usage: $0 {start|stop|status|restart}"
        exit 1
esac

      

C.3. hotplug 和 XFree 支持事件设备input.agent

对于热插拔,您还需要

#!/bin/bash

cd /etc/hotplug
. hotplug.functions
#DEBUG=yes export DEBUG

export ARG_SEP='\002'
export VAL_SEP='\003'

for dev in `ls /tmp/.X11-unix/ | grep evdev`; do {
    export dev="/tmp/.X11-unix/${dev}"
    /bin/sh -c 'echo -e "2.1${ARG_SEP}NAME${VAL_SEP}${NAME}${ARG_SEP}PHYS${VAL_SEP}${PHYS}${ARG_SEP}ACTION${VAL_SEP}${ACTION}" >> ${dev}' &
}; done

C.4. 使用 Nvidia 启动 X 的包装器libGL.so

#!/bin/bash
#########################################################
### /usr/X11R6/bin/XNV                                ###
### script to start XFree with different LIBRARY_PATH ###
### in order to use Nvidia GL libraries and           ###
### XFree GL libraries at the same time               ###
#########################################################
  
export LD_LIBRARY_PATH=/usr/X11R6/libNV
exec /usr/X11R6/bin/X0 $*
      

C.5. 用于安装 Nvidia 驱动程序以与 DRI 并行使用

#!/bin/bash
########################################################
### /usr/sbin/ruby_NVinstaller                       ###
### for usage call it with -h or --help parameter    ###
########################################################

if [[ -z $1 ]] || [ "$1" == "-h" ] || [ "$1" == "--help" ] ;then
echo
echo "Usage :"
echo "$0 full path to Nvidia installer"
echo "eg. $0 /root/NVIDIA-Linux-x86-1.0-4349.run"
exit 1
fi

if [[ -z $OPENWINHOME ]];then
echo
echo "OPENWINHOME not defined!!!"
echo "Please set the environment variable OPENWINHOME"
echo "pointing to your XFree prefix eg. /usr/X11R6"
echo "for bash shell :"
echo "export OPENWINHOME=/usr/X11R6"
exit 1
fi

cd $OPENWINHOME
echo
echo "backup file for XFree's GL libraries "
echo "is $OPENWINHOME/libGL-backup.tar"
if [ -x libGL-backup.tar ]; then
	echo "old backup exist, deleting" && rm libGL-backup.tar
fi
echo
find lib -name "libGL.*" -o -name "libGLcore*" \
	-o -name "libglx.*" | xargs tar  rpf   libGL-backup.tar \
	&& echo "backup finished"
echo
echo "now running Nvidia installer"
echo "`which $1` --no-opengl-headers --xfree86-prefix=/usr/X11R6NV --opengl-prefix=/usr/X11R6NV"
echo
`which $1` --no-opengl-headers --xfree86-prefix=/usr/X11R6NV --opengl-prefix=/usr/X11R6NV
RETVAL=$?
if [ $RETVAL -eq 0 ]; then

echo
echo "Nvidia installer finished,"
echo "now coping files to /usr/X11R6/libNV/"
echo
cd /usr/X11R6NV/lib &&  tar c * | tar xvC /usr/X11R6/libNV/
echo
echo "restoring backuped GL libraries"
echo
cd $OPENWINHOME
tar xvfp libGL-backup.tar && ldconfig && echo "GL libraries restored" && rm libGL-backup.tar
fi

if [ $RETVAL -ne 0 ]; then
	echo
	echo "installer aborted, not restoring backup"
	echo "deleting backup files" &&  rm libGL-backup.tar
fi

echo
echo "script finished"
      

附录 D. 实验性 Backstreet Ruby 配置脚本/服务

D.1.README.ruby_init解释了如何配置和使用该服务。

well,
have to be written :-)

You'll need to install the following scripts  :
(and don't forget to make them executable :-) with chmod a+x [filename] )
/etc/hotplug/input.agent
/etc/hotplug/input.rc
/etc/init.d/ruby_init

and the configuration file:
/etc/sysconfig/ruby.conf

edit the configuration file to adjust it to your system configuration

start the service and check if everything is done as requested and configured
/etc/init.d/ruby_init start

if everything is OK activate the service by running "chkconfig --add ruby_init" .

"chkconfig --list ruby_init" will tell you in which runlevels the service is active
 
root@svetljo SRPMS]# chkconfig --list ruby_init
ruby_init       0:off   1:off   2:on    3:on    4:on    5:on    6:off

you can deactivate it by running "chkconfig --del ruby_init"

The input configuration uses the same syntax 
as kbd.conf, mouse.conf, event.conf as explained
in the section about hotplug with input agent.

The other configurable options are:

HACK_VIDEO_ENABLE=no

If set to "yes", turns on at boot the hackvideo feature of the Backstreet Ruby kernel.
In case XFree PrefBusID is used set to "no"

HOTPLUG_RC_input=yes

If set to "yes", runs /etc/hotplug/input.rc to configure input devices which were activated
by the kernel before hotplug was available (drivers statically linked in the kernel).
Generaly needed by all systems unless you have all input drivers configured as loadable modules
and load the drivers after hotplug is accessible to the kernel.

AUTO_DM=no
AUTO_XFree=no

No description yet. Or may be ...
enables/disables the features explained in sections  
"7.3. 1st X server configuration file" and "7.4. Number X servers started by Display managers"
you don't need to modify your init scripts if you use the ruby_init service and enable them
in ruby.conf.

LOAD_MODULES=yes

if set to "yes" loads certain input device drivers in case a ruby kernel is running.

#
# input modules configuration
#
# module arguments

The list of modules which should be loaded in case ruby kernel is running and 
LOAD_MODULES is set to "yes". 
In the example file are listed all important input drivers (keyboards & mice).
If you have some of them compiled in the kernel, you may disable the loading 
of the corresponding drivers by commenting them out. 

the ext-status argument can give you detailed information about the current 
configuration, and valuable information in case you are in trouble. 

D.2. 全局配置文件/etc/sysconfig/ruby.conf

/etc/sysconfig/ruby.conf存储了 Backstreet ruby 内核的 Input 子系统的所有配置选项,以及在使用此类内核时是否应运行某些操作/服务。

# /etc/sysconfig/ruby.conf
# This file contains defaults for bruby_init

#
# HACK_VIDEO_ENABLE controls wether the ruby kernel shoukd
# ignore certain XFree commands. 
#
# Set to yes in case you are not running the XFree-PrefBusID
# but XFree from your distribution 
#

HACK_VIDEO_ENABLE=yes
 
# HOTPLUG_RC_input controls whether the input subsystem is started by
# hotplug rc script ("cold plugging")
#

HOTPLUG_RC_input=yes

#
# AUTO_DM controls wether the display manager configuration files
# is adjusted upon the boot argument dumbcon=[number]
#
# AUTO_XFree controls wether the XFree configuration file is
# adjusted upon XFree=[string] argument.
# For Mandrake users this always activated in /etc/rc.d/rc.sysinit
# and can not be disabled.
# 

AUTO_DM=no
AUTO_XFree=no

#
# LOAD_MODULES controls wether the additional modules listed below
# should be loaded when a ruby kernel is running.

LOAD_MODULES=yes

#
# input modules configuration
#
# module arguments

# needed for all mice
mousedev

# for USB input
hid

# for PS2 input
serio
i8042
atkbd
psmouse

#
# keyboard devices configuration
#
# vt_name device_physicaly_location
VT0     isa0060/serio0/input0
VT1     usb-00:10.1-1.1/input0
#VT0     isa0060/serio0/input0
#VT2    usb-*.*-1/input0

#
# multimedia keys configuration
#
# vt_name device_physicaly_location
#VT1     usb-00:10.1-1.1/input1
#VT2    usb-*.*-1/input0

#
# mouse devices configuration
#
# sym_link device_physicaly_location
mouse0br        isa0060/serio1/input0
mouse1br        usb-00:10.1-1.2/input0
#mouse2br        usb-00:10.1-2.7.*/input0
#mouse1br        usb-00:10.1-2.2/input0

#
# event devices configuration
#
# sym_link device_physicaly_location
#event0br        isa0060/serio1/input0
#event1br        usb-00:10.1-1.1/input0
#event2br        usb-00:10.1-1.1/input1
#event3br        usb-00:10.1-1.2/input0

#
# end input device configuration 
#

D.3. ruby_init 服务/etc/init.d/ruby_init

/etc/init.d/ruby_init服务配置/激活了 Backstreet Ruby 系统的大多数特定设置。

#!/bin/sh
#
# ruby_init  This scripts configures cold-pluging for bruby, \
#            loads additional input modules, manages the XFree \ 
#	     and display manager configuration files
#
# chkconfig: 2345 02 98
# description:	Configures the Bruby input subsystem and manages \
#		XFree and display manager configuration files.
# config: /etc/sysconfig/ruby.conf
#
# TODO 
#	* handle commented out "PciOsConfig"
# 	*? status/ ext-status
#	- show config
# 	- check wether curr. configuration matches setup ? 
#	- make it work when hotplug files not installed ?
#	  ( currently it will just just inform that they are not installed
#	  and exit )
#
# $Id: XFree-Local-multi-user-HOWTO.xml,v 1.12 2003/11/11 14:52:42 gferg Exp $
# - don't exit silently if hackvideo or modules loading is deactivated,
#   run the script to the end
# $Id: XFree-Local-multi-user-HOWTO.xml,v 1.12 2003/11/11 14:52:42 gferg Exp $
# - show keyboard status per VT ,use sed instead of head(head is in /usr)
# - *? status/ ext-status
# - (mice & evdev links)?
# $Id: XFree-Local-multi-user-HOWTO.xml,v 1.12 2003/11/11 14:52:42 gferg Exp $
# - include hackvideo handling (long time wondering what was missing)
# $Id: XFree-Local-multi-user-HOWTO.xml,v 1.12 2003/11/11 14:52:42 gferg Exp $
# - got it actually running
# - use >& /dev/null to load variables from the config file 
#   (what a mess)
# $Id: XFree-Local-multi-user-HOWTO.xml,v 1.12 2003/11/11 14:52:42 gferg Exp $
# - initial release

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# source function library
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
	. /etc/rc.d/init.d/functions
fi

# source defaults
if [ -f /etc/sysconfig/ruby.conf ]; then
	#WTF, how to get rid of the ".... >& /dev/null"
	. /etc/sysconfig/ruby.conf >& /dev/null 
	RUBY_CONF="/etc/sysconfig/ruby.conf"
else
	action "ruby_init: Configuration file missing" /bin/false
	exit 1 
fi

function get_status() {
		run_hackvideo status
#		prefbus_used ?
#		print dumb_con=? 
		get_kbds	#and curr. active VTs
}


function get_ext_status() {
		run_input_rc status
		run_hackvideo status
#		prefbus_used ?
#		print dumb_con=?
		get_kbds	#and curr. active VTs
		get_links mouse
		get_links event
}

function run_start_restart() {
     	   	load_modules
		run_hackvideo start
     	   	run_input_rc start
     	   	run_auto_dm
     	   	run_auto_xfree
}

function run_input_rc () {
    for RC in /etc/hotplug/input.rc
    do
	eval "doit=\"\$HOTPLUG_RC_input\"" 
	if [ "$doit" != yes -a "$1" != status ]; then
	    continue
	fi
	$RC $1
	if [ "$1" != status ]; then
     	   action "bruby: configuring cold-pluged devices." $RC $1
	fi
    done
}


function run_hackvideo () {
	eval "doit=\"\$HACK_VIDEO_ENABLE\""
	if [ "$doit" != yes ]; then
	    if [ "$1" = status ]; then
		echo "XFree hackvideo not configured."
	    fi
	    return ;
	fi
	if [ -f /proc/bus/pci/hackvideo ]; then
	   if [ -f /etc/X11/XF86Config-4 ]; then
		   xf_file="/etc/X11/XF86Config-4"
	   elif [ -f /etc/X11/XF86Config ]; then
		   xf_file="/etc/X11/XF86Config"
	   else
		   action "bruby: XFree configuration file not found" /bin/false
		   exit 1
	   fi
	   #fi
	   eval "xf_hackvideo=`sed -n '/^#/d;s/^.*"PciOsConfig"[ 	]//p' $xf_file | sed -e 's/[ 	]//g'`"
	   if [ "$xf_hackvideo" = "1" ]; then
		case "$1" in 
			start)
				action "bruby: Enabling XFree hackvideo workaound." /bin/true
				/bin/echo "1" > /proc/bus/pci/hackvideo
				;;
			stop)	
				action "bruby: Disabling XFree hackvideo workaound."
				/bin/echo "0" > /proc/bus/pci/hackvideo
				;;
			status)
				eval "hack_enabled=`cat /proc/bus/pci/hackvideo`"
				if [ $hack_enabled = 1 ]; then
				    echo "XFree hackvideo activated"
				else
				    echo "XFree hackvideo not activated,"
				    echo "but enabled in configuration. "
				fi
				;;
			*)
				;;
		esac
	   else
			   action "bruby: Hackvideo not configured in XFree," /bin/false
			   action "bruby: but enabled in $RUBY_CONF." /bin/false

	   fi
	else 
				action "bruby: XFree hackvideo configured," /bin/false
				action "bruby: but kernel hackvideo support missing." /bin/false
	fi
		
}

function load_modules () {
	eval "doit=\"\$LOAD_MODULES\""
	if [ "$doit" != yes -a "$1" != status ]; then
	    return ;
	fi
     	action "bruby: loading additional modules." /bin/true
	cat $RUBY_CONF | sed -n "/input modules /,/config/p" | while read module args
	do
	  case "$module" in
	      \#*|"") continue ;;
	  esac
	  initlog -s "Loading module: $module"
	  modprobe $module $args >/dev/null 2>&1
	done
}

function run_auto_xfree () {
	eval "doit=\"\$AUTO_XFree\""
	if [ "$doit" != yes -a "$1" != status ]; then
	    return ;
	fi
	# (pixel) a kind of profile for XF86Config
	# if no XFree=XXX given on kernel command-line, restore XF86Config.standard
	for i in XF86Config XF86Config-4; do
    	   if [ -L "/etc/X11/$i" ]; then
              XFree=`sed -n 's/.*XFree=\(\w*\).*/\1/p' /proc/cmdline`
              [ -n "$XFree" ] || XFree=standard
              [ -r "/etc/X11/$i.$XFree" ] && ln -sf "$i.$XFree" "/etc/X11/$i"
    	  fi
	done
     	action "bruby: configuring XFree." /bin/true
}

function run_auto_dm () {
	eval "doit=\"\$AUTO_DM\""
	if [ "$doit" != yes -a "$1" != status ]; then
	    return ;
	fi
	#
	#the same like XF86Config but for gdm.conf & Xservers
	#
	for i in xdm/Xservers gdm/gdm.conf; do
    	   if [ -L "/etc/X11/$i" ]; then
        	DumbCon=`sed -n 's/.*dumbcon=\([0-9]*\).*/\1/p' /proc/cmdline`
        	[ -n "$DumbCon" ] || DumbCon=0
        	[ -r "/etc/X11/$i.$DumbCon" ] && ln -sf "/etc/X11/$i.$DumbCon" "/etc/X11/$i"
    	   fi
	done
     	action "bruby: configuring display manager." /bin/true
	echo "Setting up display managers for `expr $DumbCon + 1` Xservers"
}


function get_kbds() {
	j=0
	for i in /proc/bus/console/* 
	   do 
		echo
		j=`expr $j + 1`
		phys=`cat $i/keyboard`
		if [ "$phys" = "" ];then
		   echo " VT-`basename $i` : keyboard not attached"
		else
		   echo " VT-`basename $i` using :"
#		   grep -n2 "$phys" /proc/bus/input/devices | sed -e '{/^B: /s;^B:.*;;};{s;^.*: ;;};' -e "/EV=/d" 
 		   grep -B2 -A1 "$phys" /proc/bus/input/devices | sed 's;^.*: ;;'  
		fi
	   done
	echo
	echo "Total of $j VT's avialable."
}

function get_links() {
		echo
 		for i in  /dev/input/$1*br
		    do 
			real=`ls -l $i 2>/dev/null | sed "{s;^.*/dev/input/;;};{s; ->;;}" | cut -d " " -f 2`
			if [ "$real" != "" ]; then
			   echo "$i" 
			   sed -e '/Name/,/Handl/s/.*: //;{/^B: /s;^B:.*;;};'  /proc/bus/input/devices | grep -B2 -A1 "$real"
			else
			    exit 0
			fi     
		    done
}

if [ -f /proc/bus/console  -o  -n tmp=`uname -r | sed -n 's:ruby::p'` ]; then
   if [ -x /etc/hotplug/input.rc  -a  -f /etc/hotplug/input.agent ]; then	

	case "$1" in
    		start|restart)
			run_start_restart
			;;
    		status)
			get_status
			touch /var/lock/subsys/ruby
			;;
    		ext-status)
			get_ext_status
			touch /var/lock/subsys/ruby
			;;
    		stop)
			#run_hackvideo stop
			run_input_rc stop
        		rm -f /var/lock/subsys/ruby
        		;;
    		force-reload)
			run_input_rc stop
			run_input_rc start
			touch /var/lock/subsys/ruby
        		;;

    		*)
			gprintf "Usage: %s {start|stop|restart|status|ext-status|force_reload}\n" "$0"
			exit 3
			;;
	esac

   else if [ -f /etc/hotplug/input.rc -a -f /etc/hotplug/input.agent ]; then
     	   action "Input: input.rc and input.agent installed, but not executable." /bin/false
     	   action "Input: Please check the file permissions." /bin/false
	else 
	   action "Input: Failed to configure cold plugged devices."  /bin/false
	   action "Input: input.rc or input.agent missing."  /bin/false
        fi
   fi
fi

D.4. 修改后的 hotplug input.agent对于热插拔,您还需要

对于热插拔,您还需要已修改为使用全局配置文件。

#!/bin/sh
# Please place this file /etc/hotplug
#
# input-specific hotplug policy agent.
#
# Kernel Input params are:
#       
#       ACTION=add
#       PHYS=pysical location of device
#       NAME=Name of the device
#
# HISTORY:
#       15-Sep-2003     modified to use single configuration file
#                       /etc/sysconfig/ruby.conf by me :-)
#                       (Svetoslav Slavtchev)
#                       added handling for multimedia keys
#                       but doesn't work as expected :(
#       15-JUN-2003     removed paste
#       07-MAY-2003     remake by Aivils Stoss
#                       /proc manipulation added
#                       parse kbd.conf event.conf mouse.conf.
#                       create necessary symbolic links
#       28-SEP-2002     Initial version from Andreas Schuldei
#                        andreas (at) schuldei.org 
#
cd /etc/hotplug
. hotplug.functions
DEBUG=yes export DEBUG
 
RUBY_CONF="/etc/sysconfig/ruby.conf"

setup_kbd ()
{
    while read VT_NUM PHYS_PATTERN NAME_PATTERN
    do
        if [ `echo "$VT_NUM" | grep "^#"` ]; then
            continue;
        fi
        if [ `echo "$PHYS" | grep $PHYS_PATTERN 2>/dev/null` ]; then
            VT=`echo "$VT_NUM" | sed 's/VT//' | awk '{printf "%02d", $0}'`
            if [ -d /proc/bus/console/$VT ]; then
                echo "$PHYS" > "/proc/bus/console/$VT/keyboard"
                debug_mesg "Input device $NAME on $PHYS mapping as secondary to VT$VT"
                return;
	    else
		debug_mesg "Trying to configure keyboard for VT$VT , but not enough VT's available"
	    fi
        fi
    done
    debug_mesg "Found no fitting VT"
}


setup_mm_keys ()
{
    while read VT_NUM PHYS_PATTERN NAME_PATTERN
    do
        if [ `echo "$VT_NUM" | grep "^#"` ]; then
            continue;
        fi
        if [ `echo "$PHYS" | grep $PHYS_PATTERN 2>/dev/null` ]; then
            VT=`echo "$VT_NUM" | sed 's/VT//' | awk '{printf "%02d", $0}'`
            if [ -d /proc/bus/console/$VT ]; then
                echo "+$PHYS" > "/proc/bus/console/$VT/keyboard"
                debug_mesg "Input device $NAME on $PHYS mapping as secondary to VT$VT"
                return;
	    else
		debug_mesg "Trying to configure keyboard for VT$VT , but not enough VT's available"
	    fi
        fi
    done
    debug_mesg "Found no fitting VT"
}

setup_event ()
{
    while read SYM_LINK PHYS_PATTERN NAME_PATTERN
    do
        if [ `echo "$SYM_LINK" | grep "^#"` ]; then
            continue;
        fi
        if [ `echo "$PHYS" | grep $PHYS_PATTERN 2>/dev/null` ]; then
            case $ACTION in
            add)
                cd /dev/input
                rm -f $SYM_LINK
                ln -s $DEV_EVENT $SYM_LINK
                debug_mesg "Input event device $NAME on $PHYS linked to $SYM_LINK"
            ;;
            remove)
                rm -f /dev/input/$SYM_LINK
                debug_mesg "Input event device link $SYM_LINK removed"
            ;;
            esac
            return;
        fi
    done
    debug_mesg "Found no fitting event device"
}

setup_mouse ()
{
    while read SYM_LINK PHYS_PATTERN NAME_PATTERN
    do
        if [ `echo "$SYM_LINK" | grep "^#"` ]; then
            continue;
        fi
        if [ `echo "$PHYS" | grep $PHYS_PATTERN 2>/dev/null` ]; then
            case $ACTION in
            add)
                cd /dev/input
                rm -f $SYM_LINK
                ln -s $DEV_MOUSE $SYM_LINK
                debug_mesg "Input mouse device $NAME on $PHYS linked to $SYM_LINK"
            ;;
            remove)
                rm -f /dev/input/$SYM_LINK
                debug_mesg "Input mouse device link $SYM_LINK removed"
            ;;
            esac
            return;
        fi
    done
    debug_mesg "Found no fitting mouse device"
}

setup_input ()
{
    if [ -n "$DEV_KBD" ]; then
        sed -n "/keyboard devices/,/config/p" $RUBY_CONF	| setup_kbd 
        sed -n "/multimedia keys/,/config/p" $RUBY_CONF		| setup_mm_keys
    fi
    if [ -n "$DEV_EVENT" ]; then
        sed -n "/event devices/,/config/p" $RUBY_CONF		| setup_event 
    fi
    if [ -n "$DEV_MOUSE" ]; then
        sed -n "/mouse devices/,/config/p" $RUBY_CONF		| setup_mouse  
    fi
}

if [ "$ACTION" = "" ]; then
    mesg Bad input agent invocation
    exit 1
fi

DEV_HANDLERS=`grep -E 'Phys|Handlers' /proc/bus/input/devices | \
    awk '{ if(count == 0) { printf("%s\t",$0); count++; } else { print $0; count=0; } }' | \
    grep $PHYS | awk -F\t '{print $2}' | sed 's/^.*=//'`

DEV_EVENT=`echo $DEV_HANDLERS | \
            awk -F" " '{for(n=1;$n;n=n+1) if($n ~ /event/) print $n}'`
DEV_MOUSE=`echo $DEV_HANDLERS | \
            awk -F" " '{for(n=1;$n;n=n+1) if($n ~ /mouse/) print $n}'`
DEV_KBD=`echo $DEV_HANDLERS | \
            awk -F" " '{for(n=1;$n;n=n+1) if($n ~ /kbd/) print $n}'`

#
# What to do with this input device event?
#
case "$ACTION" in

add)
    setup_input
    ;;
remove)
    #setup_input
    ;;
*)
    debug_mesg "Input '$ACTION' event not supported"
    return 1
    ;;

esac
      

注释

[1]

Backstreet Ruby 中包含所有功能(“/proc”接口和热插拔、视频黑客...),支持帧缓冲设备,支持接管 VGA 控制台的单个帧缓冲控制台(尚不支持多个独立的帧缓冲控制台)