parallel port frezing up - Linux

This is a discussion on parallel port frezing up - Linux ; I am trying to run ntp with a gps PPM given the time base, and thus I am trying to use a program called shmpps. It opens the parallel port, /dev/lp0, and then tries to send the ioctl PPEXCL, but ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: parallel port frezing up

  1. parallel port frezing up


    I am trying to run ntp with a gps PPM given the time base, and thus I am
    trying to use a program called shmpps. It opens the parallel port,
    /dev/lp0, and then tries to send the ioctl PPEXCL, but the system give back
    the error or invalid argument to the ioctl function. HOwever thereafter the
    parallel port seems to have been destroyed, and nothing can use it. If I
    try to run another program it says it cannot find 0x378, the parallel port
    port ( and it has no trouble before I tried to run the ioctl. )

    Here is the code fragment from the sshpps program.

    pp_fd = open (*pps_dev,O_RDWR);
    if (pp_fd<0) {
    if (nodive) {
    fprintf(stderr, "%s: r/w open on %s failed.\n", prog, *pps_dev);
    perror("open");
    }
    exit(1);
    }

    if (ioctl (pp_fd, PPEXCL) == -1) {
    if (nodive) {
    fprintf(stderr, "%s: open exclusive on %s failed.\n", prog, *pps_dev);
    perror ("ioctl_ppexcl");
    }
    ioctl(pp_fd, PPRELEASE);
    close (pp_fd);
    exit(1);
    }


    The device, pps_dev is /dev/lp0, and the open call succeeds. However the
    following ioctl throws an error which perror reports as
    "invalid argument".

    and forever after the parallel port does not work for anything.
    Even if I unload
    rmmod lp parport_pc parport lp
    and then reload
    modprobe lp
    I still get the same error messages.
    Eg another program does a request_region on 0x378 and throws and error.

    Somehow the ioctl call is destroying the access to the port.

    Any clues as to what is going on here (unfortunately my knowledge of ioctls
    is not great enough to figure it out myself. )




  2. Re: parallel port frezing up

    On Fri, 05 Oct 2007 20:38:37 -0400, Unruh wrote:

    > I am trying to run ntp with a gps PPM given the time base, and thus I am
    > trying to use a program called shmpps. It opens the parallel port,
    > /dev/lp0, and then tries to send the ioctl PPEXCL, but the system giveback


    A couple of things to try.

    In /etc/modprobe.conf, add the line
    options parport_pc irq=7 dma=3 io=0x378
    to ensure the port is using interupts, instead of polling.

    Check the bios setup program, to ensure ECP mode is enabled.

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

+ Reply to Thread