lkml.org 
[lkml]   [2023]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/2] xpad: XTYPE_XBOX: Report analog buttons
From
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

\
 
 \ /
  Last update: 2023-08-27 17:10    [W:6.249 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site