summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt (renamed from pyserial/CHANGES.txt)0
-rw-r--r--LICENSE.txt (renamed from pyserial/LICENSE.txt)0
-rw-r--r--MANIFEST (renamed from pyserial/MANIFEST)0
-rw-r--r--README.txt (renamed from pyserial/README.txt)0
-rw-r--r--examples/enhancedserial.py (renamed from pyserial/examples/enhancedserial.py)0
-rw-r--r--examples/miniterm.py (renamed from pyserial/examples/miniterm.py)0
-rw-r--r--examples/scan.py (renamed from pyserial/examples/scan.py)0
-rw-r--r--examples/scanwin32.py (renamed from pyserial/examples/scanwin32.py)0
-rw-r--r--examples/setup-miniterm-py2exe.py (renamed from pyserial/examples/setup-miniterm-py2exe.py)0
-rw-r--r--examples/setup_demo.py (renamed from pyserial/examples/setup_demo.py)0
-rw-r--r--examples/tcp_serial_redirect.py (renamed from pyserial/examples/tcp_serial_redirect.py)0
-rw-r--r--examples/test.py (renamed from pyserial/examples/test.py)0
-rw-r--r--examples/test_advanced.py (renamed from pyserial/examples/test_advanced.py)0
-rw-r--r--examples/test_high_load.py (renamed from pyserial/examples/test_high_load.py)0
-rw-r--r--examples/wxSerialConfigDialog.py (renamed from pyserial/examples/wxSerialConfigDialog.py)0
-rw-r--r--examples/wxSerialConfigDialog.wxg (renamed from pyserial/examples/wxSerialConfigDialog.wxg)0
-rw-r--r--examples/wxTerminal.py (renamed from pyserial/examples/wxTerminal.py)0
-rw-r--r--examples/wxTerminal.wxg (renamed from pyserial/examples/wxTerminal.wxg)0
-rw-r--r--pyparallel/CHANGES.txt5
-rw-r--r--pyparallel/LICENSE.txt61
-rw-r--r--pyparallel/MANIFEST23
-rw-r--r--pyparallel/README.txt62
-rw-r--r--pyparallel/examples/lcd.py182
-rw-r--r--pyparallel/makefile6
-rw-r--r--pyparallel/parallel/__init__.py22
-rw-r--r--pyparallel/parallel/parallelppdev.py591
-rw-r--r--pyparallel/parallel/parallelutil.py124
-rw-r--r--pyparallel/parallel/parallelwin32.py131
-rw-r--r--pyparallel/setup.py52
-rw-r--r--pyparallel/src/win32/README.txt32
-rw-r--r--pyparallel/src/win32/_pyparallel.c69
-rw-r--r--pyparallel/src/win32/giveio/GIVEIO.C168
-rw-r--r--pyparallel/src/win32/giveio/MAKEFILE7
-rw-r--r--pyparallel/src/win32/giveio/README.TXT92
-rw-r--r--pyparallel/src/win32/giveio/SOURCES7
-rw-r--r--pyparallel/src/win32/install_giveio.bat18
-rw-r--r--pyparallel/src/win32/loaddrv_console/loaddrv.c458
-rw-r--r--pyparallel/src/win32/loaddrv_console/loaddrv.h18
-rw-r--r--pyparallel/src/win32/loaddrv_console/makefile5
-rw-r--r--pyparallel/src/win32/makefile9
-rw-r--r--pyparallel/src/win32/remove_giveio.bat13
-rw-r--r--pyparallel/src/win32/simpleio.c47
-rw-r--r--pyparallel/src/win32/simpleio.dllbin5632 -> 0 bytes
-rw-r--r--serial/.cvsignore (renamed from pyserial/serial/.cvsignore)0
-rw-r--r--serial/__init__.py (renamed from pyserial/serial/__init__.py)0
-rw-r--r--serial/serialcli.py (renamed from pyserial/serial/serialcli.py)0
-rw-r--r--serial/serialjava.py (renamed from pyserial/serial/serialjava.py)0
-rw-r--r--serial/serialposix.py (renamed from pyserial/serial/serialposix.py)0
-rw-r--r--serial/serialutil.py (renamed from pyserial/serial/serialutil.py)0
-rw-r--r--serial/serialwin32.py (renamed from pyserial/serial/serialwin32.py)0
-rw-r--r--serial/sermsdos.py (renamed from pyserial/serial/sermsdos.py)0
-rw-r--r--setup.py (renamed from pyserial/setup.py)0
52 files changed, 0 insertions, 2202 deletions
diff --git a/pyserial/CHANGES.txt b/CHANGES.txt
index a51413a..a51413a 100644
--- a/pyserial/CHANGES.txt
+++ b/CHANGES.txt
diff --git a/pyserial/LICENSE.txt b/LICENSE.txt
index e8664f4..e8664f4 100644
--- a/pyserial/LICENSE.txt
+++ b/LICENSE.txt
diff --git a/pyserial/MANIFEST b/MANIFEST
index 74c907e..74c907e 100644
--- a/pyserial/MANIFEST
+++ b/MANIFEST
diff --git a/pyserial/README.txt b/README.txt
index ce26437..ce26437 100644
--- a/pyserial/README.txt
+++ b/README.txt
diff --git a/pyserial/examples/enhancedserial.py b/examples/enhancedserial.py
index 2c81ae1..2c81ae1 100644
--- a/pyserial/examples/enhancedserial.py
+++ b/examples/enhancedserial.py
diff --git a/pyserial/examples/miniterm.py b/examples/miniterm.py
index 613af3d..613af3d 100644
--- a/pyserial/examples/miniterm.py
+++ b/examples/miniterm.py
diff --git a/pyserial/examples/scan.py b/examples/scan.py
index 439818c..439818c 100644
--- a/pyserial/examples/scan.py
+++ b/examples/scan.py
diff --git a/pyserial/examples/scanwin32.py b/examples/scanwin32.py
index eb5f544..eb5f544 100644
--- a/pyserial/examples/scanwin32.py
+++ b/examples/scanwin32.py
diff --git a/pyserial/examples/setup-miniterm-py2exe.py b/examples/setup-miniterm-py2exe.py
index c28457a..c28457a 100644
--- a/pyserial/examples/setup-miniterm-py2exe.py
+++ b/examples/setup-miniterm-py2exe.py
diff --git a/pyserial/examples/setup_demo.py b/examples/setup_demo.py
index 854c0b9..854c0b9 100644
--- a/pyserial/examples/setup_demo.py
+++ b/examples/setup_demo.py
diff --git a/pyserial/examples/tcp_serial_redirect.py b/examples/tcp_serial_redirect.py
index 4c04294..4c04294 100644
--- a/pyserial/examples/tcp_serial_redirect.py
+++ b/examples/tcp_serial_redirect.py
diff --git a/pyserial/examples/test.py b/examples/test.py
index a059d1e..a059d1e 100644
--- a/pyserial/examples/test.py
+++ b/examples/test.py
diff --git a/pyserial/examples/test_advanced.py b/examples/test_advanced.py
index 2702e1c..2702e1c 100644
--- a/pyserial/examples/test_advanced.py
+++ b/examples/test_advanced.py
diff --git a/pyserial/examples/test_high_load.py b/examples/test_high_load.py
index 2c37fcf..2c37fcf 100644
--- a/pyserial/examples/test_high_load.py
+++ b/examples/test_high_load.py
diff --git a/pyserial/examples/wxSerialConfigDialog.py b/examples/wxSerialConfigDialog.py
index 7085035..7085035 100644
--- a/pyserial/examples/wxSerialConfigDialog.py
+++ b/examples/wxSerialConfigDialog.py
diff --git a/pyserial/examples/wxSerialConfigDialog.wxg b/examples/wxSerialConfigDialog.wxg
index f5e92e0..f5e92e0 100644
--- a/pyserial/examples/wxSerialConfigDialog.wxg
+++ b/examples/wxSerialConfigDialog.wxg
diff --git a/pyserial/examples/wxTerminal.py b/examples/wxTerminal.py
index 646c272..646c272 100644
--- a/pyserial/examples/wxTerminal.py
+++ b/examples/wxTerminal.py
diff --git a/pyserial/examples/wxTerminal.wxg b/examples/wxTerminal.wxg
index 183f876..183f876 100644
--- a/pyserial/examples/wxTerminal.wxg
+++ b/examples/wxTerminal.wxg
diff --git a/pyparallel/CHANGES.txt b/pyparallel/CHANGES.txt
deleted file mode 100644
index 94b0269..0000000
--- a/pyparallel/CHANGES.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Version 0.1 29 Jul 2002
- added to CVS
-
-Version 0.2 27 Jan 2005
- Windows version now using ctypes \ No newline at end of file
diff --git a/pyparallel/LICENSE.txt b/pyparallel/LICENSE.txt
deleted file mode 100644
index 2b0e2d8..0000000
--- a/pyparallel/LICENSE.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-Copyright (c) 2002 Chris Liechti <cliechti@gmx.net>;
-All Rights Reserved.
-
-This is the Python license. In short, you can use this product in
-commercial and non-commercial applications, modify it, redistribute it.
-A notification to the author when you use and/or modify it is welcome.
-
-
-TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING THIS SOFTWARE
-===================================================================
-
-LICENSE AGREEMENT
------------------
-
-1. This LICENSE AGREEMENT is between the copyright holder of this
-product, and the Individual or Organization ("Licensee") accessing
-and otherwise using this product in source or binary form and its
-associated documentation.
-
-2. Subject to the terms and conditions of this License Agreement,
-the copyright holder hereby grants Licensee a nonexclusive,
-royalty-free, world-wide license to reproduce, analyze, test,
-perform and/or display publicly, prepare derivative works, distribute,
-and otherwise use this product alone or in any derivative version,
-provided, however, that copyright holders License Agreement and
-copyright holders notice of copyright are retained in this product
-alone or in any derivative version prepared by Licensee.
-
-3. In the event Licensee prepares a derivative work that is based on
-or incorporates this product or any part thereof, and wants to make
-the derivative work available to others as provided herein, then
-Licensee hereby agrees to include in any such work a brief summary of
-the changes made to this product.
-
-4. The copyright holder is making this product available to Licensee on
-an "AS IS" basis. THE COPYRIGHT HOLDER MAKES NO REPRESENTATIONS OR
-WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION,
-THE COPYRIGHT HOLDER MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR
-THAT THE USE OF THIS PRODUCT WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
-
-5. THE COPYRIGHT HOLDER SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER
-USERS OF THIS PRODUCT FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL
-DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE
-USING THIS PRODUCT, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE
-POSSIBILITY THEREOF.
-
-6. This License Agreement will automatically terminate upon a material
-breach of its terms and conditions.
-
-7. Nothing in this License Agreement shall be deemed to create any
-relationship of agency, partnership, or joint venture between the
-copyright holder and Licensee. This License Agreement does not grant
-permission to use trademarks or trade names from the copyright holder
-in a trademark sense to endorse or promote products or services of
-Licensee, or any third party.
-
-8. By copying, installing or otherwise using this product, Licensee
-agrees to be bound by the terms and conditions of this License
-Agreement.
-
diff --git a/pyparallel/MANIFEST b/pyparallel/MANIFEST
deleted file mode 100644
index 653a05e..0000000
--- a/pyparallel/MANIFEST
+++ /dev/null
@@ -1,23 +0,0 @@
-README.txt
-LICENSE.txt
-CHANGES.txt
-setup.py
-parallel/__init__.py
-parallel/parallelwin32.py
-parallel/parallelppdev.py
-examples/test.py
-src/win32/_pyparallel.c
-src/win32/simpleio.c
-src/win32/simpleio.dll
-src/win32/makefile
-src/win32/README.txt
-src/win32/install_giveio.bat
-src/win32/remove_giveio.bat
-src/win32/giveio.sys
-src/win32/giveio/GIVEIO.C
-src/win32/giveio/MAKEFILE
-src/win32/giveio/README.TXT
-src/win32/giveio/SOURCES
-src/win32/loaddrv_console/loaddrv.c
-src/win32/loaddrv_console/loaddrv.h
-src/win32/loaddrv_console/makefile
diff --git a/pyparallel/README.txt b/pyparallel/README.txt
deleted file mode 100644
index 0e180ee..0000000
--- a/pyparallel/README.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-pyParallel [in developement]
-============================
-
-Overview
---------
-This module encapsulates the access for the parallel port. It provides
-backends for Python running on Windows and Linux. Other platforms are
-possible too but not yet integrated.
-
-This module is still under developement. But it may be useful for
-developers.
-The windows version needs a compiled extension and the giveio.sys driver
-for Windows NT/2k/XP. It uses ctypes to access functions in a prebuilt DLL.
-
-It is released under a free software license, see LICENSE.txt for more
-details.
-
-(C) 2001-2005 Chris Liechti cliechti@gmx.net
-
-Homepage: http://pyserial.sf.net
-
-Features
---------
- * same class based interface on all supported platforms
- * port numbering starts at zero, no need to know the port name in the
- user program
- * port string (device name) can be specified if access through numbering
- is inappropriate
-
-Requirements
-------------
- * Python 2.2 or newer
- * "Java Communications" (JavaComm) extension for Java/Jython
-
-Installation
-------------
-Extract files from the archive, open a shell/console in that directory and
-let Disutils do the rest:
-python setup.py install
-
-The files get installed in the "Lib/site-packages" directory in newer
-Python versions.
-
-Short introduction
-------------------
->>> import parallel
->>> p = parallel.Parallel() #open LPT1
->>> p.setData(0x55)
-
-Examples
---------
-Please look in the CVS Repository. There is an example directory where you
-can find a simple terminal and more.
-http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pyserial/pyparallel/examples/
-
-References
-----------
- * Python: http://www.python.org
- * Jython: http://www.jython.org
- * Java@IBM http://www-106.ibm.com/developerworks/java/jdk/ (JavaComm
- links are on the download page for the respecive platform jdk)
- * Java@SUN http://java.sun.com/products/
diff --git a/pyparallel/examples/lcd.py b/pyparallel/examples/lcd.py
deleted file mode 100644
index 8e1c66b..0000000
--- a/pyparallel/examples/lcd.py
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/env python
-# character LCD example for pyparallel
-#
-#(C) 2002 Chris Liechti <cliechti@gmx.net>
-# this is distributed under a free software license, see license.txt
-
-import sys, time
-sys.path.insert(0, '..')
-import parallel
-
-LCDON = 0x01 #0x00000001 Switch on display
-LCDOFF = 0x08 #0x00001000 Switch off display
-LCDCLEAR = 0x01 #0x00000001
-LCDLINE1 = 0x80 #0x10000000
-LCDLINE2 = 0xc0 #0x11000000
-LCDCURSORON = 0x0f #0x00001111 turn on cursor blinking
-LCDCURSOROFF = 0x0c #0x00001100 Disable cursor blinking. The cursor is hidden.
-LCDCGADRSET = 0x40 #0b01000000
-LCDDDADRSET = 0x80 #0b10000000
-LCD2LINES = 0x28 #0b00101000 Set display mode to two lines.
-LCD8BITS = 0x30 #0b00110000 select 8 Bit interface
-LCD4BITS = 0x20 #0b00100000 select 4 Bit interface
-LCD_DATA_OFF = 0x05 #0x00000101 mask used to clear the data lines
-
-LCD_RS = 1<<1
-LCD_RW = 1<<2
-LCD_E = 1<<3
-LCD_D4 = 1<<4
-LCD_D5 = 1<<5
-LCD_D6 = 1<<6
-LCD_D7 = 1<<7
-
-
-class FourBitIO(object):
- def __init__(self):
- self.data = 0
-
- self.out(0) #reset pins
- time.sleep(0.050) #wait more than 30ms
- #send the reset sequece (3 times the same pattern)
- self.out(LCD8BITS) #set 8 bit interface
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.005) #wait a bit
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.005) #wait a bit
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.005) #wait a bit
-
- self.out(LCD4BITS) #now set up the 4 bit interface
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.002) #wait until instr is finished
- self.instr(LCD2LINES) #set 2 lines display
- self.instr(LCDCURSOROFF) #hide cursor
- self.instr(LCDCLEAR) #clear display
-
- #my connector has the wrong pinorder....
- #better swap them in software than to solder ;-)
- def reveseout(self, x):
- r = ((x & (1<<0) and 1) << 7) |\
- ((x & (1<<1) and 1) << 6) |\
- ((x & (1<<2) and 1) << 5) |\
- ((x & (1<<3) and 1) << 4) |\
- ((x & (1<<4) and 1) << 3) |\
- ((x & (1<<5) and 1) << 2) |\
- ((x & (1<<6) and 1) << 1) |\
- ((x & (1<<7) and 1) << 0)
- #print "%02x" % r, "%02x" %x
- self.p.setData(r)
-
- def toggleE(self):
- """toggle enable pin"""
- self.data |= LCD_E; #toggle LCD_E, the enable pin
- self.reveseout(self.data)
- self.data &= ~LCD_E; #back to inactive position
- self.reveseout(self.data)
-
- def out(self, data):
- """set data to LCD port"""
- self.data = data
- self.reveseout(self.data)
-
- def instr(self, cmd):
- """send instruction byte to LCD"""
- self.out(cmd & 0xf0) #output upper nibble
- self.toggleE() #toggle LCD_E, the enable pin
- self.out((cmd << 4) & 0xf0) #and then the lower nibble
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.001) #wait until instr is finished
-
- def putc(self, c):
- """send a data byte to the LCD"""
- c = ord(c)
- self.out((c & 0xf0) | LCD_RS) #output upper nibble
- self.toggleE() #toggle LCD_E, the enable pin
- self.out(((c << 4) & 0xf0) | LCD_RS) #and then the lower nibble
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.001) #wait until instr is finished
-
-
-class EightBitIO(object):
- def __init__(self):
- self.data = 0
-
- self.setRS(0)
- self.setRW(0)
- self.out(0) #reset pins
- time.sleep(0.050) #wait more than 30ms
- #send the reset sequece (3 times the same pattern)
- self.out(LCD8BITS) #set 8 bit interface
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.005) #wait a bit
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.005) #wait a bit
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.005) #wait a bit
-
- #~ self.instr(LCD2LINES) #set 2 lines display
- self.instr(LCDCURSOROFF) #hide cursor
- self.instr(LCDCLEAR) #clear display
-
- def setRW(self, state):
- self.p.setAutoFeed(state)
-
- def setRS(self, state):
- self.p.setInitOut(state)
-
- def toggleE(self):
- """toggle enable pin"""
- self.p.setDataStrobe(1) #toggle LCD_E, the enable pin
- #~ time.sleep(0.001)
- self.p.setDataStrobe(0) #back to inactive position
- #~ time.sleep(0.001)
-
- def out(self, data):
- """set data to LCD port"""
- self.data = data
- self.p.setData(self.data)
-
- def instr(self, cmd):
- """send instruction byte to LCD"""
- self.setRS(0)
- self.setRW(0)
- self.out(cmd)
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.005) #wait until instr is finished
-
- def putc(self, c):
- """send a data byte to the LCD"""
- self.setRS(1)
- self.setRW(0)
- self.out(ord(c))
- self.toggleE() #toggle LCD_E, the enable pin
- time.sleep(0.001) #wait until instr is finished
-
-
-#~ class HD44780(FourBitIO):
-class HD44780(EightBitIO):
- def __init__(self):
- self.p = parallel.Parallel()
- super(HD44780, self).__init__()
-
- def write(self, str):
- """write a string to the LCD"""
- for c in str:
- self.putc(c) #write each character
-
- def downloadFont(self, fontdata):
- """Set the memory pointer and download a font"""
- self.instr(LCDCGADRSET);
- self.write(fontdata)
- self.instr(LCDLINE1) #just in case, set cursor to a visible pos
-
-if __name__ == '__main__':
- lcd = HD44780()
- lcd.write("Hello World")
- lcd.instr(LCDLINE2)
- lcd.write("from Python")
-## for c in map(chr,range(256)):
-## lcd.instr(LCDLINE1)
-## lcd.write(c)
-
- \ No newline at end of file
diff --git a/pyparallel/makefile b/pyparallel/makefile
deleted file mode 100644
index 182cf58..0000000
--- a/pyparallel/makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
- ./setup.py build --compiler=mingw32
- cp build/lib.win32-2.2/_pyparallel.pyd ./parallel
-
-installer: all
- ./setup.py bdist_wininst
diff --git a/pyparallel/parallel/__init__.py b/pyparallel/parallel/__init__.py
deleted file mode 100644
index 6eda881..0000000
--- a/pyparallel/parallel/__init__.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python
-#portable parallel port access with python
-#this is a wrapper module for different platform implementations
-#
-# (C)2001-2002 Chris Liechti <cliechti@gmx.net>
-# this is distributed under a free software license, see license.txt
-
-import sys, os, string
-VERSION = string.split("$Revision: 1.4 $")[1] #extract CVS version
-
-#chose an implementation, depending on os
-if os.name == 'nt':
- from parallelwin32 import *
-elif os.name == 'posix':
- if sys.platform == 'linux2':
- from parallelppdev import * #linux, kernel 2.4
- else:
- from parallelioctl import * #IOCTLs
-elif os.name == 'java':
- from paralleljava import *
-else:
- raise "Sorry no implementation for your platform available."
diff --git a/pyparallel/parallel/parallelppdev.py b/pyparallel/parallel/parallelppdev.py
deleted file mode 100644
index df9cf2d..0000000
--- a/pyparallel/parallel/parallelppdev.py
+++ /dev/null
@@ -1,591 +0,0 @@
-#!/usr/bin/env python
-# parallel port access using the ppdev driver
-
-import sys
-import struct
-import fcntl
-import os
-
-#----
-# Generated by h2py 0.1.1 from <linux/ppdev.h>,
-# then cleaned up a bit by Michael P. Ashton and then a gain by chris ;-)
-# Changes for Python2.2 support (c) September 2004 Alex.Perry@qm.com
-
-
-def sizeof(type): return struct.calcsize(type)
-def _IOC(dir, type, nr, size): return int((dir << _IOC_DIRSHIFT ) | (type << _IOC_TYPESHIFT ) |\
- (nr << _IOC_NRSHIFT ) | (size << _IOC_SIZESHIFT))
-def _IO(type, nr): return _IOC(_IOC_NONE, type, nr, 0)
-def _IOR(type,nr,size): return _IOC(_IOC_READ, type, nr, sizeof(size))
-def _IOW(type,nr,size): return _IOC(_IOC_WRITE, type, nr, sizeof(size))
-
-_IOC_SIZEBITS = 14
-_IOC_SIZEMASK = (1L << _IOC_SIZEBITS ) - 1
-_IOC_NRSHIFT = 0
-_IOC_NRBITS = 8
-_IOC_TYPESHIFT = _IOC_NRSHIFT + _IOC_NRBITS
-_IOC_TYPEBITS = 8
-_IOC_SIZESHIFT = _IOC_TYPESHIFT + _IOC_TYPEBITS
-IOCSIZE_MASK = _IOC_SIZEMASK << _IOC_SIZESHIFT
-IOCSIZE_SHIFT = _IOC_SIZESHIFT
-
-# Python 2.2 uses a signed int for the ioctl() call, so ...
-if ( sys.version_info[0] < 3 ) or ( sys.version_info[1] < 3 ):
- _IOC_WRITE = 1L
- _IOC_READ = -2L
- _IOC_INOUT = -1L
-else:
- _IOC_WRITE = 1L
- _IOC_READ = 2L
- _IOC_INOUT = 3L
-
-_IOC_DIRSHIFT = _IOC_SIZESHIFT + _IOC_SIZEBITS
-IOC_INOUT = _IOC_INOUT << _IOC_DIRSHIFT
-IOC_IN = _IOC_WRITE << _IOC_DIRSHIFT
-IOC_OUT = _IOC_READ << _IOC_DIRSHIFT
-
-_IOC_NONE = 0
-PP_IOCTL = ord('p')
-PPCLAIM = _IO(PP_IOCTL, 0x8b)
-PPCLRIRQ = _IOR(PP_IOCTL, 0x93, 'i')
-
-PPDATADIR = _IOW(PP_IOCTL, 0x90, 'i')
-PPEXCL = _IO(PP_IOCTL, 0x8f)
-PPFCONTROL = _IOW(PP_IOCTL, 0x8e, 'BB')
-PPGETFLAGS = _IOR(PP_IOCTL, 0x9a, 'i')
-PPGETMODE = _IOR(PP_IOCTL, 0x98, 'i')
-PPGETMODES = _IOR(PP_IOCTL, 0x97, 'I')
-PPGETPHASE = _IOR(PP_IOCTL, 0x99, 'i')
-PPGETTIME = _IOR(PP_IOCTL, 0x95, 'll')
-PPNEGOT = _IOW(PP_IOCTL, 0x91, 'i')
-PPRCONTROL = _IOR(PP_IOCTL, 0x83, 'B')
-PPRDATA = _IOR(PP_IOCTL, 0x85, 'B')
-#'OBSOLETE__IOR' undefined in 'PPRECONTROL'
-PPRELEASE = _IO(PP_IOCTL, 0x8c)
-#'OBSOLETE__IOR' undefined in 'PPRFIFO'
-PPRSTATUS = _IOR(PP_IOCTL, 0x81, 'B')
-PPSETFLAGS = _IOW(PP_IOCTL, 0x9b, 'i')
-PPSETMODE = _IOW(PP_IOCTL, 0x80, 'i')
-PPSETPHASE = _IOW(PP_IOCTL, 0x94, 'i')
-PPSETTIME = _IOW(PP_IOCTL, 0x96, 'll')
-PPWCONTROL = _IOW(PP_IOCTL, 0x84, 'B')
-PPWCTLONIRQ = _IOW(PP_IOCTL, 0x92, 'B')
-PPWDATA = _IOW(PP_IOCTL, 0x86, 'B')
-#'OBSOLETE__IOW' undefined in 'PPWECONTROL'
-#'OBSOLETE__IOW' undefined in 'PPWFIFO'
-#'OBSOLETE__IOW' undefined in 'PPWSTATUS'
-PPYIELD = _IO(PP_IOCTL, 0x8d)
-PP_FASTREAD = 1 << 3
-PP_FASTWRITE = 1 << 2
-PP_W91284PIC = 1 << 4
-PP_FLAGMASK = PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC
-PP_MAJOR = 99
-_ASMI386_IOCTL_H= None
-_IOC_DIRBITS = 2
-_IOC_DIRMASK = (1 << _IOC_DIRBITS) - 1
-_IOC_NRMASK = (1 << _IOC_NRBITS) - 1
-_IOC_TYPEMASK = (1 << _IOC_TYPEBITS ) - 1
-
-def _IOC_DIR(nr): return (nr >> _IOC_DIRSHIFT) & _IOC_DIRMASK
-def _IOC_NR(nr): return (nr >> _IOC_NRSHIFT) & _IOC_NRMASK
-def _IOC_SIZE(nr): return (nr >> _IOC_SIZESHIFT) & _IOC_SIZEMASK
-def _IOC_TYPE(nr): return (nr >> _IOC_TYPESHIFT) & _IOC_TYPEMASK
-def _IOWR(type, nr, size): return _IOC(_IOC_READ | _IOC_WRITE, type, nr , sizeof(size))
-
-__ELF__ = 1
-__i386 = 1
-__i386__ = 1
-__linux = 1
-__linux__ = 1
-__unix = 1
-__unix__ = 1
-i386 = 1
-linux = 1
-unix = 1
-
-#-------- Constants from <linux/parport.h>
-
-PARPORT_CONTROL_STROBE = 0x1
-PARPORT_CONTROL_AUTOFD = 0x2
-PARPORT_CONTROL_INIT = 0x4
-PARPORT_CONTROL_SELECT = 0x8
-PARPORT_STATUS_ERROR = 8
-PARPORT_STATUS_SELECT = 0x10
-PARPORT_STATUS_PAPEROUT = 0x20
-PARPORT_STATUS_ACK = 0x40
-PARPORT_STATUS_BUSY = 0x80
-
-IEEE1284_MODE_NIBBLE = 0
-IEEE1284_MODE_BYTE = 1
-IEEE1284_MODE_COMPAT = 1<<8
-IEEE1284_MODE_BECP = 1<<9
-IEEE1284_MODE_ECP = 1<<4
-IEEE1284_MODE_ECPRLE = IEEE1284_MODE_ECP | (1<<5)
-IEEE1284_MODE_ECPSWE = 1<<10
-IEEE1284_MODE_EPP = 1<<6
-IEEE1284_MODE_EPPSL = 1<<11
-IEEE1284_MODE_EPPSWE = 1<<12
-IEEE1284_DEVICEID = 1<<2
-IEEE1284_EXT_LINK = 1<<14
-
-IEEE1284_ADDR = 1<<13
-IEEE1284_DATA = 0
-
-PARPORT_EPP_FAST = 1
-PARPORT_W91284PIC = 2
-#----
-
-class Parallel:
- """Class for controlling the pins on a parallel port
-
- This class provides bit-level access to the pins on a PC parallel
- port. It is primarily designed for programs which must control
- special circuitry - most often non-IEEE-1284-compliant devices
- other than printers - using 'bit-banging' techniques.
-
- The current implementation makes ioctl() calls to the Linux ppdev
- driver, using the Python fcntl library. It might be rewritten in
- C for extra speed. This particular implementation is written for
- Linux; all of the upper-level calls can be ported to Windows as
- well.
-
- On Linux, the ppdev device driver, from the Linux 2.4 parallel
- port subsystem, is used to control the parallel port hardware.
- This driver must be made available from a kernel compile. The
- option is called "Support user-space parallel-port drivers". When
- using the module, be sure to unload the lp module first: usually
- the lp module claims exclusive access to the parallel port, and if
- it is loaded, this class will fail to open the parallel port file,
- and throw an exception.
-
- The primary source of information about the Linux 2.4 parallel
- port subsystem is Tim Waugh's documentation, the source for which
- is available in the kernel tree. This document (called,
- appropriately enough, "The Linux 2.4 Parallel Port Subsystem"),
- thoroughly describes the parallel port drivers and how to use
- them.
-
- This class provides a method for each of the ioctls supported by
- the ppdev module. The ioctl methods are named, in uppercase, the
- same as the ioctls they invoke. The documentation for these
- methods was taken directly from the documentation for their
- corresponding ioctl, and modified only where necessary.
-
- Unless you have special reason to use the Linux ioctls, you should
- use instead the upper-level functions, which are named in
- lowerCase fashion and should be portable between Linux and
- Windows. This way, any code you write for this class will (or
- should) also work with the Windows version of this class.
-
- """
- def __init__(self, port = 0):
- if type(port) == type(""):
- self.device = port
- else:
- self.device = "/dev/parport%d" % port
- self._fd = None
- self._fd = os.open(self.device, os.O_RDWR)
- try:
- self.PPEXCL()
- self.PPCLAIM()
- self.setDataDir(1)
- self.setData(0)
- except IOError:
- os.close(self._fd)
- self._fd = None
- raise
-
- def __del__(self):
- if self._fd is not None:
- self.PPRELEASE()
- os.close(self._fd)
-
- def timevalToFloat(self, timeval):
- t=struct.unpack('ll', timeval)
- return t[0] + (t[1]/1000000.0)
-
- def floatToTimeval(self, time):
- sec = int(time)
- usec = int(time*1000000.0)
- return struct.pack('ll', sec, usec)
-
- def PPCLAIM(self):
- """
- Claims access to the port. As a user-land device driver
- writer, you will need to do this before you are able to
- actually change the state of the parallel port in any
- way. Note that some operations only affect the ppdev driver
- and not the port, such as PPSETMODE; they can be performed
- while access to the port is not claimed.
- """
- fcntl.ioctl(self._fd, PPCLAIM)
-
- def PPEXCL(self):
- """
- Instructs the kernel driver to forbid any sharing of the port
- with other drivers, i.e. it requests exclusivity. The PPEXCL
- command is only valid when the port is not already claimed for
- use, and it may mean that the next PPCLAIM ioctl will fail:
- some other driver may already have registered itself on that
- port.
-
- Most device drivers don't need exclusive access to the
- port. It's only provided in case it is really needed, for
- example for devices where access to the port is required for
- extensive periods of time (many seconds).
-
- Note that the PPEXCL ioctl doesn't actually claim the port
- there and then---action is deferred until the PPCLAIM ioctl is
- performed.
- """
- fcntl.ioctl(self._fd, PPEXCL)
-
- def PPRELEASE(self):
- """
- Releases the port. Releasing the port undoes the effect of
- claiming the port. It allows other device drivers to talk to
- their devices (assuming that there are any).
- """
- fcntl.ioctl(self._fd, PPRELEASE)
-
- def PPYIELD(self):
- """
- Yields the port to another driver. This ioctl is a kind of
- short-hand for releasing the port and immediately reclaiming
- it. It gives other drivers a chance to talk to their devices,
- but afterwards claims the port back. An example of using this
- would be in a user-land printer driver: once a few characters
- have been written we could give the port to another device
- driver for a while, but if we still have characters to send to
- the printer we would want the port back as soon as possible.
-
- It is important not to claim the parallel port for too long,
- as other device drivers will have no time to service their
- devices. If your device does not allow for parallel port
- sharing at all, it is better to claim the parallel port
- exclusively (see PPEXCL).
- """
- fcntl.ioctl(self._fd, PPYIELD)
-
- def PPNEGOT(self, mode):
- """
- Performs IEEE 1284 negotiation into a particular
- mode. Briefly, negotiation is the method by which the host and
- the peripheral decide on a protocol to use when transferring
- data.
-
- An IEEE 1284 compliant device will start out in compatibility
- mode, and then the host can negotiate to another mode (such as
- ECP).
-
- The 'mode' parameter should be one of the following constants
- from PPDEV:
-
- - IEEE1284_MODE_COMPAT
- - IEEE1284_MODE_NIBBLE
- - IEEE1284_MODE_BYTE
- - IEEE1284_MODE_EPP
- - IEEE1284_MODE_ECP
-
- The PPNEGOT ioctl actually does two things: it performs the
- on-the-wire negotiation, and it sets the behaviour of
- subsequent read/write calls so that they use that mode (but
- see PPSETMODE).
- """
- fcntl.ioctl(self._fd, PPNEGOT, struct.pack('i', mode))
-
- def PPSETMODE(self, mode):
- """
- Sets which IEEE 1284 protocol to use for the read and write
- calls.
-
- The 'mode' parameter should be one of the following constants
- from PPDEV:
-
- - IEEE1284_MODE_COMPAT
- - IEEE1284_MODE_NIBBLE
- - IEEE1284_MODE_BYTE
- - IEEE1284_MODE_EPP
- - IEEE1284_MODE_ECP
- """
- fcntl.ioctl(self._fd, PPSETMODE, struct.pack('i', mode))
-
- def PPGETMODE(self):
- """
- Retrieves the IEEE 1284 mode being used for read and
- write. The return value is one of the following constants
- from PPDEV:
-
- - IEEE1284_MODE_COMPAT
- - IEEE1284_MODE_NIBBLE
- - IEEE1284_MODE_BYTE
- - IEEE1284_MODE_EPP
- - IEEE1284_MODE_ECP
- """
- ret = struct.pack('i', 0)
- ret = fcntl.ioctl(self._fd, PPGETMODE, ret)
- return struct.unpack('i', ret)[0]
-
- def PPGETTIME(self):
- """
- Retrieves the time-out value. The read and write calls will
- time out if the peripheral doesn't respond quickly enough. The
- PPGETTIME ioctl retrieves the length of time that the
- peripheral is allowed to have before giving up.
-
- Returns the timeout value in seconds as a floating-point value.
- """
- ret = struct.pack('ll', 0, 0)
- ret = fcntl.ioctl(self._fd, PPGETTIME, ret)
- return timevalToFloat(ret)
-
- def PPSETTIME(self, time):
- """
- Sets the time-out (see PPGETTIME for more information).
- 'time' is the new time-out in seconds; floating-point values
- are acceptable.
- """
- fcntl.ioctl(self._fd, PPSETTIME, floatToTimeval(time))
-
- def PPGETMODES(self):
- """
- Retrieves the capabilities of the hardware (i.e. the modes
- field of the parport structure).
- """
- raise NotImplementedError
-
- def PPSETFLAGS(self):
- """
- Sets flags on the ppdev device which can affect future I/O
- operations. Available flags are:
-
- - PP_FASTWRITE
- - PP_FASTREAD
- - PP_W91284PIC
- """
- raise NotImplementedError
-
- def PPWCONTROL(self, lines):
- """
- Sets the control lines. The 'lines' parameter is a bitwise OR
- of the following constants from PPDEV:
-
- - PARPORT_CONTROL_STROBE
- - PARPORT_CONTROL_AUTOFD
- - PARPORT_CONTROL_INIT
- - PARPORT_CONTROL_SELECT
- """
- fcntl.ioctl(self._fd, PPWCONTROL, struct.pack('B', lines))
-
- def PPRCONTROL(self):
- """
- Returns the last value written to the control register, in the
- form of an integer, for which each bit corresponds to a control
- line (although some are unused).
-
- This doesn't actually touch the hardware; the last value
- written is remembered in software. This is because some
- parallel port hardware does not offer read access to the
- control register.
-
- The control lines bits are defined by the following constants
- from PPDEV:
-
- - PARPORT_CONTROL_STROBE
- - PARPORT_CONTROL_AUTOFD
- - PARPORT_CONTROL_SELECT
- - PARPORT_CONTROL_INIT
- """
- ret = struct.pack('B',0)
- ret = fcntl.ioctl(self._fd, PPRCONTROL, ret)
- return struct.unpack('B', ret)[0]
-
- def PPFCONTROL(self, mask, val):
- """
- Frobs the control lines. Since a common operation is to change
- one of the control signals while leaving the others alone, it
- would be quite inefficient for the user-land driver to have to
- use PPRCONTROL, make the change, and then use PPWCONTROL. Of
- course, each driver could remember what state the control
- lines are supposed to be in (they are never changed by
- anything else), but in order to provide PPRCONTROL, ppdev must
- remember the state of the control lines anyway.
-
- The PPFCONTROL ioctl is for "frobbing" control lines, and is
- like PPWCONTROL but acts on a restricted set of control
- lines. The ioctl parameter is a pointer to a struct
- ppdev_frob_struct:
-
- struct ppdev_frob_struct {
- unsigned char mask;
- unsigned char val;
- };
-
- The mask and val fields are bitwise ORs of control line names
- (such as in PPWCONTROL). The operation performed by PPFCONTROL
- is:
-
- new_ctr = (old_ctr & ~mask) | val
-
- In other words, the signals named in mask are set to the
- values in val.
- """
- fcntl.ioctl(self._fd, PPFCONTROL, struct.pack('BB', mask, val))
-
- def PPRSTATUS(self):
- """
- Returns an unsigned char containing bits set for each status
- line that is set (for instance, PARPORT_STATUS_BUSY). The
- ioctl parameter should be a pointer to an unsigned char.
- """
- ret = struct.pack('B',0)
- ret = fcntl.ioctl(self._fd, PPRSTATUS, ret)
- return struct.unpack('B', ret)[0]
-
- def PPDATADIR(self, out):
- """
- Controls the data line drivers. Normally the computer's
- parallel port will drive the data lines, but for byte-wide
- transfers from the peripheral to the host it is useful to turn
- off those drivers and let the peripheral drive the
- signals. (If the drivers on the computer's parallel port are
- left on when this happens, the port might be damaged.)
- This is only needed in conjunction with PPWDATA or PPRDATA.
-
- The 'out' parameter indicates the desired port direction. If
- 'out' is true or non-zero, the drivers are turned on (forward
- direction); otherwise, the drivers are turned off (reverse
- direction).
- """
- if out:
- msg=struct.pack('i',0)
- else:
- msg=struct.pack('i',1)
- fcntl.ioctl(self._fd, PPDATADIR, msg)
-
- def PPWDATA(self, byte):
- """
- Sets the data lines (if in forward mode). The ioctl parameter
- is a pointer to an unsigned char.
- """
- fcntl.ioctl(self._fd, PPWDATA,struct.pack('B',byte))
-
- def PPRDATA(self):
- """
- Reads the data lines (if in reverse mode). The ioctl parameter
- is a pointer to an unsigned char.
- """
- ret=struct.pack('B',0)
- ret=fcntl.ioctl(self._fd, PPRDATA,ret)
- return struct.unpack('B',ret)[0]
-
- def PPCLRIRQ(self):
- """
- Returns the current interrupt count, and clears it. The ppdev
- driver keeps a count of interrupts as they are triggered.
- """
- ret=struct.pack('i',0)
- ret=fcntl.ioctl(self._fd, PPCLRIRQ,ret)
- return struct.unpack('i',ret)[0]
-
- def PPWCTLONIRQ(self, lines):
- """
- Set a trigger response. Afterwards when an interrupt is
- triggered, the interrupt handler will set the control lines as
- requested. The ioctl parameter is a pointer to an unsigned
- char, which is interpreted in the same way as for PPWCONTROL.
-
- The reason for this ioctl is simply speed. Without this ioctl,
- responding to an interrupt would start in the interrupt
- handler, switch context to the user-land driver via poll or
- select, and then switch context back to the kernel in order to
- handle PPWCONTROL. Doing the whole lot in the interrupt
- handler is a lot faster.
- """
- fcntl.ioctl(self._fd, PPWCTLONIRQ,struct.pack('B',lines))
-
- #data lines
-## def data(self):
-## """Returns the states of the data bus line drivers (pins 2-9)"""
-## return self._data
-
- def setDataDir(self,out):
- """Activates or deactivates the data bus line drivers (pins 2-9)"""
- self._dataDir = out
- self.PPDATADIR(out)
-
- def dataDir(self):
- """Returns true if the data bus line drivers are on (pins 2-9)"""
- return self._dataDir
-
- #control lines
-## def strobe(self):
-## """Returns the state of the nStrobe output (pin 1)"""
-## return (self.PPRCONTROL()&PARPORT_CONTROL_STROBE)==0
-
- def setDataStrobe(self, level):
- """Sets the state of the nStrobe output (pin 1)"""
- if level:
- self.PPFCONTROL(PARPORT_CONTROL_STROBE, 0)
- else:
- self.PPFCONTROL(PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE)
-
-## def autoFd(self):
-## """Returns the state of the nAutoFd output (pin 14)"""
-## return (self.PPRCONTROL()&PARPORT_CONTROL_AUTOFD)==0
-
- def setAutoFeed(self, level):
- """Sets the state of the nAutoFd output (pin 14)"""
- if level:
- self.PPFCONTROL(PARPORT_CONTROL_AUTOFD, 0)
- else:
- self.PPFCONTROL(PARPORT_CONTROL_AUTOFD, PARPORT_CONTROL_AUTOFD)
-
-## def init(self):
-## """Returns the state of the nInit output (pin 16)"""
-## return (self.PPRCONTROL()&PARPORT_CONTROL_INIT)!=0
-
- def setInitOut(self, level):
- """Sets the state of the nInit output (pin 16)"""
- if level:
- self.PPFCONTROL(PARPORT_CONTROL_INIT, PARPORT_CONTROL_INIT)
- else:
- self.PPFCONTROL(PARPORT_CONTROL_INIT, 0)
-
-## def selectIn(self):
-## """Returns the state of the nSelectIn output (pin 17)"""
-## return (self.PPRCONTROL()&PARPORT_CONTROL_SELECT)==0
-
- def setSelect(self,level):
- """Sets the state of the nSelectIn output (pin 17)"""
- if level:
- self.PPFCONTROL(PARPORT_CONTROL_SELECT, 0)
- else:
- self.PPFCONTROL(PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT)
-
- def setData(self,d):
- """Sets the states of the data bus line drivers (pins 2-9)"""
- self._data=d
- return self.PPWDATA(d)
-
- #status lines
- def getInError(self):
- """Returns the level on the nFault pin (15)"""
- return (self.PPRSTATUS() & PARPORT_STATUS_ERROR) != 0
-
- def getInSelected(self):
- """Returns the level on the Select pin (13)"""
- return (self.PPRSTATUS() & PARPORT_STATUS_SELECT) != 0
-
- def getInPaperOut(self):
- """Returns the level on the paperOut pin (12)"""
- return (self.PPRSTATUS() & PARPORT_STATUS_PAPEROUT) != 0
-
- def getInAcknowledge(self):
- """Returns the level on the nAck pin (10)"""
- return (self.PPRSTATUS() & PARPORT_STATUS_ACK) != 0
-
- def getInBusy(self):
- """Returns the level on the Busy pin (11)"""
- return (self.PPRSTATUS() & PARPORT_STATUS_BUSY) == 0
-
diff --git a/pyparallel/parallel/parallelutil.py b/pyparallel/parallel/parallelutil.py
deleted file mode 100644
index a1a262a..0000000
--- a/pyparallel/parallel/parallelutil.py
+++ /dev/null
@@ -1,124 +0,0 @@
-class BitaccessMeta(type):
- """meta class that adds bit access properties to a
- parallel port implementation"""
-
- def __new__(self, classname, bases, classdict):
- klass = type.__new__(self, classname, bases, classdict)
- #status lines
- klass.paperOut = property(klass.getInPaperOut, None, "Read the PaperOut signal")
- #control lines
- klass.dataStrobe = property(None, klass.setDataStrobe, "Set the DataStrobe signal")
- #XXX ... other bits
- #data bits
- for bit in range(8):
- mask = (1<<bit)
- def getter(self, mask=mask):
- return (self.getData() & mask) != 0
- def setter(self, b, mask=mask):
- if b:
- self.setData(self.getData() | mask)
- else:
- self.setData(self.getData() & ~mask)
- setattr(klass, "D%d" % bit, property(getter, setter, "Access databit %d" % bit))
- #nibbles
- for name, shift, width in [('D0_D3', 0, 4), ('D4_D7', 4, 4)]:
- mask = (1<<width) - 1
- def getter(self, shift=shift, mask=mask):
- return (self.getData() >> shift) & mask
- def setter(self, b, shift=shift, mask=mask):
- self.setData((self.getData() & ~(mask<<shift)) | ((b&mask) << shift))
- setattr(klass, name, property(getter, setter, "Access to %s" % name))
- return klass
-
-class VirtualParallelPort:
- """provides a virtual parallel port implementation, useful
- for tests and simulations without real hardware"""
-
- __metaclass__ = BitaccessMeta
-
- def __init__(self, port=None):
- self._data = 0
-
- def setData(self, value):
- self._data = value
-
- def getData(self):
- return self._data
-
- #inputs return dummy value
- def getInPaperOut(self): return self._dummy
- #...
- #outputs just store a tuple with (action, value) pair
- def setDataStrobe(self, value): self._last = ('setDataStrobe', value)
- #...
-
-#testing
-if __name__ == '__main__':
- import unittest, sys
-
- class TestBitaccess(unittest.TestCase):
- """Tests a port with no timeout"""
- def setUp(self):
- self.p = VirtualParallelPort()
-
- def testDatabits(self):
- """bit by bit D0..D7"""
- p = self.p
- p.D0 = p.D2 = p.D4 = p.D6 = 1
- self.failUnlessEqual(p._data, 0x55)
- self.failUnlessEqual(
- [p.D7, p.D6, p.D5, p.D4, p.D3, p.D2, p.D1, p.D0],
- [0, 1, 0, 1, 0, 1, 0, 1]
- )
- p._data <<= 1
- self.failUnlessEqual(
- [p.D7, p.D6, p.D5, p.D4, p.D3, p.D2, p.D1, p.D0],
- [1, 0, 1, 0, 1, 0, 1, 0]
- )
-
- def testDatabitsGroups(self):
- """nibbles D0..D7"""
- p = self.p
- p.D0_D3 = 14
- self.failUnlessEqual(p._data, 0x0e)
- p.D0_D3 = 0
- p.D4_D7 = 13
- self.failUnlessEqual(p._data, 0xd0)
- p.D0_D3 = p.D4_D7 = 0xa
- self.failUnlessEqual(p._data, 0xaa)
- #test bit patterns
- for x in range(256):
- #test getting
- p._data = x
- self.failUnlessEqual((p.D4_D7, p.D0_D3), (((x>>4) & 0xf), (x & 0xf)))
- #test setting
- p._data = 0
- (p.D4_D7, p.D0_D3) = (((x>>4) & 0xf), (x & 0xf))
- self.failUnlessEqual(p._data, x)
-
- def testStatusbits(self):
- """bit by bit status lines"""
- #read the property:
- self.p._dummy = 0
- self.failUnlessEqual(self.p.paperOut, 0)
-
- self.p._dummy = 1
- self.failUnlessEqual(self.p.paperOut, 1)
-
- #read only, must not be writable:
- self.failUnlessRaises(AttributeError, setattr, self.p, 'paperOut', 1)
-
- def testControlbits(self):
- """bit by bit control lines"""
- self.p.dataStrobe = 0
- self.failUnlessEqual(self.p._last, ('setDataStrobe', 0))
- self.p.dataStrobe = 1
- self.failUnlessEqual(self.p._last, ('setDataStrobe', 1))
-
- #write only, must not be writable:
- self.failUnlessRaises(AttributeError, getattr, self.p, 'dataStrobe')
-
- sys.argv.append('-v')
- # When this module is executed from the command-line, it runs all its tests
- unittest.main()
- \ No newline at end of file
diff --git a/pyparallel/parallel/parallelwin32.py b/pyparallel/parallel/parallelwin32.py
deleted file mode 100644
index 5754578..0000000
--- a/pyparallel/parallel/parallelwin32.py
+++ /dev/null
@@ -1,131 +0,0 @@
-#pyparallel driver for win32
-#see __init__.py
-#
-#(C) 2002 Chris Liechti <cliechti@gmx.net>
-# this is distributed under a free software license, see license.txt
-#
-# thanks to Dincer Aydin dinceraydin@altavista.net for his work on the
-# winioport module: www.geocities.com/dinceraydin/ the graphic below is
-# borrowed form him ;-)
-
-
-# LPT1 = 0x0378 or 0x03BC
-# LPT2 = 0x0278 or 0x0378
-# LPT3 = 0x0278
-#
-# Data Register (base + 0) ........ outputs
-#
-# 7 6 5 4 3 2 1 0
-# . . . . . . . * D0 ........... (pin 2), 1=High, 0=Low (true)
-# . . . . . . * . D1 ........... (pin 3), 1=High, 0=Low (true)
-# . . . . . * . . D2 ........... (pin 4), 1=High, 0=Low (true)
-# . . . . * . . . D3 ........... (pin 5), 1=High, 0=Low (true)
-# . . . * . . . . D4 ........... (pin 6), 1=High, 0=Low (true)
-# . . * . . . . . D5 ........... (pin 7), 1=High, 0=Low (true)
-# . * . . . . . . D6 ........... (pin 8), 1=High, 0=Low (true)
-# * . . . . . . . D7 ........... (pin 9), 1=High, 0=Low (true)
-#
-# Status Register (base + 1) ...... inputs
-#
-# 7 6 5 4 3 2 1 0
-# . . . . . * * * Undefined
-# . . . . * . . . Error ........ (pin 15), high=1, low=0 (true)
-# . . . * . . . . Selected ..... (pin 13), high=1, low=0 (true)
-# . . * . . . . . No paper ..... (pin 12), high=1, low=0 (true)
-# . * . . . . . . Ack .......... (pin 10), high=1, low=0 (true)
-# * . . . . . . . Busy ......... (pin 11), high=0, low=1 (inverted)
-#
-# ctrl Register (base + 2) ..... outputs
-#
-# 7 6 5 4 3 2 1 0
-# . . . . . . . * Strobe ....... (pin 1), 1=low, 0=high (inverted)
-# . . . . . . * . Auto Feed .... (pin 14), 1=low, 0=high (inverted)
-# . . . . . * . . Initialize ... (pin 16), 1=high,0=low (true)
-# . . . . * . . . Select ....... (pin 17), 1=low, 0=high (inverted)
-# * * * * . . . . Unused
-
-LPT1 = 0
-LPT2 = 1
-
-LPT1_base = 0x0378
-LPT2_base = 0x0278
-
-import ctypes
-import os
-#need to patch PATH so that the DLL can be found and loaded
-os.environ['PATH'] = os.environ['PATH'] + ';' + os.path.abspath(os.path.dirname(__file__))
-#fake module, names of the functions are the same as in the old _pyparallel
-#python extension in earlier versions of this modules
-_pyparallel = ctypes.windll.simpleio
-#need to initialize giveio on WinNT based systems
-if _pyparallel.init():
- raise IOError('Could not access the giveio driver which is required on NT based systems.')
-
-
-class Parallel:
- def __init__(self, port = LPT1):
- if port == LPT1:
- self.dataRegAdr = LPT1_base
- elif port == LPT2:
- self.dataRegAdr = LPT2_base
- else:
- raise ValueError("No such port available - expecting a number")
- self.statusRegAdr = self.dataRegAdr + 1
- self.ctrlRegAdr = self.dataRegAdr + 2
- self.ctrlReg = _pyparallel.inp(self.ctrlRegAdr)
-
- def setData(self, value):
- _pyparallel.outp(self.dataRegAdr, value)
-
- # control register output functions
- def setDataStrobe(self, level):
- """data strobe bit"""
- if level:
- self.ctrlReg = self.ctrlReg & ~0x01
- else:
- self.ctrlReg = self.ctrlReg | 0x01
- _pyparallel.outp(self.ctrlRegAdr, self.ctrlReg)
-
- def setAutoFeed(self, level):
- """auto feed bit"""
- if level:
- self.ctrlReg = self.ctrlReg & ~0x02
- else:
- self.ctrlReg = self.ctrlReg | 0x02
- _pyparallel.outp(self.ctrlRegAdr, self.ctrlReg)
-
- def setInitOut(self, level):
- """initialize bit"""
- if level:
- self.ctrlReg = self.ctrlReg | 0x04
- else:
- self.ctrlReg = self.ctrlReg & ~0x04
- _pyparallel.outp(self.ctrlRegAdr, self.ctrlReg)
-
- def setSelect(self, level):
- """select bit"""
- if level:
- self.ctrlReg = self.ctrlReg & ~0x08
- else:
- self.ctrlReg = self.ctrlReg | 0x08
- _pyparallel.outp(self.ctrlRegAdr, self.ctrlReg)
-
- def getInError(self):
- """Error pin"""
- return _pyparallel.inp(self.statusRegAdr) & 0x08 and 1
-
- def getInSelected(self):
- """select pin"""
- return _pyparallel.inp(self.statusRegAdr) & 0x10 and 1
-
- def getInPaperOut(self):
- """paper out pin"""
- return _pyparallel.inp(self.statusRegAdr) & 0x20 and 1
-
- def getInAcknowledge(self):
- """Acknowledge pin"""
- return _pyparallel.inp(self.statusRegAdr) & 0x40 and 1
-
- def getInBusy(self):
- """input from busy pin"""
- return not (_pyparallel.inp(self.statusRegAdr) & 0x80)
diff --git a/pyparallel/setup.py b/pyparallel/setup.py
deleted file mode 100644
index 937923f..0000000
--- a/pyparallel/setup.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-# setup.py
-try:
- from setuptools import setup
-except ImportError:
- print "standart distutils"
- from distutils.core import setup
-else:
- print "setuptools"
-import sys
-
-#windows installer:
-# python setup.py bdist_wininst
-
-# patch distutils if it can't cope with the "classifiers" or
-# "download_url" keywords
-if sys.version < '2.2.3':
- from distutils.dist import DistributionMetadata
- DistributionMetadata.classifiers = None
- DistributionMetadata.download_url = None
-
-import os
-if os.name == 'nt':
- print "# set dependedcies for windows version"
- data_files = {'parallel': ['simpleio.dll']}
-else:
- print "# no dependedcies"
- data_files = {}
-
-setup(
- name = "pyparallel",
- description="Python Parallel Port Extension",
- version="0.2",
- author="Chris Liechti",
- author_email="cliechti@gmx.net",
- url="http://pyserial.sourceforge.net/",
- packages=['parallel'],
- license="Python",
- long_description="Python Parallel Port Extension for Win32, Linux, BSD",
- classifiers = [
- 'Development Status :: 4 - Beta',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Python Software Foundation License',
- 'Natural Language :: English',
- 'Operating System :: POSIX',
- 'Operating System :: Microsoft :: Windows',
- 'Programming Language :: Python',
- 'Topic :: Communications',
- 'Topic :: Software Development :: Libraries',
- ],
- package_data = data_files
-)
diff --git a/pyparallel/src/win32/README.txt b/pyparallel/src/win32/README.txt
deleted file mode 100644
index 4b6984b..0000000
--- a/pyparallel/src/win32/README.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-New:
-simpleio.c provides inp(), outp(), init() these functions are accessed trough
-ctypes.
-
-Build (cygwin/mingw): run "make" the makfile should care of everything.
-
-- - - - - - - - - - - - -
-Old python extension:
-
-This extension is needed on Windows as there is no API to
-manipulate the parallel port. This Python extension exposes
-"inp()" and "outp()" that can be used to manipulate the printer
-IOs directly. It could be basicaly used to access any IO port.
-
-On Windows NT/2k/XP direct access to IOs is not possible for
-user applications (only kernel mode drivers). Because of that
-a kernel driver is needed. The sources to GIVEIO.SYS are in
-the respective directory. The loaddrv sources come from the
-archive that is mentioned in the giveio readme.
-
-If the extension detects that it is running on an NT based system
-(NT, 2k, XP) it activates the giveio driver to gain access to the
-IO ports. To make this work, the giveio driver must be installed.
-this can be done with the loaddrv tool. The batchfiles
-"install_giveio.bat" and "remove_giveio.bat" do whats needed to
-install or uninstall.
-
-Thanks go to
- Dale Roberts for the giveio driver and to
- Paula Tomlinson for the loaddrv sources
-
-chris <cliechti@gmx.net>
diff --git a/pyparallel/src/win32/_pyparallel.c b/pyparallel/src/win32/_pyparallel.c
deleted file mode 100644
index 6316de0..0000000
--- a/pyparallel/src/win32/_pyparallel.c
+++ /dev/null
@@ -1,69 +0,0 @@
-// Parallel port extension for Win32
-// "inp" and "outp" are used to access the parallelport hardware
-// needs giveio.sys driver on NT/2k/XP
-//
-// (C) 2002 Chris Liechti <cliechti@gmx.net>
-// this is distributed under a free software license, see license.txt
-
-#include <Python.h>
-#include <windows.h>
-#include <conio.h>
-
-#define DRIVERNAME "\\\\.\\giveio"
-
-/* module-functions */
-
-static PyObject*
-py_outp(PyObject *self, PyObject *args)
-{
- int port, value;
- if(!PyArg_ParseTuple(args, "ii", &port, &value))
- return 0;
- _outp(port, value);
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-static PyObject*
-py_inp(PyObject *self, PyObject *args)
-{
- int port, value;
- if(!PyArg_ParseTuple(args, "i", &port))
- return 0;
- value = _inp(port);
- return Py_BuildValue("i", value);
-}
-
-
-
-static PyMethodDef pypar_methods[] = {
- {"outp", py_outp, METH_VARARGS},
- {"inp", py_inp, METH_VARARGS},
- {0, 0}
-};
-
-/* module entry-point (module-initialization) function */
-void init_pyparallel(void) {
- OSVERSIONINFO vi;
-
- /* Create the module and add the functions */
- Py_InitModule("_pyparallel", pypar_methods);
-
- //detect OS, on NT,2k,XP the driver needs to be loaded
- vi.dwOSVersionInfoSize = sizeof(vi);
- GetVersionEx(&vi);
- if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- HANDLE h;
- //try to open driver
- h = CreateFile(DRIVERNAME, GENERIC_READ, 0, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (h == INVALID_HANDLE_VALUE) {
- //if it fails again, then we have a problem... -> exception
- PyErr_Format(PyExc_ImportError, "Couldn't access giveio device");
- }
- //close again immediately.
- //the process is now tagged to have the rights it needs,
- //the giveio driver remembers that
- if (h != NULL) CloseHandle(h); //close the driver's file
- }
-}
diff --git a/pyparallel/src/win32/giveio/GIVEIO.C b/pyparallel/src/win32/giveio/GIVEIO.C
deleted file mode 100644
index f752a29..0000000
--- a/pyparallel/src/win32/giveio/GIVEIO.C
+++ /dev/null
@@ -1,168 +0,0 @@
-/*********************************************************************
-
-Author: Dale Roberts
-Date: 8/30/95
-Program: GIVEIO.SYS
-Compile: Use DDK BUILD facility
-
-Purpose: Give direct port I/O access to a user mode process.
-
-*********************************************************************/
-#include <ntddk.h>
-
-/*
- * The name of our device driver.
- */
-#define DEVICE_NAME_STRING L"giveio"
-
-/*
- * This is the "structure" of the IOPM. It is just a simple
- * character array of length 0x2000.
- *
- * This holds 8K * 8 bits -> 64K bits of the IOPM, which maps the
- * entire 64K I/O space of the x86 processor. Any 0 bits will give
- * access to the corresponding port for user mode processes. Any 1
- * bits will disallow I/O access to the corresponding port.
- */
-#define IOPM_SIZE 0x2000
-typedef UCHAR IOPM[IOPM_SIZE];
-
-/*
- * This will hold simply an array of 0's which will be copied
- * into our actual IOPM in the TSS by Ke386SetIoAccessMap().
- * The memory is allocated at driver load time.
- */
-IOPM *IOPM_local = 0;
-
-/*
- * These are the two undocumented calls that we will use to give
- * the calling process I/O access.
- *
- * Ke386IoSetAccessMap() copies the passed map to the TSS.
- *
- * Ke386IoSetAccessProcess() adjusts the IOPM offset pointer so that
- * the newly copied map is actually used. Otherwise, the IOPM offset
- * points beyond the end of the TSS segment limit, causing any I/O
- * access by the user mode process to generate an exception.
- */
-void Ke386SetIoAccessMap(int, IOPM *);
-void Ke386QueryIoAccessMap(int, IOPM *);
-void Ke386IoSetAccessProcess(PEPROCESS, int);
-
-/*********************************************************************
- Release any allocated objects.
-*********************************************************************/
-VOID GiveioUnload(IN PDRIVER_OBJECT DriverObject)
-{
- WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING;
- UNICODE_STRING uniDOSString;
-
- if(IOPM_local)
- MmFreeNonCachedMemory(IOPM_local, sizeof(IOPM));
-
- RtlInitUnicodeString(&uniDOSString, DOSNameBuffer);
- IoDeleteSymbolicLink (&uniDOSString);
- IoDeleteDevice(DriverObject->DeviceObject);
-}
-
-/*********************************************************************
- Set the IOPM (I/O permission map) of the calling process so that it
-is given full I/O access. Our IOPM_local[] array is all zeros, so
-the IOPM will be all zeros. If OnFlag is 1, the process is given I/O
-access. If it is 0, access is removed.
-*********************************************************************/
-VOID SetIOPermissionMap(int OnFlag)
-{
- Ke386IoSetAccessProcess(PsGetCurrentProcess(), OnFlag);
- Ke386SetIoAccessMap(1, IOPM_local);
-}
-
-void GiveIO(void)
-{
- SetIOPermissionMap(1);
-}
-
-/*********************************************************************
- Service handler for a CreateFile() user mode call.
-
- This routine is entered in the driver object function call table by
-the DriverEntry() routine. When the user mode application calls
-CreateFile(), this routine gets called while still in the context of
-the user mode application, but with the CPL (the processor's Current
-Privelege Level) set to 0. This allows us to do kernel mode
-operations. GiveIO() is called to give the calling process I/O
-access. All the user mode application needs do to obtain I/O access
-is open this device with CreateFile(). No other operations are
-required.
-*********************************************************************/
-NTSTATUS GiveioCreateDispatch(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- GiveIO(); // give the calling process I/O access
-
- Irp->IoStatus.Information = 0;
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_SUCCESS;
-}
-
-/*********************************************************************
- Driver Entry routine.
-
- This routine is called only once after the driver is initially
-loaded into memory. It allocates everything necessary for the
-driver's operation. In our case, it allocates memory for our IOPM
-array, and creates a device which user mode applications can open.
-It also creates a symbolic link to the device driver. This allows
-a user mode application to access our driver using the \\.\giveio
-notation.
-*********************************************************************/
-NTSTATUS DriverEntry(
- IN PDRIVER_OBJECT DriverObject,
- IN PUNICODE_STRING RegistryPath
- )
-{
- PDEVICE_OBJECT deviceObject;
- NTSTATUS status;
- WCHAR NameBuffer[] = L"\\Device\\" DEVICE_NAME_STRING;
- WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING;
- UNICODE_STRING uniNameString, uniDOSString;
-
- //
- // Allocate a buffer for the local IOPM and zero it.
- //
- IOPM_local = MmAllocateNonCachedMemory(sizeof(IOPM));
- if(IOPM_local == 0)
- return STATUS_INSUFFICIENT_RESOURCES;
- RtlZeroMemory(IOPM_local, sizeof(IOPM));
-
- //
- // Set up device driver name and device object.
- //
- RtlInitUnicodeString(&uniNameString, NameBuffer);
- RtlInitUnicodeString(&uniDOSString, DOSNameBuffer);
-
- status = IoCreateDevice(DriverObject, 0,
- &uniNameString,
- FILE_DEVICE_UNKNOWN,
- 0, FALSE, &deviceObject);
-
- if(!NT_SUCCESS(status))
- return status;
-
- status = IoCreateSymbolicLink (&uniDOSString, &uniNameString);
-
- if (!NT_SUCCESS(status))
- return status;
-
- //
- // Initialize the Driver Object with driver's entry points.
- // All we require are the Create and Unload operations.
- //
- DriverObject->MajorFunction[IRP_MJ_CREATE] = GiveioCreateDispatch;
- DriverObject->DriverUnload = GiveioUnload;
- return STATUS_SUCCESS;
-}
-
diff --git a/pyparallel/src/win32/giveio/MAKEFILE b/pyparallel/src/win32/giveio/MAKEFILE
deleted file mode 100644
index 5818975..0000000
--- a/pyparallel/src/win32/giveio/MAKEFILE
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
-# file to this component. This file merely indirects to the real make file
-# that is shared by all the driver components of the Windows NT DDK
-#
-
-!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/pyparallel/src/win32/giveio/README.TXT b/pyparallel/src/win32/giveio/README.TXT
deleted file mode 100644
index 4a6ec36..0000000
--- a/pyparallel/src/win32/giveio/README.TXT
+++ /dev/null
@@ -1,92 +0,0 @@
-The entire archive was pulled from here:
-Dr. Dobb's Journal, http://www.ddj.com/ftp/1996/1996.05/directio.zip
-It contained some other snippets too, but as they are not useful here
-I don't include them here.
-
-chris
-
-Following is the original readme of the archive:
------------------------------------------------------------------------------
-
-
-Author: Dale Roberts, Direct I/O and Windows NT
-
-
-Here are two helpful hints to get you going with GIVEIO. The first
-section below mentions the INSTDRV utility that is provided with the
-Microsoft DDK. If you do not have access to the DDK, you can use Paula
-Tomlinson's program LOADDRV instead. She describes it in her May 1995
-article in Windows/DOS Developer's Journal (now Windows Developer's
-Journal). You can get the program from their FTP site at:
-
- ftp://ftp.mfi.com/pub/windev/1995/may95.zip.
-
-
-------------------------------------------------------------------
-Device Driver Installation Made Easy
-
-The Microsoft NT Device Driver Kit documentation implies in several
-places that there are several steps involved in installing a device driver
-and making it accessible to a Win32 application. It explains that you
-should edit the registry manually and then reboot the system. But
-device drivers are dynamically loadable and unloadable in NT, and the
-DDK comes with a very handy utility called INSTDRV that
-demonstrates this facility in a very practical manner.
-
-INSTDRV is a console application that will register, load, and start a
-kernel mode device driver. It does not require you to edit the registry
-manually or reboot the computer. On the command line you simply
-give the name of your device driver and the complete path to the .SYS
-file (which does not need to be in the system's DRIVERS directory).
-After this command is executed, you will find that the driver has been
-registered with the system and appears in the Devices applet in the
-control panel. If you give the word remove instead of the path, the
-driver is removed from the system and taken out of the driver database.
-
-Once the driver is loaded and started, you can use the control panel's
-Devices applet to start and stop it, or you can use the net start and net
-stop commands (these are much faster) from a console window. When
-a kernel mode device is stopped, it is in also unloaded from memory.
-The next time you start the device, a fresh copy of the driver is read
-from the hard drive, if it has been modified. This makes it very
-convenient to develop device drivers, since you can go through the
-modify, stop, start cycle repeatedly without ever needing to reboot. If
-you need your driver to load at boot time, you can go into the Devices
-applet and change its startup mode to boot.
-
-The other component that is needed to make the driver visible to user
-mode applications, so they can use CreateFile() calls to access the
-driver, is registering the name in the DOS Devices name space. This
-can be done, as documented in the DDK, by editing the registry
-manually and rebooting. Or, much more simply, the kernel mode
-driver can call the IoCreateSymbolicLink() function to register the
-name itself. The GIVEIO driver shown in Listing Four uses the later
-technique. Once the name is registered, user mode applications can get
-a file handle to the device driver by calling CreateFile() with the driver
-name as the file parameter, but preceding the driver name with the
-special cookie \\.\. The TESTIO application in Listing Five uses this
-technique.
-
-------------------------------------------------------------------
-Quick Trick: Using DEBUG With Port I/O
-
-Sometimes you just need to do a quick I/O operation to a port. In DOS,
-you could use the DEBUG program to accomplish this. In NT, once
-you have the GIVEIO device driver up and running, you can once
-again use DEBUG for port I/O. If you look at the source code for the
-test application, you'll see that all it does is open and close the GIVEIO
-device driver. It uses the special cookie \\.\ before the driver name in
-order to access it. Without modifying DEBUG, you can have it open
-this device driver by simply typing debug \\.\giveio in an NT console
-window. You will get an error message complaining that the file
-\\.\giveio is not found, but it will give DEBUG I/O access anyway.
-Subsequent DOS applications that are run from this console window
-will also have I/O access.
-
-WIN32 applications executed from this console window will still cause
-exceptions. This is because DEBUG (and any other DOS application)
-runs in the context of the VDM (Virtual DOS Machine) process of the
-console box, whereas each WIN32 application gets its own process.
-The VDM process stays active as long as the console window is open,
-but each WIN32 application creates a brand new process with the
-IOPM offset initialized to point beyond the end of the TSS.
diff --git a/pyparallel/src/win32/giveio/SOURCES b/pyparallel/src/win32/giveio/SOURCES
deleted file mode 100644
index 1f8abef..0000000
--- a/pyparallel/src/win32/giveio/SOURCES
+++ /dev/null
@@ -1,7 +0,0 @@
-TARGETNAME=giveio
-TARGETPATH=.
-TARGETTYPE=DRIVER
-
-INCLUDES=c:\ddk\inc
-
-SOURCES=giveio.c
diff --git a/pyparallel/src/win32/install_giveio.bat b/pyparallel/src/win32/install_giveio.bat
deleted file mode 100644
index 79f1383..0000000
--- a/pyparallel/src/win32/install_giveio.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@set DIRVERNAME=giveio
-
-@echo Installing Windows NT/2k/XP driver: %DIRVERNAME%
-
-@loaddrv install %DIRVERNAME%
-@if errorlevel 3 goto error
-
-@loaddrv start %DIRVERNAME%
-@if errorlevel 1 goto error
-
-@loaddrv starttype %DIRVERNAME% auto
-@if errorlevel 1 goto error
-
-@goto exit
-:error
-@echo ERROR: Installation of %DIRVERNAME% failed
-:exit
-@pause
diff --git a/pyparallel/src/win32/loaddrv_console/loaddrv.c b/pyparallel/src/win32/loaddrv_console/loaddrv.c
deleted file mode 100644
index 99755fb..0000000
--- a/pyparallel/src/win32/loaddrv_console/loaddrv.c
+++ /dev/null
@@ -1,458 +0,0 @@
-// loaddrv.c - Dynamic driver install/start/stop/remove
-// based on Paula Tomlinson's LOADDRV program.
-// She describes it in her May 1995 article in Windows/DOS Developer's
-// Journal (now Windows Developer's Journal).
-// i removed the old/ugly dialog, it now accepts command line options and
-// prints error messages with textual description from the OS.
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "loaddrv.h"
-
-// globals
-SC_HANDLE hSCMan = NULL;
-
-//get ext messages for windows error codes:
-void DisplayErrorText(DWORD dwLastError) {
- LPSTR MessageBuffer;
- DWORD dwBufferLength;
-
- DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_IGNORE_INSERTS |
- FORMAT_MESSAGE_FROM_SYSTEM;
-
- dwBufferLength = FormatMessageA(
- dwFormatFlags,
- NULL, // module to get message from (NULL == system)
- dwLastError,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
- (LPSTR) &MessageBuffer,
- 0,
- NULL
- );
- if (dwBufferLength) {
- // Output message
- puts(MessageBuffer);
- // Free the buffer allocated by the system.
- LocalFree(MessageBuffer);
- }
-}
-
-int exists(char *filename) {
- FILE * pFile;
- pFile = fopen(filename, "r");
- return pFile != NULL;
-}
-
-void usage(void) {
- printf("USGAE: loaddrv command drivername [args...]\n\n"
- "NT/2k/XP Driver and Service modification tool.\n"
- "(C)2002 Chris Liechti <cliechti@gmx.net>\n\n"
- "Suported commands:\n\n"
- " install [fullpathforinstall]\n"
- " Install new service. Loaded from given path. If path is not present,\n"
- " the local directory is searched for a .sys file. If the service\n"
- " already exists, it must be removed first.\n"
- " start\n"
- " Start service. It must be installed in advance.\n"
- " stop\n"
- " Stop service.\n"
- " remove\n"
- " Remove service. It must be stopped in advance.\n"
- " status\n"
- " Show status information about service.\n"
- " starttype auto|manual|system|disable\n"
- " Change startup type to the given type.\n"
- );
-}
-
-int main(int argc, char *argv[]) {
- DWORD status = 0;
- int level = 0;
- if (argc < 3) {
- usage();
- exit(1);
- }
- LoadDriverInit();
- if (strcmp(argv[1], "start") == 0) {
- printf("starting %s... ", argv[2]);
- status = DriverStart(argv[2]);
- if ( status != OKAY) {
- printf("start failed (status %ld):\n", status);
- level = 1;
- } else {
- printf("ok.\n");
- }
- } else if (strcmp(argv[1], "stop") == 0) {
- printf("stoping %s... ", argv[2]);
- status = DriverStop(argv[2]);
- if ( status != OKAY) {
- printf("stop failed (status %ld):\n", status);
- level = 1;
- } else {
- printf("ok.\n");
- }
- } else if (strcmp(argv[1], "install") == 0) {
- char path[MAX_PATH*2];
- if (argc<4) {
- char cwd[MAX_PATH];
- getcwd(cwd, sizeof cwd);
- sprintf(path, "%s\\%s.sys", cwd, argv[2]);
- } else {
- strncpy(path, argv[3], MAX_PATH);
- }
- if (exists(path)) {
- printf("installing %s from %s... ", argv[2], path);
- status = DriverInstall(path, argv[2]);
- if ( status != OKAY) {
- printf("install failed (status %ld):\n", status);
- level = 2;
- } else {
- printf("ok.\n");
- }
- } else {
- printf("install failed, file not found: %s\n", path);
- level = 1;
- }
- } else if (strcmp(argv[1], "remove") == 0) {
- printf("removing %s... ", argv[2]);
- status = DriverRemove(argv[2]);
- if ( status != OKAY) {
- printf("remove failed (status %ld):\n", status);
- level = 1;
- } else {
- printf("ok.\n");
- }
- } else if (strcmp(argv[1], "status") == 0) {
- printf("status of %s:\n", argv[2]);
- status = DriverStatus(argv[2]);
- if ( status != OKAY) {
- printf("stat failed (status %ld):\n", status);
- level = 1;
- } else {
- printf("ok.\n");
- }
- } else if (strcmp(argv[1], "starttype") == 0) {
- if (argc < 4) {
- printf("Error: need start type (string) as argument.\n");
- level = 2;
- } else {
- DWORD type = 0;
- printf("set start type of %s to %s... ", argv[2], argv[3]);
- if (strcmp(argv[1], "boot") == 0) {
- type = SERVICE_BOOT_START;
- } else if (strcmp(argv[3], "system") == 0) {
- type = SERVICE_SYSTEM_START;
- } else if (strcmp(argv[3], "auto") == 0) {
- type = SERVICE_AUTO_START;
- } else if (strcmp(argv[3], "manual") == 0) {
- type = SERVICE_DEMAND_START;
- } else if (strcmp(argv[3], "disabled") == 0) {
- type = SERVICE_DISABLED;
- } else {
- printf("unknown type\n");
- level = 1;
- }
- if (level == 0) {
- status = DriverStartType(argv[2], type);
- if ( status != OKAY) {
- printf("set start type failed (status %ld):\n", status);
- level = 1;
- } else {
- printf("ok.\n");
- }
- }
- }
- } else {
- usage();
- level = 1;
- }
- if (status) DisplayErrorText(status);
- LoadDriverCleanup();
- exit(level);
- return 0;
-}
-
-
-DWORD LoadDriverInit(void) {
- // connect to local service control manager
- if ((hSCMan = OpenSCManager(NULL, NULL,
- SC_MANAGER_ALL_ACCESS)) == NULL) {
- return -1;
- }
- return OKAY;
-}
-
-void LoadDriverCleanup(void) {
- if (hSCMan != NULL) CloseServiceHandle(hSCMan);
-}
-
-/**-----------------------------------------------------**/
-DWORD DriverInstall(LPSTR lpPath, LPSTR lpDriver) {
- BOOL dwStatus = OKAY;
- SC_HANDLE hService = NULL;
-
- // add to service control manager's database
- if ((hService = CreateService(hSCMan, lpDriver,
- lpDriver, SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER,
- SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, lpPath,
- NULL, NULL, NULL, NULL, NULL)) == NULL)
- dwStatus = GetLastError();
- else CloseServiceHandle(hService);
-
- return dwStatus;
-} // DriverInstall
-
-/**-----------------------------------------------------**/
-DWORD DriverStart(LPSTR lpDriver) {
- BOOL dwStatus = OKAY;
- SC_HANDLE hService = NULL;
-
- // get a handle to the service
- if ((hService = OpenService(hSCMan, lpDriver,
- SERVICE_ALL_ACCESS)) != NULL)
- {
- // start the driver
- if (!StartService(hService, 0, NULL))
- dwStatus = GetLastError();
- } else dwStatus = GetLastError();
-
- if (hService != NULL) CloseServiceHandle(hService);
- return dwStatus;
-} // DriverStart
-
-/**-----------------------------------------------------**/
-DWORD DriverStop(LPSTR lpDriver)
-{
- BOOL dwStatus = OKAY;
- SC_HANDLE hService = NULL;
- SERVICE_STATUS serviceStatus;
-
- // get a handle to the service
- if ((hService = OpenService(hSCMan, lpDriver,
- SERVICE_ALL_ACCESS)) != NULL)
- {
- // stop the driver
- if (!ControlService(hService, SERVICE_CONTROL_STOP,
- &serviceStatus))
- dwStatus = GetLastError();
- } else dwStatus = GetLastError();
-
- if (hService != NULL) CloseServiceHandle(hService);
- return dwStatus;
-} // DriverStop
-
-/**-----------------------------------------------------**/
-DWORD DriverRemove(LPSTR lpDriver)
-{
- BOOL dwStatus = OKAY;
- SC_HANDLE hService = NULL;
-
- // get a handle to the service
- if ((hService = OpenService(hSCMan, lpDriver,
- SERVICE_ALL_ACCESS)) != NULL)
- { // remove the driver
- if (!DeleteService(hService))
- dwStatus = GetLastError();
- } else dwStatus = GetLastError();
-
- if (hService != NULL) CloseServiceHandle(hService);
- return dwStatus;
-} // DriverRemove
-
-/**-----------------------------------------------------**/
-////extensions by Lch
-/**-----------------------------------------------------**/
-DWORD DriverStatus(LPSTR lpDriver) {
- BOOL dwStatus = OKAY;
- SC_HANDLE hService = NULL;
- DWORD dwBytesNeeded;
-
- // get a handle to the service
- if ((hService = OpenService(hSCMan, lpDriver,
- SERVICE_ALL_ACCESS)) != NULL)
- {
- LPQUERY_SERVICE_CONFIG lpqscBuf;
- //~ LPSERVICE_DESCRIPTION lpqscBuf2;
- // Allocate a buffer for the configuration information.
- if ((lpqscBuf = (LPQUERY_SERVICE_CONFIG) LocalAlloc(
- LPTR, 4096)) != NULL)
- {
- //~ if ((lpqscBuf2 = (LPSERVICE_DESCRIPTION) LocalAlloc(
- //~ LPTR, 4096)) != NULL)
- {
- // Get the configuration information.
- if (QueryServiceConfig(
- hService,
- lpqscBuf,
- 4096,
- &dwBytesNeeded) //&&
- //~ QueryServiceConfig2(
- //~ hService,
- //~ SERVICE_CONFIG_DESCRIPTION,
- //~ lpqscBuf2,
- //~ 4096,
- //~ &dwBytesNeeded
- )
- {
- // Print the configuration information.
- printf("Type: [0x%02lx] ", lpqscBuf->dwServiceType);
- switch (lpqscBuf->dwServiceType) {
- case SERVICE_WIN32_OWN_PROCESS:
- printf("The service runs in its own process.");
- break;
- case SERVICE_WIN32_SHARE_PROCESS:
- printf("The service shares a process with other services.");
- break;
- case SERVICE_KERNEL_DRIVER:
- printf("Kernel driver.");
- break;
- case SERVICE_FILE_SYSTEM_DRIVER:
- printf("File system driver.");
- break;
- case SERVICE_INTERACTIVE_PROCESS:
- printf("The service can interact with the desktop.");
- break;
- default:
- printf("Unknown type.");
- }
- printf("\nStart Type: [0x%02lx] ", lpqscBuf->dwStartType);
- switch (lpqscBuf->dwStartType) {
- case SERVICE_BOOT_START:
- printf("Boot");
- break;
- case SERVICE_SYSTEM_START:
- printf("System");
- break;
- case SERVICE_AUTO_START:
- printf("Automatic");
- break;
- case SERVICE_DEMAND_START:
- printf("Manual");
- break;
- case SERVICE_DISABLED:
- printf("Disabled");
- break;
- default:
- printf("Unknown.");
- }
- printf("\nError Control: [0x%02lx] ", lpqscBuf->dwErrorControl);
- switch (lpqscBuf->dwErrorControl) {
- case SERVICE_ERROR_IGNORE:
- printf("IGNORE: Ignore.");
- break;
- case SERVICE_ERROR_NORMAL:
- printf("NORMAL: Display a message box.");
- break;
- case SERVICE_ERROR_SEVERE:
- printf("SEVERE: Restart with last-known-good config.");
- break;
- case SERVICE_ERROR_CRITICAL:
- printf("CRITICAL: Restart w/ last-known-good config.");
- break;
- default:
- printf("Unknown.");
- }
- printf("\nBinary path: %s\n", lpqscBuf->lpBinaryPathName);
-
- if (lpqscBuf->lpLoadOrderGroup != NULL)
- printf("Load order grp: %s\n", lpqscBuf->lpLoadOrderGroup);
- if (lpqscBuf->dwTagId != 0)
- printf("Tag ID: %ld\n", lpqscBuf->dwTagId);
- if (lpqscBuf->lpDependencies != NULL)
- printf("Dependencies: %s\n", lpqscBuf->lpDependencies);
- if (lpqscBuf->lpServiceStartName != NULL)
- printf("Start Name: %s\n", lpqscBuf->lpServiceStartName);
- //~ if (lpqscBuf2->lpDescription != NULL)
- //~ printf("Description: %s\n", lpqscBuf2->lpDescription);
- }
- //~ LocalFree(lpqscBuf2);
- }
- LocalFree(lpqscBuf);
- } else {
- dwStatus = GetLastError();
- }
- } else {
- dwStatus = GetLastError();
- }
-
- if (hService != NULL) CloseServiceHandle(hService);
- return dwStatus;
-} // DriverStatus
-
-/**-----------------------------------------------------**/
-DWORD DriverStartType(LPSTR lpDriver, DWORD dwStartType) {
- BOOL dwStatus = OKAY;
- SC_HANDLE hService = NULL;
-
- SC_LOCK sclLock;
- LPQUERY_SERVICE_LOCK_STATUS lpqslsBuf;
- DWORD dwBytesNeeded;
-
- // Need to acquire database lock before reconfiguring.
- sclLock = LockServiceDatabase(hSCMan);
-
- // If the database cannot be locked, report the details.
- if (sclLock == NULL) {
- // Exit if the database is not locked by another process.
- if (GetLastError() == ERROR_SERVICE_DATABASE_LOCKED) {
-
- // Allocate a buffer to get details about the lock.
- lpqslsBuf = (LPQUERY_SERVICE_LOCK_STATUS) LocalAlloc(
- LPTR, sizeof(QUERY_SERVICE_LOCK_STATUS)+256);
- if (lpqslsBuf != NULL) {
- // Get and print the lock status information.
- if (QueryServiceLockStatus(
- hSCMan,
- lpqslsBuf,
- sizeof(QUERY_SERVICE_LOCK_STATUS)+256,
- &dwBytesNeeded) )
- {
- if (lpqslsBuf->fIsLocked) {
- printf("Locked by: %s, duration: %ld seconds\n",
- lpqslsBuf->lpLockOwner,
- lpqslsBuf->dwLockDuration
- );
- } else {
- printf("No longer locked\n");
- }
- }
- LocalFree(lpqslsBuf);
- }
- }
- dwStatus = GetLastError();
- } else {
- // The database is locked, so it is safe to make changes.
- // Open a handle to the service.
- hService = OpenService(
- hSCMan, // SCManager database
- lpDriver, // name of service
- SERVICE_CHANGE_CONFIG
- ); // need CHANGE access
- if (hService != NULL) {
- // Make the changes.
- if (!ChangeServiceConfig(
- hService, // handle of service
- SERVICE_NO_CHANGE, // service type: no change
- dwStartType, // change service start type
- SERVICE_NO_CHANGE, // error control: no change
- NULL, // binary path: no change
- NULL, // load order group: no change
- NULL, // tag ID: no change
- NULL, // dependencies: no change
- NULL, // account name: no change
- NULL, // password: no change
- NULL) ) // display name: no change
- {
- dwStatus = GetLastError();
- }
- }
- // Release the database lock.
- UnlockServiceDatabase(sclLock);
- }
-
- if (hService != NULL) CloseServiceHandle(hService);
- return dwStatus;
-} // DriverStartType
diff --git a/pyparallel/src/win32/loaddrv_console/loaddrv.h b/pyparallel/src/win32/loaddrv_console/loaddrv.h
deleted file mode 100644
index e09b276..0000000
--- a/pyparallel/src/win32/loaddrv_console/loaddrv.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef LOADDRV_H
-#define LOADDRV_H
-
-#include <windows.h>
-
-#define OKAY 0
-#define UNEXPECTED_ERROR 9999
-
-//prototypes
-DWORD LoadDriverInit(void);
-void LoadDriverCleanup(void);
-DWORD DriverInstall(LPSTR, LPSTR);
-DWORD DriverStart(LPSTR);
-DWORD DriverStop(LPSTR);
-DWORD DriverRemove(LPSTR);
-DWORD DriverStatus(LPSTR);
-DWORD DriverStartType(LPSTR, DWORD);
-#endif //LOADDRV_H \ No newline at end of file
diff --git a/pyparallel/src/win32/loaddrv_console/makefile b/pyparallel/src/win32/loaddrv_console/makefile
deleted file mode 100644
index d09ec29..0000000
--- a/pyparallel/src/win32/loaddrv_console/makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-COPT = -O2 -Wall -g -mno-cygwin
-
-loaddrv.exe: loaddrv.c loaddrv.h
- gcc ${COPT} $< -o $@
- strip $@
diff --git a/pyparallel/src/win32/makefile b/pyparallel/src/win32/makefile
deleted file mode 100644
index fad59ee..0000000
--- a/pyparallel/src/win32/makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-CFLAGS = -mno-cygwin -mdll -O -Wall
-
-.PHONY: clean FORCE
-
-simpleio.dll: simpleio.o
- gcc -mno-cygwin -mdll -static -s $^ -Wl,--export-all-symbols,--kill-at -o $@
-
-clean:
- rm -f simpleio.dll simpleio.o
diff --git a/pyparallel/src/win32/remove_giveio.bat b/pyparallel/src/win32/remove_giveio.bat
deleted file mode 100644
index c75caea..0000000
--- a/pyparallel/src/win32/remove_giveio.bat
+++ /dev/null
@@ -1,13 +0,0 @@
-@set DIRVERNAME=giveio
-
-@loaddrv stop %DIRVERNAME%
-@if errorlevel 2 goto error
-
-@loaddrv remove %DIRVERNAME%
-@if errorlevel 1 goto error
-@goto exit
-
-:error
-@echo ERROR: Deinstallation of %DIRVERNAME% failed
-:exit
-@pause
diff --git a/pyparallel/src/win32/simpleio.c b/pyparallel/src/win32/simpleio.c
deleted file mode 100644
index 793cfac..0000000
--- a/pyparallel/src/win32/simpleio.c
+++ /dev/null
@@ -1,47 +0,0 @@
-// Parallel port extension for Win32
-// "inp" and "outp" are used to access the parallelport hardware
-// needs giveio.sys driver on NT/2k/XP
-//
-// (C) 2005 Chris Liechti <cliechti@gmx.net>
-// this is distributed under a free software license, see license.txt
-
-#include <windows.h>
-#include <conio.h>
-
-#define DRIVERNAME "\\\\.\\giveio"
-
-/* module-functions */
-
-WINAPI void outp(int port, int value) {
- _outp(port, value);
-}
-
-WINAPI int inp(int port) {
- int value;
- value = _inp(port);
- return value;
-}
-
-WINAPI int init(void) {
- OSVERSIONINFO vi;
-
- //detect OS, on NT,2k,XP the driver needs to be loaded
- vi.dwOSVersionInfoSize = sizeof(vi);
- GetVersionEx(&vi);
- if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- HANDLE h;
- //try to open driver
- h = CreateFile(DRIVERNAME, GENERIC_READ, 0, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (h == INVALID_HANDLE_VALUE) {
- //if it fails again, then we have a problem... -> exception
- //"Couldn't access giveio device";
- return 1;
- }
- //close again immediately.
- //the process is now tagged to have the rights it needs,
- //the giveio driver remembers that
- if (h != NULL) CloseHandle(h); //close the driver's file
- }
- return 0;
-}
diff --git a/pyparallel/src/win32/simpleio.dll b/pyparallel/src/win32/simpleio.dll
deleted file mode 100644
index df480ac..0000000
--- a/pyparallel/src/win32/simpleio.dll
+++ /dev/null
Binary files differ
diff --git a/pyserial/serial/.cvsignore b/serial/.cvsignore
index 7e99e36..7e99e36 100644
--- a/pyserial/serial/.cvsignore
+++ b/serial/.cvsignore
diff --git a/pyserial/serial/__init__.py b/serial/__init__.py
index 681ad5c..681ad5c 100644
--- a/pyserial/serial/__init__.py
+++ b/serial/__init__.py
diff --git a/pyserial/serial/serialcli.py b/serial/serialcli.py
index 9864848..9864848 100644
--- a/pyserial/serial/serialcli.py
+++ b/serial/serialcli.py
diff --git a/pyserial/serial/serialjava.py b/serial/serialjava.py
index cca46dc..cca46dc 100644
--- a/pyserial/serial/serialjava.py
+++ b/serial/serialjava.py
diff --git a/pyserial/serial/serialposix.py b/serial/serialposix.py
index 174e2f7..174e2f7 100644
--- a/pyserial/serial/serialposix.py
+++ b/serial/serialposix.py
diff --git a/pyserial/serial/serialutil.py b/serial/serialutil.py
index fd466f2..fd466f2 100644
--- a/pyserial/serial/serialutil.py
+++ b/serial/serialutil.py
diff --git a/pyserial/serial/serialwin32.py b/serial/serialwin32.py
index f5e8961..f5e8961 100644
--- a/pyserial/serial/serialwin32.py
+++ b/serial/serialwin32.py
diff --git a/pyserial/serial/sermsdos.py b/serial/sermsdos.py
index a516118..a516118 100644
--- a/pyserial/serial/sermsdos.py
+++ b/serial/sermsdos.py
diff --git a/pyserial/setup.py b/setup.py
index 9f3b349..9f3b349 100644
--- a/pyserial/setup.py
+++ b/setup.py