Mad Catz 鼠标
Mad Catz 生产一系列游戏鼠标,例如 Saitek Cyborg R.A.T.3 鼠标(7 键 USB 有线)或 R.A.T9(7 键 USB 无线)。这些鼠标在 X 环境下不进行一些重新配置就无法正常工作。本文将介绍如何使其在任何桌面管理器下都能正常工作。
安装
无需安装驱动程序。鼠标应在启动时或热插拔时被检测到。
xinput list问题
插入鼠标后,鼠标似乎可以工作,但您可能会遇到各种问题
- 在拖动窗口标题栏时无法移动窗口。(在 Openbox 和其他 窗口管理器 中发生)
- 无法点击按钮。
- 无法获得窗口焦点。
- 无法打开菜单,即使使用键盘快捷键。
- 显示不刷新(使用 Xcompmgr)
- 关闭某些窗口会恢复功能,直到鼠标锁定到新窗口。
禁用按钮解决方案
在 Xorg 上
这些问题是由 R.A.T 模式按钮与 X 服务器之间的交互引起的。要恢复正常功能,必须禁用“模式”按钮,如下所示:
使用 root 权限,创建文件 /etc/X11/xorg.conf.d/50-vmmouse.conf(参见 xorg),内容如下:
Section "InputDevice"
Identifier "Mouse0"
Driver "evdev"
Option "Name" "Saitek Cyborg R.A.T.3 Mouse"
Option "Vendor" "06a3"
Option "Product" "0ccc"
Option "Protocol" "auto"
Option "Device" "/dev/input/event4"
Option "Emulate3Buttons" "no"
Option "Buttons" "7"
Option "ZAxisMapping" "4 5"
Option "ButtonMapping" "1 2 3 4 5 6 7 0 0 0 0 0 0 0"
Option "Resolution" "3200"
EndSection
重启 X 服务器后,鼠标应能完全正常工作,包括两个侧边按钮。您可以重启 显示管理器 服务来重启 X 服务器,例如 sddm.service、lightdm.service 等... 如果没有,或者您需要有关配置游戏鼠标的更多信息,请参见 All Mouse Buttons Working。
在 Wayland 上
创建 Xorg 配置文件对 wayland 没有影响,wayland 也没有直接禁用模式按钮的方法。可以使用 Udev 来替代禁用按钮。
使用 libinput debug-events 获取鼠标名称,并使用 evtest 获取按下模式按钮时触发的按键。然后,以 root 权限,创建文件 /etc/udev/hwdb.d/70-remap-mouse.hwdb,内容如下(替换名称和代码):
evdev:name:Mad Catz Mad Catz R.A.T.TE:* KEYBOARD_KEY_90009=reserved # Bouton 280 KEYBOARD_KEY_9000a=reserved # Bouton 281 KEYBOARD_KEY_9000b=reserved # Bouton 282
然后拔出鼠标,使用 udevadm hwdb --update 重新加载配置文件,再重新插入鼠标。
RAT7 或 RAT9 部分修复
这是在 Linux 下使您的 R.A.T. 7 或 R.A.T. 9 鼠标正常工作的配置文件。
- RAT9 的切换配置文件按钮未修复,此配置文件需要更多调整,或者干脆不要按它。
/etc/X11/xorg.conf.d/910-rat.conf:
Section "InputClass" Identifier "Mouse Remap" MatchProduct "Mad Catz Mad Catz M.M.O.7 Mouse|M.M.O.7" MatchIsPointer "true" MatchUSBID "0738:1713" Driver "evdev" Option "Buttons" "24" Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 21 22 23 24" Option "AutoReleaseButtons" "20" Option "ZAxisMapping" "4 5 6 7" # Option "Resolution" "3200" # Option "ConstantDeceleration" "2" EndSection
您可以通过在 ~/.xbindkeysrc 中定义来为每个鼠标按钮指定不同的按键,例如:
# pressing mouse button 7 sends keystroke: 2
"xvkbd -text 2"
m:0x0 + b:7
# pressing mouse button 8 sends keystroke: Space
"xvkbd -text "\[SPACE]""
m:0x0 + b:8
# pressing mouse button 9 sends keystroke: F8
"xvkbd -text "\[F8]""
m:0x0 + b:9
# pressing mouse button 10 sends keystroke: CursorLeft
"xvkbd -text "\[Left]""
m:0x0 + b:10
# pressing mouse button 11 sends keystroke: Shift+F2
"xvkbd -text "\[Shift]\[F2]""
m:0x0 + b:11
一篇关于在 Linux 上设置 Mad Catz M.M.O.7 鼠标的非常好的文章写在 这里。
手动按钮映射修复
请注意,R.A.T.3 鼠标有两种不同的版本,分别是 **Saitek** 和 **Madcatz**,这必须正确输入到“MatchProduct”中,否则您将遇到相同的问题。
首先找出鼠标的 ID 和名称
xinput list | grep "id"
在您的输出中,您应该看到鼠标被标记为“Madcatz Mad Catz R.A.T.3 Mouse”或“Saitek Cyborg R.A.T.3 Mouse”。记下设备 ID 号,然后输入以下命令
xinput query-state ID
(其中 ID 对应于您的鼠标的 ID 号)
记下当前活动的“模式”颜色(红色/蓝色/紫色),以及哪些按钮编号对应于当前“模式”,即处于 **“向上”** 或 **“向下”** 状态。更改鼠标“模式”并重新输入上述命令,记下哪些按钮状态发生变化以匹配“模式”。
示例
U = up
D = down
U U U U U D D U U D D D U U
Option "ButtonMapping" "1 2 3 4 5 0 0 8 9 0 0 0 13 14"
其中按钮 10、11 和 12 被确定为“模式”按钮,因此可以通过设置为零来禁用它们。
当您确定了哪些按钮编号对应于鼠标“模式”后,您应该能够编辑您的 xorg.conf 文件,并通过在按钮序列的相应位置插入零来禁用它们。
在您选择的编辑器中打开
/etc/X11/xorg.conf or /etc/X11/xorg.conf.d/910-rat-xx.conf
创建一个块,覆盖您在 **鼠标配置** 章节中列出的鼠标型号的模式按钮。
MadCatz R.A.T.3
# RAT3 mouse Section "InputClass" Identifier "Mouse Remap" MatchProduct "Madcatz Mad Catz R.A.T.3 Mouse" MatchDevicePath "/dev/input/event*" Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 0 0 0 13 14 15 16 17 18" EndSection
在 Wine/游戏中使用额外的鼠标按钮
安装 evrouterAUR 并将您的用户添加到 input 组,然后重新登录以激活更改。
# gpasswd -a <user> input
编辑 evrouter 配置文件,并将 `eventX` 号更改为鼠标使用的事件号,方法是:
$ evrouter --dump /dev/input/event*
然后为任何鼠标按钮分配热键。最好使用不常用的按键组合,以免与其他已使用的按键冲突,例如示例中的 Right Shift + F 键。
~/.evrouterrc
# 10 "Mad Catz Mad Catz M.M.O.7 Mouse" "/dev/input/event9" none key/277 "XKey/Shift_R+F1" # 11 "Mad Catz Mad Catz M.M.O.7 Mouse" "/dev/input/event9" none key/278 "XKey/Shift_R+F2"
使用以下命令启动:
$ evrouter /dev/input/event*
使用以下命令停止:
$ evrouter -q && rm -f /tmp/.evrouter*
R.A.T. 配置软件
Saitek/Mad Catz 不为 Linux 提供任何官方配置软件。
但是,有一个开源项目允许您在此处配置每个模式的 DPI 设置 here。
它可能需要为某些 R.A.T. 鼠标进行一些调整,例如将您的鼠标 ID 添加到支持的 ID 列表中。
鼠标配置
建议您为使用的每个型号将这些设置放在一个文件中,例如 /etc/X11/xorg.conf.d/920-rat-mmo7.conf。
Mad Catz R.A.T. 5
Section "InputClass" Identifier "Mad Catz R.A.T. 5" MatchProduct "Mad Catz Mad Catz R.A.T.5 Mouse" MatchDevicePath "/dev/input/event*" Option "Buttons" "21" Option "ButtonMapping" "1 2 3 4 5 0 0 9 8 7 6 10 0 0 0 0 0 0 0 0 0" Option "ZAxisMapping" "4 5 11 10" Option "AutoReleaseButtons" "13 14 15" EndSection
Mad Catz M.M.O.7
Section "InputClass" Identifier "Mouse Remap 7" MatchProduct "Mad Catz Mad Catz M.M.O.7 Mouse|M.M.O.7" MatchIsPointer "true" MatchUSBID "0738:1713" Driver "evdev" Option "Buttons" "24" Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 21 22 23 24" Option "AutoReleaseButtons" "20" Option "ZAxisMapping" "4 5 6 7" EndSection
Mad Catz R.A.T. TE
Section "InputClass" Identifier "Mouse Remap" MatchProduct "Mad Catz Mad Catz R.A.T.TE" MatchDevicePath "/dev/input/event*" Option "ButtonMapping" " 1 2 3 4 5 6 7 8 9 10 11 12 0 0 0" Option "ZAxisMapping" "4 5 6 7" EndSection
Mad Catz M.M.O. TE
Section "InputClass" Identifier "Mouse Remap TE" MatchProduct "Mad Catz Mad Catz M.M.O.TE" MatchIsPointer "true" MatchUSBID "0738:1714" Driver "evdev" Option "Buttons" "24" Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24" Option "AutoReleaseButtons" "20" Option "ZAxisMapping" "4 5" Option "ConstantDeceleration" "2" EndSection
Saitek Cyborg R.A.T.3
# RAT3 mouse Section "InputClass" Identifier "Mouse Remap" MatchProduct "Saitek Cyborg R.A.T.3 Mouse" MatchDevicePath "/dev/input/event*" Option "ButtonMapping" "1 2 3 4 5 0 0 8 9 0 0 0 13 14" EndSection