[Gambas-devel] Parallel Port (was Gamba's Digest)

Ron Onstenk ronstk at ...124...
Tue Jun 27 19:54:18 CEST 2006


On Monday 26 June 2006 11:39, Jason Curl wrote:
> Hello..
> 
> I notice that the Wiki page indicates using the /dev/port device. 

/dev/port is a link to a driver using a driver to CPU ports
Simple read/write to specific port address in the CPU space.

> Is it possible to use the generic parallel port device /dev/parportN? 

/dev/parportN is a link to a printer driver for I/O
Using the *handshake* for printers and fixed address (CPU port).

The behaviour of both are very different.
Talking to '/dev/parportN' is protocol managed 
and then that one talks internal to '/dev/port' via ioctl()

> In particular there needs to be methods to send ioctl() as in C. 

This is more or less using '/dev/port'

> Then if a driver is ever written for USB, this should also work right?   

A printer driver for USB? 
No because/if you want real user bit Set/Reset control.

A bit Set/Reset driver for a chip on USB? 
Yes but you must select any way somewhere what to 
use, USB or the I/O port of the box.

> 
> Regards,
> Jason.
> 

And yes the IBM printer is standard on CPU ports but
as you say it can be nowadays USB or network based to.
However the /dev/parportN is as far I know to the good old CPU ports.
 
Note about '/dev/parportN', Here is assumed this is the same as the /dev/lpN ports.
If not same then the question rise why /dev/port and /dev/parportN exists.


http://docs.blackfin.uclinux.org/doku.php?id=flashing_the_board
As described in this article '/dev/parportN' is the 'printer' port.
Confirms my assumption.
Read at last half.

http://pikdev.free.fr/installation.html
Here it goes about PIC programming on the parport.
Using a driver ppdev.


Abstract of it:

Parallel port 
 PiKdev uses the parallel port in user mode (/dev/parport device). 
 The parport devices are automatically detected since version 0.3.4.
 If this device is not present in your filesystem, you can easily create 
 it with the mknode command (with root privileges): 
 (Note: /dev/parportN is a character device whose major number is 99 and minor number is N) 
 
mknod /dev/parport0 c 99 0
 (first parallel port)
 
mknod /dev/parport1 c 99 1
 (eventually, second parallel port)
 Moreover, be sure that the device is RW enabled: 
chmod a+rw /dev/parport0
 Finally, you must have the ppdev support. 
 This is necessary for using parallel ports in user mode. 
 This support can be compiled into the linux kernel, or loaded as 
 modules (depending on your system, you might have to update 
 /etc/modprobe.preload or /etc/modules). 

http://people.redhat.com/twaugh/parport/html/ppdev.html

Programming interface
 The ppdev interface is largely the same as that of other character 
special devices, in that it supports open, close, read, write, and ioctl. 
The constants for the ioctl commands are in include/linux/ppdev.h.

I guess this is what you want.

But for me the parportN and a USB printer do not match.
I do have a USB adaptor and can connect a 25pin D connector from the 
printer to it. Then I can talk to a (fake) USB printer ( the Epson FX80)
Talking to /dev/parportN don't print on the USB connected printer.
 
My  whish was to use this adaptor as general I/O port for experiments 
but connected by USB (notebook) and protect the notebook.

Ron









More information about the Devel mailing list