gamecon.c change for SNES controller

gamecon.c change for SNES controller

Post by Eduard » Fri, 20 Jul 2001 04:30:13



Pavlik -

I've had to applie the following change to make the SNES controller work
at the parallel port. It have been applied to two computers. The old
code was giving the same values when you pressed right or left or when
you pressed up or down. The new code have been done to not use expensive
codification (i.e. multiplication).

It have been applied to kernel 2.4.6, and compiled with gcc 3.0.

See ya,

Eng. Eduardo Bortoluzzi Junior

--- start of patch ---

--- drivers/char/joystick/gamecon.c.orig Sat Jul 14 19:03:12 2001

                        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[6]) + !!(s & data[7]));
+                               input_report_abs(dev + i, ABS_Y, - !!(s
& data[4]) + !!(s & data[5]));
                        }

                        if (s & gc->pads[GC_NES])

--- end of patch ---

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

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.

--- linux-2.4.4-orig/drivers/char/joystick/gamecon.c    Wed Apr 11 22:02:30 2001

                        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])

  application_pgp-signature_part
< 1K Download

2. IP Masquerading almost fully functioning!

3. SNES controllers

4. software I can uninstall

5. gamecon (added support for Sega Saturn controller), kernel 2.4.20

6. Limit BG processes

7. gamecon module & PSX dance mat controller

8. Disabling 32-bit support on solaris 7/8

9. gamecon (added support for Sega Saturn controller), kernel 2.4.20

10. db9.c (Re: [PATCH] gamecon (added support for Sega Saturn controller), kernel 2.4.20)

11. snes pad as pointing device

12. joystick 1.2.12 & SNES pad

13. SNES games?