Necessity of driver when communicating with custom hardware on parallel port
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
Necessity of driver when communicating with custom hardware on parallel port
Hello everybody out there using linux,
My aim is to send signals to simple custom curcuits using the parallel port of my PC with C programs. My question is, whether I will have to write own drivers for doing this or just use the linux parport driver.
Depends how you want to use the parallel port. If you can do it by simply writing characters to the port (ie. to the parallel port, your custom circuits look like printers), then you can use the parallel port driver directly. Otherwise you will have to either write your own driver, or you will have to build your application(s) with userspace drivers using the /dev/port facility, or with ioperm() + inb()/outb(). The userspace driver method requires root privileges. It is possible to use a kernel driver, and also use a userspace driver concurrently. I found this useful, as libiee1284 provides a convenient way to locate where in IO-space the parallel port hardware is mapped.
--- rod.
Well, I imagine a minimal example like the one Arduino uses, i.e. a blinking LED. I've found descriptions which manage to do this without any custom drivers, but I am not sure about the resulting restriction of just using the parport driver in simple programs (in C, for example).
Much of what you want to do, you can program from user space. I know. I did it.
The only drive you will need is a generic parallel port module.
NOTE -- On a modern linux, you will might not see your parallel ports unless the hardware thinks it is online and ready. I did this before all of the automatice
detection and such happened. If this is the case, simply use modprobe to force the install.
For user space to access the device your process must must have permission to access the "device file" -- in *nix, everything is a file. Parallel ports have a name something like /dev/lpt*.
As root, you can use chmod to alter permissions such that read-write are possible. I created a special group name, "myDevice" and ran my program as a member of that group. My permissions were such that /dev/lpt* had g=rwx permissions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.