LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C program (https://www.linuxquestions.org/questions/programming-9/c-program-816646/)

abakhiet 06-27-2010 12:13 PM

C program
 
Hola,
I need to make some C program under linux to make some scripts that can talk to my Server's Parallel port by sending some quare signal as high or low, so what i can do ???
Thanks in advance :D

jiml8 06-27-2010 12:22 PM

The book, Linux Device Drivers, uses the parallel port as an example. It will get you going quickly. You can view it online. Google for it.

For that matter, most tutorials online that talk about device drivers for Linux also talk about the parallel port.

jlinkels 06-27-2010 12:27 PM

If your intention is to have a program which controls the parallel port, as opposed to learning to write a device driver, consider the Comedi library.

http://www.comedi.org/doc/

Those are available device driver to be linked to your code, and faily easy to use. It includes a parallel port driver. And it is definitely easier than writing a device driver.

jlinkels

theNbomr 06-28-2010 08:57 AM

Your project can be accomplished either as a userspace application, or as a kernel driver. The method in each case will be quite different. If timing is critical, especially at higher speeds, then a kernel driver is most likely required, and even then it may be difficult to meet a tight spec. It is not obvious whether you are asking about the details of parallel port hardware functionality, or how to gain access to low-level hardware in general. The PC parallel port was a pretty standard piece of hardware, once upon a time (ISA bus era). These days, you often have to deal with PCI or USB to access the device, and this can make it difficult, maybe impossible, depending on your requirements.
It sounds like you probably intend to write a purely userspace application, so if you have a nice parallel port that is mapped into low IO address space, you can use either the combination of ioperm()/inb()/outb() family of functions, or the /dev/port interface.
More detail about your requirements and the type of hardware you have available will enable people to provide more detailed help.
--- rod.

zirias 06-28-2010 12:30 PM

hmmm wait .. if all you want is the ability to put a certain byte on the parallel-port data lines -- I already did that. It's a solution with a daemon and a client program:
https://svn.home.palmen-it.de/viewvc/ppshot/trunk/

Source doc is here:
http://home.palmen-it.de/~felix/ppshot/


All times are GMT -5. The time now is 11:03 AM.