本页已停止更新,请您访问 Gracecode.com

文档资料 :: Document

这个栏目主要包含本人感兴趣的技术文档和参考资料。

声明:部分的文档资料来自互联网,其版权为原作者所有。 本站的原创文档遵循 “创作共用 - 非商业、署名、派生” 版权协议发行。

订阅 Gracecode.info 订阅 Gracecode.info 焦点 订阅 Gracecode.info 下载 订阅 Gracecode.info 下载

用户反馈 :: Feedback

文档排行 :: Top

焦点讨论 :: Focus

文档资料 :: Document

资源下载 :: Download

关于这里 :: About

Slackware 下双鼠标的配置

日期:2007-02-07 18:58:05

标签:Linux Slackware 操作系统

保存:

评论:

背景:由于笔记本是一个特殊的硬件系统,特别是对于安装 Linux 系统来说尤其是这样。一般在笔记本上使用鼠标有两种情况:同时使用触摸板和 USB 鼠标。所以以前我经常的更换配置文件,用来更换鼠标。这样一来非常的麻烦,而来在使用一个鼠标时,同时另外的一个鼠标就不能使用。

经过查阅 MAN 和网络上的一些相关的文章,成功配置了同时使用双鼠标(同时使用笔记本的触摸板和 USB 鼠标)颇有一点的心得,所以写成这篇文章让大家好有一个参考。

先说一下本人的系统环境,本人使用的时 Slackware 9.1 的系统,内核的版本是 2.4.22 ,并重新编译了内核。

重新编译内核

其实这一步可以省略,因为你完全可以使用载入模块的方式使用鼠标模块。而重新配置和编译内核可以提高系统总体的运行效率,所以建议你重新安装一下你的系统核心。

我们可以这样考虑,其实笔记本上的触摸板其实就使可以看做一个使 PS2 的鼠标,而 USB 鼠标其实就是一个 USB 设备然后加入了一个 USB 输入模块。好了,那么我们开始吧。

首先我们要做的就使加入合适的驱动,对于 2.4.xx 内核你可以这样的加入:

Under InputCore Support
Enable <*> Input core support
Enable <*> Mouse support
[Ignore resolution, that is for tablets]

Under USB Support
Enable <*> Support for USB
Enable one of the --- USB Controllers
[example <*> UHCI (Intel PIIX4, VIA, ...) support]
Enable <*> USB Human Interface Device (full HID) support

Under Character devices / Mice
[may not be nessacey but just in case]
Enable <*> Mouse Support (not serial and bus mice)
Enable[*] PS/2 mouse (aka "auxiliary device") support

接上这些然后再选择另外相对于你的系统的选项编译下核心就可以了,然后我们用这个新的核心启动系统。启动完成以后,我们可以查看 /dev 下面的设备文件,以确定两个鼠标是否已经正常的被识别。触摸板(其实就是 PS2 鼠标)的设备文件是 /dev/psaux 、 USB 鼠标的设备文件是 /dev/input/mice 。

使 Console 支持双鼠标

Console 下使用鼠标一般是使用 gpm 支持的。所以在 Console 下配置鼠标其实就是配置 gpm 的属性。经过我查阅 gpm 的 man 文档,我发现一个 -M 选项非常有用处,下面一段就是关于它的用法的叙述:

-M     Enable multiple mode. The daemon will read two dif-
       ferent  mouse  devices.  Any subsequent option will
       refer to the second  device,  while  any  preceding
       option  will  be  used  for  the first device. This
       option automatically  forces  the  repeater  (`-R')
       option on.

所以我们能够很容易的使用这个选项配置双鼠标。

Slackware 下的 gpm 配置文件是 /etc/rc.d/rc.gpm。所以我们编辑 gpm 文件:

#!/bin/sh
# Start/stop/restart the GPM mouse server:

if [ "$1" = "stop" ]; then
  echo "Stopping gpm..."
  /usr/sbin/gpm -k
elif [ "$1" = "restart" ]; then
  echo "Restarting gpm..."
  /usr/sbin/gpm -k
  sleep 1
  /usr/sbin/gpm -m /dev/mouse -t ps2 -M -m /dev/input/mice -t imps2
else # assume $1 = start:
  echo "Starting gpm:  /usr/sbin/gpm -m /dev/mouse -t ps2 -M /dev/input/mice -t imps2"
  /usr/sbin/gpm -m /dev/mouse -t ps2 -M -m /dev/input/mice -t imps2
fi

这样,我们就可以在 Console 下使用双鼠标了。 Take it easy ^^

使 X 支持双鼠标

X 下使用双鼠标有一点的难,但是有了上面的经验以后,你会发现其实也是一件很简单的事情。我敢打赌,你大部分的时间都是在 X 下工作的。首先在你的 XF86Config 配置文件下加入一个新的输入设备:

Section "InputDevice"
    Identifier  "USBmouse"
    Driver      "mouse"
    Option      "Protocol"  "IMPS/2"
    Option      "Device"    "/dev/input/mice"
EndSection

让你的 X 知道你有另外的一个鼠标,所以我们在 Serverlayout 处加入这个新的设备:

Section "ServerLayout"
    ...
    InputDevice  "Keyboard" "CoreKeyboard"
    InputDevice  "TouchPad"  "CorePointer"
    InputDevice  "USBmouse"  "SendCoreEvents" # 我们加入这样的一行,使 X 支持 USB 鼠标
    ...
EndSection

同时我们在 ServerFlags 下加入 AllowMouseOpenFail 选项,这样即使你忘记插上 USB 鼠标也不至于 X 退出。

好了,好了。就是这样的简单!现在 startx 启动你的 X 吧,你会感激我的,呵呵。

Valid XHTML 1.0 Strict 使用 ADOdb 数据抽象层 Generate With GVIM Editor. RSS Feed