LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-01-2010, 08:00 AM   #1
tincy
LQ Newbie
 
Registered: Sep 2010
Posts: 6

Rep: Reputation: 0
parallel port in linux kernel


i would like to add a driver to /dev which can light the LEDS using the parallel port.Please tell me from where i should start.i am trying to learn device driver programming, which is quite difficult for me now.please guide me on how to start the task.pls..

thanks
 
Old 10-01-2010, 01:10 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The 'usual' driver for controlling a parallel port is parport. You can write to /dev/parportX (where X is a low digit) from userspace to drive the data lines. The control lines will probably be under exclusive control of the driver itself. With root privileges, you can also write directly to the IO registers that make up a standard parallel port, thus gaining control of the control lines, and gaining the ability to read the status bits.

If you still feel a need to access the hardware from kernel space, you should consult the documentation and source code for the parport kernel driver. You will need the kernel sources, and the relevant code will be in the directory drivers/parport/... below the kernel source root.

--- rod.
 
Old 10-01-2010, 06:01 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,383

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
It also may be that you can set your parallel port to be a serial port and use those tools also.
 
Old 10-01-2010, 07:59 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by jefro View Post
It also may be that you can set your parallel port to be a serial port and use those tools also.
Huh? Please explain that. The hardware is completely different, the connectors are normally completely different, the signaling and electrical natures are completely different. The OP wants to use and control the individual bits on the parallel port to drive LEDs. A serial port would be virtually useless for such an application.

--- rod.
 
Old 10-02-2010, 10:06 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,383

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Same chip runs both. I have used parallel ports in place of serial before. I know it can be done. There might be an instance where you have the last version of chip for parallel. I suspect it can be altered too but I have never tried it. Very few computers had that chip.
 
Old 10-04-2010, 08:01 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Just because the function of each kind of port are on the same piece of silicon means nothing. There is next to zero chance that connecting a serial port to a device requiring a parallel interface or vice versa will work. There may be some odd cases where the logical and electrical signaling on a connector could be controlled through software, but I've never heard of such a thing. It would be very unlikely that you would ever find a cable that would work in such a circumstance. Please describe a case where you 'have used parallel ports in place of serial before'. It would be a very unusual application that could be served equally by either.

--- rod.
 
Old 10-05-2010, 04:56 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,383

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
So you don't know anything about the circuit, the os, the programming or the applications but you don't believe me?
 
Old 10-05-2010, 06:50 PM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Not the way you've described it, however vaguely that is. I'd be most interested to hear about it though. I'd be especially eager to see how the OS has any bearing on the how a serial interface can serve as a parallel interface, or vice versa. Especially if it can apply to tincy's problem.

--- rod.
 
Old 10-05-2010, 08:44 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,383

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
I think you mis understand what I had suggested. You don't use a parallel port as a parallel port. You set it as a serial port and use it as any serial port would be used. The OP wanted to use parallel but I feel it would be much easier to do this with serial.
 
  


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 in linux? linuxunix Linux - Newbie 3 04-23-2010 11:05 PM
Problems compiling crrcsim parallel port kernel module CONFIG_MODVERSION ???? rhauff Linux - Kernel 4 04-17-2008 07:53 AM
Parallel port interrupt in 2.6 kernel FastCatch Linux - Hardware 0 11-02-2006 03:50 PM
Parallel port interface on linux brave_heart7725 Linux - Hardware 8 05-28-2006 09:48 AM
How to get Parallel Port Joysticks (eg SNES pad) working in linux 2.6.4 kernel Tyco Linux - Hardware 1 06-06-2004 03:59 PM


All times are GMT -5. The time now is 06:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration