turtle beach multisound, patch for 2.4

From: John Coiner (jcoiner@stanford.edu)
Date: Sat Jul 01 2000 - 05:18:42 EDT

  • Next message: Andi Kleen: "Re: spinlocks() are severely broken in 2.2.X and 2.4.X for modules"

    greetings and hallucinations

    This is a patch against the file msnd.c included in 2.4.0-test2ac.

    It should fix those OOPSes when you try to play or record sound on that
    turtle beach multisound of yours. The patched driver uses isa_readb and
    isa_writeb instead of memcpy to access ISA address space. I guess some
    smart people decided that accessing ISA space with memcpy was bad, and
    they broke it in 2.4.

    I've tested this under 2.4.0-test2-ac, with a vanilla tb Fiji revision
    C, without digital i/o. xmms plays, rec records, kmix mixes. I haven't
    checked too much beyond that. Who knows it might even work for other
    multisounds. It worked as a module, and also compiled in.

    Hope someone finds this helpful. I'm new to this list. Please don't
    totally flame me when you look at the four lines of code I attached, and
    see what an awful programmer I am.

    - John

    encl: msnd.patch

    what to do with it:
    patch /path/to/linux/drivers/sound/msnd.c msnd.patch

    --- msnd-orig.c Sat Jul 1 01:41:56 2000
    +++ msnd.c Sat Jul 1 01:41:45 2000
    @@ -158,6 +158,7 @@
     int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user)
     {
             int count = 0;
    + int i;
     
             if (f->len == f->n)
                     return 0;
    @@ -181,7 +182,10 @@
                             if (copy_from_user(f->data + f->tail, buf, nwritten))
                                     return -EFAULT;
                     } else
    - memcpy(f->data + f->tail, buf, nwritten);
    + {
    + for(i=0;i<nwritten;i++)
    + *(f->data+f->tail+i)=isa_readb((unsigned int)buf+i);
    + }
     
                     count += nwritten;
                     buf += nwritten;
    @@ -196,6 +200,7 @@
     int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user)
     {
             int count = 0;
    + int i;
     
             if (f->len == 0)
                     return f->len;
    @@ -219,7 +224,11 @@
                             if (copy_to_user(buf, f->data + f->head, nread))
                                     return -EFAULT;
                     } else
    - memcpy(buf, f->data + f->head, nread);
    + {
    + for(i=0;i<nread;i++)
    + isa_writeb(*(f->data+f->head+i), (unsigned int)buf+i);
    +
    + }
     
                     count += nread;
                     buf += nread;

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Jul 01 2000 - 05:22:36 EDT