All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] HID: use macros in IS_INPUT_APPLICATION
@ 2018-12-03  6:46 Chris Chiu
  2018-12-03  6:46 ` [PATCH 2/2] HID: input: support Microsoft wireless radio control hotkey Chris Chiu
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Chiu @ 2018-12-03  6:46 UTC (permalink / raw)
  To: jikos, benjamin.tissoires, rydberg; +Cc: linux-input, linux-kernel, linux

Add missing definition for HID_DG_WHITEBOARD then replace the hid
usage hex with macros for better readibility.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
---
 include/linux/hid.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index a355d61940f2..ce5f996c8d3d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -238,6 +238,7 @@ struct hid_item {
 #define HID_DG_LIGHTPEN		0x000d0003
 #define HID_DG_TOUCHSCREEN	0x000d0004
 #define HID_DG_TOUCHPAD		0x000d0005
+#define HID_DG_WHITEBOARD	0x000d0006
 #define HID_DG_STYLUS		0x000d0020
 #define HID_DG_PUCK		0x000d0021
 #define HID_DG_FINGER		0x000d0022
@@ -836,7 +837,10 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
 
 /* Applications from HID Usage Tables 4/8/99 Version 1.1 */
 /* We ignore a few input applications that are not widely used */
-#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006)))
+#define IS_INPUT_APPLICATION(a) \
+		(((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \
+		|| ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \
+		|| (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL))
 
 /* HID core API */
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] HID: input: support Microsoft wireless radio control hotkey
  2018-12-03  6:46 [PATCH 1/2] HID: use macros in IS_INPUT_APPLICATION Chris Chiu
@ 2018-12-03  6:46 ` Chris Chiu
  2018-12-07 13:01   ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Chiu @ 2018-12-03  6:46 UTC (permalink / raw)
  To: jikos, benjamin.tissoires, rydberg; +Cc: linux-input, linux-kernel, linux

The ASUS laptops start to support the airplane mode radio management
to replace the original mechanism of airplane mode toggle hotkey.
On the ASUS P5440FF, it presents as a HID device connecting via
I2C, named i2c-AMPD0001. When pressing it, the Embedded Controller
send hid report via I2C and switch the airplane mode indicator LED
based on the status.

However, it's not working because it fails to be identified as a
hidinput device. It fails in hidinput_connect() due to the macro
IS_INPUT_APPLICATION doesn't have HID_GD_WIRELESS_RADIO_CTLS as
a legit application code.

It's easy to add the HID I2C vendor and product id to the quirk
list and apply HID_QUIRK_HIDINPUT_FORCE to make it work. But it
makes more sense to support it as a generic input application.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
---
 include/linux/hid.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index ce5f996c8d3d..42079116fb61 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -840,7 +840,8 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
 #define IS_INPUT_APPLICATION(a) \
 		(((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \
 		|| ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \
-		|| (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL))
+		|| (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL) \
+		|| (a == HID_GD_WIRELESS_RADIO_CTLS))
 
 /* HID core API */
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] HID: input: support Microsoft wireless radio control hotkey
  2018-12-03  6:46 ` [PATCH 2/2] HID: input: support Microsoft wireless radio control hotkey Chris Chiu
@ 2018-12-07 13:01   ` Benjamin Tissoires
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2018-12-07 13:01 UTC (permalink / raw)
  To: chiu
  Cc: Jiri Kosina, Henrik Rydberg, open list:HID CORE LAYER, lkml,
	Linux Upstreaming Team

On Mon, Dec 3, 2018 at 7:46 AM Chris Chiu <chiu@endlessm.com> wrote:
>
> The ASUS laptops start to support the airplane mode radio management
> to replace the original mechanism of airplane mode toggle hotkey.
> On the ASUS P5440FF, it presents as a HID device connecting via
> I2C, named i2c-AMPD0001. When pressing it, the Embedded Controller
> send hid report via I2C and switch the airplane mode indicator LED
> based on the status.
>
> However, it's not working because it fails to be identified as a
> hidinput device. It fails in hidinput_connect() due to the macro
> IS_INPUT_APPLICATION doesn't have HID_GD_WIRELESS_RADIO_CTLS as
> a legit application code.
>
> It's easy to add the HID I2C vendor and product id to the quirk
> list and apply HID_QUIRK_HIDINPUT_FORCE to make it work. But it
> makes more sense to support it as a generic input application.
>
> Signed-off-by: Chris Chiu <chiu@endlessm.com>
> ---

Thanks for the refresh of the series. It looks much better now.

I have scheduled this for 4.21. I am a bit hesitant in pushing changes
to 4.20 when they touch hid-input.c, especially when we are this late
in the process.

Cheers,
Benjamin

>  include/linux/hid.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index ce5f996c8d3d..42079116fb61 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -840,7 +840,8 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
>  #define IS_INPUT_APPLICATION(a) \
>                 (((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \
>                 || ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \
> -               || (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL))
> +               || (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL) \
> +               || (a == HID_GD_WIRELESS_RADIO_CTLS))
>
>  /* HID core API */
>
> --
> 2.19.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-07 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03  6:46 [PATCH 1/2] HID: use macros in IS_INPUT_APPLICATION Chris Chiu
2018-12-03  6:46 ` [PATCH 2/2] HID: input: support Microsoft wireless radio control hotkey Chris Chiu
2018-12-07 13:01   ` Benjamin Tissoires

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.