On Mon, 1 Jun 2020 at 08:27, David Rheinsberg <david.rheinsberg@xxxxxxxxx> wrote: > > Hi > > On Sat, 30 May 2020 at 17:04, Daniel Morse <dmorse@xxxxxxxxxxxxxx> wrote: > > > > The controllers from the Super Nintendo Classic Edition (AKA the SNES > > Mini) appear as a Classic Controller Pro when connected to a Wii > > Remote. All the buttons work as the same, with the d-pad being mapped > > the same as the d-pad on the Classic Controller Pro. This differs from > > the behaviour of most controllers with d-pads and no analogue sticks, > > where the d-pad maps to ABS_HAT1X for left and right, and ABS_HAT1Y > > for up and down. This patch adds an option to the hid-wiimote module > > to make the Super Nintendo Classic Controller behave this way. > > > > The patch has been tested with a Super Nintendo Classic Controller > > plugged into a Wii Remote in both with the option both enabled and > > disabled. When enabled the d-pad acts as the analogue control, and > > when disabled it acts as it did before the patch was applied. This > > patch has not been tested with e Wii Classic Controller (either the > > original or the pro version) as I do not have one of these > > controllers. > > > > Although I have not tested it with these controllers, I think it is > > likely this patch will also work with the NES Classic Edition > > Controllers. > > > > Changes from V1 to V2 > > * 3 if statements to control the behaviour, one to make the d-pad > > register as button presses when the behaviour is disabled, and 2 to > > make it act as an analog stick when enabled (once for each of the > > motion plus states) > > * the values for lx and ly are calculated and then passed to > > input_report_abs() in one place, rather then calling > > input_report_abs() from different places depending on how the values > > are determined. > > * using an array to map from button presses to analog value. > > * reduced the values used to indicate the position of the analog stick > > > > Changes from V3 to V3 > > * Moved the definition of dpad_as_analog in hid-wiimote.h > > * Renamed the dpad_as_analog vaiable to wiimote_dpad_as_analog > > * changed digital_to_analog from an __s8 to static const s8 > > * Removed the unnecessary braces when getting values from digital_to_analog > > > > Note: I have also attached a patch file to this final version in > > addition to the code in the body because gmail web client keeps > > turning the tabs into spaces. > > > > Signed-off-by: Daniel G. Morse <dmorse@xxxxxxxxxxxxxx> > > Reviewed-by: David Rheinsberg <david.rheinsberg@xxxxxxxxx> > > > > From 8909feec10fda919d1ec46c95418d63ac52ee41f Mon Sep 17 00:00:00 2001 > > From: Speedfox <speedfox@xxxxxxxxxxxxxx> > > Date: Tue, 26 May 2020 02:55:50 +0100 > > Subject: [PATCH] Added option to make d-pad analog > > > > Updates from code review > > --- > > You can put comments below these 3 dashes^^. There seems to be some > email-header in the commit message above, and the changes between > versions can also be put outside of the commit message. Some > subsystems keep it in the commit-message, though. Maybe Jiri can strip > that when applying? The `Signed-off-by`-etc lines are usually last in > the commit-message. I don't mind either way. Since it's probably best that Jiri applies the patch from the attachment which I included to get around gmail's inability to use tabs, I think it'll be easiest to let him strip out that superfluous email header when he does that rather than me sending another version of the patch. > > Anyway, thanks for the patch, looks all good! > David Thanks again for reviewing my patch. --Daniel