Solution: Direct access to Printer I/O lines
Suchandra Thapa
ssthapa at harper.uchicago.edu
Fri Dec 15 03:25:30 EST 2000
jkndeja at my-deja.com <jkndeja at my-deja.com> wrote:
>CAVEATS:
> - It's intended to work under Windows 95 only. It won't work under
>NT (you need a kernel-mode driver to access I/O ports under NT, and I
>haven't written that yet ;-). I don't know about W98. It won't work
>under linux either ;-). I'm happy to write a similar extension for
>linux if people are interested - it's good practice for me...
It should work in w98 since I've used the same approach you seem to
have used in w98. It should also work in windows me.
> - to be safe, I have restricted the range over which I/O port
>access is allowed. This is currently limited to the address spaces of
>the LPT ports:
>
> 0x278 to 0x27a (LPT1:)
> 0x378 to 0x37a (LPT2:)
> 0x3bc to 0x3bf (LPT3:)
>
Actually there is a second range of addresses at base+300(?) that
controls ECP/EPP/SPP operations. The specific offset is in the parallel
port faq. I don't think people will need much access to this in python
except to check to make sure SPP mode is on or to switch to SPP mode.
>I assume you know what you're doing...
>
> - Oh, I built it with Python v1.5.2 (ie. this is the import Library
>I used). Does this mean it will need re-building for V2.0? not sure...
I believe you need to rebuild due to changes in the interface API.
>I haven't even checked yet which of the LPT: port addresses are Read-
>only, which are Write only, and which are Read/Write - that's how
>tested this is! Track down Ralph Browns Interrupt list for the gen. on
>this.
It's even worse than this. base+2 is the control register and certain
bits are readonly while others are read-write. The status register base+1
has a similar feature. BTW, I'm not sure if I've gotten the addresses
for the registers reversed.
--
------------------------------------------------------------------
|
Suchandra Thapa | "There are only two kinds of math books.
s-thapaNO at SPAMuchicago.edu | Those you cannot read beyond the first
| sentence, and those you cannot read
| beyond the first page."
| -C.N. Yang
------------------------------------------------------------------
More information about the Python-list
mailing list