Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 161f62cd authored by Alex Henrie's avatar Alex Henrie Committed by Benjamin Tissoires
Browse files

HID: macally: Add support for Macally ikey keyboard



This enables the power and equals keys on the Macally ikey keyboard.

Based on the Cougar gaming keyboard HID driver, which uses the same
vendor ID.

Signed-off-by: default avatarAlex Henrie <alexhenrie24@gmail.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
parent c6400e5c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -230,6 +230,16 @@ config HID_COUGAR
	Supported devices:
	- Cougar 500k Gaming Keyboard

config HID_MACALLY
	tristate "Macally devices"
	depends on HID
	help
	Support for Macally devices that are not fully compliant with the
	HID standard.

	supported devices:
	- Macally ikey keyboard

config HID_PRODIKEYS
	tristate "Prodikeys PC-MIDI Keyboard support"
	depends on HID && SND
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o
obj-$(CONFIG_HID_LOGITECH)	+= hid-logitech.o
obj-$(CONFIG_HID_LOGITECH_DJ)	+= hid-logitech-dj.o
obj-$(CONFIG_HID_LOGITECH_HIDPP)	+= hid-logitech-hidpp.o
obj-$(CONFIG_HID_MACALLY)	+= hid-macally.o
obj-$(CONFIG_HID_MAGICMOUSE)	+= hid-magicmouse.o
obj-$(CONFIG_HID_MALTRON)	+= hid-maltron.o
obj-$(CONFIG_HID_MAYFLASH)	+= hid-mf.o
+1 −0
Original line number Diff line number Diff line
@@ -1034,6 +1034,7 @@
#define USB_DEVICE_ID_SINO_LITE_CONTROLLER	0x3008

#define USB_VENDOR_ID_SOLID_YEAR			0x060b
#define USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD		0x0001
#define USB_DEVICE_ID_COUGAR_500K_GAMING_KEYBOARD	0x500a
#define USB_DEVICE_ID_COUGAR_700K_GAMING_KEYBOARD	0x700a

+45 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0+
/*
 *  HID driver for quirky Macally devices
 *
 *  Copyright (c) 2019 Alex Henrie <alexhenrie24@gmail.com>
 */

#include <linux/hid.h>
#include <linux/module.h>

#include "hid-ids.h"

MODULE_AUTHOR("Alex Henrie <alexhenrie24@gmail.com>");
MODULE_DESCRIPTION("Macally devices");
MODULE_LICENSE("GPL");

/*
 * The Macally ikey keyboard says that its logical and usage maximums are both
 * 101, but the power key is 102 and the equals key is 103
 */
static __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc,
				 unsigned int *rsize)
{
	if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {
		hid_info(hdev,
			"fixing up Macally ikey keyboard report descriptor\n");
		rdesc[53] = rdesc[59] = 0x67;
	}
	return rdesc;
}

static struct hid_device_id macally_id_table[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
			 USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD) },
	{ }
};
MODULE_DEVICE_TABLE(hid, macally_id_table);

static struct hid_driver macally_driver = {
	.name			= "macally",
	.id_table		= macally_id_table,
	.report_fixup		= macally_report_fixup,
};

module_hid_driver(macally_driver);