Controlling the Parallel Port
Grant Edwards
grante at visi.com
Tue Jan 2 12:57:38 EST 2001
Cary O'Brien wrote:
>Simon Faulkner <News at Titanic.co.uk> wrote:
>
>>Is it easy to control (read/write) the Parallel Port in linux
>>using Python?
>>
>>I am hoping to use it to drive some simple electronics
>
>You need to do two things to access the parallel port from
>a user program.
>
>1) call ioperm() to get permissions to access the ports. man ioperm
> should provide the gory details. Requires root access.
>
>2) use the inb() macro to read, and the outb() macro to write. See
> man outb for the gory details. Pay attension to the note about using
> -O or -O2 on the compile command line. They matter.
>
>Now to access this from python, you can either
[...]
The alternative way to access I/O ports is by doing open(),
lseek(), read(), write(), on /dev/port. This is slower than
using the above method, but it can be done directly from Python
using the posix file-descriptor i/o stuff in the "os" module.
--
Grant Edwards grante Yow! PUNK ROCK!! DISCO
at DUCK!! BIRTH CONTROL!!
visi.com
More information about the Python-list
mailing list