Apple magic trackpad linux

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

mwyborski/Linux-Magic-Trackpad-2-Driver

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

This driver was merged into the official Linux kernel in 4.20 (see update 2018-12-15 below). If uname -srm shows 4.20 or greater, you already have this driver installed and likely have no use for the driver in this repo.

Installed today Xubuntu 19.04 and the pressure problem was back. I had to add the following file:

Section "InputClass" Identifier "Touchpads" Driver "libinput" MatchProduct "Apple Inc. Magic Trackpad 2" MatchDevicePath "/dev/input/event*" EndSection 

To pair via Bluetooth disconnect from USB, then turn it off and on again and you will find it when you search for devices.

Tried today the beta of Ubuntu 19.04 with Kernel 5.0 and the Magic Trackpad 2 works out of the box. No quirks needed.

As the pressure offsets have been removed from the official release, the driver needs a libinput quirks file. schmunk42 suggested the following quirks file in his comment torvalds/linux#332 (comment):

[Touchpad touch override] MatchUdevType=touchpad MatchName=*Magic Trackpad 2 AttrPressureRange=4:0 

The driver will be included in the 4.20 release of the official linux kernel.

This means that the active development in this repository is stopped and you should use the official code for modifications.

  • Thank you to everybody who helped, whether through testing or active development!
  • https://github.com/bobbysue/Linux-Magic-Trackpad-2-Driver
  • https://github.com/ponyfleisch/hid-magictrackpad2
  • https://github.com/adam-h/Linux-Magic-Trackpad-2-Driver

This repository contains the linux hid-magicmouse driver with Magic Trackpad 2 support for Linux 4.18. For older kernels you might have to diff and backport.

The driver is tested in combination with the xf86-libinput and xf86-mtrack driver.

Читайте также:  Hp laser 107a драйвер линукс

The driver supports bluetooth and USB. To connect the Trackpad via bluetooth, it must be clicked once after it is turned on, then the Trackpad tries to reconnect to the last paired (and trusted) connection.

Please help to test this driver and report issues.

You can just use the standard xf86-libinput driver and configure it through your Window-Manager-Settings. This driver works very well, but does not support three-finger-drag, but tap-to-drag.

An example configuration for mtrack can be found in:

usr/share/X11/xorg.conf.d/90-magictrackpad.conf 

This configuration supports tap-to-click, two-finger-scroll and three-finger-drag. Though scrolling is not as smooth as with xf86-libinput. It can be used as starting point for your own configuration. Make sure, that you have xf86-input-mtrack-git installed and it gets loaded. You find more information about the options here: https://github.com/p2rkw/xf86-input-mtrack

@adam-h made a DKMS which can be used for testing:

cd scripts sudo ./install.sh 

Or just use regular dkms commands once you’ve added ./linux/drivers/hid .

If the driver is not working, please make sure that the correct hid-magicmouse driver gets loaded and try the following steps:

cd linux/drivers/hid make sudo rmmod hid_magicmouse sudo insmod ./hid-magicmouse.ko tail -f ~/.local/share/xorg/Xorg.0.log 

Now unplug the trackpad and plug it back in, to see which driver gets loaded.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Magic Mouse 2 driver for Linux.

RicardoEPRodrigues/magicmouse-hid

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Linux Apple Magic Mouse 2 and Magic Trackpad 2 Driver

This repository contains the linux hid-magicmouse driver with Magic Trackpad 2 and Magic Mouse 2 support for Linux 4.18 onwards. For older kernels you might have to diff and backport. It also contains 2 fixes to the Magic Mouse 2 regarding Bluetooth random disconnections and this driver not loading on bluetooth reconnection.

This driver is based off of the work of @robotrovsky, @svartalf, @0xABAD and probably others.

Please help to test this driver and report issues.

NOTE: Since kernel version 5.15, there is support for the mouse without the need for this driver. We try to backport changes to this driver to have it up-to-date with the one on the kernel and try to offer a bit more functionality but it is not perfect. If you want the mouse to just work either install a more recent kernel or proceed with this driver installation.

Читайте также:  Жесткие ссылка папок linux

A .deb file is now available in Releases. Get the latest version here.

Install Driver with DKMS and the two fixes.

sudo apt-get install dkms git clone https://github.com/RicardoEPRodrigues/Linux-Magic-Trackpad-2-Driver.git cd Linux-Magic-Trackpad-2-Driver chmod u+x install.sh sudo ./install.sh 

The driver supports bluetooth and USB for the trackpad. To connect the Trackpad via bluetooth, it must be clicked once after it is turned on, then the Trackpad tries to reconnect to the last paired (and trusted) connection.

The drivers supports regular mouse motion and additionally scrolling and mouse middle click. Middle click is a single finger click near the middle portion of the touch surface OR a 3 finger click anywhere on the touch surface if you put the mouse in 3 finger middle click mode. Scrolling is a single finger up or down motion anywhere on the touch surface.

Several parameters are avaliable for you to modify to personalize the driver to your taste. These can be found in /etc/modprobe.d/hid-magicmouse.conf after install. Modify them and the next time the driver is loaded it will have the new values.

After changing the parameters the driver can be reloaded using the following commands:

sudo rmmod hid_magicmouse sudo modprobe hid_magicmouse 

If the driver is not working, please make sure that the correct hid-magicmouse driver gets loaded and try the following steps:

cd linux/drivers/hid make sudo rmmod hid_magicmouse sudo insmod ./hid-magicmouse.ko tail -f ~/.local/share/xorg/Xorg.0.log 

Now unplug the trackpad and plug it back in, to see which driver gets loaded.

Data Layout of bluetooth packets.

 /* The data layout for magic mouse 2 is: * 14 bytes of prefix * data[0] is the device report ID * data[1] is the mouse click events. Value of 1 is left, 2 is right. * data[2] (contains lsb) and data[3] (msb) are the x movement * of the mouse 16bit representation. * data[4] (contains msb) and data[5] (msb) are the y movement * of the mouse 16bit representation. * data[6] data[13] are unknown so far. Need to decode this still * * data[14] onwards represent touch data on top of the mouse surface * touchpad. There are 8 bytes per finger. e.g: * data[14]-data[21] will be the first finger detected. * data[22]-data[29] will be finger 2 etc. * these sets of 8 bytes are passed in as tdata to * magicmouse_emit_touch() * * npoints is the number of fingers detected. * size is minimum 14 but could be any multpiple of 14+ii*8 based on * how many fingers are detected. e.g for 1 finger, size=22 for * 2 fingers, size=30 and so on. */ /* tdata is 8 bytes per finger detected. * tdata[0] (lsb of x) and least sig 4bits of tdata[1] (msb of x) * are x position of touch on touch surface. * tdata[1] most sig 4bits (lsb of y) and and tdata[2] (msb of y) * are y position of touch on touch surface. * tdata[1] bits look like [y y y y x x x x] * tdata[3] touch major axis of ellipse of finger detected * tdata[4] touch minor axis of ellipse of finger detected * tdata[5] contains 6bits of size info (lsb) and the two msb of tdata[5] * are the lsb of id: [id id size size size size size size] * tdata[6] 2 lsb bits of tdata[6] are the msb of id and 6msb of tdata[6] * are the orientation of the touch. [o o o o o o id id] * tdata[7] 4 msb are state. 4lsb are unknown. * * [ x x x x x x x x ] * [ y y y y x x x x ] * [ y y y y y y y y ] * [touch major ] * [touch minor ] * [id id s s s s s s] * [o o o o o o id id] * [s s s s | unknown] */ 

Below is the explanation to 2 fixes performed when running the install.sh shown above. The first relates to the disconnection of the mouse over bluetooth and will restart the bluetooth service. The second regards the driver not being loaded when the mouse reconnects with the computer.

Читайте также:  Русификация firefox linux mint 17

There have been many complaining of repeated and random disconnections of the Magic Mouse 2. One solution to this is to disable eSCO mode on the bluetooth service as shown in this answer. You can disable it like this:

echo 1 | sudo tee /sys/module/bluetooth/parameters/disable_esco sudo /etc/init.d/bluetooth restart # persist setting echo "options bluetooth disable_esco=1" | sudo tee /etc/modprobe.d/bluetooth-tweaks.conf 

Driver not loading when connecting Magic Mouse 2

0xABAD created a fix that loads the driver when it detects the mouse. Here we’ll show an updated version that was changed a bit to use the idProduct of the device to identify any Magic Mouse 2.

To begin we need to build the driver and register it has a kernel module, please take a look at scripts/install.sh .

With that we’ll create a shell script that will load the driver. Let’s create a folder in /opt/ to place it into.

sudo mkdir -p /opt/magic-mouse-fix/

Let’s create a script named magic-mouse-2-add.sh (to create and edit it use something like sudo nano /opt/magic-mouse-fix/magic-mouse-2-add.sh ). This should be the its contents:

#!/bin/sh FILE=/tmp/magicmouse-driveload reload() < if [ ! -f "$FILE" ]; then touch $FILE modprobe -r hid_magicmouse sleep 2 modprobe hid-generic modprobe hid_magicmouse \ scroll_acceleration=1 \ scroll_speed=25 \ middle_click_3finger=1 sleep 2 rm -f "$FILE" fi > reload &

You can also adjust the scroll_speed to a value of your liking (somewhere between 0 to 63). If you wish to disable scroll acceleration or middle clicking with 3 fingers then set those values to zero. Give the script permission to run with sudo chmod +x /opt/magic-mouse-fix/magic-mouse-2-add.sh . When this script is run it will unload the default Magic Mouse driver and then load the new one built eariler.

We now need to create a udev rule that runs the script and loads the driver when the Mouse connects. In /etc/udev/rules.d directory create a 10-magicmouse.rules file and add the following:

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" 

The 10- prefix was picked arbitrarily and could be any number as it is used to determine the lexical ordering of rules in the kernel. The earlier the file is loaded guarantees that the rule will be applied before any others.

Now we need to reload the udev database with:

With that in place the Magic Mouse 2 will now be properly loaded with scrolling when connected via Bluetooth. Note that isn’t perfect and bugs may be around.

Источник

Оцените статью
Adblock
detector