Figuring out the Printer port base address

Aki Niimura akineko at pacbell.net
Sun Dec 29 01:45:35 EST 2002


Hi everyone,

I'm writing a Python program which accesses the PC printer port directly.
Thanks to PortIO package from Scientific Software Tools, Inc 
(www.driverlinx.com) and 'calldll' and 'windll' from Sam Rushing, I can 
access hardware I/O addresses directly from my Python program.

However, I couldn't find a way to determine the Printer port base address.
LPT1 is usually assigned to 0x378 - 0x37A but not always.
In fact, the LPT1 in my laptop is assigned 0x3BC - 0x3be.

I found a posting mentioning the following code fragment:
int GetLPTAddr() {
    return(_peek(0x08,0x40) | _peek(0x09, 0x40) << 8);
}

But I couldn't find any package which allows reading memory (BIOS area)
from Python.

I thought Win32 API was providing such service but so far I couldn't
find it. (But there must be a way as Windows' utility display such info)

Any feedbacks will be highly appreciated.

Thanks!
Aki-



More information about the Python-list mailing list