This driver handles the telephony phone mute HID usage by ignoring it. This avoids the default handling by the hid-input driver which is to map this to a KEY_MICMUTE event. The issue is that this device implements the phone mute HID usage as a toggle switch, where 1 indicates muted, and 0 indicates unmuted. However, for an EV_KEY event 1 indicates the key has been pressed and 0 indicates it has been released. Signed-off-by: Pablo Ceballos <pceballos@xxxxxxxxxx> --- drivers/hid/Kconfig | 6 +++++ drivers/hid/Makefile | 1 + drivers/hid/hid-google-atrus.c | 44 ++++++++++++++++++++++++++++++++++ drivers/hid/hid-ids.h | 1 + 4 files changed, 52 insertions(+) create mode 100644 drivers/hid/hid-google-atrus.c diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index f5544157576c9..d89c57d89a699 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -403,6 +403,12 @@ config HOLTEK_FF Say Y here if you have a Holtek On Line Grip based game controller and want to have force feedback support for it. +config HID_GOOGLE_ATRUS + tristate "Google Hangouts Meet Speakermic" + depends on USB_HID + ---help--- + Say Y here if you have a Google Hangouts Meet Speakermic + config HID_GOOGLE_HAMMER tristate "Google Hammer Keyboard" depends on USB_HID && LEDS_CLASS && CROS_EC diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 6d3e630e81af5..2ee446b5b953b 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_HID_FT260) += hid-ft260.o obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o obj-$(CONFIG_HID_GFRM) += hid-gfrm.o obj-$(CONFIG_HID_GLORIOUS) += hid-glorious.o +obj-$(CONFIG_HID_GOOGLE_ATRUS) += hid-google-atrus.o obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o obj-$(CONFIG_HID_VIVALDI) += hid-vivaldi.o obj-$(CONFIG_HID_GT683R) += hid-gt683r.o diff --git a/drivers/hid/hid-google-atrus.c b/drivers/hid/hid-google-atrus.c new file mode 100644 index 0000000000000..938947417f119 --- /dev/null +++ b/drivers/hid/hid-google-atrus.c @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * HID driver for Google Hangouts Meet Speakermic + * + * Copyright 2022 Google LLC. + */ + +#include <linux/hid.h> +#include <linux/module.h> + +#include "hid-ids.h" + +static int atrus_event(struct hid_device *hid, struct hid_field *field, + struct hid_usage *usage, __s32 value) +{ + // Return 1 to indicate no further processing should be done for this + // usage. + return 1; +} + +static const struct hid_device_id atrus_devices[] = { + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_ATRUS) }, + { } +}; +MODULE_DEVICE_TABLE(hid, atrus_devices); + +static const struct hid_usage_id atrus_usages[] = { + // Handle only the Telephony Phone Mute usage. + { HID_UP_TELEPHONY | 0x2f, EV_KEY, HID_ANY_ID }, + { HID_TERMINATOR, HID_TERMINATOR, HID_TERMINATOR } +}; + +static struct hid_driver atrus_driver = { + .name = "atrus", + .id_table = atrus_devices, + .usage_table = atrus_usages, + .event = atrus_event, +}; +module_hid_driver(atrus_driver); + +MODULE_AUTHOR("Pablo Ceballos <pcebalos@xxxxxxxxxx>"); +MODULE_DESCRIPTION("Google Hangouts Meet Speakermic USB HID Driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 85975031389b3..9f6fc5cfbeb96 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -506,6 +506,7 @@ #define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044 #define USB_DEVICE_ID_GOOGLE_DON 0x5050 #define USB_DEVICE_ID_GOOGLE_EEL 0x5057 +#define USB_DEVICE_ID_GOOGLE_ATRUS 0x8001 #define USB_VENDOR_ID_GOTOP 0x08f2 #define USB_DEVICE_ID_SUPER_Q2 0x007f -- 2.35.1.574.g5d30c73bfb-goog