aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-23 11:48:47 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-23 11:48:47 +0000
commitbbbb2f0af96dbf6706c90209ebb16dc5b87d32e1 (patch)
tree79922d976c68892be2bf62c880ed154cb8898c8f /hw
parente32664fbd296e962ebb9a731c02e44bc5d1ce3ae (diff)
Fix Caps lock and Num lock handling
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3209 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/slavio_serial.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/hw/slavio_serial.c b/hw/slavio_serial.c
index b71bbb3442..1aa5e7a174 100644
--- a/hw/slavio_serial.c
+++ b/hw/slavio_serial.c
@@ -95,7 +95,7 @@ typedef struct ChannelState {
uint8_t rx, tx, wregs[16], rregs[16];
SERIOQueue queue;
CharDriverState *chr;
- int e0_mode, led_mode;
+ int e0_mode, led_mode, caps_lock_mode, num_lock_mode;
} ChannelState;
struct SerialState {
@@ -195,7 +195,7 @@ static void slavio_serial_reset_chn(ChannelState *s)
s->rx = s->tx = 0;
s->rxint = s->txint = 0;
s->rxint_under_svc = s->txint_under_svc = 0;
- s->e0_mode = s->led_mode = 0;
+ s->e0_mode = s->led_mode = s->caps_lock_mode = s->num_lock_mode = 0;
clear_queue(s);
}
@@ -651,9 +651,32 @@ static void sunkbd_event(void *opaque, int ch)
int release = ch & 0x80;
KBD_DPRINTF("Untranslated keycode %2.2x (%s)\n", ch, release? "release" : "press");
- if (ch == 0xe0) {
+ switch (ch) {
+ case 58: // Caps lock press
+ s->caps_lock_mode ^= 1;
+ if (s->caps_lock_mode == 2)
+ return; // Drop second press
+ break;
+ case 69: // Num lock press
+ s->num_lock_mode ^= 1;
+ if (s->num_lock_mode == 2)
+ return; // Drop second press
+ break;
+ case 186: // Caps lock release
+ s->caps_lock_mode ^= 2;
+ if (s->caps_lock_mode == 3)
+ return; // Drop first release
+ break;
+ case 197: // Num lock release
+ s->num_lock_mode ^= 2;
+ if (s->num_lock_mode == 3)
+ return; // Drop first release
+ break;
+ case 0xe0:
s->e0_mode = 1;
return;
+ default:
+ break;
}
if (s->e0_mode) {
s->e0_mode = 0;