diff options
author | sos <sos@FreeBSD.org> | 1997-10-01 20:46:29 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 1997-10-01 20:46:29 +0000 |
commit | 85a02d214d4daf2fbdbfa72558a07df37a7d832f (patch) | |
tree | 21006868c4674b0de8ef5f6bfd5dd0fd1d08d979 /sys/dev | |
parent | 8880ef0decba18474fbb1f90a0869f48177cabf3 (diff) | |
download | FreeBSD-src-85a02d214d4daf2fbdbfa72558a07df37a7d832f.zip FreeBSD-src-85a02d214d4daf2fbdbfa72558a07df37a7d832f.tar.gz |
Add a new keyboard mode K_CODE. Returns a single byte for each key
much like the scancode mode.
However the keys that (for no good reason) returns extension codes
etc, are translated into singlebyte codes.
Needed by libvgl. This makes life ALOT easier, also the XFree86
folks could use this.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/syscons/syscons.c | 19 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.h | 19 |
2 files changed, 25 insertions, 13 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index fa0c28a..c92bb36 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.232 1997/09/14 03:19:27 peter Exp $ + * $Id: syscons.c,v 1.233 1997/09/26 15:27:55 itojun Exp $ */ #include "sc.h" @@ -1408,13 +1408,19 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) case KDSKBMODE: /* set keyboard mode */ switch (*data) { case K_RAW: /* switch to RAW scancode mode */ + scp->status &= ~KBD_CODE_MODE; scp->status |= KBD_RAW_MODE; return 0; + case K_CODE: /* switch to CODE mode */ + scp->status &= ~KBD_RAW_MODE; + scp->status |= KBD_CODE_MODE; + return 0; + case K_XLATE: /* switch to XLT ascii mode */ if (scp == cur_console && scp->status & KBD_RAW_MODE) shfts = ctls = alts = agrs = metas = 0; - scp->status &= ~KBD_RAW_MODE; + scp->status &= ~(KBD_RAW_MODE | KBD_CODE_MODE); return 0; default: return EINVAL; @@ -1422,7 +1428,8 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) /* NOT REACHED */ case KDGKBMODE: /* get keyboard mode */ - *data = (scp->status & KBD_RAW_MODE) ? K_RAW : K_XLATE; + *data = (scp->status & KBD_RAW_MODE) ? K_RAW : + ((scp->status & KBD_CODE_MODE) ? K_CODE : K_XLATE); return 0; case KDMKTONE: /* sound the bell */ @@ -1992,7 +1999,8 @@ exchange_scr(void) set_destructive_cursor(new_scp); if ((old_scp->status & UNKNOWN_MODE) && crtc_vga) load_palette(palette); - if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE) + if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE || + old_scp->status & KBD_CODE_MODE || new_scp->status & KBD_CODE_MODE) shfts = ctls = alts = agrs = metas = 0; update_leds(new_scp->status); delayed_next_scr = FALSE; @@ -3026,6 +3034,9 @@ next_code: break; } + if (cur_console->status & KBD_CODE_MODE) + return (keycode | (scancode & 0x80)); + /* if scroll-lock pressed allow history browsing */ if (cur_console->history && cur_console->status & SLKED) { int i; diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 578a71e..0c74c32 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.h,v 1.32 1997/08/25 23:21:55 bde Exp $ + * $Id: syscons.h,v 1.33 1997/09/04 23:01:06 yokota Exp $ */ #ifndef _I386_ISA_SYSCONS_H_ @@ -56,14 +56,15 @@ #define LED_MASK 0x00007 #define UNKNOWN_MODE 0x00010 #define KBD_RAW_MODE 0x00020 -#define SWITCH_WAIT_REL 0x00040 -#define SWITCH_WAIT_ACQ 0x00080 -#define BUFFER_SAVED 0x00100 -#define CURSOR_ENABLED 0x00200 -#define MOUSE_ENABLED 0x00400 -#define MOUSE_MOVED 0x00800 -#define MOUSE_CUTTING 0x01000 -#define MOUSE_VISIBLE 0x02000 +#define KBD_CODE_MODE 0x00040 +#define SWITCH_WAIT_REL 0x00080 +#define SWITCH_WAIT_ACQ 0x00100 +#define BUFFER_SAVED 0x00200 +#define CURSOR_ENABLED 0x00400 +#define MOUSE_ENABLED 0x00800 +#define MOUSE_MOVED 0x01000 +#define MOUSE_CUTTING 0x02000 +#define MOUSE_VISIBLE 0x04000 /* configuration flags */ #define VISUAL_BELL 0x00001 |