Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am building a simple circuit I trying to control from the
parallel port using linux gcc.
I get the following error. I don't understand what I need to
do to get my code to work from a non root user.
Any hint would be appreciated.
./lptloop Couldn't get the port at 378
[code]
// lptloop
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/io.h>
//#include </usr/include/sys/io.h>
#define base 0x378 /* printer port base address */
#define value 255 /* numeric value to send to printer port */
#define value0 0 /* numeric value to send to printer port */
#define value1 1 /* numeric value to send to printer port */
#define value2 2 /* numeric value to send to printer port */
#define value3 4 /* numeric value to send to printer port */
#define value4 8 /* numeric value to send to printer port */
#define value5 16 /* numeric value to send to printer port */
#define value6 32 /* numeric value to send to printer port */
#define value7 64 /* numeric value to send to printer port */
#define value8 128 /* numeric value to send to printer port */
main(int argc, char **argv)
{
int i,p;
if (ioperm(base,1,1))
fprintf(stderr, "Couldn't get the port at %x\n", base), exit(1);
You can't use the IO instructions without root permissions. To allows this would completely undermine all security on the system. That is why access to real hardware is done through kernel-mode device drivers. Your application looks as if it is only using the data signals of the parallel port; perhaps simply writing bytes to /dev/lp will suffice.
--- rod.
You can't use the IO instructions without root permissions. To allows this would completely undermine all security on the system. That is why access to real hardware is done through kernel-mode device drivers. Your application looks as if it is only using the data signals of the parallel port; perhaps simply writing bytes to /dev/lp will suffice.
--- rod.
Thank you very much.
That's what I thought. It looks like I have some work to do
I've looked into a couple of device driver books.
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.