[nmglug] parallel port address

akaluta akaluta at taosnet.com
Tue Jan 6 05:27:09 PST 2009


Dear Glug Persons:
The parallel port location found in /proc/ioports/ is 0378-037a,
what would be the correct entry for: "#define base ..." /* printer port
base address */  ( referenced program, see this page below.)
 My untutored attempts at correct entry have not located the port as
indicated by error message "port 17a not found." alternately invalid
digit 8 in octal constant.
Any insightful thoughts are appreciated. Best, Anthony K


On Sun, 2008-12-28 at 19:47 -0700, akaluta wrote:
> Bob:
> That is an interesting development and puzzling to a neophyte I will
> doodle with the example program a bit more in the next day or two,thanks
> for the try and results, I did modify the program to sys/io.h from the
> original asm/io.h to delete an error message. Anthony K
> 
> On Sat, 2008-12-27 at 21:39 -0700, Bob Knight wrote:
> > You probably don't want to hear this, but it compiles fine here after I 
> > get rid of the newlines inserted by the mail client...
> > 
> > Ubuntu Intrepid, gcc 4.3.2 ubuntuized.
> > 
> > Bob
> > 
> > akaluta wrote:
> > > Seasons Greetings All;
> > > The parallel port location found in /proc/ioports/ is 0378-037a
> > > parportO.
> > > The pertinent uncooperative program part: "#define base 0x0378"
> > >  /* printer port base address */
> > > a                                                                                    
> > >
> > > I have tried inputting various address permutations i.e 0x378 ,0378 ,
> > > 0378-037a I get varying error messages: cannot locate 378 ,alternately
> > > "invalid digit 8 in octal constant"
> > >
> > > program quoted:
> > > "/*
> > >  * Simple parallel port output control program for Linux
> > >  * Written and copyright by Tomi Engdahl 1998
> > >  * (e-mail: tomi.engdahl at hut.fi)
> > >  *
> > >  * The program output the data value to PC parallel port data pins
> > >  * (default lpt1 I/O address 0x378). The data values are given as the
> > >  * command line parameter to the program. The number can be
> > >  * in decimal (0..255) or hexadecimal format (0x00..0xFF).
> > >  *
> > >  */
> > >
> > > #include <stdio.h>
> > > #include <stdlib.h>
> > > #include <unistd.h>
> > > #include <sys/io.h>
> > >
> > > #define base 0x0378           /* printer port base address */
> > >
> > > main(int argc, char **argv)
> > > {                    
> > >   int value;
> > >
> > >   if (argc!=2)
> > >     fprintf(stderr, "Error: Wrong number of arguments. This program
> > > needs one argument which is number between 0 and 255.\n"), exit(1);
> > >   if (sscanf(argv[1],"%i",&value)!=1)
> > >     fprintf(stderr, "Error: Parameter is not a number.\n"), exit(1);
> > >   if ((value<0) || (value>255))
> > >     fprintf(stderr, "Error: Invalid numeric value. The parameter number
> > > must be between 0 and 255\n"), exit(1);
> > >   if (ioperm(base,1,1))
> > >     fprintf(stderr, "Error: Couldn't get the port at %x\n", base),
> > > exit(1);
> > >
> > >   outb((unsigned char)value, base);
> > > }" end quote.
> > >                                           
> > >
> > > Any insights,provided to the greenhorn,are appreciated. 
> > >                                              Best Regards,Anthony K
> > >
> > >
> > > _______________________________________________
> > > nmglug mailing list
> > > nmglug at nmglug.org
> > > https://nmglug.org/mailman/listinfo/nmglug
> > >   
> > _______________________________________________
> > nmglug mailing list
> > nmglug at nmglug.org
> > https://nmglug.org/mailman/listinfo/nmglug
> > 
> 
> _______________________________________________
> nmglug mailing list
> nmglug at nmglug.org
> https://nmglug.org/mailman/listinfo/nmglug
> 




More information about the nmglug mailing list