# 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).

ACTION != "add", GOTO="solaar_end"
SUBSYSTEM != "hidraw", GOTO="solaar_end"

# 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"

# classic Nano receiver -- MK220/MK320 mouse and keyboard combo
ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52e", GOTO="solaar_apply"

# classic? Nano receiver -- V220 wireless mouse
ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c51b", GOTO="solaar_apply"

# G-Series receiver -- G-Series mouse
ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c531", GOTO="solaar_apply"

# other Nano receivers known to Solaar
ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c517", GOTO="solaar_apply"
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"

# Lenovo nano receiver
ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6042", GOTO="solaar_apply"

GOTO="solaar_end"

#
#
#
LABEL="solaar_apply"

# don't apply to the paired peripherals, just the receivers
DRIVERS=="logitech-djdevice|logitech-hidpp-device", GOTO="solaar_end"

# if the package configuration does not want the plugdev group, don't change the
# group and access mode
PROGRAM="/usr/bin/debconf-show solaar", RESULT=="*use_plugdev_group: false*", GOTO="solaar_no_plugdev"
MODE="0660", GROUP="plugdev"

LABEL="solaar_no_plugdev"
# tags for systemd/consolekit, they will apply the right ACLs for seated users
TAG+="uaccess", TAG+="udev-acl"

#
#
#

LABEL="solaar_end"
# vim: ft=udevrules
