[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84c7f090-b84e-fbea-4e2e-9730a39e2db8@enpas.org>
Date: Mon, 28 Aug 2023 00:07:39 +0900
From: Max Staudt <max@...as.org>
To: Rahul Rameshbabu <sergeantsagara@...tonmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Vicki Pfau <vi@...rift.com>,
Pavel Rojtberg <rojtberg@...il.com>,
Roderick Colenbrander <roderick@...kai.com>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] xpad: XTYPE_XBOX: Report analog buttons
On 8/27/23 01:52, Rahul Rameshbabu wrote:
> You will want to update the commit message subject to use the prefix
> "Input: xpad -" instead of "xpad:".
Thanks, will do!
>> +/* used for analog face buttons mapped to axes */
>> +static const signed short xpad_abs_analog_face_buttons[] = {
>> + ABS_MISC + 0, ABS_MISC + 1, /* A, B */
>> + ABS_MISC + 3, ABS_MISC + 4, /* X, Y */
>> + ABS_MISC + 2, ABS_MISC + 5, /* C, Z */
>> + -1
>> +};
>
> Would it make more sense to use an enum for this?
> Something like the below enum.
>
> enum xpad_abs_analog_face_btn {
> XPAD_ABS_ANALOG_FACE_BTN_A = ABS_MISC,
> XPAD_ABS_ANALOG_FACE_BTN_B,
> XPAD_ABS_ANALOG_FACE_BTN_C,
> XPAD_ABS_ANALOG_FACE_BTN_X,
> XPAD_ABS_ANALOG_FACE_BTN_Y,
> XPAD_ABS_ANALOG_FACE_BTN_Z,
> XPAD_ABS_ANALOG_FACE_BTN_END, /* Must remain as the last element */
> };
>
> This would clean up both xpad_process_packet and xpad_set_up_abs a bit
> in my opinion. Your loop for xpad_set_up_abs would look like the
> following.
>
> enum xpad_abs_analog_face_btn btn;
>
> ...
>
> for (btn = XPAD_ABS_ANALOG_FACE_BTN_A; btn != XPAD_ABS_ANALOG_FACE_BTN_END; ++btn)
> xpad_set_up_abs(input_dev, btn);
I agree, that looks cleaner.
Since it's a step closer to standardising a mapping for those analog buttons, I'd like to wait and see whether there is a consensus across drivers and maintainers. Maybe we can include something like this enum in input-event-codes.h and have a really clean solution.
Thanks!
Max
Powered by blists - more mailing lists