Turning on a relay.

2000-04-25 Thread Leif Neland

I'd like to turn on a relay to the power for my laserprinter 3 rooms away
where the server is located.

I have an i/o board with a 8255 24 bit i/o port.(IIRC)

So I wrote a simple userland program to do inb/outb, but it dumped core with
BUSERR, I presume because userland is not supposed to do i/o to the
hardware.

I guess I have these options:
A: write a driver/kernel module to access the port.
B: use an extra parallel port. (I use 2 at the moment)
C: use a serial port; I have 3-4 available.

What would be the simplest to interface from a shellscript, i.e. the spooler
to turn on and off the printer? (The relay has a turn-off delay, so I don't
have to worry about turning off the power after everything has been sent,
but the printer not finished, or turning off/on between printjobs)

Leif





To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



RE: Turning on a relay.

2000-04-25 Thread Jason Young


I think you need to have a fd open on /dev/io to do inb/outb.

Jason Young
Access US(tm) Chief Network Engineer 

 -Original Message-
 From: Leif Neland [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 25, 2000 1:51 PM
 To: [EMAIL PROTECTED]
 Subject: Turning on a relay.
 
 
 I'd like to turn on a relay to the power for my laserprinter 
 3 rooms away
 where the server is located.
 
 I have an i/o board with a 8255 24 bit i/o port.(IIRC)
 
 So I wrote a simple userland program to do inb/outb, but it 
 dumped core with
 BUSERR, I presume because userland is not supposed to do i/o to the
 hardware.
 
 I guess I have these options:
 A: write a driver/kernel module to access the port.
 B: use an extra parallel port. (I use 2 at the moment)
 C: use a serial port; I have 3-4 available.
 
 What would be the simplest to interface from a shellscript, 
 i.e. the spooler
 to turn on and off the printer? (The relay has a turn-off 
 delay, so I don't
 have to worry about turning off the power after everything 
 has been sent,
 but the printer not finished, or turning off/on between printjobs)
 
 Leif
 
 
 
 
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with "unsubscribe freebsd-hackers" in the body of the message
 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Turning on a relay.

2000-04-25 Thread Samuel Tardieu

On 25/04, Leif Neland wrote:

| I guess I have these options:
| A: write a driver/kernel module to access the port.
| B: use an extra parallel port. (I use 2 at the moment)
| C: use a serial port; I have 3-4 available.

D: use i386_set_ioperm to get access to the I/O port space



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Turning on a relay.

2000-04-25 Thread Alfred Perlstein

* Leif Neland [EMAIL PROTECTED] [000425 12:24] wrote:
 I'd like to turn on a relay to the power for my laserprinter 3 rooms away
 where the server is located.
 
 I have an i/o board with a 8255 24 bit i/o port.(IIRC)
 
 So I wrote a simple userland program to do inb/outb, but it dumped core with
 BUSERR, I presume because userland is not supposed to do i/o to the
 hardware.
 
 I guess I have these options:
 A: write a driver/kernel module to access the port.
 B: use an extra parallel port. (I use 2 at the moment)
 C: use a serial port; I have 3-4 available.

D: open(/dev/io)

-Alfred


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Turning on a relay.

2000-04-25 Thread Charles Anderson

Yet another way.

I used 
#include sys/kbio.h
...
io_fd = open("/dev/console", O_RDWR, 0);
ioctl(io_fd, KDENABIO, 0);
and 
ioctl(io_fd, KDDISABIO, 0);

to turn it off again.

Is there a "right" way of doing it?  Linux has a iopl call that sets the
i/o privilege level, it seems much easier and at least better documented.
(I was porting glx code, that was using iopl)

-Charlie
On Tue, Apr 25, 2000 at 12:30:21PM -0700, Alfred Perlstein wrote:
 * Leif Neland [EMAIL PROTECTED] [000425 12:24] wrote:
  I'd like to turn on a relay to the power for my laserprinter 3 rooms away
  where the server is located.
  
  I have an i/o board with a 8255 24 bit i/o port.(IIRC)
  
  So I wrote a simple userland program to do inb/outb, but it dumped core with
  BUSERR, I presume because userland is not supposed to do i/o to the
  hardware.
  
  I guess I have these options:
  A: write a driver/kernel module to access the port.
  B: use an extra parallel port. (I use 2 at the moment)
  C: use a serial port; I have 3-4 available.
 
 D: open(/dev/io)
 
 -Alfred
 
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with "unsubscribe freebsd-hackers" in the body of the message

-- 
Charles Anderson[EMAIL PROTECTED]

No quote, no nothin'


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message