From patchwork Wed Apr 3 03:18:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 10882623 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 536F017E1 for ; Wed, 3 Apr 2019 03:18:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B38B28950 for ; Wed, 3 Apr 2019 03:18:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CADA289D2; Wed, 3 Apr 2019 03:18:36 +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 ADE5428950 for ; Wed, 3 Apr 2019 03:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726625AbfDCDSf (ORCPT ); Tue, 2 Apr 2019 23:18:35 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:44556 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfDCDSe (ORCPT ); Tue, 2 Apr 2019 23:18:34 -0400 Received: by mail-io1-f67.google.com with SMTP id u12so12820263iop.11 for ; Tue, 02 Apr 2019 20:18:34 -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=3RSlMhVI7tERxuoMf+P/TMOM0IpOLPg+kSarq/TAzek=; b=mMjlpuXVqixVsH5KjpsZLnVL0+E1acKmVNexhd5N0FNTblbN0SY1fwtbSe5cMDS58x 03bOmgjSQAS64N0S7BCwxBWMO4vyGUlEt55OeNPsFZb+KMLTrbs/fOWjmWJTBCqoMhV/ ymoK7FRJi0eN96/YLfSf8XTt3Lw3hOOv1798bpdr4uY+lGvGva6gLPyOoZO/tVbEHjjH TW0Jjo1IIcU/ryZ8vYn33PInJld8kXn8XxubyPcwmZmqDd9MzVDivhfzp/aAqcspZEzD rJJ4mDAW5Z14e5l5O8uQpzEkw+4Qc6420/cs/wzNSFsWcmQr8ewWf5sTY8ZgWaMWh3Q1 2s4Q== 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=3RSlMhVI7tERxuoMf+P/TMOM0IpOLPg+kSarq/TAzek=; b=MpzFcgeSiov2acR76J5lz7+S+yZJVk9HiAhn1lqIOMcb+JsCQY3bv4aMFpL6tUGaSF EWjrQjgE5myf9SoReqMRnvAtc15yQ1Jh5jOdh21yb1oV+mLQvAEaZePlLY8u6AlwW2ZM yN5y3AClvl2yUimVzXvG/0eE4iABQaZ/vyYedfJa4dYvfNnqlNySeAz8vIrXJ4YJUhc8 unR/s/3dQyJbkUJHx1Fy3FjlaH7VJCLeFwD+6e9tmIY8G3UKOKr8T7ci2ao3zp7wIUCq Hq+XZ8zXPPwzKkIWzr/ISmGIPrGkrHYi9nAvlvqtKss/JnkBjzb73gLiC8CR1zCkzfV/ J3iQ== X-Gm-Message-State: APjAAAUPk9jS7rv2v5b18XhygfaoHL6LMR47pVcMpQ/i6r9YzjCBfVnJ uZLkF254UOUPV+xOej7hDilFSDpT X-Google-Smtp-Source: APXvYqxj6ffyxYOMznx9Dyc+oiG5pqdEsL9+SYsh/1iRLL8ghTXDxdnTpLacONZz0D6Y7hOX0Cy9ug== X-Received: by 2002:a5e:d506:: with SMTP id e6mr29178848iom.7.1554261513415; Tue, 02 Apr 2019 20:18:33 -0700 (PDT) Received: from xavier.hsd1.ut.comcast.net ([2601:681:4100:375e:f2d5:bfff:fecd:8741]) by smtp.gmail.com with ESMTPSA id z25sm5864390ioh.43.2019.04.02.20.18.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Apr 2019 20:18:32 -0700 (PDT) From: Alex Henrie To: linux-input@vger.kernel.org, jikos@kernel.org, benjamin.tissoires@redhat.com, dmlambea@gmail.com, hdegoede@redhat.com Cc: Alex Henrie Subject: [PATCH v2] HID: macally: Add support for Macally ikey keyboard Date: Tue, 2 Apr 2019 21:18:17 -0600 Message-Id: <20190403031817.14722-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 Reviewed-by: Hans de Goede --- drivers/hid/Kconfig | 10 +++++++++ drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-macally.c | 45 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 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..9a4fc7dffb14 --- /dev/null +++ b/drivers/hid/hid-macally.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * HID driver for quirky 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 (*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);