LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   parallel port in linux kernel (https://www.linuxquestions.org/questions/linux-newbie-8/parallel-port-in-linux-kernel-835609/)

tincy 10-01-2010 07:00 AM

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

theNbomr 10-01-2010 12:10 PM

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.

jefro 10-01-2010 05:01 PM

It also may be that you can set your parallel port to be a serial port and use those tools also.

theNbomr 10-01-2010 06:59 PM

Quote:

Originally Posted by jefro (Post 4115188)
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.

jefro 10-02-2010 09:06 PM

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.

theNbomr 10-04-2010 07:01 PM

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.

jefro 10-05-2010 03:56 PM

So you don't know anything about the circuit, the os, the programming or the applications but you don't believe me?

theNbomr 10-05-2010 05:50 PM

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.

jefro 10-05-2010 07:44 PM

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.


All times are GMT -5. The time now is 09:17 PM.