mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Piel <Eric.Piel@tremplin-utc.net>
To: Peter Nelson <rufus-kernel@hackish.org>
Cc: Vojtech Pavlik <vojtech@suse.cz>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Hotplug support for several PSX controlers
Date: Wed, 15 Dec 2004 10:30:33 +0100	[thread overview]
Message-ID: <41C00439.5070506@tremplin-utc.net> (raw)
In-Reply-To: <41BE421B.8060106@hackish.org>

Peter Nelson wrote:
> Eric Piel wrote:
:
:
>> Is there anyone in particular to tell about those patches? Or is the 
>> normal way that Vojtech inserts the patches in his tree and Linus 
>> pulls it when he feels it's stable enough?
> 
> 
>  From what I see Vojtech accepts them and then Linus eventually pulls 
> from Vojtech's tree.  Here is my modified patch.  Please test it to 
> double check it works.
Ok, I've tried it completly yesterday evening and I confirm it works 
perfectly. There is a minor correction to do concerning the comment of 
GC_PSX_LENGTH: "bytes" need to be changed to "bits" .

Eric



> 
> ---
> From: Eric Piel <Eric.Piel@tremplin-utc.net>
> 
> Fixes hotplug support for PSX controllers and some mis-sized arrays.
> 
> Signed-off-by: Peter Nelson <rufus-kernel@hackish.org>
> ---
> ===== gamecon.c 1.19 vs edited =====
> --- 1.19/drivers/input/joystick/gamecon.c    2004-12-13 20:04:39 -05:00
> +++ edited/gamecon.c    2004-12-13 20:18:02 -05:00
> @@ -228,6 +228,7 @@
> 
> #define GC_PSX_DELAY    25        /* 25 usec */
> #define GC_PSX_LENGTH    8        /* talk to the controller in bytes */
> +#define GC_PSX_BYTES    6        /* the maximum number of bytes to read 
> off the controller */
> 
> #define GC_PSX_MOUSE    1        /* Mouse */
> #define GC_PSX_NEGCON    2        /* NegCon */
> @@ -241,7 +242,7 @@
> #define GC_PSX_SELECT    0x02        /* Pin 3 */
> 
> #define GC_PSX_ID(x)    ((x) >> 4)    /* High nibble is device type */
> -#define GC_PSX_LEN(x)    ((x) & 0xf)    /* Low nibble is length in 
> words */
> +#define GC_PSX_LEN(x)    (((x) & 0xf) << 1)    /* Low nibble is length 
> in bytes/2 */
> 
> static int gc_psx_delay = GC_PSX_DELAY;
> module_param_named(psx_delay, gc_psx_delay, uint, 0);
> @@ -259,13 +260,13 @@
>  * the psx pad.
>  */
> 
> -static void gc_psx_command(struct gc *gc, int b, unsigned char 
> data[GC_PSX_LENGTH])
> +static void gc_psx_command(struct gc *gc, int b, unsigned char data[5])
> {
>     int i, j, cmd, read;
>     for (i = 0; i < 5; i++)
>         data[i] = 0;
> 
> -    for (i = 0; i < 8; i++, b >>= 1) {
> +    for (i = 0; i < GC_PSX_LENGTH; i++, b >>= 1) {
>         cmd = (b & 1) ? GC_PSX_COMMAND : 0;
>         parport_write_data(gc->pd->port, cmd | GC_PSX_POWER);
>         udelay(gc_psx_delay);
> @@ -283,7 +284,7 @@
>  * device identifier code.
>  */
> 
> -static void gc_psx_read_packet(struct gc *gc, unsigned char 
> data[5][GC_PSX_LENGTH], unsigned char id[5])
> +static void gc_psx_read_packet(struct gc *gc, unsigned char 
> data[5][GC_PSX_BYTES], unsigned char id[5])
> {
>     int i, j, max_len = 0;
>     unsigned long flags;
> @@ -302,10 +303,11 @@
> 
>     for (i =0; i < 5; i++)                                /* Find the 
> longest pad */
>         if((gc_status_bit[i] & (gc->pads[GC_PSX] | gc->pads[GC_DDR]))
> -           && (GC_PSX_LEN(id[i]) > max_len))
> +           && (GC_PSX_LEN(id[i]) > max_len)
> +           && (GC_PSX_LEN(id[i]) <= GC_PSX_BYTES))
>             max_len = GC_PSX_LEN(id[i]);
> 
> -    for (i = 0; i < max_len * 2; i++) {                        /* Read 
> in all the data */
> +    for (i = 0; i < max_len; i++) {                            /* Read 
> in all the data */
>         gc_psx_command(gc, 0, data2);
>         for (j = 0; j < 5; j++)
>             data[j][i] = data2[j];
> @@ -330,7 +332,7 @@
>     struct gc *gc = (void *) private;
>     struct input_dev *dev = gc->dev;
>     unsigned char data[GC_MAX_LENGTH];
> -    unsigned char data_psx[5][GC_PSX_LENGTH];
> +    unsigned char data_psx[5][GC_PSX_BYTES];
>     int i, j, s;
> 
> /*
> 


      reply	other threads:[~2004-12-15  9:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-12 20:24 Eric Piel
2004-12-12 21:12 ` Peter Nelson
2004-12-12 21:54   ` Eric Piel
2004-12-14  1:30     ` Peter Nelson
2004-12-15  9:30       ` Eric Piel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41C00439.5070506@tremplin-utc.net \
    --to=eric.piel@tremplin-utc.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rufus-kernel@hackish.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®