Giter Club home page Giter Club logo

Comments (15)

liverwust avatar liverwust commented on July 1, 2024 2

Thanks for the excellent work, @RicardoEPRodrigues!

On my Fedora 33 system, I needed to do two things to make the scroll wheel emulation work:

Reconfigure the upstream hid_magicmouse driver as module, not builtin

Debian and Fedora are configured differently with respect to the hid_magicmouse driver:

debian:~$ grep MAGICMOUSE /boot/config-4.19.0-12-amd64
CONFIG_HID_MAGICMOUSE=m
fedora:~$ grep MAGICMOUSE /boot/config-5.10.17-200.fc33.x86_64
CONFIG_HID_MAGICMOUSE=y

The upstream hid_magicmouse driver is included as a module on Debian, but is statically linked (builtin) in the kernel on Fedora. Although running install.sh succeeds, modprobe will silently refuse to load the module on Fedora, and insmod will report that the module is already loaded.

Fixing this requires rebuilding the kernel package. This isn't as hard as it sounds, although the compilation took several hours for me:

  1. Install prerequisites (see the article)
  2. $ fedpkg clone -a kernel
  3. $ git checkout origin/f33
  4. Edit the kernel.spec file to uncomment the line %define buildid .local and bump the release number (see the article)
  5. Edit the kernel-local file to change the CONFIG_HID_MAGICMOUSE=y line to CONFIG_HID_MAGICMOUSE=m
  6. Build with fedpkg local
  7. Install with dnf install --nogpgcheck ./x86_64/kernel-$version.rpm

For now, this will need to be done every time that a new kernel is built.

Disable the scroll_acceleration parameter

I'm not sure if this is Fedora-specific, but I wasn't initially able to use the scroll wheel emulation even after rebuilding the kernel. As soon as I edited /etc/modprobe.d/hid-magicmouse.conf to toggle scroll_acceleration=1 to scroll_acceleration=0, however, it began working.

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 1, 2024 1

Thank you for the report. I will look into it when I have time.

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 1, 2024

What distro are you using? Kernel version?

from magicmouse-hid.

bryce-carson avatar bryce-carson commented on July 1, 2024

What distro are you using? Kernel version?

Fedora Workstation 33, with kernel 5.9.11-200.fc33.x86_64.

from magicmouse-hid.

rashamalek avatar rashamalek commented on July 1, 2024

The scrolling does not work me either, I am on Arch linux 5.10.4-arch2-1 x86_64

from magicmouse-hid.

rashamalek avatar rashamalek commented on July 1, 2024

The same problem here, scrolling does not work

I add some details of system that may help for debugging!


$ cat /opt/magic-mouse-fix/magic-mouse-2-add.sh 
#!/bin/sh

FILE=/tmp/magicmouse-driveload

reload() {
    if [ ! -f "$FILE" ]; then
        touch $FILE

        modprobe -r hid_magicmouse
        modprobe -a hid-generic
        sleep 2
        insmod /opt/magic-mouse-fix/hid-magicmouse.ko \
            scroll_acceleration=1 \
            scroll_speed=25 \
            middle_click_3finger=1

        sleep 2
        rm -f "$FILE"

    fi
}

reload &


$ cat /etc/udev/rules.d/10-magicmouse.rules 
SUBSYSTEM=="input", \
    KERNEL=="mouse*", \
    DRIVER=="", \
    SUBSYSTEMS=="hid", \
    KERNELS=="0005:004C:0269*", \
    DRIVERS=="hid-generic|magicmouse", \
    ACTION=="add", \
    SYMLINK+="input/magicmouse-%k", \
    RUN+="/opt/magic-mouse-fix/magic-mouse-2-add.sh"


$ uname -r
5.10.4-arch2-1

$ tail ... ~/.local/share/xorg/Xorg.1.log
[   100.226] (II) config/udev: Adding input device Magic Mouse 2 (/dev/input/event17)
[   100.226] (**) Magic Mouse 2: Applying InputClass "libinput pointer catchall"
[   100.226] (II) Using input driver 'libinput' for 'Magic Mouse 2'
[   100.226] (EE) systemd-logind: failed to take device /dev/input/event17: No such device
[   100.226] (**) Magic Mouse 2: always reports core events
[   100.226] (**) Option "Device" "/dev/input/event17"
[   100.226] (**) Option "_source" "server/udev"
[   100.226] (EE) client bug: Invalid path /dev/input/event17
[   100.226] (EE) libinput: Magic Mouse 2: Failed to create a device for /dev/input/event17
[   100.226] (EE) PreInit returned 2 for "Magic Mouse 2"
[   100.226] (II) UnloadModule: "libinput"
[   100.276] (II) config/udev: Adding input device Magic Mouse 2 Mouse (/dev/input/mouse3)
[   100.276] (II) No input driver specified, ignoring this device.
[   100.276] (II) This device may have been added with another device file.
[   100.308] (II) config/udev: Adding input device Magic Mouse 2 (/dev/input/event18)
[   100.309] (II) No input driver specified, ignoring this device.
[   100.309] (II) This device may have been added with another device file.
[   100.327] (II) config/udev: Adding input device Magic Mouse 2 Mouse (/dev/input/event17)
[   100.327] (**) Magic Mouse 2 Mouse: Applying InputClass "libinput pointer catchall"
[   100.327] (II) Using input driver 'libinput' for 'Magic Mouse 2 Mouse'
[   100.328] (II) systemd-logind: got fd for /dev/input/event17 13:81 fd 75 paused 0
[   100.328] (**) Magic Mouse 2 Mouse: always reports core events
[   100.328] (**) Option "Device" "/dev/input/event17"
[   100.328] (**) Option "_source" "server/udev"
[   100.330] (II) event17 - Magic Mouse 2 Mouse: is tagged by udev as: Mouse
[   100.330] (II) event17 - Magic Mouse 2 Mouse: device is a pointer
[   100.331] (II) event17 - Magic Mouse 2 Mouse: device removed
[   100.331] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hci0:256/0005:004C:0269.0002/input/input25/event17"
[   100.331] (II) XINPUT: Adding extended input device "Magic Mouse 2 Mouse" (type: MOUSE, id 16)
[   100.332] (**) Option "AccelerationScheme" "none"
[   100.332] (**) Magic Mouse 2 Mouse: (accel) selected scheme none/0
[   100.332] (**) Magic Mouse 2 Mouse: (accel) acceleration factor: 2.000
[   100.332] (**) Magic Mouse 2 Mouse: (accel) acceleration threshold: 4
[   100.334] (II) event17 - Magic Mouse 2 Mouse: is tagged by udev as: Mouse
[   100.334] (II) event17 - Magic Mouse 2 Mouse: device is a pointer
[   102.297] (II) config/udev: removing device Magic Mouse 2 Mouse
[   102.297] (**) Option "fd" "75"
[   102.297] (II) event17 - Magic Mouse 2 Mouse: device removed
[   102.300] (II) UnloadModule: "libinput"
[   102.300] (II) systemd-logind: releasing fd for 13:81
[   102.376] (II) config/udev: Adding input device Magic Mouse 2 (/dev/input/mouse3)
[   102.376] (II) No input driver specified, ignoring this device.
[   102.376] (II) This device may have been added with another device file.
[   102.447] (II) config/udev: Adding input device Magic Mouse 2 (/dev/input/event17)
[   102.447] (**) Magic Mouse 2: Applying InputClass "libinput pointer catchall"
[   102.447] (II) Using input driver 'libinput' for 'Magic Mouse 2'
[   102.448] (II) systemd-logind: got fd for /dev/input/event17 13:81 fd 75 paused 0
[   102.448] (**) Magic Mouse 2: always reports core events
[   102.448] (**) Option "Device" "/dev/input/event17"
[   102.448] (**) Option "_source" "server/udev"
[   102.450] (II) event17 - Magic Mouse 2: is tagged by udev as: Mouse
[   102.450] (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_35 is missing
[   102.450] (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_36 is missing
[   102.450] (II) event17 - Magic Mouse 2: device is a pointer
[   102.451] (II) event17 - Magic Mouse 2: device removed
[   102.451] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hci0:256/0005:004C:0269.0002/input/input27/event17"
[   102.451] (II) XINPUT: Adding extended input device "Magic Mouse 2" (type: MOUSE, id 16)
[   102.451] (**) Option "AccelerationScheme" "none"
[   102.452] (**) Magic Mouse 2: (accel) selected scheme none/0
[   102.452] (**) Magic Mouse 2: (accel) acceleration factor: 2.000
[   102.452] (**) Magic Mouse 2: (accel) acceleration threshold: 4
[   102.454] (II) event17 - Magic Mouse 2: is tagged by udev as: Mouse
[   102.454] (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_35 is missing
[   102.454] (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_36 is missing
[   102.454] (II) event17 - Magic Mouse 2: device is a pointer

$ lsmod | grep -i mouse
hid_magicmouse         20480  0
mousedev               24576  0


$ journalctl -r [partly]
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) event17 - Magic Mouse 2: device is a pointer
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_36 is missing
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_35 is missing
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) event17 - Magic Mouse 2: is tagged by udev as: Mouse
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Magic Mouse 2: (accel) acceleration threshold: 4
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Magic Mouse 2: (accel) acceleration factor: 2.000
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Magic Mouse 2: (accel) selected scheme none/0
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Option "AccelerationScheme" "none"
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) XINPUT: Adding extended input device "Magic Mouse 2" (type: MOUSE, id 16)
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hc>
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) event17 - Magic Mouse 2: device removed
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) event17 - Magic Mouse 2: device is a pointer
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_36 is missing
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (EE) event17 - Magic Mouse 2: libinput bug: kernel fuzz of 4 but LIBINPUT_FUZZ_35 is missing
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) event17 - Magic Mouse 2: is tagged by udev as: Mouse
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Option "_source" "server/udev"
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Option "Device" "/dev/input/event17"
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Magic Mouse 2: always reports core events
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) systemd-logind: got fd for /dev/input/event17 13:81 fd 75 paused 0
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) Using input driver 'libinput' for 'Magic Mouse 2'
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Magic Mouse 2: Applying InputClass "libinput pointer catchall"
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) config/udev: Adding input device Magic Mouse 2 (/dev/input/event17)
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) This device may have been added with another device file.
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) No input driver specified, ignoring this device.
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) config/udev: Adding input device Magic Mouse 2 (/dev/input/mouse3)
Jan 07 13:27:34 x1-carbon kernel: magicmouse 0005:004C:0269.0002: input,hidraw1: BLUETOOTH HID v1.02 Mouse [Magic Mouse 2] on b8:9a:2a:41:8d:71
Jan 07 13:27:34 x1-carbon kernel: input: Magic Mouse 2 as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/bluetooth/hci0/hci0:256/0005:004C:0269.0002/input/>
Jan 07 13:27:34 x1-carbon kernel: magicmouse 0005:004C:0269.0002: unknown main item tag 0x0
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) systemd-logind: releasing fd for 13:81
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) UnloadModule: "libinput"
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) event17 - Magic Mouse 2 Mouse: device removed
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (**) Option "fd" "75"
Jan 07 13:27:34 x1-carbon /usr/lib/gdm-x-session[974]: (II) config/udev: removing device Magic Mouse 2 Mouse

from magicmouse-hid.

NgoHuy avatar NgoHuy commented on July 1, 2024

I can use the scrolling, did you modprobe the module?

from magicmouse-hid.

rashamalek avatar rashamalek commented on July 1, 2024

@NgoHuy Yes, but not working

$ modprobe hid_magicmouse scroll_acceleration=1 scroll_speed=55

$ lsmod | grep mous                                   ✔  my_env   22:27:54  
hid_magicmouse         20480  0
mousedev               24576  0

from magicmouse-hid.

NgoHuy avatar NgoHuy commented on July 1, 2024

I think you typed wrong module. It's hid-magicmouse as
sudo modprobe hid-magicmouse scroll_acceleration=1 scroll_speed=25 right_click_2finger=1

from magicmouse-hid.

rashamalek avatar rashamalek commented on July 1, 2024

I think both are the same module, to be on the safe side, tried that with a "-" , still the same

$ sudo rmmod hid_magicmouse
$ sudo modprobe hid-magicmouse scroll_acceleration=1 scroll_speed=25 right_click_2finger=1     

$ lsmod | grep mous    
hid_magicmouse         20480  0
mousedev               24576  0

from magicmouse-hid.

NgoHuy avatar NgoHuy commented on July 1, 2024

I can scroll with this module. I use install.sh from scripts directory then modprobe. Archlinux with latest kernel

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 1, 2024

In my last commit, I tried to improve the way the driver loads using modprobe. Can you try it out?

I don't promise it fixes scrolling, but now the driver is loading using modprobe hid-magicmouse and the parameters are defined at /etc/modprobe.d/hid-magicmouse.conf.

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 1, 2024

Some reports seem to suggest this is, in fact, a kernel problem: https://bbs.archlinux.org/viewtopic.php?id=259954

Can you confirm you have the same or similar issues?

from magicmouse-hid.

liverwust avatar liverwust commented on July 1, 2024

Hmm, I was wrong about scroll_acceleration. This is what I needed to do to get the scroll emulation working today:

  1. Boot the computer and turn on the mouse
  2. Run bluetoothctl connect {device-id} — see @RicardoEPRodrigues 's link regarding newer kernels
  3. Review the files /sys/modules/hid_magicmouse/parameters/* to make sure they match /etc/modprobe.d/hid_magicmouse.conf (yes, they do)
  4. Observed: scroll wheel emulation is not working
  5. Run sudo rmmod hid_magicmouse && sudo modprobe hid_magicmouse
  6. Observed: scroll wheel emulation is working again
  7. Edit /etc/modprobe.d/hid_magicmouse.conf and toggle scroll_acceleration=0 back to scroll_acceleration=1
  8. Run sudo rmmod hid_magicmouse && sudo modprobe hid_magicmouse
  9. Observed: scroll wheel emulation is still working

I then rebooted and tried again, now with scroll_acceleration=1. I again needed to rmmod and modprobe the driver, but the bottom line is that the scroll wheel emulation works with acceleration enabled.

Whenever I need to rebuild the kernel next, I will try to apply the patches referenced in the Arch forum thread. I am hopeful that they will alleviate the need to explicitly re-connect the mouse (step 3 above) and I will report back whether they also alleviate the need to rmmod/modprobe (step 5).

from magicmouse-hid.

ahosam avatar ahosam commented on July 1, 2024

Linux - Linux Hosam 5.11.0-41-generic
modprobe hid_magicmouse scroll_acceleration=1 scroll_speed=50 right_click_2finger=1
lsmod | grep mous
hid_magicmouse 20480 0
hid 135168 5 hidp,usbhid,hid_apple,hid_generic,hid_magicmouse
psmouse 163840 0

scroll is working but super slow

from magicmouse-hid.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.