gamecon.c: Fix for SNES controllers

gamecon.c: Fix for SNES controllers

Post by Michael Gol » Sat, 07 Jul 2001 11:00:08



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
 
 
 

gamecon.c: Fix for SNES controllers

Post by Vojtech Pavli » Mon, 09 Jul 2001 01:50:07



> 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
> +++ linux-2.4.4/drivers/char/joystick/gamecon.c    Sat May 26 03:57:13 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])

Already fixed in -ac series kernels. Thanks anyway.

--
Vojtech Pavlik
SuSE Labs
-
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 change for SNES controller

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/

2. any good http links for X-windows programming?

3. SNES controllers

4. CANT MAKE BOOT DISK DURING INSTALL IN REDHAT 5.1

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

6. Help! Crushed by shells

7. gamecon module & PSX dance mat controller

8. dhcpagent problem

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. Fix for promise RAID controllers not working as IDE controllers in 2.4.19

12. snes pad as pointing device

13. joystick 1.2.12 & SNES pad