Mad Catz 鼠标

出自 ArchWiki

Mad Catz 生产一系列游戏鼠标,例如 Saitek Cyborg R.A.T.3 鼠标(7 键 USB 有线)或 R.A.T9(7 键 USB 无线)。这些鼠标在 X 环境下不能正常工作,需要进行一些重新配置。本文解释了如何使其在任何桌面管理器下工作。

安装

无需安装驱动程序。鼠标应在启动时或热插拔时被检测到。

注意: 在某些系统上,MatchProduct 字符串可能会有所不同,因此,您可以使用命令 xinput list

问题

插入鼠标后,鼠标似乎可以工作,但您可能会遇到不同的问题 

  • 当抓住窗口的标题栏时,您无法移动窗口。(在使用 Openbox 和其他 窗口管理器 时会发生)
  • 您无法点击按钮。
  • 您无法将焦点放在窗口上。
  • 您无法打开菜单,即使使用键盘快捷键也是如此。
  • 显示不会刷新(使用 Xcompmgr
  • 关闭某些窗口会恢复功能,直到鼠标锁定到新窗口。

禁用按钮解决方案

这些问题是由 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.servicelightdm.service 等... 如果没有,或者如果您需要更多关于配置游戏鼠标的信息,请参阅 所有鼠标按钮正常工作

RAT7 或 RAT9 部分修复

这是使您的 R.A.T. 7 或 R.A.T. 9 鼠标在 Linux 下正常工作的配置文件。

  • 无法修复 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

一篇关于设置 Mad Catz M.M.O.7 鼠标与 Linux 的文章写得非常好,这里

手动按钮映射修复

请注意,R.A.T.3 鼠标有两个不同的版本,分别是 SaitekMadcatz,这必须正确输入到“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 号)

注意当前活动的“模式”颜色(红色/蓝色/紫色)以及哪些按钮编号对应于当前“模式”,状态为 “up”“down”。更改鼠标“模式”并重新输入上述命令,注意哪些按钮状态发生变化以匹配“模式”。

示例

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-key

~/.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 设置 这里

但是,对于某些 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

参见