Skip to contentSkip to conversation

gamecon.c: Fix for SNES controllers

PATCH In review Michael Gold 2 participants 2 messages Jul 6, 2001 – Jul 7, 2001 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gamecon.c: Fix for SNES controllers

In kernel 2.4.4, a change was made to gamecon.c that causes problems with Super Nintendo controllers. The directional pad no longer works correctly - only the up and left directions work. The following patch fixes the problem by reversing the change. It applies cleanly to kernels 2.4.4, 2.4.5, and 2.4.6.

drivers/char/joystick/gamecon.c +2 -2
@@ -345,8 +345,8 @@
 			s = gc_status_bit[i];
 
 			if (s & (gc->pads[GC_NES] | gc->pads[GC_SNES])) {
-				input_report_abs(dev + i, ABS_X, ! - !(s & data[6]) - !(s & data[7]));
-				input_report_abs(dev + i, ABS_Y, ! - !(s & data[4]) - !(s & data[5]));
+				input_report_abs(dev + i, ABS_X, !!(s & data[7]) - !!(s & data[6]));
+				input_report_abs(dev + i, ABS_Y, !!(s & data[5]) - !!(s & data[4]));
 			}
 
 			if (s & gc->pads[GC_NES])
#1 lore raw
Quoted 10 lines · Michael Gold

In kernel 2.4.4, a change was made to gamecon.c that causes problems with Super Nintendo controllers. The directional pad no longer works correctly - only the up and left directions work. The following patch fixes the problem by reversing the change. It applies cleanly to kernels 2.4.4, 2.4.5, and 2.4.6.

drivers/char/joystick/gamecon.c line 352

Quoted 10 lines
drivers/char/joystick/gamecon.c +2 -2
@@ -345,8 +345,8 @@
 			s = gc_status_bit[i];
 
 			if (s & (gc->pads[GC_NES] | gc->pads[GC_SNES])) {
-				input_report_abs(dev + i, ABS_X, ! - !(s & data[6]) - !(s & data[7]));
-				input_report_abs(dev + i, ABS_Y, ! - !(s & data[4]) - !(s & data[5]));
+				input_report_abs(dev + i, ABS_X, !!(s & data[7]) - !!(s & data[6]));
+				input_report_abs(dev + i, ABS_Y, !!(s & data[5]) - !!(s & data[4]));
 			}
 
 			if (s & gc->pads[GC_NES])

Already fixed in -ac series kernels. Thanks anyway.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs