From patchwork Thu Mar 28 03:34:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 10874451 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3478715AC for ; Thu, 28 Mar 2019 03:34:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C931288AF for ; Thu, 28 Mar 2019 03:34:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CC022874B; Thu, 28 Mar 2019 03:34:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 931142874B for ; Thu, 28 Mar 2019 03:34:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727146AbfC1Dek (ORCPT ); Wed, 27 Mar 2019 23:34:40 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:40047 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbfC1Dek (ORCPT ); Wed, 27 Mar 2019 23:34:40 -0400 Received: by mail-io1-f67.google.com with SMTP id d201so16009602iof.7 for ; Wed, 27 Mar 2019 20:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pwAZ3PPoAb6xM2IQgZ56+ZyvX9ZNdjYluDCaHYm3XPk=; b=nrZZ2EGmIYOh+n+EFZLdRpivY2bxpxITnhXNFV/VKCA+P69aLlcagnx+ZtpFneKf29 VChTklFlFxsOJ1cn0r/2Ju+hwZ8oqqE4pfJuKCQuqtPfMQ0qxME2Ip34Q7AkQcu3ecd+ zLvLcNC6OsucGj54pd6UzC9dY898SoBo5MD9oZWv5D5QslEvv1ZCBFwNI7COougvT64J n5tnPOj8V4imwdbpbQGkuiwTzmk7I54f6Dp85MmV4opW8C/X29KOBYNqikjFZRZvW8d0 tFBoOu/hZwYh3jbLNDgLXSAGMMXww1/In1YuQALHSMURzsqDW8rudoJc94Hm8pIGr1cf GkOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pwAZ3PPoAb6xM2IQgZ56+ZyvX9ZNdjYluDCaHYm3XPk=; b=fLaq4DmG36h6BGj+OUOIkR8hY9PQDW4ORfOqQYj4CpJZFpZ7V+G0xDYyB4xFoEP9ul xjkFj0fJdJxES2i15EAtPui8f29dUA/EJVtMSrM6ukHdl6ZePpztGg6iTG3EPqDN2PWG XqPugOJe995s2YIs0ICsI5NOgFzJNAeeSON96TfwNwMYWyMaBnP6QneDI0YDKx9Pj1Jn 6UG9XAgFwYEiTUxuCaCFb7v0vmqgkvGCRMMgDV9End/q530Bw4M2cqg4wtasZ3kuKyfw 1uUBXVL/4oEFZ08F+kptQ5cWPTs/IQnWglRhFWgLRtpQ123dPXsggHQ8XGaq6MNVICP3 EKtA== X-Gm-Message-State: APjAAAUw5DxBc+7Z9HGkY3+w3zxWUDo677x93X4fs34R2CaUpxkq+OGA otQiH1VyBrNbQS3BgTr3MLAEQOwF X-Google-Smtp-Source: APXvYqw7gb6Kd1abtBuAuS152URzV0v0RdVhYBpg1zioSlcGIwuEAKc8btCMlYjypqaL7hyPYeJjIA== X-Received: by 2002:a5e:d803:: with SMTP id l3mr3428180iok.229.1553744078531; Wed, 27 Mar 2019 20:34:38 -0700 (PDT) Received: from xavier.hsd1.ut.comcast.net ([2601:681:4100:375e:f2d5:bfff:fecd:8741]) by smtp.gmail.com with ESMTPSA id t25sm10164732ioc.37.2019.03.27.20.34.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2019 20:34:37 -0700 (PDT) From: Alex Henrie To: linux-input@vger.kernel.org, jikos@kernel.org, benjamin.tissoires@redhat.com, dmlambea@gmail.com Cc: Alex Henrie Subject: [PATCH 1/2] HID: macally: Add support for Macally ikey keyboard Date: Wed, 27 Mar 2019 21:34:34 -0600 Message-Id: <20190328033435.17931-1-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/hid/Kconfig | 10 +++++++++ drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-macally.c | 47 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 drivers/hid/hid-macally.c diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 6ca8d322b487..aef4a2a690e1 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -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 diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 170163b41303..44b9caea46a7 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -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 diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b6d93f4ad037..aacc7534b076 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -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 diff --git a/drivers/hid/hid-macally.c b/drivers/hid/hid-macally.c new file mode 100644 index 000000000000..6f62f059b795 --- /dev/null +++ b/drivers/hid/hid-macally.c @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * HID driver for Macally devices + * + * Copyright (c) 2019 Alex Henrie + */ + +#include +#include + +#include "hid-ids.h" + +MODULE_AUTHOR("Alex Henrie "); +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 (hdev->product == USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD) { + 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);