Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/syscons/syscons.c
Show First 20 Lines • Show All 402 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
sctty_outwakeup(struct tty *tp) | sctty_outwakeup(struct tty *tp) | ||||
{ | { | ||||
size_t len; | size_t len; | ||||
u_char buf[PCBURST]; | u_char buf[PCBURST]; | ||||
scr_stat *scp = sc_get_stat(tp); | scr_stat *scp = sc_get_stat(tp); | ||||
ttydisc_assert_locked(tp); | |||||
if (scp->status & SLKED || | if (scp->status & SLKED || | ||||
(scp == scp->sc->cur_scp && scp->sc->blink_in_progress)) | (scp == scp->sc->cur_scp && scp->sc->blink_in_progress)) | ||||
return; | return; | ||||
for (;;) { | for (;;) { | ||||
len = ttydisc_getc(tp, buf, sizeof buf); | len = ttydisc_getc(tp, buf, sizeof buf); | ||||
if (len == 0) | if (len == 0) | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | if (sc->kbd != NULL) { | ||||
key.keynum = KEYCODE_BS; | key.keynum = KEYCODE_BS; | ||||
(void)kbdd_ioctl(sc->kbd, GIO_KEYMAPENT, (caddr_t)&key); | (void)kbdd_ioctl(sc->kbd, GIO_KEYMAPENT, (caddr_t)&key); | ||||
tp->t_termios.c_cc[VERASE] = key.key.map[0]; | tp->t_termios.c_cc[VERASE] = key.key.map[0]; | ||||
} | } | ||||
} | } | ||||
scp = sc_get_stat(tp); | scp = sc_get_stat(tp); | ||||
if (scp == NULL) { | if (scp == NULL) { | ||||
/* | |||||
* ttydisc lock isn't sleepable like Giant, so we must go ahead | |||||
* and drop it. The tty lock is still held, but that's Giant at | |||||
* the moment as it was before the ttydisc lock became distinct. | |||||
* This is still likely unsafe, but something to revisit once | |||||
* this particular tty device isn't Giant locked anymore. | |||||
*/ | |||||
ttydisc_unlock(tp); | |||||
scp = SC_STAT(tp) = alloc_scp(sc, SC_VTY(tp)); | scp = SC_STAT(tp) = alloc_scp(sc, SC_VTY(tp)); | ||||
ttydisc_lock(tp); | |||||
if (ISGRAPHSC(scp)) | if (ISGRAPHSC(scp)) | ||||
sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8); | sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8); | ||||
} | } | ||||
if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) { | if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) { | ||||
tp->t_winsize.ws_col = scp->xsize; | tp->t_winsize.ws_col = scp->xsize; | ||||
tp->t_winsize.ws_row = scp->ysize; | tp->t_winsize.ws_row = scp->ysize; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | sckbdevent(keyboard_t *thiskbd, int event, void *arg) | ||||
* Loop while there is still input to get from the keyboard. | * Loop while there is still input to get from the keyboard. | ||||
* I don't think this is nessesary, and it doesn't fix | * I don't think this is nessesary, and it doesn't fix | ||||
* the Xaccel-2.1 keyboard hang, but it can't hurt. XXX | * the Xaccel-2.1 keyboard hang, but it can't hurt. XXX | ||||
*/ | */ | ||||
while ((c = scgetc(sc, SCGETC_NONBLOCK, NULL)) != NOKEY) { | while ((c = scgetc(sc, SCGETC_NONBLOCK, NULL)) != NOKEY) { | ||||
cur_tty = SC_DEV(sc, sc->cur_scp->index); | cur_tty = SC_DEV(sc, sc->cur_scp->index); | ||||
if (!tty_opened_ns(cur_tty)) | if (!tty_opened_ns(cur_tty)) | ||||
continue; | continue; | ||||
ttydisc_lock(cur_tty); | |||||
if ((*sc->cur_scp->tsw->te_input)(sc->cur_scp, c, cur_tty)) | if ((*sc->cur_scp->tsw->te_input)(sc->cur_scp, c, cur_tty)) { | ||||
ttydisc_unlock(cur_tty); | |||||
continue; | continue; | ||||
} | |||||
switch (KEYFLAGS(c)) { | switch (KEYFLAGS(c)) { | ||||
case 0x0000: /* normal key */ | case 0x0000: /* normal key */ | ||||
ttydisc_rint(cur_tty, KEYCHAR(c), 0); | ttydisc_rint(cur_tty, KEYCHAR(c), 0); | ||||
break; | break; | ||||
case FKEY: /* function key, return string */ | case FKEY: /* function key, return string */ | ||||
cp = (*sc->cur_scp->tsw->te_fkeystr)(sc->cur_scp, c); | cp = (*sc->cur_scp->tsw->te_fkeystr)(sc->cur_scp, c); | ||||
if (cp != NULL) { | if (cp != NULL) { | ||||
Show All 9 Lines | case MKEY: /* meta is active, prepend ESC */ | ||||
ttydisc_rint(cur_tty, KEYCHAR(c), 0); | ttydisc_rint(cur_tty, KEYCHAR(c), 0); | ||||
break; | break; | ||||
case BKEY: /* backtab fixed sequence (esc [ Z) */ | case BKEY: /* backtab fixed sequence (esc [ Z) */ | ||||
ttydisc_rint_simple(cur_tty, "\x1B[Z", 3); | ttydisc_rint_simple(cur_tty, "\x1B[Z", 3); | ||||
break; | break; | ||||
} | } | ||||
ttydisc_rint_done(cur_tty); | ttydisc_rint_done(cur_tty); | ||||
ttydisc_unlock(cur_tty); | |||||
} | } | ||||
sc->cur_scp->status |= MOUSE_HIDDEN; | sc->cur_scp->status |= MOUSE_HIDDEN; | ||||
done: | done: | ||||
mtx_unlock(&Giant); | mtx_unlock(&Giant); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 3,347 Lines • ▼ Show 20 Lines | |||||
sc_paste(scr_stat *scp, const u_char *p, int count) | sc_paste(scr_stat *scp, const u_char *p, int count) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
u_char *rmap; | u_char *rmap; | ||||
tp = SC_DEV(scp->sc, scp->sc->cur_scp->index); | tp = SC_DEV(scp->sc, scp->sc->cur_scp->index); | ||||
if (!tty_opened_ns(tp)) | if (!tty_opened_ns(tp)) | ||||
return; | return; | ||||
ttydisc_lock(tp); | |||||
rmap = scp->sc->scr_rmap; | rmap = scp->sc->scr_rmap; | ||||
for (; count > 0; --count) | for (; count > 0; --count) | ||||
ttydisc_rint(tp, rmap[*p++], 0); | ttydisc_rint(tp, rmap[*p++], 0); | ||||
ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
ttydisc_unlock(tp); | |||||
} | } | ||||
void | void | ||||
sc_respond(scr_stat *scp, const u_char *p, int count, int wakeup) | sc_respond(scr_stat *scp, const u_char *p, int count, int wakeup) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
tp = SC_DEV(scp->sc, scp->sc->cur_scp->index); | tp = SC_DEV(scp->sc, scp->sc->cur_scp->index); | ||||
if (!tty_opened_ns(tp)) | if (!tty_opened_ns(tp)) | ||||
return; | return; | ||||
ttydisc_lock(tp); | |||||
ttydisc_rint_simple(tp, p, count); | ttydisc_rint_simple(tp, p, count); | ||||
if (wakeup) { | if (wakeup) { | ||||
/* XXX: we can't always call ttydisc_rint_done() here! */ | /* XXX: we can't always call ttydisc_rint_done() here! */ | ||||
ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
} | } | ||||
ttydisc_unlock(tp); | |||||
} | } | ||||
/* | /* | ||||
* pitch is the divisor for 1.193182MHz PIT clock. By dividing 1193172 / pitch, | * pitch is the divisor for 1.193182MHz PIT clock. By dividing 1193172 / pitch, | ||||
* we convert it back to Hz. | * we convert it back to Hz. | ||||
* duration is in ticks of 1/hz. | * duration is in ticks of 1/hz. | ||||
*/ | */ | ||||
void | void | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |