All of lore.kernel.org
 help / color / mirror / Atom feed
* Support for Logitech MX Anywhere 2
@ 2017-03-22 11:32 Mauro Carvalho Chehab
  2017-03-23 10:59 ` Benjamin Tissoires
  0 siblings, 1 reply; 16+ messages in thread
From: Mauro Carvalho Chehab @ 2017-03-22 11:32 UTC (permalink / raw)
  To: Jiri Kosina, linux-input, Benjamin Tissoires, Dmitry Torokhov

Hi,

The MX Anywhere 2 mouse has a high-resolution wheel that allows sending
wheel events together with mouse movements or in separate, via HID++.
By default, it starts in low-resolution mode, reporting events via HID.

The documentation for it was recently added[1]:
	https://lekensteyn.nl/files/logitech/x2121_hires_wheel.pdf

[1] there's a small error at the documentation, though:
    On page 5, at "[event0] wheelMovement() → resolution, periods, deltaV"
    chapter, it says that the "periods" field can be up to 15, but it shows
    only 3 bits for it table 9 "wheelMovement() report packet", placing
    the high-resolution bit as bit 3.

    After investigating it in practice, the actual bit that changes when
    the wheel is in high-resolution mode is bit 4. When bit = 1, the mouse
    is using high-resolution; when 0, it is using low resolution.

    So, in summary, the correct information there at the table should be,
    instead:
	- bits 0-3: periods
	- bit 4: resolution

There is a BZ for Solaar userspace application, opened in Aug, 2016
requesting support for it:
	https://github.com/pwr/Solaar/issues/283

With the new documentation, released yesterday, I added support for it today,
on a set of patches at:
	https://github.com/mchehab/Solaar/tree/mx_anywhere2-v3

With those patches, Solaar, in CLI, mode, shows the status of the
high-res wheel:

        11: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert
              Normal wheel motion
            Has ratchet switch
              Free wheel mode
            Low resolution mode
            HID notification

And allows to toggle at the 3 possible switches:
	- Invert wheel movement;
	- Change to high-resolution mode - with makes the wheel to
	  scroll 8 times faster;
	- Select between HID or HID++ notifications.

It also generate an event when the ratchet button is clicked
(changing from ratchet mode to freewheel). Solaar now handle those
events using hiraw interface.

When the notification is set to HID mode, evdev properly
generates Wheel events:

1490181781.995144: event type EV_REL(0x02): REL_WHEEL (0x0002) value=-1
1490181781.995144: event type EV_SYN(0x00).
1490181782.211146: event type EV_REL(0x02): REL_WHEEL (0x0002) value=1
1490181782.211146: event type EV_SYN(0x00).

But it doesn't generate events when ratchet switch button is
pressed.

When the notification is changed to HID++ mode, it also doesn't
generate events.

I suspect that the right thing to do would be to add a handler for
it, probably at:

	drivers/hid/hid-logitech-hidpp.c

On Solaar, with my patches, we can receive such messages via
hidraw interface:

HID++ wheel movement event:

	07:37:22,846    DEBUG [ReceiverListener:hidraw1] logitech_receiver.base: (13) => r[11 03 0B00 01FFFF00000000000000000000000000]
	07:37:22,847     INFO [ReceiverListener:hidraw1] logitech_receiver.notifications: <PairedDevice(3,404A,Anywhere MX 2)>: WHEEL: res: 0 periods: 1 delta V:-1 

Ratchet event (generated on both HID and HID++ modes):

	08:26:12,455    DEBUG [ReceiverListener:hidraw2] logitech_receiver.base: (13) => r[11 03 0B10 01000000000000000000000000000000]
	08:26:12,456     INFO [ReceiverListener:hidraw2] logitech_receiver.notifications: <PairedDevice(3,404A,Anywhere MX 2)>: WHEEL: ratchet: 1

With regards to ratchet, it probably makes sense to query its state
when the driver starts, as IMHO, it should work on a way similar to
<CAPS LOCK>. Btw, are there any event already defined for ratchet mode?

As I never touched on those HID drivers, could someone either add support
for it or shed some light about what would be the proper way to add support
for it?

Thanks!
Mauro

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-04-03 19:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-22 11:32 Support for Logitech MX Anywhere 2 Mauro Carvalho Chehab
2017-03-23 10:59 ` Benjamin Tissoires
2017-03-23 17:29   ` Mauro Carvalho Chehab
2017-03-24  5:22     ` Peter Hutterer
2017-03-24  9:57       ` Mauro Carvalho Chehab
2017-03-25 12:36         ` Mauro Carvalho Chehab
2017-03-25 16:02           ` Mauro Carvalho Chehab
2017-03-27  1:38             ` Peter Hutterer
2017-03-27 12:17               ` Mauro Carvalho Chehab
2017-03-31 10:03                 ` Benjamin Tissoires
2017-03-31 10:53                   ` Mauro Carvalho Chehab
2017-03-31 12:28                     ` Benjamin Tissoires
2017-04-03  4:43                       ` Peter Hutterer
2017-04-03 12:49                         ` Mauro Carvalho Chehab
2017-04-03 15:03                           ` Mauro Carvalho Chehab
2017-04-03 19:10                       ` Mauro Carvalho Chehab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.