All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pedro Vanzella <pedro@pedrovanzella.com>
To: linux-input@vger.kernel.org
Cc: lains@archlinux.org, Pedro Vanzella <pedro@pedrovanzella.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 1/4] hid-logitech-hidpp: add quirk to handle battery voltage
Date: Thu, 22 Aug 2019 16:18:45 -0400	[thread overview]
Message-ID: <20190822201849.28924-2-pedro@pedrovanzella.com> (raw)
In-Reply-To: <20190822201849.28924-1-pedro@pedrovanzella.com>

This quirk allows us to pick which devices support the 0x1001 hidpp
feature to read the battery voltage.

Signed-off-by: Pedro Vanzella <pedro@pedrovanzella.com>
---
 drivers/hid/hid-logitech-hidpp.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 0179f7ed77e5..402ddba93adc 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -59,7 +59,8 @@ MODULE_PARM_DESC(disable_tap_to_click,
 #define HIDPP_QUIRK_CLASS_G920			BIT(3)
 #define HIDPP_QUIRK_CLASS_K750			BIT(4)
 
-/* bits 2..20 are reserved for classes */
+/* bits 2..1f are reserved for classes */
+#define HIDPP_QUIRK_BATTERY_VOLTAGE_X1001	BIT(20)
 /* #define HIDPP_QUIRK_CONNECT_EVENTS		BIT(21) disabled */
 #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS	BIT(22)
 #define HIDPP_QUIRK_NO_HIDINPUT			BIT(23)
@@ -3732,6 +3733,13 @@ static const struct hid_device_id hidpp_devices[] = {
 	  LDJ_DEVICE(0xb30b),
 	  .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS },
 
+	{ /* Logitech G403 Gaming Mouse over Lightspeed */
+	  LDJ_DEVICE(0x405d),
+	  .driver_data = HIDPP_QUIRK_BATTERY_VOLTAGE_X1001 },
+	{ /* Logitech G900 Gaming Mouse over Lightspeed */
+	  LDJ_DEVICE(0x4053),
+	  .driver_data = HIDPP_QUIRK_BATTERY_VOLTAGE_X1001 },
+
 	{ LDJ_DEVICE(HID_ANY_ID) },
 
 	{ /* Keyboard LX501 (Y-RR53) */
@@ -3750,13 +3758,15 @@ static const struct hid_device_id hidpp_devices[] = {
 	{ L27MHZ_DEVICE(HID_ANY_ID) },
 
 	{ /* Logitech G403 Wireless Gaming Mouse over USB */
-	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC082) },
+	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC082),
+	  .driver_data = HIDPP_QUIRK_BATTERY_VOLTAGE_X1001 },
 	{ /* Logitech G703 Gaming Mouse over USB */
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC087) },
 	{ /* Logitech G703 Hero Gaming Mouse over USB */
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090) },
 	{ /* Logitech G900 Gaming Mouse over USB */
-	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081) },
+	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081),
+	  .driver_data = HIDPP_QUIRK_BATTERY_VOLTAGE_X1001 },
 	{ /* Logitech G903 Gaming Mouse over USB */
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC086) },
 	{ /* Logitech G903 Hero Gaming Mouse over USB */
-- 
2.23.0

  reply	other threads:[~2019-08-22 20:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 20:18 [Resubmit] Read battery voltage from Logitech Gaming mice Pedro Vanzella
2019-08-22 20:18 ` Pedro Vanzella [this message]
2019-08-22 20:18 ` [PATCH v3 2/4] hid-logitech-hidpp: add function to query battery voltage Pedro Vanzella
2019-08-22 20:18 ` [PATCH v3 3/4] hid-logitech-hidpp: report battery voltage to the power supply Pedro Vanzella
2019-08-22 20:18 ` [PATCH v3 4/4] hid-logitech-hidpp: subscribe to battery voltage events Pedro Vanzella
2019-08-23  8:25 ` [Resubmit] Read battery voltage from Logitech Gaming mice Benjamin Tissoires
2019-08-23 14:22   ` Pedro Vanzella
2019-08-23 14:29     ` Filipe Laíns
2019-08-23 14:32     ` Benjamin Tissoires
2019-08-23 14:48       ` Filipe Laíns
2019-08-23 15:32         ` Benjamin Tissoires
2019-08-23 15:46       ` Pedro Vanzella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190822201849.28924-2-pedro@pedrovanzella.com \
    --to=pedro@pedrovanzella.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=lains@archlinux.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.