how to do io?

how to do io?

Post by TMX » Thu, 13 Mar 2003 01:01:32



My program needs to talk to a small gadget connected to the pc printer
printer port.

How can it be done with FreeBSD kernel?

 
 
 

how to do io?

Post by Lowell Gilber » Thu, 13 Mar 2003 04:26:49



> My program needs to talk to a small gadget connected to the pc printer
> printer port.

> How can it be done with FreeBSD kernel?

Try "man lpt".  It's just one of the things turned up by "apropos parallel".

 
 
 

how to do io?

Post by Steve O'Hara-Smit » Thu, 13 Mar 2003 03:34:49


On Tue, 11 Mar 2003 18:01:32 +0200

T> My program needs to talk to a small gadget connected to the pc printer
T> printer port.
T>
T> How can it be done with FreeBSD kernel?

        Start at man ppi and man ppbus.

--
C:>WIN                                      |     Directable Mirrors
The computer obeys and wins.                |A Better Way To Focus The Sun
You lose and Bill collects.                 |  licenses available - see:
                                            |   http://www.sohara.org/

 
 
 

1. seg faulting while doing io

Hey all,

I got a few weird errors while compiling the following.  It all works now,
as I will explain, but I still don't understand why it didn't work.

******************************************************
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/io.h>
#include <unistd.h>
#define BASEPORT 0x378
int main(int argc, char *argv[])
{

  if( ioperm(BASEPORT, 3, 1) ) {perror("ioperm error"); exit(1);}

  /* Set the data signals (D0-7) of the port to all low (0) */
  outb(0, BASEPORT);

  /* Sleep for a while (100 ms) */
  usleep(100000);

  /* Read from the status port (BASE+1) and display the result */
  printf("status: %d\n", inb(BASEPORT + 1));

  /* We don't need the ports anymore */
  if( ioperm(BASEPORT, 3, 0) ) {perror("ioperm error"); exit(1);}
  exit(0);
*******************************************************

Now, when I tried to compile this using gcc, I got a warning saying
undefined reference to exit or something along those lines.  But then it
compiles fine.

Now, as I was reading "Linux Device Drivers," he mentioned that  inb_p,
outb_p might be safer to use as they include a small delay that may be
needed on older ISA buses.  So, I tried it with the _p versions, and it kept
segfaulting on the inb_p.  Using the plain outb and inb seems to work just
fine.  Any idea why this is?  The system I'm testing on right now does not
have an ISA bus...could that be it?  I'm just coding in all the logic and
what not right now until we actually get the hardware.  So, I'm just dumping
things to lp1 for now.

Everything is being executed as root in cause you're wondering.  Don't
worry, this is just for development right now, a proper module will be
written later.

Thanks all,

Yamin

2. NATD & ICQ

3. 2 IDE Channel IO cards with DOS drivers

4. RH5.1-SPARC on ss10: can't mount root booting from cd

5. Optimizing disk-io when doing backup

6. kernel problims a cry for help!!

7. doing a small script to log io on disk

8. question about installing apps

9. VGA IO on systems with multiple PCI IO domains

10. IO-APIC says: unexpected IO-APIC was found

11. Zoltrix Plus IO != 0x20c && IO != 0x30c

12. VGA IO on systems with multiple PCI IO domains

13. mmap+IO potential dangling IO in ext3