Access parallel port using Linux

1.1k views Asked by At

currently I access the parallel port this way:

ioperm(data->baseaddr,5,1);
outb(0x00,data->controlport);
inb(data->statusport);

The big disadvantage: it requires root-privileges and works with real parallel port hardware only (means USB-2-LPT converters are not supported).

So: is there an other way tho read/write data from/to parallel port?

Thanks!

1

There are 1 answers

1
mti2935 On

As you mentioned, the user must have privileges to access the parallel port in order for the executable to run successfully. Normally, only root users have privileges to access the ports, so the program must be run with root privileges. However, It should be possible to enable non-root users to run the executable by doing the following:

1) Make root the owner of the executable. One way to do this is to compile the program as root.

2) Give non-users the right to execute the program, but such that the program is run with root rights when run by non-root users. You can set the program to be run with the owner's rights (i.e. root's rights) using the following command (as root): chmod +s /name/of/executable