Skip to content

Commit 161f62c

Browse files
alexhenriebentiss
authored andcommitted
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: Alex Henrie <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent c6400e5 commit 161f62c

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

drivers/hid/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ config HID_COUGAR
230230
Supported devices:
231231
- Cougar 500k Gaming Keyboard
232232

233+
config HID_MACALLY
234+
tristate "Macally devices"
235+
depends on HID
236+
help
237+
Support for Macally devices that are not fully compliant with the
238+
HID standard.
239+
240+
supported devices:
241+
- Macally ikey keyboard
242+
233243
config HID_PRODIKEYS
234244
tristate "Prodikeys PC-MIDI Keyboard support"
235245
depends on HID && SND

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o
6565
obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
6666
obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o
6767
obj-$(CONFIG_HID_LOGITECH_HIDPP) += hid-logitech-hidpp.o
68+
obj-$(CONFIG_HID_MACALLY) += hid-macally.o
6869
obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
6970
obj-$(CONFIG_HID_MALTRON) += hid-maltron.o
7071
obj-$(CONFIG_HID_MAYFLASH) += hid-mf.o

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,7 @@
10341034
#define USB_DEVICE_ID_SINO_LITE_CONTROLLER 0x3008
10351035

10361036
#define USB_VENDOR_ID_SOLID_YEAR 0x060b
1037+
#define USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD 0x0001
10371038
#define USB_DEVICE_ID_COUGAR_500K_GAMING_KEYBOARD 0x500a
10381039
#define USB_DEVICE_ID_COUGAR_700K_GAMING_KEYBOARD 0x700a
10391040

drivers/hid/hid-macally.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* HID driver for quirky Macally devices
4+
*
5+
* Copyright (c) 2019 Alex Henrie <[email protected]>
6+
*/
7+
8+
#include <linux/hid.h>
9+
#include <linux/module.h>
10+
11+
#include "hid-ids.h"
12+
13+
MODULE_AUTHOR("Alex Henrie <[email protected]>");
14+
MODULE_DESCRIPTION("Macally devices");
15+
MODULE_LICENSE("GPL");
16+
17+
/*
18+
* The Macally ikey keyboard says that its logical and usage maximums are both
19+
* 101, but the power key is 102 and the equals key is 103
20+
*/
21+
static __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc,
22+
unsigned int *rsize)
23+
{
24+
if (*rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) {
25+
hid_info(hdev,
26+
"fixing up Macally ikey keyboard report descriptor\n");
27+
rdesc[53] = rdesc[59] = 0x67;
28+
}
29+
return rdesc;
30+
}
31+
32+
static struct hid_device_id macally_id_table[] = {
33+
{ HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
34+
USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD) },
35+
{ }
36+
};
37+
MODULE_DEVICE_TABLE(hid, macally_id_table);
38+
39+
static struct hid_driver macally_driver = {
40+
.name = "macally",
41+
.id_table = macally_id_table,
42+
.report_fixup = macally_report_fixup,
43+
};
44+
45+
module_hid_driver(macally_driver);

0 commit comments

Comments
 (0)