PDA

View Full Version : parallel port & linux


kmj
07-02-2002, 12:48 PM
Anyone know offhand how to go about writing to the parallel port in linux? I know someone who's trying to convert a DOS/Borland C program to linux, and apparently conio handles all that in Borland. So I was wondering how it's done in linux. Any links/comments would be appreciated.

l01yuk
07-02-2002, 05:57 PM
I seem to remember something called parport and I know there are some howto's on www.tldp.org.

stuka
07-02-2002, 06:29 PM
kmj - raw output, or just writing data to the port? I've got a copy of Linux Programming Unleashed, which includes a section on making a device driver to drive a device via the parallel port. If you want a regular "data" write, I'm betting you open /dev/lp0 and write to it (but of course I could be way off there....)

binaryDigit
07-02-2002, 06:33 PM
http://www.tldp.org./LDP/khg/HyperNews/get/devices/parport.html

looks to me like the parport module is the way to go on this one. the above is a more exact link on the info for it.

kmj
07-03-2002, 11:43 AM
Stuka: I think it's just writing raw data

here's scrapz's post from lno. I was helping him on #grasshoppers


I have this program which was written for DOS, but it also came with the source code (just the one .c file) and I'm having a bugger of a time trying to compile it for linux. I know how to compile them, but this file in particular include "conio.h" which I cant find anywhere on my system... therefore I cant compile it. I'm guessing conio.h is a DOS specific include file... whats the linux equivilent?

Also, the favor I'd like to ask... I know only very little about programming in C, and I dont know if thats all, that header file. So maybe you can have a
look at it (http://scrapz.0catch.com/k134lcd.c) and maybe tell me what else,
and tips for compiling it, please?


Basically, he make an lcd and now he wants to write to it. He's a hardware guy, so he can't write the code himself.

Note, it's not just ncurses stuff, since the whole program is about writing to the parallel port.

stuka
07-03-2002, 12:12 PM
kmj - saw that last night, figured out the connection! I'll break out my LPU book, and dig through the code - it uses REALLY low level stuff. I'll probably pull down his code today, and see what I can do about translating it.....since I've got no phone line (and hence no 'Net) at home, I'm BOOOORED! ;)

kmj
07-03-2002, 12:37 PM
:D cool. I'm sure you'll make scrapz very happy if you can do that.

edit: Oh, and cripes man, get a cable modem!

stuka
07-03-2002, 01:34 PM
heh - I will, but not 'til December - my wife's makin' me wait until I finish school..:(

Strike
07-04-2002, 04:52 AM
Yeah, basically you treat it just like any normal file, I believe. I've only done serial port I/O, but I imagine it is the same (more or less).