Re: [PARPORT] Parallel Port Midi driver?

From: Tom Perkins (tomp@trperkins.2y.net)
Date: Mon Jan 14 2002 - 22:11:31 EST

  • Next message: Tim Waugh: "Re: [PARPORT] Parallel Port Midi driver?"

    If you're using the built in port then you should be able to read and
    change the parport setting from the bios setup. ECP mode, in general,
    provides the best performance. Most bios' will let you select ECP+EPP
    which is ok. The default dma should be ok -- an ISA sound or network
    card are the only things likely to conflict.

    Another option is to load "modprobe parport_pc irq=auto dma=auto".

    If IEEE1284 is turned on in the kernel it should report the ports values
    in the system log (usally /var/log/messages or /var/log/syslog).

    Don't know much of anything about user level drivers.

    Regards,
    Tom

    ÃÖ Á¾È¯ wrote:

    > I am trying to write my own device driver for Egosys miditerminal 4140,
    > which is an midi interface via parallel port.
    > As I'm really newbie in programming in kernel mode and writing device
    > drivers, the first step I could imagine was
    > to make a working userland drivers.
    > According to the manual, it needs ECP or EPP mode to work and finds out
    > its own IRQ. I looked up in the M$ windows control panel
    > to see what DMA, io addr, IRQ it uses -- no tab in its driver section.
    > ooops.
    > The first stuff I could imagine was to load the parport.o anyway. I
    > read /usr/src/linux/Documentation/parport.txt and followed the steps.
    > After loading, I could see no device probed in /proc/sys/dev/parport*
    >
    > Ooops, I'm stuck. So I did write a sample (& simple ) userland program
    > to read raw parport devices. The code follows.
    >
    > --- < snip > -----------------
    >
    > #include <stdio.h>
    > #include <linux/ppdev.h>
    > #include <linux/parport.h>
    > #include <sys/types.h>
    > #include <fcntl.h>
    > #include <sys/stat.h>
    > #include <sys/ioctl.h>
    > #include <sys/poll.h>
    >
    > main(int argc, char **argv)
    > {
    >
    > int fd, mode;
    > int negotiate_first=0;
    > struct pollfd pfd;
    > int pollret=0;
    > char rchar=0;
    > int nread=0;
    >
    > if ( argc!=2 ) {
    > printf("Usage: %s [dev]\n", argv[0]);
    > exit(0);
    > }
    >
    > fd = open (argv[1], O_RDONLY | O_NOCTTY);
    > if ( fd < 0 ) {
    > perror("open");
    > exit(0);
    > }
    > if ( ioctl (fd, PPCLAIM) ) {
    > perror("PPCLAIM");
    > close(fd);
    > exit(0);
    > }
    > mode = IEEE1284_MODE_ECP;
    > if (negotiate_first ) {
    > if (ioctl (fd, PPNEGOT, &mode) ) {
    > perror("PPNEGOT");
    > close(fd);
    > exit(0);
    > }
    > /* no need for PPSETMODE */
    > } else {
    > if ( ioctl (fd, PPSETMODE, &mode) ) {
    > perror("PPSETMODE");
    > close(fd);
    > exit(0);
    > }
    > }
    >
    > for ( ; ;) {
    > struct pollfd pfd;
    > pfd.fd = fd;
    > pfd.events = POLLIN;
    >
    > if ( poll(&pfd, 1, 1000 ) > 0 ) {
    > while ( (nread=read(fd, &rchar, 1)) > 0 )
    > printf("%x ", rchar);
    > }
    > printf(".");
    > fflush(stdout);
    > }
    >
    > /* Okay, finished */
    > ioctl (fd, PPRELEASE);
    > close (fd);
    >
    > }
    >
    > --- < snip > -----------------
    >
    > OK. I ran the program as root, tried EPP and ECP for all the devices (
    > parport{0,1,2,3} ) while sending some midi input signals through my
    > keyboard. All I could see was just <dot>s ! Nothing was coming in to
    > the raw device.
    >
    > Ooops, I'm really stuck. I have no idea what to try next. I'm really
    > wondering what's going on. Please help me.
    > And if you have any idea of what parallel-port midi device should look
    > like, It'll be great!
    >
    > Thanks in advance.
    >
    >
    >
    > -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    > -- with the single word "unsubscribe" in the body of the message. --
    >
    >
    >

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Mon Jan 14 2002 - 22:13:22 EST