Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/tty.c
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Operations that are exposed through the character device in /dev. | * Operations that are exposed through the character device in /dev. | ||||
*/ | */ | ||||
static int | static int | ||||
ttydev_open(struct cdev *dev, int oflags, int devtype __unused, | ttydev_open(struct cdev *dev, int oflags, int devtype __unused, | ||||
struct thread *td) | struct thread *td) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
int error; | int cflags, error; | ||||
tp = dev->si_drv1; | tp = dev->si_drv1; | ||||
error = 0; | error = 0; | ||||
tty_lock(tp); | tty_lock(tp); | ||||
if (tty_gone(tp)) { | if (tty_gone(tp)) { | ||||
/* Device is already gone. */ | /* Device is already gone. */ | ||||
tty_unlock(tp); | tty_unlock(tp); | ||||
return (ENXIO); | return (ENXIO); | ||||
Show All 39 Lines | if (TTY_CALLOUT(tp, dev)) | ||||
tp->t_termios = tp->t_termios_init_out; | tp->t_termios = tp->t_termios_init_out; | ||||
else | else | ||||
tp->t_termios = tp->t_termios_init_in; | tp->t_termios = tp->t_termios_init_in; | ||||
ttydevsw_param(tp, &tp->t_termios); | ttydevsw_param(tp, &tp->t_termios); | ||||
/* Prevent modem control on callout devices and /dev/console. */ | /* Prevent modem control on callout devices and /dev/console. */ | ||||
if (TTY_CALLOUT(tp, dev) || dev == dev_console) | if (TTY_CALLOUT(tp, dev) || dev == dev_console) | ||||
tp->t_termios.c_cflag |= CLOCAL; | tp->t_termios.c_cflag |= CLOCAL; | ||||
ttydevsw_modem(tp, SER_DTR|SER_RTS, 0); | cflags = 0; | ||||
if (tp->t_termios.c_cflag & CDTR_IFLOW) | |||||
cflags |= SER_DTR; | |||||
if (tp->t_termios.c_cflag & CRTS_IFLOW) | |||||
cflags |= SER_RTS; | |||||
if (cflags != 0) | |||||
ttydevsw_modem(tp, cflags, 0); | |||||
error = ttydevsw_open(tp); | error = ttydevsw_open(tp); | ||||
if (error != 0) | if (error != 0) | ||||
goto done; | goto done; | ||||
ttydisc_open(tp); | ttydisc_open(tp); | ||||
error = tty_watermarks(tp); | error = tty_watermarks(tp); | ||||
if (error != 0) | if (error != 0) | ||||
▲ Show 20 Lines • Show All 2,012 Lines • Show Last 20 Lines |