History log of /drivers/hid/hid-magicmouse.c
Revision Date Author Comments
420359667ce49da1f5d6b081abf5cb6db0d7b700 21-Sep-2011 Jaikumar Ganesh <jaikumarg@android.com> HID: magicmouse: Add input_register callback.

The magicmouse driver needs to setup the input mapping
after reports are parsed but before device is registered.

Change-Id: Ic3a0ff4fc056f5d374bb7ea1bd831a175c690b0b
Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com>
503f7d53b368c8e4e13a7756220c0536fcf1a034 14-Feb-2012 Chase Douglas <chase.douglas@canonical.com> HID: hid-magicmouse: Add pointer and buttonpad properties for Magic Trackpad

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
bca621421c53caf73f36e181d6e5fe41fe0da7a7 14-Oct-2011 Daniel van Vugt <vanvugt@gmail.com> HID: hid-magicmouse: Magic Trackpad has 1 button, not 2

hid-magicmouse was advertising the Apple Magic Trackpad as having 2
buttons (left and right) when it actually only has 1 button.

Advertising multiple buttons makes Xorg disable all button 2 and 3
emulation (using multi-finger clicks). So Xorg users don't get working
right/middle-click emulation out of the box.

This patch makes hid-magicmouse correctly only report one real button
for Magic Trackpad, which in turn makes Xorg enable multi-finger click
support to emulate right/middle buttons.

[http://launchpad.net/bugs/862094]

Signed-off-by: Daniel van Vugt <vanvugt@gmail.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
35d851df23b093ee027f827fed2213ae5e88fc7a 25-Aug-2011 Jiri Kosina <jkosina@suse.cz> HID: magicmouse: ignore 'ivalid report id' while switching modes, v2

This is basically a more generic respin of 23746a6 ("HID: magicmouse: ignore
'ivalid report id' while switching modes") which got reverted later by
c3a492.

It turns out that on some configurations, this is actually still the case
and we are not able to detect in runtime.

The device reponds with 'invalid report id' when feature report switching it
into multitouch mode is sent to it.

This has been silently ignored before 0825411ade ("HID: bt: Wait for ACK
on Sent Reports"), but since this commit, it propagates -EIO from the _raw
callback .

So let the driver ignore -EIO as response to 0xd7,0x01 report, as that's
how the device reacts in normal mode.

Sad, but following reality.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=35022

Reported-by: Chase Douglas <chase.douglas@canonical.com>
Reported-by: Jaikumar Ganesh <jaikumarg@android.com>
Tested-by: Chase Douglas <chase.douglas@canonical.com>
Tested-by: Jaikumar Ganesh <jaikumarg@android.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
4f6fdf08681cecd9f38499de7a02eb4f05f399a7 05-Aug-2011 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: Set resolution of touch surfaces

Add touch surface resolution information. The size of the touch surfaces
has been determined to the hundredth of a mm.

Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Michael Poole <mdpoole@troilus.org>
Cc: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
[jkosina@suse.cz: update comments and commit message]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
c3a4924565e2eecf2539871abd123d35be6d76d5 16-Jun-2011 Jiri Kosina <jkosina@suse.cz> Revert "HID: magicmouse: ignore 'ivalid report id' while switching modes"

This reverts commit 23746a66d7d9e73402c68ef00d708796b97ebd72.

It turned out that the actual reason for failure is not the device
firmware, but bug in Bluetooth stack, which will be fixed by
patch by Ville Tervo which corrects the mask handling for CSR 1.1
Dongles.

Reported-and-tested-by: Ed Tomlinson <edt@aei.ca>
Reported-and-tested-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
23746a66d7d9e73402c68ef00d708796b97ebd72 19-May-2011 Jiri Kosina <jkosina@suse.cz> HID: magicmouse: ignore 'ivalid report id' while switching modes

The device reponds with 'invalid report id' when feature report switching it
into multitouch mode is sent to it.

This has been silently ignored before 0825411ade ("HID: bt: Wait for ACK
on Sent Reports"), but since this commit, it propagates -EIO from the _raw
callback .

So let the driver ignore -EIO as response to 0xd7,0x01 report, as that's
how the device reacts in normal mode.

Sad, but following reality.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=35022

Tested-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
cc5e0f08ca2a66fc4c6984ccff74fd529e969fac 01-Apr-2011 Chase Douglas <chase.douglas@canonical.com> HID: hid-magicmouse: Increase evdev buffer size

The evdev buffer isn't big enough when you get many fingers on the
device. Bump up the buffer to a reasonable size, matching what other
multitouch devices use. Without this change, events may be discarded in
the evdev buffer before they are read.

Reported-by: Simon Budig <simon@budig.de>
Cc: Henrik Rydberg <rydberg@euromail.se>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: stable@kernel.org
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2d9ca4e9f393d81d8f37ed37505aecbf3a5e1bd6 09-Mar-2011 Henrik Rydberg <rydberg@euromail.se> HID: hid-magicmouse: Correct touch orientation direction

The magic trackpad and mouse both report touch orientation in opposite
direction to the bcm5974 driver and what is written in
Documents/input/multi-touch-protocol.txt. This patch reverts the
direction, so that all in-kernel devices with this feature behave the
same way.

Since no known application has been utilizing this information yet, it
seems appropriate also for stable.

Cc: stable@kernel.org
Cc: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
4291ee305e9bb0699504a66f0e2b7aefcf0512a5 10-Dec-2010 Joe Perches <joe@perches.com> HID: Add and use hid_<level>: dev_<level> equivalents

Neaten current uses of dev_<level> by adding and using
hid specific hid_<level> macros.

Convert existing uses of dev_<level> uses to hid_<level>.
Convert hid-pidff printk uses to hid_<level>.

Remove err_hid and use hid_err instead.

Add missing newlines to logging messages where necessary.
Coalesce format strings.

Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Other miscellaneous changes:

Add const struct hid_device * argument to hid-core functions
extract() and implement() so hid_<level> can be used by them.
Fix bad indentation in hid-core hid_input_field function
that calls extract() function above.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
6a66bbd693c12f71697c61207aa18bc5a12da0ab 09-Dec-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: Don't report REL_{X,Y} for Magic Trackpad

With the recent switch to having the hid layer handle standard axis
initialization, the Magic Trackpad now reports relative axes. This would
be fine in the normal mode, but the driver puts the device in multitouch
mode where no relative events are generated. Also, userspace software
depends on accurate axis information for device type detection. Thus,
ignoring the relative axes from the Magic Trackpad is best.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
921990b7046ab4fb523cbccc5bce2c921762232d 01-Sep-2010 Henrik Rydberg <rydberg@euromail.se> HID: magicmouse: Adjust major / minor axes to scale

By visual inspection, the reported touch_major and touch_minor axes
are roughly a factor of four too small. The factor is approximate,
since the protocol is not known and the HID report encodes touch size
with fewer bits than positions. This patch scales the reported values
by a factor of four.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
64eb105d7f92fa48798106ac0d8bf17668eb2524 24-Sep-2010 Michael Poole <mdpoole@troilus.org> HID: magicmouse: Use hid-input parsing rather than bypassing it

Let the HID core handle input device setup and HID-compliant reports.
This driver then only has to worry about the non-standard reports.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
a462230e16acc8664145216da3c928d03556691a 01-Sep-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: enable Magic Trackpad support

The trackpad speaks a similar, but different, protocol from the magic
mouse. However, only small code tweaks here and there are needed to make
basic multitouch work.

Extra logic is required for single-touch emulation of the touchpad. The
changes made here take the approach that only one finger may emulate the
single pointer when multiple fingers have touched the screen. Once that
finger is raised, all touches must be raised before any further single
touch events can be sent.

Sometimes the magic trackpad sends two distinct touch reports as one big
report. Simply splitting the packet in two and resending them through
magicmouse_raw_event ensures they are handled properly.

I also added myself to the copyright statement.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
6de048bf1dd2ad35fe9b2326bf9d6d23fb2fff7a 01-Sep-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: simplify touch data bit manipulation

The new format should be easier to read to determine which bits
correspond to which data. It also brings all the manipulation logic to
the top of the function. This makes size and orientation reading more
clear.

Note that the impetus for this change is the forthcoming support for the
Magic Trackpad, which has a different touch data protocol.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
0773590c89fee9c62eaddc5459e52ba96173f930 01-Sep-2010 Chase Douglas <chase.douglas@ubuntu.com> HID: magicmouse: simplify multitouch feature request

Only the first feature request is required to put the Magic Mouse into
multitouch mode. This is also the case for the Magic Trackpad, for which
support will be added in a later commit.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
c61b7cee672cc7276619ac0edf8f426e2f9e63e9 02-Sep-2010 Chase Douglas <chase.douglas@ubuntu.com> HID: magicmouse: remove timestamp logic

The timestamps from the device are currently stored in the private data
structure. These aren't used, so remove them. I've left a comment
detailing the protocol for future reference.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
0228db70ce6afdcd14164ab8d18137fa319c76e8 02-Sep-2010 Chase Douglas <chase.douglas@ubuntu.com> HID: magicmouse: simplify touch down logic

For the MT protocol, we need to properly keep track of each down touch.
This change simplifies the logic, and should make things easier when
support for the Magic Trackpad is added.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
7d876c05fa6cf82f0274f27276d981ed325697a5 05-Jul-2010 Michael Poole <mdpoole@troilus.org> HID: magicmouse: Correct parsing of large X and Y motions.

The X and Y values have two more significant bits in the same byte
that contains click status. Include these in the reported value.
Thanks to Iain Hibbert of NetBSD for pointing this out.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
e3612e8669b8c15278058f8dd52e3dc6e7d26710 05-Jul-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: report last touch up

The evdev multitouch protocol requires that a last MT sync event must be
sent after all touches are up. This change adds the last MT sync event
to the hid-magicmouse driver.

Also, don't send events when a touch leaves.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
c04266889b591165bdea396b20313bebb83c0fd6 21-Jun-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: enable horizontal scrolling

Mimicks OS X behavior.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
0b778e76c1e7ccf49f8980b594e72f984095fd26 21-Jun-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: add param for scroll speed

The new scroll_speed param takes an integer value from 0 to 63, where 0
is slowest and 63 is fastest. The default of 32 remains the same. This
parameter also affects scroll acceleration linearly.

A second part of this change is a tightly coupled modification to the
scroll acceleration. Previously, scroll acceleration could be reset
without lifting the scroll finger. This is rather unintuitive and hard
to control in the case where a user wants faster scrolling, but wants to
hold the scroll touch for longer than a moment.

Note that scroll acceleration levels are now 1-7, where 7 is slowest. In
the previous implementation, there were 8 levels defined, but it was
impossible to start at the slowest level. In order to keep the default
scroll speed unchanged, only 7 levels are used now.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
8d93efb27ab8927ffc7a357f1b2d10039de50ed4 21-Jun-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: properly account for scroll movement in state

Before this change, sequential scroll events would take a variable
amount of movement due to incorrect accounting. This change ensures all
scroll movements require a deterministic touch movement for an action to
occur.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9846f350ef4d4108c1154acfc125fe8d8630ef84 02-Jun-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: disable and add module param for scroll acceleration

Scroll acceleration is unique to the magicmouse driver, and is
unintuitive to a user who is unaware of the functionality. Thus, disable
it by default, but add a module parameter to enable it for power users
who want it.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
ef566d30a702cc9b49d24edc4ad45c62208a4f5d 02-Jun-2010 Chase Douglas <chase.douglas@canonical.com> HID: magicmouse: scroll on entire surface, not just middle of mouse

Previously, scroll events only occurred when the user moved a touch
along the middle of the touch surface. This is unintuitive for a normal
user who is not aware of this. The device has a uniform surface, so the
distinction is artificial. This change removes the touch area check for
a scroll event, which replicates the OS X behavior.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
23d021167eebf0df5ccadf4f8de5ccb8d4ac2904 12-May-2010 Jiri Kosina <jkosina@suse.cz> HID: magicmouse: fix input registration

When HIDRAW is not set, hid_hw_start() returns ENODEV as no subsystem has
claimed the magicmouse device, and probe routine bails out. Which is not what we want.

This happens because magicmouse driver is instantiating the connection to
Input subsystem itself, and since commit 28918c211d86b ("HID: magicmouse: fix
oops after device removal") the HID core is not registering input device
itself.

Fix this by letting HID core register the input device (so that hid_hw_start()
succeeds, as the device is claimed by at least one subsystem) and de-register
it again later before proceeding with proper input setup.

Reported-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
28918c211d86b6eeb70182c523800c7bc442960c 09-Mar-2010 Michael Poole <mdpoole@troilus.org> HID: magicmouse: fix oops after device removal

Ask the HID core not to register an input device for the mouse.
Fix an oops after removing the device, due to leaving the new
input device registered.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
71b38bd4c1cc4f2b653064357e4efab77dfd711d 11-Feb-2010 Michael Poole <mdpoole@troilus.org> HID: magicmouse: coding style and probe failure fixes

Use proper values to initialize bool configuration variables, tabs rather than
spaces, no braces for one-line else clause, __set_bit() when the operation
doesn't have to be atomic, input_set_abs_params() rather than writing the
fields directly, and call hid_hw_stop() when appropriate to handle failures in
the probe.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
128537cea464d919febeaea2000e256749f317eb 06-Feb-2010 Michael Poole <mdpoole@troilus.org> HID: add a device driver for the Apple Magic Mouse.

The Magic Mouse requires that a driver send an unlock Report(Feature) command,
similar to the Wacom wireless tablet and Sixaxis controller quirks. This turns
on an Input Report that isn't published in the input Report descriptor that
contains touch data (and usually overrides the normal motion and click Report).

Because the mouse has only one switch and no scroll wheel, the driver
(under control of parameters) emulates a middle button and scroll wheel.
User space could also ignore and/or re-synthesize those events based on
the reported events.

Some user-space tools to talk to the mouse directly (that is, when it is not
associated with the host's HIDP stack) are at
http://github.com/entrope/linux-magicmouse

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>