libieee1284

What is it?

This library is intended to be used by applications that need to communicate with (or at least identify) devices that are attached via a parallel port. It is written under the GNU General Public License.

It currently works on Linux, Windows (with Cygwin), OpenBSD (i386 only), FreeBSD/i386 and Solaris/x86.

The reason for writing it originally was that for Linux, there are some wrinkles in communicating with devices on parallel ports:

  • Applications that want to harvest IEEE 1284 Device ID information can look in /proc for it, but it is in a different location in 2.4 kernels than it was in 2.2 kernels, and is completely absent in 2.0 kernels.
  • There is an extra location to look for this information in 2.6.
  • All kernels allow ioperm/inb/outb-style I/O, but it requires root privilege. In addition, string I/O (such as outsb) is not available on some architectures.
  • Since 2.4, Linux has /dev/parport[0,1,2,…] device nodes which applications can use; applications don’t need to be run as root, but they obviously need appropriate permissions set on the device node they want to use.
  • When capabilities catch on, /dev/port will be another alternative to ioperm that doesn’t require root privilege, although it does require RAWIO capabilities.

The aim of this library is to take all the worry about the above wrinkles from the application. It will figure out which method is appropriate for the currently running kernel. For instance, if the application wants to know the device ID of a device on a particular port, it will ask the library for the the device ID. The library will then figure out if it’s available via /proc (in any of the possible locations), and if not then it will try asking the device itself. If /dev/parport0 isn’t available for use, it will try ioperm; if that fails, it will try /dev/port. And the application doesn’t have to care.

Documentation:

  • HTML | PDF : Public interface of libieee1284 (2002-09-19) : This is API 3.1.

Where is it?

On GitHub. Tarballs are also here: http://cyberelk.net/tim/data/libieee1284/.