PortIO

Python low level port I/O for Linux x86
Download

PortIO Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Fabrizio Pollastri
  • Publisher web site:
  • http://avc.inrim.it/html/

PortIO Tags


PortIO Description

Python low level port I/O for Linux x86 PortIO is a Python wrapper for the port I/O macros like outb, inb, etc. provided by the C library on Linux x86 platforms. This module is useful when a general pourpose port I/O at the low level is needed. Programmers that want to perform I/O on the parallel port at an higher level, will be better satisfied by the pyParallel module. A similar module Ioport has inspired the writing of PortIO.This project is released under the GNU General Public License (GPL).Usage example:This sample program toggle on and off all the data lines of the parallel port lp0 with a 6 seconds period. Note the check for root privileges before the call to ioperm to acquire the proper I/O permissions for the involved ports.import sys, time, osimport portio# check for root privilegesif os.getuid(): print 'You need to be root! Exiting.' sys.exit()# acquire permission for I/O on lp0status = portio.ioperm(0x378, 1, 1)if status: print 'ioperm:',os.strerror(status) sys.exit()# toggle for ever the data lines of lp0data = 0while 1: lp0in = portio.inb(0x378) portio.outb(data,0x378) print 'read %x from lp0, written %x to lp0' % (lp0in,data) data = ~data & 0xff time.sleep(3) Requirements: · Python What's New in This Release: · Fixed some argument type mismatch in I/O macros. · Upgraded PyArg_ParseTuple format strings with the new “unsigned” formats available from python 2.3 . So portio now requires python version => 2.3.


PortIO Related Software