From ca9825d26284a71e61d7148010ebce5aca2dfce5 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Thu, 20 Jun 2013 13:10:30 +0200 Subject: [PATCH] support for the VX Nano mouse --- lib/logitech/unifying_receiver/base.py | 4 +++ lib/logitech/unifying_receiver/descriptors.py | 18 ++++++++----- packaging/debian/solaar.udev | 9 +++++-- rules.d/42-logitech-unify-permissions.rules | 27 ++++++++++++------- 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/lib/logitech/unifying_receiver/base.py b/lib/logitech/unifying_receiver/base.py index 45e89180..4dcca760 100644 --- a/lib/logitech/unifying_receiver/base.py +++ b/lib/logitech/unifying_receiver/base.py @@ -73,6 +73,7 @@ class DeviceUnreachable(_KwException): DEVICE_UNIFYING_RECEIVER = (0x046d, 0xc52b, 2, 'logitech-djreceiver') DEVICE_UNIFYING_RECEIVER_2 = (0x046d, 0xc532, 2, 'logitech-djreceiver') DEVICE_NANO_RECEIVER_ADVANCED = (0x046d, 0xc52f, 1, 'hid-generic') +DEVICE_VXNANO = (0x046d, 0xc526, 1, 'hid-generic') def receivers(): @@ -83,6 +84,8 @@ def receivers(): yield d for d in _hid.enumerate(*DEVICE_NANO_RECEIVER_ADVANCED): yield d + for d in _hid.enumerate(*DEVICE_VXNANO): + yield d def notify_on_receivers_glib(callback): @@ -91,6 +94,7 @@ def notify_on_receivers_glib(callback): DEVICE_UNIFYING_RECEIVER, DEVICE_UNIFYING_RECEIVER_2, DEVICE_NANO_RECEIVER_ADVANCED, + DEVICE_VXNANO, ) # diff --git a/lib/logitech/unifying_receiver/descriptors.py b/lib/logitech/unifying_receiver/descriptors.py index 34bd02e9..8b797566 100644 --- a/lib/logitech/unifying_receiver/descriptors.py +++ b/lib/logitech/unifying_receiver/descriptors.py @@ -153,13 +153,6 @@ _D('Wireless Illuminated Keyboard K800', protocol=1.0, # Mice -# _D('VX Nano Cordless Laser Mouse', product_id='c526', codename='VXNano', -# registers={'battery_charge': 0x0D}, -# settings=[ -# _register_smooth_scroll(0x01, true_value=0x40, mask=0x40), -# ], -# ) - _D('Wireless Mouse M215', protocol=1.0) _D('Wireless Mouse M315') _D('Wireless Mouse M325') @@ -204,5 +197,16 @@ _D('Wireless Trackball M570') _D('Wireless Rechargeable Touchpad T650') +# +# classic Nano devices +# a product_id is necessary to properly identify them +# + +_D('VX Nano Cordless Laser Mouse', codename='VX Nano', protocol=1.0, product_id='c526', + registers={'battery_charge': 0x0D, 'battery_status': -0x07}, + settings=[ + _register_smooth_scroll(0x01, true_value=0x40, mask=0x40), + ], + ) del namedtuple diff --git a/packaging/debian/solaar.udev b/packaging/debian/solaar.udev index 4f640747..c75a4ab1 100644 --- a/packaging/debian/solaar.udev +++ b/packaging/debian/solaar.udev @@ -1,3 +1,5 @@ +# This rule was added by Solaar. +# # Allows non-root users to have raw access the Logitech Unifying USB Receiver # device. For development purposes, allowing users to write to the receiver is # potentially dangerous (e.g. perform firmware updates). @@ -5,13 +7,16 @@ ACTION != "add", GOTO="solaar_end" SUBSYSTEM != "hidraw", GOTO="solaar_end" -# Unifying receiver +# official Unifying receivers ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", GOTO="solaar_apply" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", GOTO="solaar_apply" # Nano receiver, "Unifying ready" ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52f", GOTO="solaar_apply" +# classic Nano receiver -- VX Nano mouse +ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c526", GOTO="solaar_apply" + GOTO="solaar_end" # @@ -19,7 +24,7 @@ GOTO="solaar_end" # LABEL="solaar_apply" -# don't apply to the paired devices, just the receivers +# don't apply to the paired peripherals, just the receivers DRIVERS=="logitech-djdevice", GOTO="solaar_end" # if the package configuration does not want the plugdev group, don't change the diff --git a/rules.d/42-logitech-unify-permissions.rules b/rules.d/42-logitech-unify-permissions.rules index e315fb3d..e99b9280 100644 --- a/rules.d/42-logitech-unify-permissions.rules +++ b/rules.d/42-logitech-unify-permissions.rules @@ -1,20 +1,29 @@ +# This rule was added by Solaar. +# # Allows non-root users to have raw access the Logitech Unifying USB Receiver # device. For development purposes, allowing users to write to the receiver is # potentially dangerous (e.g. perform firmware updates). -# skip actual unified devices, only consider the receiver -DRIVERS=="logitech-djdevice", GOTO="not_unify_recv" +ACTION != "add", GOTO="solaar_end" +SUBSYSTEM != "hidraw", GOTO="solaar_end" # official Unifying receivers -SUBSYSTEM=="hidraw", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", GOTO="unify_dev" -SUBSYSTEM=="hidraw", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", GOTO="unify_dev" +ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", GOTO="solaar_apply" +ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", GOTO="solaar_apply" -# "Unifying Ready" Nano receiver -SUBSYSTEM=="hidraw", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52f", GOTO="unify_dev" +# Nano receiver, "Unifying Ready" +ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52f", GOTO="solaar_apply" -GOTO="not_unify_recv" +# clasic Nano receiver -- VX Nano mouse +ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c526", GOTO="solaar_apply" + +GOTO="solaar_end" + +LABEL="solaar_apply" + +# don't apply to the paired peripherals, just the receivers +DRIVERS=="logitech-djdevice", GOTO="solaar_end" -LABEL="unify_dev" # Allow any seated user to access the receiver. # uaccess: modern ACL-enabled udev # udev-acl: for Ubuntu 12.10 and older @@ -23,5 +32,5 @@ TAG+="uaccess", TAG+="udev-acl" # Grant members of the "plugdev" group access to receiver (useful for SSH users) #MODE="0660", GROUP="plugdev" -LABEL="not_unify_recv" +LABEL="solaar_end" # vim: ft=udevrules