[Linux-parport] Problem with ppdev in EPP mode

Andreas Stricker andreas.stricker at fela.ch
Tue Apr 25 07:08:19 EDT 2006


Hi

I've got a problem with ppdev in EPP mode. I need a verification
if I'm right. The Problem:

I've got hardware that should be EPP 1.9 compatible. If I write to
the port, the write()-Call returns 0 bytes written. If I read from
the port, the driver blocks in read().

To open the port I do (error checking simplified):

   fd = open(device, O_RDWR | O_NOCTTY);
   if (ioctl(fd, PPCLAIM))
       error();

Then I try for example to write to address 0x03:

   char addr = 0x03;
   int mode = IEEE1284_MODE_EPP | IEEE1284_ADDR;
   if (ioctl(fd, PPSETMODE, &mode) == -1)
       error();
   wrote = write(fd, &addr, 1);   /* here write returns 0! */
   if ( wrote < 0 )
       error();
   if ( wrote < 1 )
       warn();

   /* the following part is here for completeness */
   mode = IEEE1284_MODE_EPP | IEEE1284_DATA;
   wrote = write(fd, &data, 1);  /* here write returns 0, too */
   if ( wrote < 0 )
       error();
   if ( wrote < 1 )
       warn();

Am I right that if the write() in address mode returns zero,
the address was not written? Is this the same if i don't plug
any devices in? Then this could be a hardware issue?


More informations:

The driver seems to correctly load and detect the right hardware:
(in BIOS the parallel port is set to EPP1.9)

ppdev: user-space parallel port driver
parport_pc: VIA 686A/8231 detected
parport_pc: probing current configuration
parport_pc: Current parallel port base: 0x378
parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE,EPP]
parport_pc: VIA parallel port: io=0x378, irq=7

If I run my program, the kernel write:
ppdev0: registered pardevice

And if I exit my program, the kernel write:
ppdev0: unregistered pardevice

I'm using a self compiled vanilla kernel linux 2.6.14.1.

The port and the device attached works. The piece of software
I'm redesign was written with ioperm() and direct I/O from
user-space (urgs!). The old code writes to BASE + 3 (address)
and BASE + 4 (EPPDATA).

Cheers,
Andy




More information about the Linux-parport mailing list