Skip to contentSkip to conversation

Support for side buttons of Xiaomi Mi Dual Mode Wireless Mouse Silent Edition

PATCH In review Ilya Skriblovsky 2 participants 2 messages Sep 19, 2021 – Sep 22, 2021 HID

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Support for side buttons of Xiaomi Mi Dual Mode Wireless Mouse Silent Edition

This patch enables side-buttons of Xiaomi Bluetooth mouse (specifically Xiaomi Mi Dual Mode Wireless Mouse Silent Edition).

The mouse sends invalid button count in its HID Report Descriptor and this patch just replaces its descriptor with corrected one. With this driver side buttons work as expected acting like Back/Forward buttons.

---
Changes since v2:
- Vendor ID and Device ID moved to hid-ids.h
- Removed unneeded license blurb

Changes since v1:
- Fixed syntax of Kconfig

---
 drivers/hid/Kconfig      |  7 +++
 drivers/hid/Makefile     |  1 +
 drivers/hid/hid-ids.h    |  3 ++
 drivers/hid/hid-xiaomi.c | 94 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 105 insertions(+)
 create mode 100644 drivers/hid/hid-xiaomi.c
drivers/hid/Kconfig +7 -0
index 76937f716fbe..cc0d3169fe75 100644
@@ -467,6 +467,13 @@ config HID_VIEWSONIC
 	help
 	  Support for ViewSonic/Signotec PD1011 signature pad.
 
+config HID_XIAOMI
+	tristate "Xiaomi"
+	depends on HID
+	help
+	  Adds support for side buttons of Xiaomi Mi Dual Mode Wireless
+	  Mouse Silent Edition.
+
 config HID_GYRATION
 	tristate "Gyration remote control"
 	depends on HID
drivers/hid/Makefile +1 -0
index 1ea1a7c0b20f..c89a25b9c4b9 100644
@@ -126,6 +126,7 @@ hid-uclogic-objs		:= hid-uclogic-core.o \
 obj-$(CONFIG_HID_UCLOGIC)	+= hid-uclogic.o
 obj-$(CONFIG_HID_UDRAW_PS3)	+= hid-udraw-ps3.o
 obj-$(CONFIG_HID_LED)		+= hid-led.o
+obj-$(CONFIG_HID_XIAOMI)	+= hid-xiaomi.o
 obj-$(CONFIG_HID_XINMO)		+= hid-xinmo.o
 obj-$(CONFIG_HID_ZEROPLUS)	+= hid-zpff.o
 obj-$(CONFIG_HID_ZYDACRON)	+= hid-zydacron.o
drivers/hid/hid-ids.h +3 -0
index 8f1893e68112..3d095ad2407e 100644
@@ -1295,6 +1295,9 @@
 #define USB_VENDOR_ID_XAT	0x2505
 #define USB_DEVICE_ID_XAT_CSR	0x0220
 
+#define USB_VENDOR_ID_XIAOMI		0x2717
+#define USB_DEVICE_ID_MI_SILENT_MOUSE	0x5014
+
 #define USB_VENDOR_ID_XIN_MO			0x16c0
 #define USB_DEVICE_ID_XIN_MO_DUAL_ARCADE	0x05e1
 #define USB_DEVICE_ID_THT_2P_ARCADE		0x75e1
drivers/hid/hid-xiaomi.c new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 8 lines · Ilya Skriblovsky

This patch enables side-buttons of Xiaomi Bluetooth mouse (specifically Xiaomi Mi Dual Mode Wireless Mouse Silent Edition).

The mouse sends invalid button count in its HID Report Descriptor and this patch just replaces its descriptor with corrected one. With this driver side buttons work as expected acting like Back/Forward buttons.

I've added 'HID:' prefix to the shortlog and applied. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs