Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Oct 2000 14:40:38 +0200
From:      Alexander Maret <maret@atrada.net>
To:        "'freebsd-hackers@freebsd.org'" <freebsd-hackers@freebsd.org>
Subject:   Accessing the tty structure of an opened device
Message-ID:  <58A002A02C5ED311812E0050044517F00D2611@erlangen01.atrada.de>

next in thread | raw e-mail | index | archive | help
Hi,

is it possible to access the tty structure of an opened
device directly?

Background:
I'm trying to sense the DCD state of a serial port for
getting the pulses and spaces of a simple IR device.
I could use ioctl commands to get the current state but then
I would have to check the state continously which uses
too much cpu time.
What I want to do is something like that:

- open the serial port
- get the tty structure of the opened device
- define something like that:
#define TSA_CARR_OFF(tp)         (!((void *)&(tp)->t_rawq))
and then wait for TSA_CARR_OFF and TSA_CARR_ON

for example:
- get current DCD state
if DCD is up
  error = tsleep(TSA_CARR_OFF(tp), .....)

to get a wakeup on DCD down.

Is this possible and if yes where do I get access to the
tty structure of my opened serial port?

Unfortunately I'm no kernel hacker so be patient with me.
I tried to find examples within the source code and in
"The design and implementation of the 4.4 BSD OS" but couldn't
find a good solution.

An example code how to access the tty structure would be great.
Perhaps you can point me to the right files within the kernel
sources.


Thanks in advance,
Alex



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?58A002A02C5ED311812E0050044517F00D2611>