.\" Copyright (c) 2009 Rohit Grover <rgrover1 at gmail dot com>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\"    may be used to endorse or promote products derived from this software
.\"   without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: release/10.0.0/share/man/man4/atp.4 235317 2012-05-12 03:25:46Z gjb $
.\"
.Dd November 12, 2009
.Dt ATP 4
.Os
.Sh NAME
.Nm atp
.Nd Apple touchpad driver
.Sh SYNOPSIS
To compile this driver into the kernel, place the following lines into
your kernel configuration file:
.Bd -ragged -offset indent
.Cd "device atp"
.Cd "device usb"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
atp_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
driver provides support for the Apple Internal Trackpad
device found in many Apple laptops.
.Pp
The driver simulates a three\-button mouse using multi\-finger tap
detection.
.
A single\-finger tap generates a left button click;
two\-finger tap maps to the middle button; whereas a three\-finger tap
gets treated as a right button click.
.
A double\-tap followed by a drag is treated as a selection gesture; a
virtual left\-button click is assumed for the lifespan of the drag.
.
.Nm
attempts to filter away activity at the horizontal edges of the
trackpad\-\-this is to keep unintentional palm movement from being
considered as user input.
.
.Pp
.Nm
supports dynamic reconfiguration using
.Xr sysctl 8 ;
through nodes under
.Nm hw.usb.atp .
Pointer sensitivity can be controlled using the sysctl tunable
.Nm hw.usb.atp.scale_factor .
.
.Sh HARDWARE
The
.Nm
driver provides support for the following Product IDs:
.Pp
.Bl -bullet -compact
.It
Core Duo MacBook & MacBook Pro (IDs: 0x0217, 0x0218, 0x0219)
.It
Core2 Duo MacBook & MacBook Pro (IDs: 0x021a, 0x021b, 0x021c)
.It
Core2 Duo MacBook3,1 (IDs: 0x0229, 0x022a, 0x022b)
.It
12 inch PowerBook and iBook (IDs: 0x030a, 0x030b)
.It
15 inch PowerBook (IDs: 0x020e, 0x020f, 0x0215)
.It
17 inch PowerBook (ID: 0x020d)
.El
.Pp
To discover the product\-id of a touchpad, search for 'Trackpad' in the
output of
.Xr lshal 1
and look up the property
.Nm usb_device.product_id .
.Sh FILES
.Nm
creates a blocking pseudo\-device file,
.Pa /dev/atp0 ,
which presents the mouse as a
.Ar sysmouse
or
.Ar mousesystems
type device\-\-see
.Xr moused 8
for an explanation of these mouse
types.
.Xr moused 8
can be configured to read touchpad data from
.Pa /dev/atp0
and pass it along to the
.Xr sysmouse 4
driver so that any process wanting to utilize mouse operation (such as
an X server) may fetch it from
.Pa /dev/sysmouse ;
alternatively,
.Pa /dev/atp0
may be manipulated via
.Xr read 2
and
.Xr ioctl 2
calls to get mouse data directly.
.Sh EXAMPLES
To use a compatible Apple Trackpad as your console mouse:
.Pp
.Dl moused -p /dev/atp0 -t auto
.Pp
To launch
.Xr moused 8
automatically upon boot, add the following to
.Pa /etc/rc.conf :
.Pp
.Dl moused_enable="YES"
.Dl moused_type="auto"
.Dl moused_port="/dev/atp0"
.Pp
If you want
.Xr moused 8
to also probe for external USB mice or other devices, then add the
following to
.Pa /etc/rc.conf :
.Pp
.Dl moused_nondefault_enable="YES"
.Dl moused_ums0_enable="YES"
.Dl moused_ums1_enable="YES"
.Pp
To be able to use the trackpad under X, change the "Pointer" section in
.Nm xorg.conf
to the following:
.Pp
.Dl Device "/dev/atp0"
.Dl Protocol "Auto"
.Pp
Better still, if you want to be able to use the mouse in both virtual
consoles as well as in X change it to:
.Pp
.Dl Device "/dev/sysmouse"
.Dl Protocol "Auto"
.Sh SEE ALSO
.Xr sysmouse 4 ,
.Xr usb 4 ,
.Xr loader.conf 5 ,
.Xr xorg.conf 5 Pq Pa ports/x11/xorg ,
.Xr moused 8 ,
.Xr sysctl 8
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Rohit Grover Aq rgrover1@gmail.com .
