AppleMagicMouse

Apple Magic Trackpad - Wikimedia Commons

The Magic Mouse is a multi-touch mouse produced by Apple Inc.

It can be used as a single-touch or multi-touch device in Ubuntu by pairing it using the Bluetooth utilities in Ubuntu. The following setup instructions only need to be followed once, then Ubuntu will recognize the Magic Mouse without further configuration.

Note: This has been tested in Ubuntu Maverick (10.10) only.

Pairing the Magic Mouse

Once you have inserted batteries in your Magic Mouse, if your system is Bluetooth-capable and its radio is enabled, go to System > Preferences > Bluetooth and click on Setup new device.... Once the Bluetooth setup dialog opens, you should see you mouse listed. Click once on it, then choose "PIN options..". Make sure "0000" is selected under "Fixed PIN":

Screenshot-Mouse1.png

Clicking Forward should then complete the pairing, which Ubuntu will remember.

The Magic Mouse can be forced in pairing mode by turning it off and on again (the "on" position will show green color in the switch position).

Once the device has been connected once or moved from another system, you can force pairing again by going to the Bluetooth applet and choosing Apple Wireless Mouse > Connect (if a PIN is asked, you can provide 0000 as the PIN code and press Enter to pair the mouse):

Screenshot-1.png

Once these steps have been completed the mouse will remain available in Ubuntu.

Problem: Pairing does not persist between reboots on Maverick (10.10)

If you find that you are not being prompted to "Always grant access" (refer to the Apple Magic Trackpad article) and that the device is not available after a reboot (i.e., you have to reconnect), try adding the pincode for the device (0000) to /var/lib/bluetooth/<physical_device_ID>/pincodes, like so:

In a terminal:

  1. Determine the physical (model-specific) and unique device IDs from the output of lsinput (from the "input-tools" package) as shown below.

  2. Create /lib/bluetooth/<physical_ID>/pincodes as the root user (or with sudo):

     # This folder *should* already exist, create it with 'sudo mkdir' if not.
     # You can use TAB to complete, if it's the only Bluetooth device on your system:
     cd /lib/bluetooth/<physical_ID>
    
     sudo gedit pincodes
    Add this line to the new file, save, and exit:
     <unique_ID> 0000

    where <physical_ID> is a backslash-escaped physical device ID, like D8\:30\:62\:38\:18\:02, and <unique_ID> is your device's unique ID, both from the output of lsinput.

See also: ubuntuforums.org's [HOWTO] Apple Magic Mouse on 10.10 Maverick Meerkat and bluez bug #61838.

Multitouch status

Finding your input device

Once your mouse has been paired, the hid_magicmouse module should automatically load. To verify this, issue the following command from a terminal:

$ lsmod | grep magic
hid_magicmouse          5958  0 
hid                    67710  3 hid_magicmouse,hidp,usbhid

Here is example output for lsinput (from the "input-tools" package) with a Magic Mouse present (other irrelevant input device removed):

$ sudo lsinput

/dev/input/event7
   bustype : BUS_BLUETOOTH
   vendor  : 0x5ac
   product : 0x30d
   version : 132
   name    : "Apple Wireless Mouse"
   phys    : "XX:XX:XX:XX:XX:XX"
   uniq    : "XX:XX:XX:XX:XX:XX"
   bits ev : EV_SYN EV_KEY EV_REL EV_ABS

In this case the input device would be /dev/input/event7. The input device number would be 7.

For more information on testing this device for multi-touch support, see Multitouch/Testing.

Installing PyMT and configuring it

To experiment multi-touch capabilities of the Apple Magic Mouse, you can try using PyMT, an open source library for developing multi-touch applications. You will need the device name as ound aboce (in this example, /dev/input/event7). See the Ubuntu PyMT documentation for this.

Multitouch/AppleMagicMouse (last edited 2013-04-24 12:53:34 by pittsford-216-226-127-122)