Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2037352pxb; Sun, 10 Jan 2021 21:47:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUeTJGTnp5hYu+l2f+AMIcxyaiJ6HTYhBTwymSDLP+b0+eSk4hGwxsrOj9A8x4ZL7WtiAB X-Received: by 2002:a17:906:30d3:: with SMTP id b19mr9380931ejb.538.1610344039624; Sun, 10 Jan 2021 21:47:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610344039; cv=none; d=google.com; s=arc-20160816; b=U1sS7pByO4BuJw3eRfsT/zZdoF9cZ+6MZ0qLxpFojbymAzXYuQ6QmqsM1q49NNerGl ooi/rm9FW9Rme70BCg0G2OE5CpJvvTLgg11IwCmOow1Cmq3iqFnH2SUinUwtvdGLjP4w WCJ7WwXaQPyjaBM7JeaoavFPJtHXkkrqCVTkd50fllYPJkt9LmzG5SNQzNc6AX1Ctmha 9YsKo0zUwokBX1u+TIu0Pu0EDFwvQ0jDJuhvhrXFQ6PghtTEN5ZHi48PekBpPVLHAtlG OQQRJibIt7RZKGv3VLsDfVJPliag3o8Bad6rjtYiN+3DufH8X07gg0ybQyvtHsxjysMo AfUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=aaghGwXhwHb6c1OJI6+t9e5vgxL5IhImdtWhkfCHZ3k=; b=dh6/QnUhNUPH7bJOgFs5ENKBQRO0980xJCPOgYStmEY1jrZyXmoS6hn00/oXwiLm9C bp2Vv0VKx1204GpW+eGXyjRn2fjrHkq8CChGJFxdvFt/K/yknKQ5qlfkxPWWHM09qzEe gUfj7idAPUtJMJ5iKIOTOGGClaFkREH44nKwr63u8KFp2DE7iBC08PAPZpzSFg9dxEfx B5ODl1aJ2Uadd0mist6qRlwnp7G6wAz0Z69oc6LaRBLSrkhLBWQe9VvNsf6hlyhijGlI ByP19EwT9guk8BQZwN3hOK4JPBgHgI9g2lSwCaILkEn7b22+D5VYFjNBPQ/SZF/BQBr6 /EAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=CJaoYWxI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m3si6182441ejn.166.2021.01.10.21.46.56; Sun, 10 Jan 2021 21:47:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=CJaoYWxI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726049AbhAKFl7 (ORCPT + 99 others); Mon, 11 Jan 2021 00:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbhAKFl6 (ORCPT ); Mon, 11 Jan 2021 00:41:58 -0500 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F043C061794 for ; Sun, 10 Jan 2021 21:41:18 -0800 (PST) Received: by mail-oi1-x22e.google.com with SMTP id f132so18937955oib.12 for ; Sun, 10 Jan 2021 21:41:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=aaghGwXhwHb6c1OJI6+t9e5vgxL5IhImdtWhkfCHZ3k=; b=CJaoYWxIiTAZukX0O2CgZrYhNd2YX8EWUcR4ZKjmU8RvkkyNFDlRfX/Wkoou2B4CEz sNiGnvYWglC+oOK2oXRFaAFu6CsN4uWFre4ipXVyQ6+91rzjRqQHN/JWWy8HSn2ns6Rq BGdG03g36aesO0X9hngzInKuyS75TM4rVnvV7WnMporN8cj/8ya9V4LQzqz4fBMhonqt tIMwVlO9L+2wbSLD/peVe9URNgjS+wdNvTuWdtq6AIcO0ntTJSTIN1OjUYOy3XUDD1ZE /onpAnII8NFnBkWzx1YzD7rJO9Flx5SXyO+F60+YxJXNpJtQCpvl3Px8tPp2ZdsTABj3 E50Q== 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:content-transfer-encoding; bh=aaghGwXhwHb6c1OJI6+t9e5vgxL5IhImdtWhkfCHZ3k=; b=Ff5cKWmA/fK7aJVKdiwH5hqfOuYDEzmuHPA01iO7Yu93vzr6+lfWMb9hyNLTFO9vDh 1jfcDS1uaXgFzoGJxMPjMMCjnhgx6y/6hmLSKVDAX2sufvYIh+HyJlVq5tSbvT+2zBZg TrUF4G2pnNZsPZEXZ4xJaN0CF15ymGzZl3/6RyPXp8O8GUHcO5oLpWm89FXY2TLRSqOh IOc9/OFwFzvUV/pYwzm+RyG+LUjusB6hIPeF7ZG+9jQEtnS+nxl4Ntqiih9LOc9cbvLj SAs4W/6c+cyEq49laTw5zYzQaUPXN1KvflKM8SsuuLb4nffaQK6JsH/HYkTdJhKWnjfr ykPQ== X-Gm-Message-State: AOAM532KqQT6ys9aTujdIwXC3veAjLJBE0QWUc+Q9wv70lk7DPtWTVSr rV1d6800tQY7gBoQD915oxlu+fTm/yGMCJ9tzw3+Lw== X-Received: by 2002:aca:909:: with SMTP id 9mr9041279oij.69.1610343676814; Sun, 10 Jan 2021 21:41:16 -0800 (PST) MIME-Version: 1.0 References: <20201223055540.204685-1-jhp@endlessos.org> In-Reply-To: From: Jian-Hong Pan Date: Mon, 11 Jan 2021 13:40:25 +0800 Message-ID: Subject: Re: [PATCH v2] HID: Add Wireless Radio Control feature for Chicony devices To: Jiri Kosina Cc: Benjamin Tissoires , Chris Chiu , linux-input , Linux Kernel , linux@endlessos.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jiri Kosina =E6=96=BC 2021=E5=B9=B41=E6=9C=887=E6=97=A5 = =E9=80=B1=E5=9B=9B =E4=B8=8B=E5=8D=885:23=E5=AF=AB=E9=81=93=EF=BC=9A > > On Wed, 23 Dec 2020, Jian-Hong Pan wrote: > > > Some Chicony's keyboards support airplane mode hotkey (Fn+F2) with > > "Wireless Radio Control" feature. For example, the wireless keyboard > > [04f2:1236] shipped with ASUS all-in-one desktop. > > > > After consulting Chicony for this hotkey, learned the device will send > > with 0x11 as the report ID and 0x1 as the value when the key is pressed > > down. > > > > This patch maps the event as KEY_RFKILL. > > I don't know how exactly does the report descriptor of that device look > like, but is this not doable from userspace via setkeycode() (udev/system= d > is shipping a lot of such mappings already -- see evdev/keyboard > definitions in hwdb). Thanks for your suggestion! I have tested the key with evtest. But it has no response from all inputs. Nor response from xev. So, I tried usb monitor to see what does it send: $ lsusb -d 04f2:1236 Bus 001 Device 002: ID 04f2:1236 Chicony Electronics Co., Ltd $ sudo modprobe usbmon $ sudo cat /sys/kernel/debug/usb/usbmon/1u ffff9145e0dea6c0 348311963 C Ii:1:002:1 0:8 8 =3D 00000000 00000000 ffff9145e0dea6c0 348311996 S Ii:1:002:1 -115:8 8 < ffff9145e0deaf00 352852533 C Ii:1:002:2 0:4 2 =3D 1101 ffff9145e0deaf00 352852547 S Ii:1:002:2 -115:4 3 < It sends 0x1101 for the hotkey. The same response from hid events: $ sudo cat /sys/kernel/debug/hid/0003\:04F2\:1236.0002/events report (size 2) (numbered) =3D 11 01 Then, I notice there is the RFKILL event listed on the "Chicony USB Receiver Wireless Radio Control" device: $ sudo evtest /dev/input/event8 Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0x4f2 product 0x1236 version 0x111 Input device name: "Chicony USB Receiver Wireless Radio Control" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 103 (KEY_UP) Event code 105 (KEY_LEFT) Event code 106 (KEY_RIGHT) Event code 108 (KEY_DOWN) Event code 116 (KEY_POWER) Event code 138 (KEY_HELP) Event code 139 (KEY_MENU) Event code 142 (KEY_SLEEP) Event code 143 (KEY_WAKEUP) Event code 148 (KEY_PROG1) Event code 174 (KEY_EXIT) Event code 227 (KEY_SWITCHVIDEOMODE) Event code 247 (KEY_RFKILL) Event code 314 (BTN_SELECT) Event code 315 (BTN_START) Event code 353 (KEY_SELECT) Event code 356 (KEY_POWER2) Event code 408 (KEY_RESTART) Event code 438 (KEY_CONTEXT_MENU) Event type 2 (EV_REL) Event code 9 (REL_MISC) Event type 3 (EV_ABS) ... Also, after debugging, I found its HID application ID is HID_GD_WIRELESS_RADIO_CTLS 0x0001000c [1]. Then, I searched HID_GD_WIRELESS_RADIO_CTLS in the kernel. I found HID_GD_RFKILL_BTN [2] is mapped in hid-input. However, this key press on the Chicony keyboard maps to nothing, nor HID_GD_RFKILL_BTN. Only have the HID report with raw data 0x11 0x00 as mentioned above. It is more like ignored by the kernel and it even has no scancode. That's why I try to map it as KEY_RFKILL in the driver. [1] https://elixir.bootlin.com/linux/v5.10/source/include/linux/hid.h#L181 [2] https://elixir.bootlin.com/linux/v5.10/source/drivers/hid/hid-input.c#L= 743 Regards, Jian-Hong Pan