unsacrificed/fix-ms-mouse-scroll

语言:

git: https://github.com/unsacrificed/fix-ms-mouse-scroll

修复了某些Microsoft鼠标的滚轮问题。
Fixes scroll wheel problems with certain Microsoft mice.
README.md (中文)

FIX-MS-鼠标滚动

用于修复Linux中某些Microsoft鼠标的滚轮问题的修补程序。

问题探索

在Microsoft Windows中工作后,一些无线Microsoft鼠标在Linux中有奇怪的行为 - 滚动速度太快。可能的解决方法 - 将鼠标接收器重新插入USB(即关闭接收器电源)。更多信息可以在这里找到:  * http://sourceforge.net/projects/resetmsmice/  * https://bbs.archlinux.org/viewtopic.php?id=177916

Linux内核的fix-ms-mouse-scroll补丁可以修复这种行为。

支持的老鼠

仅支持Microsoft鼠标,因此设备usb供应商ID应为0x045e。  支持以下设备ID的USB设备:   * 0x07a5:    *微软雕刻符合人体工程学的鼠标   * 0x0745 - 不确定,可能跟随鼠标:    * Microsoft无线鼠标1000    * Microsoft无线光学桌面3000    * Microsoft无线移动鼠标3500    * Microsoft无线移动鼠标4000    * Microsoft Comfort Mouse 4500    * Microsoft无线鼠标5000

支持的Linux内核

在以下vanilla内核和/或Gentoo默认内核上测试的补丁:   1. 3.3.0(仅测试汇编)   2. 4.0.5(经过测试的编译和真正的工作)   3. 4.2.0(仅测试汇编)   4. 4.3.0-rc2(仅测试编译)

选择合适的补丁版本

使用以下名称约定: FIX-MS-鼠标滚动功能的<V> .patch  其中<v> - 开发了针对女巫补丁的主要内核版本。   *对于内核<3.3.0,尝试使用fix-ms-mouse-scroll-3.3.0.patch   *对于内核3.3.0,请使用fix-ms-mouse-scroll-3.3.0.patch   *对于内核> 3.3.0但<4.0.5尝试使用fix-ms-mouse-scroll-3.3.0.patch或fix-ms-mouse-scroll-4.0.5.patch(选择版本,但没有内核“build”出错   *对于内核> = 4.0.5但<= 4.3.0使用fix-ms-mouse-scroll-4.0.5.patch   *对于内核> 4.3.0,尝试使用fix-ms-mouse-scroll-4.0.5.patch并查看有关此类情况的特殊说明(或者如果内核构建失败,请让我更新补丁)

如何申请补丁

  1. 下载适当的补丁(例如/home/unsacrificed/Downloads/fix-ms-mouse-scroll-4.0.5.patch),
  2. 在使用内核源的终端cd到目录中(例如cd /usr/src/linux-4.0.5-gentoo),
  3. 使用patch -p1命令应用补丁(例如patch -p1 </home/unsacrificed/Downloads/fix-ms-mouse-scroll-4.0.5.patch),
  4. 像往常一样重建和安装内核(不需要特殊的内核配置)。

如何查看USB设备供应商ID和设备ID(又名产品ID)

  1. 在内核日志中找到它 使用像sudo journalctl -k或sudo less / var / log / dmesg这样的东西。输出示例: usb 1-4:找到新的USB设备,idVendor = 045e,idProduct = 07a5 usb 1-4:新的USB设备字符串:Mfr = 1,Product = 2,SerialNumber = 0 usb 1-4:产品:Microsoft®2.4GHzTransceiver v9.0 usb 1-4:制造商:微软 其中045e - 供应商ID,07a5 - 设备ID。  2.使用lsusb 运行lsusb以显示已安装的设备。输出示例: 总线001设备002:ID 045e:07a5 Microsoft Corp. 其中045e - 供应商ID,07a5 - 设备ID。

添加新的鼠标支持

如果您的Microsoft鼠标有滚动错误,并且此补丁不支持鼠标,请执行以下操作:  1.将补丁中的0x07a5(行+ #define USB_DEVICE_ID_MS_SCULPT_ERGONOMIC_MOUSE 0x07a5)更改为鼠标设备ID,  2.应用修改过的补丁,  3.如果修改补丁帮助您解决滚动错误 - 让我知道并扩展支持的鼠标。

将补丁应用于更新的内核4.3.0

确保在文件drivers / hid / hid-microsoft.c中对这些内核进行apllying补丁之后,MS_VSCROLL定义在MS_define块上具有唯一值。将MS_VSCROLL定义的值乘以2,如果需要则不是唯一的。  例如,内核4.0.5有以下块: C    #define MS_HIDINPUT 0x01    #define MS_ERGONOMY 0x02    #define MS_PRESENTER 0x04    #define MS_RDESC 0x08    #define MS_NOGET 0x10    #define MS_DUPLICATE_USAGES 0x20    #define MS_RDESC_3K 0x40   所以MS_VSCROLL定义的值应该是0x80(0x40 * 2)。

历史

基于resetmsmice的补丁。谢谢Paul F. Richards。

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

fix-ms-mouse-scroll

Patch to fix scroll wheel problems with certain Microsoft mice in Linux.

Problem exploration

Some wireless Microsoft mice have strange behaviour in Linux after working in Microsoft Windows - scroll is too fast. Possible workaround - reinsert mouse receiver to usb (i.e. power off receiver). More information can be found here:
* http://sourceforge.net/projects/resetmsmice/
* https://bbs.archlinux.org/viewtopic.php?id=177916

fix-ms-mouse-scroll patch for Linux kernel can fixes this behaviour.

Supported mice

Only Microsoft mice are supported, so device usb vendor id should be 0x045e.
Usb devices with following device id supported:
* 0x07a5:
* Microsoft sculpt ergonomic mouse
* 0x0745 - Not sure, possible following mice:
* Microsoft Wireless Mouse 1000
* Microsoft Wireless Optical Desktop 3000
* Microsoft Wireless Mobile Mouse 3500
* Microsoft Wireless Mobile Mouse 4000
* Microsoft Comfort Mouse 4500
* Microsoft Wireless Mouse 5000

Supported Linux kernels

Patches tested on the following vanilla kernel and/or Gentoo default kernel:
1. 3.3.0 (tested only compilation)
2. 4.0.5 (tested compilation & really working)
3. 4.2.0 (tested only compilation)
4. 4.3.0-rc2 (tested only compilation)

Choose appropriate patch version

Following name convention is used:
fix-ms-mouse-scroll-<v>.patch
where <v> - primary kernel version for witch patch is developed.
* For kernel <3.3.0 try to use fix-ms-mouse-scroll-3.3.0.patch
* For kernel 3.3.0 use fix-ms-mouse-scroll-3.3.0.patch
* For kernel >3.3.0 but <4.0.5 try to use fix-ms-mouse-scroll-3.3.0.patch or fix-ms-mouse-scroll-4.0.5.patch (choose version with wich there is no error at kernel "build")
* For kernel >=4.0.5 but <=4.3.0 use fix-ms-mouse-scroll-4.0.5.patch
* For kernel >4.3.0 try to use fix-ms-mouse-scroll-4.0.5.patch and look at special notes about such case (or ask me to update patch if kernel build failed)

How to apply patch

  1. Download appropriate patch (e.g. /home/unsacrificed/Downloads/fix-ms-mouse-scroll-4.0.5.patch),
  2. In terminal cd to directory with your kernel sources (e.g. cd /usr/src/linux-4.0.5-gentoo),
  3. Apply patch with patch -p1 command (e.g. patch -p1 < /home/unsacrificed/Downloads/fix-ms-mouse-scroll-4.0.5.patch),
  4. Rebuild and install your kernel as usual (no special kernel configuration needed).

How to view usb device vendor id and device id (aka product id)

  1. Find it in kernel log

    Use something like sudo journalctl -k or sudo less /var/log/dmesg. Example output:

    usb 1-4: New USB device found, idVendor=045e, idProduct=07a5 usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-4: Product: Microsoft® 2.4GHz Transceiver v9.0 usb 1-4: Manufacturer: Microsoft

    where 045e - vendor id, 07a5 - device id.
    2. Using lsusb

    Run lsusb to show installed devices. Example output:

    Bus 001 Device 002: ID 045e:07a5 Microsoft Corp.

    where 045e - vendor id, 07a5 - device id.

Add new mouse support

If you have Microsoft mouse with scroll bug and mouse isn't supported by this patch do following:
1. Change 0x07a5 (in line +#define USB_DEVICE_ID_MS_SCULPT_ERGONOMIC_MOUSE 0x07a5) in patch to your mouse device id,
2. Apply modified patch,
3. If modified patch help you to resolve scroll bug - let me know and I extend supported mice.

Apply patch to kernel newer then 4.3.0

Be sure that after apllying patch to such kernels in file drivers/hid/hid-microsoft.c MS_VSCROLL define have unique value over the block of MS_ defines. Multiply MS_VSCROLL defined value by 2 while it isn't unique if needed.
E.g., kernel 4.0.5 has following block:
c #define MS_HIDINPUT 0x01 #define MS_ERGONOMY 0x02 #define MS_PRESENTER 0x04 #define MS_RDESC 0x08 #define MS_NOGET 0x10 #define MS_DUPLICATE_USAGES 0x20 #define MS_RDESC_3K 0x40
so MS_VSCROLL defined value should be 0x80 (0x40 * 2).

History

Based on patch from resetmsmice. Thank you, Paul F. Richards.