Writing to the parallel port as a normal user

Phil phil at spiderweb.com.au
Sun Nov 25 06:17:14 GMT 2001


Hello All,

I wonder if someone could sort this out for me?

I want to write to and read from the parallel port as a normal user.

This piece of code causes my program to freeze both as root and a normal user:

  int fd = open("/dev/lp0", O_RDWR);
  int res = write(fd, data, 1);

This next piece of code (from the mini howto) works but only if the program 
is run as root:

  /* Get access to the ports */
//  if (ioperm(BASEPORT, 3, 1)) {perror("ioperm"); exit(1);}

  /* Set the data signals (D0-7) of the port to all low (0) */
//  outb(0, BASEPORT);

I could set my program, using set setuid, to run as root but that would make 
development and debugging difficult.

What's the answer?

-- 
Regards,
Phil
phil at spiderweb.com.au

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list