[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] ioctl.h

On Mon, 10 Oct 2005 15:45:42 -0500, Evan Langlois <Evan@CoolRunningConcepts.com> wrote:
> On Mon, 2005-10-10 at 19:53 +0200, Peter Slegg wrote:
> > I am trying to compile a Linux application for dowloading
> > data from a Suunto dive computer.
> You'll likely have to know some details about what hardware serial
> signals it needs.  If its standard RTS/CTS, then you can just turn that
> on and comment out the code that doesn't work.  If it uses something
> stranger, it might be easier to make a cable to swap a few control lines
> around.
> > TIOCMSET isn't found. I expected to find it in ioctl.h where
> > TIOCMGET is defined.
> TIOCMGET retrieves the status of serial port signals, and TIOCMSET will
> set them, such as DTR and RTS.  MiNT has the first (but only a hack -
> may not work on anything but the first serial port) as part of
> Ssystem(), but not the second at all.
> > Is there much I can do about this ?
> I don't think so.  I don't believe mint supports these itself.  You'd
> likely have to replace the call with something Atari specific. The
> situation looks grim as far as getting instant access to the state of
> the serial control signals.  Just hacking the source to your app as a
> work-around and faking whatever its trying to do signal-wise may be
> easier.  Supporting this properly looks like it would require changing
> the drivers to actually query the hardware registers for the
> information, adding an OS calls to get it, adding a mintlib function to
> call the OS, etc.
> Not even sure if booting Linux would get you closer since you can't be
> guaranteed that the serial drivers support the call under m68k-linux
> anyway.
> -- Evan


This is an example of the code. It's used in routines to wake-up and
close the serial device. The wake-up may not be needed but I am not
sure about the close down.

I originally started writing my own version of this program and then
and found the Linux one yesterday so I thought it was worth a try.

 /* ---- Set RTS high  ---- */
 (void) ioctl(device, TIOCMGET, &erg);
 erg &= ~TIOCM_RTS;
 (void) ioctl(device, TIOCMSET, &erg);


 /* ---- Set RTS low  ---- */
 (void) ioctl(device, TIOCMGET, &erg);
 erg &= ~TIOCM_RTS;
 (void) ioctl(device, TIOCMSET, &erg);