Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mx anywhere2 v5 #351

Merged
merged 4 commits into from
Sep 20, 2017
Merged

Mx anywhere2 v5 #351

merged 4 commits into from
Sep 20, 2017

Conversation

mchehab
Copy link
Contributor

@mchehab mchehab commented Mar 24, 2017

Add support for controlling and events for the MX Anyware 2 High-res Wheel

The high-res wheel allows setting 3 properties:

  • if the wheel will scroll inverted;
  • if the wheel will use high-resolution (e. g. will scroll faster);
  • if the wheel will send HID++ or HID notifications.

Currently, the Logitech HID Kernel driver doesn't handle HID++ wheel notifications. So, when this mode is set, the scroll won't work on apps. It is possible to see the HID++ messages, though, by enabling solaar debug logs.

With this mouse, mouse movement and wheel HID events, on HID mode are like those:

000009159 ms 000008 ms (007961 us EP=83, Dev=6a) >>> 20 03 02 00 00 ff ff ff 00 00 00 00 00 00 00
000009167 ms 000008 ms (007957 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 f0 ff 00 00 00 00 00 00 00
000009175 ms 000008 ms (007905 us EP=83, Dev=6a) >>> 20 03 02 00 00 ff ff ff 00 00 00 00 00 00 00
000009183 ms 000008 ms (007972 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 f0 ff 00 00 00 00 00 00 00
000009191 ms 000008 ms (007940 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 f0 ff 00 00 00 00 00 00 00
000009199 ms 000008 ms (007913 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 f0 ff 00 00 00 00 00 00 00
000009207 ms 000008 ms (077958 us EP=83, Dev=6a) >>> 20 03 02 00 00 ff 0f 00 00 00 00 00 00 00 00
000009285 ms 000078 ms (007967 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 f0 ff 00 00 00 00 00 00 00
000009293 ms 000008 ms (007916 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 f0 ff 00 00 00 00 00 00 00
000009301 ms 000008 ms (615980 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 10 00 00 00 00 00 00 00 00
000009917 ms 000616 ms (007940 us EP=83, Dev=6a) >>> 20 03 02 00 00 00 10 00 00 00 00 00 00 00 00
000009925 ms 000008 ms (007926 us EP=83, Dev=6a) >>> 20 03 02 00 00 01 00 00 00 00 00 00 00 00 00

Those packets start with "20" and have "00" for feature request_id (with is supposed to be DEVICE_FW_VERSION).

Ratchet HID events always come from feature 0x2121.

When the mouse is in HID++, wheel events also come from feature 0x2121.

When called via CLI, solaar show will display the settings for the mouse just after the high-res feature:

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

Tested on my MX Anywhere 2 device on both CLI and GUI.

_("High-sensitivity wheel invert mode for vertical scroll."))
_HIRES_RES = ('hires-smooth-resolution', _("Wheel Resolution"),
_("High-sensitivity mode for vertical scroll with the wheel."))
_HIRES_TGT = ('hires-smooth-hid', _("High Resolution HID++ notification"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normal users will normally not have to modify this option (it is a driver thing), what do you think about removing it?

Copy link
Contributor Author

@mchehab mchehab Mar 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I see is that, if hid-logitech-hidpp driver is loaded, it should switch to HID++ mode, in order to be able to get the resolution at the mouse events. However, if the Kernel is compiled without it, the mouse will produce standard HID events.

In other words, I think we should merge a patchset at the Kernel with the functionality provided by this patch series:

  1. https://patchwork.kernel.org/patch/9644899/
  2. https://patchwork.kernel.org/patch/9644897/
  3. https://patchwork.kernel.org/patch/9644895/
  4. https://patchwork.kernel.org/patch/9644901/

With such patch series, if wheel is producing either HID or HID++ events should be transparent for the user, at least in low resolution mode.

Yet, being able to enable/disable HID+ feature could be useful for debugging. So, perhaps it could be disabled only at GUI - or require some debug flag in order to allow changing it - as I would find useful to be able to dynamically switch it and see if input/evdev is properly reporting events on both modes.

Copy link
Member

@Lekensteyn Lekensteyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, do you want to make other changes or are these ready to go?

@Lekensteyn
Copy link
Member

uh-oh, there is a small conflict

Add support for the high resolution wheel found on MX Anywhere 2.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Set wrongly to HI_RES_SCROLLING. Correct it to HIRES_WHEEL as reported
by MX Anywhere2.

relates to pwr-Solaar#283

Signed-off-by: Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
The event at address 0 is only produced while in HID++ mode.

The rachet event (address 0x10) happens on both HID and
HID++ modes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The best is to make the logitech-hidpp driver to switch to
hid++ notification mode when it starts. As we don't want users
to mangle with it, let's remove support from it.

PS.: I opted to keep this as a separate patch. This way, if
anyone needs to add support for it, in order to debug the
driver, it is just a matter of reverting this patch.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
@mchehab
Copy link
Contributor Author

mchehab commented Sep 11, 2017

Just rebased the patches on the top of current master branch. No other changes, except for the rebase.

@Lekensteyn Lekensteyn merged commit e3d658e into pwr-Solaar:master Sep 20, 2017
@Lekensteyn
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants