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

Jason Curl j.m.curl at ...485...
Wed Jun 28 15:33:13 CEST 2006


Ron,

Thanks for your answer, it's pretty informative.


> Ron Onstenk <ronstk at ...124...> wrote:
> 
> 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()
> 

I've been using /dev/parportN for physical ports in C (using ioctl() to write the particular bits), but I don't know how to write X applications, and was investigating using Gambas to do this for me. I'm not using the IEEE1284 protocols, just using ioctls() to change the bits via /dev/parportN.

> > In particular there needs to be methods to send ioctl() as in C. 
> 
> This is more or less using '/dev/port'
> 

I use /dev/parportN successfully, and use this device as the user doesn't need to know what the physical port numbers are and the kernel can choose instead. Otherwise you're right, it's nearly the same. It also is better protected though than using /dev/port, and won't interfere if a printer driver is already loaded (access to /dev/parportN is denied).

> > 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.
> 

I don't know if there is a /dev/parportN driver for USB printers, I've only seen /dev/lpN in this case.

And actually, my new HP doesn't even come with a printer port, unless it's connected to a docking station.

ignoring USB for now, does Gambas allow sending ioctls without having to make a specific component?

Thanks,
Jason.




More information about the Devel mailing list