Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6766287imm; Tue, 28 Aug 2018 00:11:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZDmTQKzy/ELaiLDV45QDPloPHN6A9i4aEoo5lgpP091cUVxdUPGYsHvycokLymZULYewh/ X-Received: by 2002:a62:64ca:: with SMTP id y193-v6mr220334pfb.250.1535440269661; Tue, 28 Aug 2018 00:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535440269; cv=none; d=google.com; s=arc-20160816; b=kpHTZ8yq0zOcPyDxMP/nDUrFnsq6/xZpJxs6uQ5NZVtGEL4BF3nWODgZBNFjxeTUQk pTn00GjQIf2KbK9cqKf4zjBKfuE2gFd0+sVauHfCFf5YXZ7QufD0Xopl5g9HlyiRlGGz iZ778nX4/hWdePfABqg9aEvGS683Wbp46i0OPxuXBts2gbYDIXuhsgrzoFdxBKTcrha1 bFYz6HudxQihVp+X02xOjvzkJWW7VBiIkZWMLOuHl3/Ed9Q5fl/vQt+c5bPg1aUziVMA jJibEU3TdGseMDPLk6zn4n6V7ouVBHXL4qmABeqU7W5Tnci7PYZEBxEueaV7/sLJS13l BcDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:arc-authentication-results; bh=mjrZnQLv29ZlEU6RAj8VkcOw+PHZgbRFBH5JX+Xwn30=; b=osMJlrurFoVw2ZQWyEandpSQpmw6HJyXf0Xscrktn2vfGfURX0IcQaggm930xBpS9C lVIjjsYEi5iQwfkW7K1TKPoT5P1nZYtQFdhR8uk10ByRiuZ5KeWZblHYSL8oEQy35yxG RUNZFODl1S8WMMM2kqfH+MEwiqsb6zxB8Vs/1WLsqptPeZsjxAC3u0GZzXFZ9zpzg6zY TUwhlkh7ClT3pxviMO1BlkIg3/Ie2I2d0QCpz+WyfUHfyciCy4So1CUUD5nSpTifwU+s qPxovz7I9/ZbjVVxx59wgvZ55+z8cjKMDrwZn76aduD5A2Jd075z/bTqqb5GxbNc+Bmi yjcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8-v6si387617pgs.144.2018.08.28.00.10.54; Tue, 28 Aug 2018 00:11:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727147AbeH1LAD (ORCPT + 99 others); Tue, 28 Aug 2018 07:00:03 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:34208 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726781AbeH1LAD (ORCPT ); Tue, 28 Aug 2018 07:00:03 -0400 Received: by mail-qk0-f194.google.com with SMTP id d15-v6so353218qkc.1 for ; Tue, 28 Aug 2018 00:09:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mjrZnQLv29ZlEU6RAj8VkcOw+PHZgbRFBH5JX+Xwn30=; b=KM/j6K6TOVJDrCHFr20O5mfH7UmlGz/JcxRNSNL3WYzHrlt+OxDU31NnMyfmZ9p6Gn YdT8F0L/nJ/wdcFNRYwgfUVuGF+rqX9wSGf6t4Bx3vkKZsNq4Ry4fwvUHL1VR/PRJ0uS iRKpgG4gpdQoOjQQbHKijfj2aTr3rD5tOiiiD1ataQjk6M49LJpwjOFEM+CK0CkjXiZT u4YatRURDwGuCLUOFTqU26iw1Khxq1X15yGJiHgl6rWs94rexX6QRo9oEASa5zOvJY1x eflJUVafmEcM71TxoJVqQtRFCDRe2QdrxHumUGctO0IJpPIntdLmbiy1mHfIjh70tuaY CcxA== X-Gm-Message-State: APzg51D621ponp2uF2MJ92HS4uQ5kfmP9b/EvSaC2MfuC6Kf+M6oyf0h DvRUJyrymgCAqfYaEDkiuWc/aki1qDJcWY6sEjMIWg== X-Received: by 2002:a37:6888:: with SMTP id d130-v6mr274450qkc.192.1535440188263; Tue, 28 Aug 2018 00:09:48 -0700 (PDT) MIME-Version: 1.0 References: <20180827200215.172838-1-seobrien@chromium.org> In-Reply-To: <20180827200215.172838-1-seobrien@chromium.org> From: Benjamin Tissoires Date: Tue, 28 Aug 2018 09:09:36 +0200 Message-ID: Subject: Re: [PATCH] [v2] HID: add support for Apple Magic Keyboards To: seobrien@chromium.org Cc: Jiri Kosina , Dmitry Torokhov , lkml , "open list:HID CORE LAYER" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 27, 2018 at 10:02 PM Sean O'Brien wrote: > > USB device > Vendor 05ac (Apple) > Device 026c (Magic Keyboard with Numeric Keypad) > > Bluetooth devices > Vendor 004c (Apple) > Device 0267 (Magic Keyboard) > Device 026c (Magic Keyboard with Numeric Keypad) > > Support already exists for the Magic Keyboard over USB connection. > Add support for the Magic Keyboard over Bluetooth connection, and for > the Magic Keyboard with Numeric Keypad over Bluetooth and USB > connection. > > Signed-off-by: Sean O'Brien > --- Looks good now. Reviewed-by: Benjamin Tissoires However, now that I read it, I believe the quirk APPLE_HAS_FN could be autodetected or at least renamed to something better (or inverted to not have 80% of the devices that need it). Anyway, that's for someone who will want to do it, I am not requesting this to be changed. Cheers, Benjamin > > drivers/hid/hid-apple.c | 9 ++++++++- > drivers/hid/hid-ids.h | 2 ++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c > index 25b7bd56ae11..1cb41992aaa1 100644 > --- a/drivers/hid/hid-apple.c > +++ b/drivers/hid/hid-apple.c > @@ -335,7 +335,8 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, > struct hid_field *field, struct hid_usage *usage, > unsigned long **bit, int *max) > { > - if (usage->hid == (HID_UP_CUSTOM | 0x0003)) { > + if (usage->hid == (HID_UP_CUSTOM | 0x0003) || > + usage->hid == (HID_UP_MSVENDOR | 0x0003)) { > /* The fn key on Apple USB keyboards */ > set_bit(EV_REP, hi->input->evbit); > hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN); > @@ -472,6 +473,12 @@ static const struct hid_device_id apple_devices[] = { > .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, > { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI), > .driver_data = APPLE_HAS_FN }, > + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI), > + .driver_data = APPLE_HAS_FN }, > + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI), > + .driver_data = APPLE_HAS_FN }, > + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI), > + .driver_data = APPLE_HAS_FN }, > { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), > .driver_data = APPLE_HAS_FN }, > { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h > index 79bdf0c7e351..5dbe3fb82690 100644 > --- a/drivers/hid/hid-ids.h > +++ b/drivers/hid/hid-ids.h > @@ -88,6 +88,7 @@ > #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101 > > #define USB_VENDOR_ID_APPLE 0x05ac > +#define BT_VENDOR_ID_APPLE 0x004c > #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 > #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d > #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e > @@ -157,6 +158,7 @@ > #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256 > #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS 0x0257 > #define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI 0x0267 > +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI 0x026c > #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 > #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 > #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 > -- > 2.19.0.rc0.228.g281dcd1b4d0-goog >