1.\" $NetBSD: btmagic.4,v 1.6 2015/07/03 22:18:02 wiz Exp $ 2.\" 3.\" Copyright (c) 2010 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Iain Hibbert. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd July 4, 2015 31.Dt BTMAGIC 4 32.Os 33.Sh NAME 34.Nm btmagic 35.Nd Apple Magic Mouse and Apple Magic Trackpad 36.Sh SYNOPSIS 37.Cd "btmagic* at bthub?" 38.Cd "wsmouse* at btmagic?" 39.Sh DESCRIPTION 40The 41.Nm 42driver provides support for the 43.Tn Bluetooth 44.Dq Magic Mouse 45and 46.Dq Magic Trackpad 47from 48.Tn Apple, Inc . 49As remote devices cannot be discovered by autoconfig, configuring 50a mouse is normally carried out with the 51.Xr btdevctl 8 52program. 53.Pp 54The Magic Mouse and Magic Trackpad use the standard 55.Tn USB 56Human Interface Device protocol to communicate, but do not provide a 57proper HID Descriptor, and require specific initializations to enable 58the proprietary touch reports. 59.Pp 60The Magic Mouse provides basic mouse functionality with two buttons, 61and the 62.Nm 63driver additionally interprets the touch reports to emulate a middle 64mouse button when more than one firm touch is detected during a click 65event, plus horizontal and vertical scrolling for touch movements 66greater than a certain distance. 67The mouse has a base resolution of 1300dpi, which the driver scales 68by default to a less sensitive 650dpi, but this is adjustable with 69.Xr sysctl 8 70along with the pressure needed to discern a firm touch, the minimum 71distance necessary to trigger scrolling and the additional downscale 72factor applied to scroll movements. 73.Pp 74The Magic Trackpad provides multi touch functionality and one button. 75The 76.Nm 77driver emulates 3 buttons by splitting the area at the bottom of the 78device in 3 equal zones and detects finger presence in one of these zones 79when the button is pressed. 80In addition, a tap in any area of the trackpad is interpreted as a left click. 81The timeout for tap detection defaults to 100ms 82and is adjustable with 83.Xr sysctl 8 . 84.Pp 85Pointer movement is reported for single-touch 86movements over the device, and scroll is reported for multi-touch movements. 87.Pp 88The trackpad has a base resolution of 1300dpi, which the driver scales 89by default to a less sensitive 650dpi, but this is adjustable with 90.Xr sysctl 8 91along with the additional downscale factor applied to scroll movements. 92.Pp 93.Nm 94interfaces to the system as usual through the 95.Xr wsmouse 4 96driver, and the following properties are used during autoconfiguration: 97.Bl -tag -width ".It remote-bdaddr" 98.It vendor-id 99Must be 0x05ac. 100.It product-id 101Must be 0x030d or 0x030e. 102.It local-bdaddr 103Local device address. 104.It remote-bdaddr 105Remote device address. 106.It link-mode 107This optional string represents the link mode of the baseband link, and 108may be one of 109.Sq auth , 110.Sq encrypt , 111or 112.Sq secure . 113.El 114.Pp 115When the 116.Nm 117driver has configured, it will attempt to open a connection to the mouse 118and, if this fails or the connection is lost, will wait for the 119mouse to initiate connections. 120The Magic Mouse requires connections to be authenticated, and 121should accept a PIN of 122.Sq 0000 123during the pairing process. 124.Sh SEE ALSO 125.Xr bluetooth 4 , 126.Xr bthub 4 , 127.Xr wsmouse 4 , 128.Xr btdevctl 8 , 129.Xr sysctl 8 130.Sh AUTHORS 131.An -nosplit 132The 133.Nm 134driver was written by 135.An Iain Hibbert 136with reference to the 137.Tn Linux 138driver written by 139.An Michael Poole . 140.An Manuel Bouyer 141added Magic Trackpad support, with reference to the 142.Tn Linux 143driver written by 144.An Michael Poole 145and 146.An Chase Douglas . 147