From db0656967ba3d11ee29937deb0360f263ebc3765 Mon Sep 17 00:00:00 2001 From: Alex Cherkayev Date: Fri, 10 Feb 2017 18:51:49 +0200 Subject: [PATCH] Add basic 0xc534 receiver and M185 mouse support Fix connection notification protocol for M185 Fixes from review --- lib/logitech_receiver/base_usb.py | 3 ++- lib/logitech_receiver/descriptors.py | 11 ++++++++++- lib/logitech_receiver/notifications.py | 1 + lib/logitech_receiver/receiver.py | 12 ++++++++---- lib/logitech_receiver/special_keys.py | 5 ++++- packaging/debian/solaar.udev | 1 + rules.d/42-logitech-unify-permissions.rules | 1 + 7 files changed, 27 insertions(+), 7 deletions(-) diff --git a/lib/logitech_receiver/base_usb.py b/lib/logitech_receiver/base_usb.py index 2a4c6345..c0dc84b6 100644 --- a/lib/logitech_receiver/base_usb.py +++ b/lib/logitech_receiver/base_usb.py @@ -49,7 +49,7 @@ NANO_RECEIVER_C525 = _nano_receiver(0xc525) NANO_RECEIVER_C526 = _nano_receiver(0xc526) NANO_RECEIVER_C52e = _nano_receiver(0xc52e) NANO_RECEIVER_C531 = _nano_receiver(0xc531) - +NANO_RECEIVER_C534 = _nano_receiver(0xc534) del _unifying_receiver, _nano_receiver @@ -67,4 +67,5 @@ ALL = ( NANO_RECEIVER_C526, NANO_RECEIVER_C52e, NANO_RECEIVER_C531, + NANO_RECEIVER_C534, ) diff --git a/lib/logitech_receiver/descriptors.py b/lib/logitech_receiver/descriptors.py index 333d71c0..a951c75f 100644 --- a/lib/logitech_receiver/descriptors.py +++ b/lib/logitech_receiver/descriptors.py @@ -213,7 +213,16 @@ _D('Illuminated Living-Room Keyboard K830', protocol=2.0, wpid='4032', # Mice _D('Wireless Mouse M175', protocol=2.0, wpid='4008') -_D('Wireless Mouse M185') +_D('Wireless Mouse M185 new', codename='M185n', protocol=4.5, wpid='4054', + settings=[ + _FS.lowres_smooth_scroll(), + _FS.pointer_speed(), + ]) +_D('Wireless Mouse M185 old', codename='M185o', protocol=4.5, wpid='4055', + settings=[ + _FS.lowres_smooth_scroll(), + _FS.pointer_speed(), + ]) _D('Wireless Mouse M187', protocol=2.0, wpid='4019') _D('Wireless Mouse M215', protocol=1.0, wpid='1020') _D('Wireless Mouse M235') diff --git a/lib/logitech_receiver/notifications.py b/lib/logitech_receiver/notifications.py index 4e4aa4db..3367d4d9 100644 --- a/lib/logitech_receiver/notifications.py +++ b/lib/logitech_receiver/notifications.py @@ -156,6 +156,7 @@ def _process_hidpp10_notification(device, status, n): if n.sub_id == 0x41: protocol_name = ('unifying (eQuad DJ)' if n.address == 0x04 else 'eQuad' if n.address == 0x03 + else 'M185' if n.address == 0x0A else None) if protocol_name: if _log.isEnabledFor(_DEBUG): diff --git a/lib/logitech_receiver/receiver.py b/lib/logitech_receiver/receiver.py index 1a01ba33..3ba02e02 100644 --- a/lib/logitech_receiver/receiver.py +++ b/lib/logitech_receiver/receiver.py @@ -336,10 +336,14 @@ class Receiver(object): # read the serial immediately, so we can find out max_devices # this will tell us if it's a Unifying or Nano receiver - serial_reply = self.read_register(_R.receiver_info, 0x03) - assert serial_reply - self.serial = _strhex(serial_reply[1:5]) - self.max_devices = ord(serial_reply[6:7]) + if self.product_id != 'c534': + serial_reply = self.read_register(_R.receiver_info, 0x03) + assert serial_reply + self.serial = _strhex(serial_reply[1:5]) + self.max_devices = ord(serial_reply[6:7]) + else: + self.serial = 0 + self.max_devices = 6 if self.max_devices == 6: self.name = 'Unifying Receiver' diff --git a/lib/logitech_receiver/special_keys.py b/lib/logitech_receiver/special_keys.py index 5669e7ec..bd827f22 100644 --- a/lib/logitech_receiver/special_keys.py +++ b/lib/logitech_receiver/special_keys.py @@ -335,8 +335,11 @@ TASK = _NamedInts( ShowUI=0x0092, ) TASK._fallback = lambda x: 'unknown:%04X' % x - +# hidpp 4.5 info from https://lekensteyn.nl/files/logitech/x1b04_specialkeysmsebuttons.html KEY_FLAG = _NamedInts( + virtual=0x80, + persistently_divertable=0x40, + divertable=0x20, reprogrammable=0x10, FN_sensitive=0x08, nonstandard=0x04, diff --git a/packaging/debian/solaar.udev b/packaging/debian/solaar.udev index e9dde2c4..2a891650 100644 --- a/packaging/debian/solaar.udev +++ b/packaging/debian/solaar.udev @@ -32,6 +32,7 @@ ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c518", GOTO="solaar_apply" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c51a", GOTO="solaar_apply" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c521", GOTO="solaar_apply" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c525", GOTO="solaar_apply" +ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c534", GOTO="solaar_apply" GOTO="solaar_end" diff --git a/rules.d/42-logitech-unify-permissions.rules b/rules.d/42-logitech-unify-permissions.rules index 0b44c447..1fbc7329 100644 --- a/rules.d/42-logitech-unify-permissions.rules +++ b/rules.d/42-logitech-unify-permissions.rules @@ -32,6 +32,7 @@ ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c518", GOTO="solaar_apply" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c51a", GOTO="solaar_apply" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c521", GOTO="solaar_apply" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c525", GOTO="solaar_apply" +ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c534", GOTO="solaar_apply" GOTO="solaar_end"