Skip to main content

PortIO, python low level port I/O for Linux x86

Project description

PortIO is a Python front end to the low level functions provided by the C library on Linux 386 platforms for the hardware input and output ports: outb, outw, outl, outsb, outsw, outsl, outb_p, outw_p, outl_p, inb, inw, inl, insb, insw, insl, inb_p, inw_p, inl_p, ioperm, iopl.

Before doing port I/O, it is mandatory to acquire proper privileges by calling ioperm or iopl. Otherwise you will get a segmentation fault.

outb (data,port)
Output the byte data to the I/O address port.
outb_p (data,port)
The same as outb, but waits for I/O completion.
outw (data,port)
Output the 16 bit word data to the I/O address port.
outw_p (data,port)
The same as outw, but waits for I/O completion.
outl (data,port)
Output the 32 bit word data to the I/O address port.
outl_p (data,port)
The same as outl, but waits for I/O completion.
outsb (port,data,count)
Repeat count times the output of a byte to the I/O address port, reading it from buffer of bytes starting at data and with length count.
outsw (port,data,count)
Repeat count times the output of a 16 bit word to the I/O address port, reading it from buffer of 16 bit words starting at data and with length count x 2.
outsl (port,data,count)
Repeat count times the output of a 32 bit word to the I/O address port, reading it from buffer of 32 bit words starting at data and with length count x 4.
inb (port)
Input a byte from the I/O address port and return it as integer.
inb_p (port)
The same as inb, but waits for I/O completion.
inw (port)
Input a 16 bit word from the I/O address port and return it as integer.
inw_p (port)
The same as inw, but waits for I/O completion.
inl (port)
Input a 32 bit word from the I/O address port and return it as integer.
inl_p (port)
The same as inl, but waits for I/O completion.
insb (port,data,count)
Repeat count times the input of a byte from the I/O address port and write it to a buffer of bytes starting at data and with length count bytes.
insw (port,data,count)
Repeat count times the input of a 16 bit word from the I/O address port and write it to a buffer of 16 bit words starting at data and with length count x 2 bytes.
insl (port,data,count)
Repeat count times the input of a 32 bit word from the I/O address port and write it to a buffer of 32 bit words starting at data and with length count x 4 bytes.
ioperm (from,extent,enable)

Set port access permission starting from address from for extent bytes. If the enable is True, access is enabled, otherwise is disabled. On success, zero is returned. On error, the errno code is returned. The use of ioperm requires root privileges.

Only the first 0x3ff I/O ports can be specified in this manner. To gain access to any I/O port in the whole (0x0000-0xffff) address range, use the iopl function.

iopl (level)
Set the I/O privilege level of the current process. When level is 3 access is granted to any I/O port. On success, zero is returned. On error, the errno code is returned. The use of iopl requires root privileges.

Project details


Release history Release notifications

This version
History Node

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
portio-0.5.tar.gz (134.1 kB) Copy SHA256 hash SHA256 Source None May 28, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page