- 论坛徽章:
- 0
|
背景:由于笔记本是一个特殊的硬件系统,特别是对于安装 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 吧,你会感激我的,呵呵。
__________________
> 我的 MSN :amdk6[at]yeah.net
> 我的 MAIL: i.amdk6[at]gmail.com
> 非常感谢 Linuxsir 提供主页空间:
> http://slack.linuxsir.org/amdk6
> 渔舟唱晚,响穷彭蠡之滨;
> 雁阵惊寒,声断衡阳之浦。
![]()
![]()
![]()
![]()
![]()
AMD-K6
查看公开信息
发悄悄话给 AMD-K6
访问 AMD-K6 的个人网站
查找 AMD-K6 发表的更多帖子
添加 AMD-K6 到好友列表
![]()
06-06-22, 10:52
第 2 帖
linux-root
![]()
![]()
注册会员
注册日期: Dec 2005
帖子: 24
精华: 0
标题: 楼上的方法真好,谢了!
我的slackware安装后一直不能使用外置usb鼠标,一直找不到真正的设置方法和原因,今天看到楼上这篇东西,真是惶然大悟,且设置成功,
先感谢一下吧!!
引用:
作者: AMD-K6
http://www.mtstu.com/~amdk6/
背景:由于笔记本是一个特殊的硬件系统,特别是对于安装 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
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16993/showart_131097.html |
|