diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2002-08-25 18:35:44 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2002-08-25 18:35:44 +0000 |
commit | 8a3f71b35d007ae2037f60c6bbe378568eb584d0 (patch) | |
tree | e970e710a793a9785bc7f0b6b76274d5a807e57b /sys | |
parent | 928233d6eae7ebe62aa70b3a64d8332d2eef20c7 (diff) | |
download | FreeBSD-src-8a3f71b35d007ae2037f60c6bbe378568eb584d0.zip FreeBSD-src-8a3f71b35d007ae2037f60c6bbe378568eb584d0.tar.gz |
Add suspend/resume method to syscons. This switch the mode
(text <-> graphics) by changing current vty during ACPI
sleep/wakeup (maybe APM also).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/isa/syscons_isa.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sys/isa/syscons_isa.c b/sys/isa/syscons_isa.c index e6c4380..dabf55d 100644 --- a/sys/isa/syscons_isa.c +++ b/sys/isa/syscons_isa.c @@ -88,6 +88,39 @@ scattach(device_t dev) return sc_attach_unit(device_get_unit(dev), device_get_flags(dev)); } +static int sc_cur_scr; + +static int +scsuspend(device_t dev) +{ + int retry = 10; + static int dummy; + sc_softc_t *sc; + + sc = &main_softc; + sc_cur_scr = sc->cur_scp->index; + do { + sc_switch_scr(sc, 0); + if (!sc->switch_in_progress) { + break; + } + tsleep(&dummy, 0, "scsuspend", 100); + } while (retry--); + + return (0); +} + +static int +scresume(device_t dev) +{ + sc_softc_t *sc; + + sc = &main_softc; + sc_switch_scr(sc, sc_cur_scr); + + return (0); +} + int sc_max_unit(void) { @@ -230,6 +263,8 @@ static device_method_t sc_methods[] = { DEVMETHOD(device_identify, scidentify), DEVMETHOD(device_probe, scprobe), DEVMETHOD(device_attach, scattach), + DEVMETHOD(device_suspend, scsuspend), + DEVMETHOD(device_resume, scresume), { 0, 0 } }; |