LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-01-2012, 09:47 AM   #1
Summer_Penguin
LQ Newbie
 
Registered: Sep 2010
Posts: 5

Rep: Reputation: 0
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.

Thanks in advance for your answers!
 
Old 04-01-2012, 10:43 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 04-01-2012, 01:24 PM   #3
Summer_Penguin
LQ Newbie
 
Registered: Sep 2010
Posts: 5

Original Poster
Rep: Reputation: 0
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).
 
Old 04-02-2012, 12:39 AM   #4
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,771
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
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.

I hope that this helps.
~~~ 0;-Dan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parallel Port Device Driver Resmi Linux - Embedded & Single-board computer 2 01-07-2009 01:22 AM
Writing own parallel port driver mathimca05 Linux - Kernel 1 10-08-2008 06:03 AM
Parallel Port Device Driver rajtendulkar Linux - Hardware 4 03-16-2006 11:34 PM
hardware control through the parallel port Darkfalz Linux - Hardware 1 11-03-2005 11:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration