[Linux-parport] libieee1284 open/claim gives ppdev error
christian.braun at ch.abb.com
christian.braun at ch.abb.com
Tue Mar 9 17:33:00 GMT 2004
Yes, I tried that. That's where I had the Idea from that the open function
actually doesn't give back an error while the claim gives back the
By the way the "ppdev0: failed to register device!" appears on both machines, on the SuSE it's in the /var/log/messages...
there it also talks about that it "cannot grant exclusive access for
I've included the program output as well as my code down below, maybe that
Thank you again very much!
===Below the Output of the program===
Searching for Ports...
/dev/parport0 is accessible
We can use ioperm()
/dev/port is accessible
/dev/lp0 is accessible
This system has /proc/sys/dev/parport
Found 1 port(s)!
Port no. 0:
Details of the chosen port:
Base address: 0x378
ECR address: 0x778
File name: /dev/parport0
Got 0 from ppdev init
Using port no. 0
*** Error no. 8 in ieee1284_claim - "No such device or address"
*** parport0: Could not be claimed.
===The Program Code===
/* Display the found portnames. */
static void display_ports (struct parport_list *pl)
printf("Found %d port(s)!\n",pl->portc);
for(i = 0; i < pl->portc; i++)
printf("\nPort no. %d:\n", i);
printf("Name: %s\n", pl->portv[i]->name);
/* Display the details of the chosen port. */
int display_port_details(struct parport *port, int portno)
printf("\nDetails of the chosen port (no. %d):\n", portno);
printf(" Portname: %s\n", port->name);
printf(" Base address: 0x%x\n", port->base_addr);
printf(" ECR address: 0x%x\n", port->hibase_addr);
printf(" File name: %s\n", port->filename);
/* Reading in the status lines of the opened and claimed port. */
int readin(struct parport *port)
status = ieee1284_read_status(port);
if(status < 0)
printf("*** Error no. %d in ieee1284_read_status -
\"%s\"\n", abs(status), strerror(errno));
printf("*** %s's status lines could not be read.\n
return -13; //Port status lines could not be read
//Print out status of the chosen port:
printf("Status of Port %s is: %x\n", port->name, status);
/* Main Program */
int main ()
/* Specify here the serial port to use! **
** Set PORT_TO_USE to x for parallel port x */
const int PORT_TO_USE=0;
struct parport_list pl;
printf("Searching for Ports...\n");
ieee1284_find_ports (&pl, 0);
printf("*** No ports found.\n Exiting...\n");
return -14; //No ports found
struct parport *port = pl.portv[PORT_TO_USE]; //set pointer port
to the chosen parport structure
unsigned int cap;
open_state = ieee1284_open(port, F1284_EXCL, &cap);
printf("Chosen port is No. %d\n", PORT_TO_USE);
printf("*** Error no. %d in ieee1284_open - \"%s\"\n",
printf("*** %s: inaccessible\n Exiting...\n",
return -11; //Port inaccessible
printf("Using port no. %d\n", PORT_TO_USE);
claim_state = ieee1284_claim(port);
printf("*** Error no. %d in ieee1284_claim - \"%s\"\n",
printf("*** %s: Could not be claimed.\n Exiting...\n",
return -12; //Port could not be claimed
//ieee1284_release(port); //undo the claim
ieee1284_close(port); //undo the open
Message from Tim Waugh <twaugh at redhat.com> received on 09.03.2004 17:07
Tim Waugh <twaugh at redhat.com>
To: christian.braun at ch.abb.com
cc: Linux-parport at lists.infradead.org
Subject: Re: [Linux-parport] libieee1284 open/claim gives ppdev error
You can set the environment variable LIBIEEE1284_DEBUG (to anything)
to find out more about what the library is up to.
I'm trying to write a program that reads in the status lines on the
parallel port. For that I intend to use libieee1284... but my program
fails when I try to use the libieee1284 function to claim the port.
I do without the ieee1284_get_deviceid since I already know what port I
will use (the device will be permanently connected) but otherwise I follow
the sequence given in the libieee1284 Public interface description by Tim
Waugh (find_ports, open, claim, (..., release, close)).
The Problem is that when I try to claim the port, the program terminates
with the Error E1284_SYS (-8), errno giving a
"No such device or address".
I actually have that problem on two computers here, one being a Intel PIII
machine with standard SuSE Linux 8.1 (Kernel 2.4.21) and the other one an
embedded PC-Board with an AMD ELAN520 processor running a
Debian-Woody-based bud largely customized Linux distribution. On the SuSE
there's that problem with no further error messages while on the Debian
system additionally the message
"ppdev0: failed to register device!"
appears for both the open and the claim routine (but the open routine does
not hand back an error while the claim routine fails).
Can anybody help me? Any Ideas?
Thanks a lot!
Linux-parport mailing list
Linux-parport at lists.infradead.org
More information about the Linux-parport