linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxim Mikityanskiy <maxtram95@gmail.com>
To: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Oliver Neukum <oneukum@suse.de>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Maxim Mikityanskiy <maxtram95@gmail.com>
Subject: [PATCH 1/6] HID: hid-input: Add offhook and ring LEDs for headsets
Date: Sun,  4 Jul 2021 01:01:57 +0300	[thread overview]
Message-ID: <20210703220202.5637-2-maxtram95@gmail.com> (raw)
In-Reply-To: <20210703220202.5637-1-maxtram95@gmail.com>

A lot of USBHID headsets available on the market have LEDs that indicate
ringing and off-hook states when used with VoIP applications. This
commit exposes these LEDs via the standard sysfs interface.

Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
---
 drivers/hid/hid-input.c                | 2 ++
 drivers/input/input-leds.c             | 2 ++
 include/uapi/linux/input-event-codes.h | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 4286a51f7f16..44b8243f9924 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -798,6 +798,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x4b:  map_led (LED_MISC);     break;    /*   "Generic Indicator"        */
 		case 0x19:  map_led (LED_MAIL);     break;    /*   "Message Waiting"          */
 		case 0x4d:  map_led (LED_CHARGING); break;    /*   "External Power Connected" */
+		case 0x17:  map_led (LED_OFFHOOK);  break;    /*   "Off-Hook"                 */
+		case 0x18:  map_led (LED_RING);     break;    /*   "Ring"                     */
 
 		default: goto ignore;
 		}
diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c
index 0b11990ade46..bc6e25b9af25 100644
--- a/drivers/input/input-leds.c
+++ b/drivers/input/input-leds.c
@@ -33,6 +33,8 @@ static const struct {
 	[LED_MISC]	= { "misc" },
 	[LED_MAIL]	= { "mail" },
 	[LED_CHARGING]	= { "charging" },
+	[LED_OFFHOOK]	= { "offhook" },
+	[LED_RING]	= { "ring" },
 };
 
 struct input_led {
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 225ec87d4f22..dd785a5b5076 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -925,6 +925,8 @@
 #define LED_MISC		0x08
 #define LED_MAIL		0x09
 #define LED_CHARGING		0x0a
+#define LED_OFFHOOK		0x0b
+#define LED_RING		0x0c
 #define LED_MAX			0x0f
 #define LED_CNT			(LED_MAX+1)
 
-- 
2.32.0


  reply	other threads:[~2021-07-03 22:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-03 22:01 [PATCH 0/6] Add support for common USB HID headset features Maxim Mikityanskiy
2021-07-03 22:01 ` Maxim Mikityanskiy [this message]
2021-07-06  8:02   ` [PATCH 1/6] HID: hid-input: Add offhook and ring LEDs for headsets Benjamin Tissoires
2021-07-15 18:57     ` Jiri Kosina
2021-07-15 20:39       ` Dmitry Torokhov
2021-07-15 22:49         ` Pavel Machek
2021-07-16 17:23           ` Maxim Mikityanskiy
2021-08-09 18:30             ` Maxim Mikityanskiy
2021-08-31 19:11               ` Jiri Kosina
2021-09-07  6:30             ` Dmitry Torokhov
2021-07-03 22:01 ` [PATCH 2/6] HID: hid-input: Add phone hook and mic mute buttons " Maxim Mikityanskiy
2021-07-03 22:01 ` [PATCH 3/6] HID: plantronics: Expose headset LEDs Maxim Mikityanskiy
2021-07-03 22:02 ` [PATCH 4/6] HID: plantronics: Expose headset telephony buttons Maxim Mikityanskiy
2021-07-03 22:02 ` [PATCH 5/6] HID: hid-input: Update LEDs in all HID reports Maxim Mikityanskiy
2021-07-03 22:02 ` [PATCH 6/6] HID: jabra: Change mute LED state to avoid missing key press events Maxim Mikityanskiy

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=20210703220202.5637-2-maxtram95@gmail.com \
    --to=maxtram95@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=djkurtz@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oneukum@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).