sync keyboard with recent usb work, and throw in a few misc fixes Reference: /n/atom/patch/applied/teg2kbd Date: Tue Apr 15 22:49:03 CES 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/9/teg2/arch.c Tue Apr 15 22:49:03 2014 +++ /sys/src/9/teg2/arch.c Tue Apr 15 22:49:03 2014 @@ -53,7 +53,7 @@ tos->pcycles = up->pcycles; tos->cyclefreq = m->cpuhz; tos->pid = up->pid; -// tos->core = m->machno; + tos->machno = m->machno; /* make visible immediately to user phase */ l1cache->wbse(tos, sizeof *tos); --- /sys/src/9/teg2/fpiarm.c Tue Apr 15 22:49:03 2014 +++ /sys/src/9/teg2/fpiarm.c Tue Apr 15 22:49:03 2014 @@ -581,6 +581,7 @@ break; ur->pc += 4; } - if(fpemudebug) print("\n"); + if(fpemudebug) + print("\n"); return n; } --- /sys/src/9/teg2/kbd.c Tue Apr 15 22:49:03 2014 +++ /sys/src/9/teg2/kbd.c Tue Apr 15 22:49:03 2014 @@ -27,7 +27,7 @@ Kmouse= Spec|0x100, No= 0x00, /* peter */ - Home= KF|13, + Home= KF|13, /* failure of vision; collides with f keys */ Up= KF|14, Pgup= KF|15, Print= KF|16, @@ -51,7 +51,7 @@ * The codes at 0x79 and 0x7b are produced by the PFU Happy Hacking keyboard. * A 'standard' keyboard doesn't produce anything above 0x58. */ -Rune kbtab[Nscan] = +Rune kbtab[Nscan] = { [0x00] No, 0x1b, '1', '2', '3', '4', '5', '6', [0x08] '7', '8', '9', '0', '-', '=', '\b', '\t', @@ -65,8 +65,8 @@ [0x48] '8', '9', '-', '4', '5', '6', '+', '1', [0x50] '2', '3', '0', '.', No, No, No, KF|11, [0x58] KF|12, No, No, No, No, No, No, No, -[0x60] No, No, No, No, No, No, No, No, -[0x68] No, No, No, No, No, No, No, No, +[0x60] No, No, No, No, KF|13, KF|14, KF|15, KF|16, +[0x68] KF|17, KF|18, KF|19, KF|20, KF|21, KF|22, KF|23, KF|24, [0x70] No, No, No, No, No, No, No, No, [0x78] No, View, No, Up, No, No, No, No, }; @@ -85,8 +85,8 @@ [0x48] '8', '9', '-', '4', '5', '6', '+', '1', [0x50] '2', '3', '0', '.', No, No, No, KF|11, [0x58] KF|12, No, No, No, No, No, No, No, -[0x60] No, No, No, No, No, No, No, No, -[0x68] No, No, No, No, No, No, No, No, +[0x60] No, No, No, No, KF|13, KF|14, KF|15, KF|16, +[0x68] KF|17, KF|18, KF|19, KF|20, KF|21, KF|22, KF|23, KF|24, [0x70] No, No, No, No, No, No, No, No, [0x78] No, Up, No, Up, No, No, No, No, }; @@ -162,10 +162,12 @@ int esc2; int alt; int altgr; - int caps; int ctl; + int caps; int num; + int scroll; int shift; + int lastc; int collecting; int nk; Rune kc[5]; @@ -180,7 +182,7 @@ void kbdputsc(int c, int external) { - int i, keyup; + int i, lastc, keyup; Kbscan *kbscan; if(external) @@ -265,6 +267,8 @@ /* * normal character */ + lastc = kbscan->lastc; + kbscan->lastc = c; if(!(c & (Spec|KF))){ if(kbscan->ctl) if(kbscan->alt && c == Del) @@ -290,6 +294,9 @@ case Caps: kbscan->caps ^= 1; return; + case Scroll: + kbscan->scroll ^= 1; + return; case Num: kbscan->num ^= 1; return; @@ -304,14 +311,16 @@ /* * VMware and Qemu use Ctl-Alt as the key combination * to make the VM give up keyboard and mouse focus. + * Iogear kvm use Ctl followed by Alt as their special key. * This has the unfortunate side effect that when you * come back into focus, Plan 9 thinks you want to type * a compose sequence (you just typed alt). * - * As a clumsy hack around this, we look for ctl-alt - * and don't treat it as the start of a compose sequence. + * As a clumsy hack around this, we look for ctl-alt or + * ctl followed by alt and don't treat it as the start of a + * compose sequence. */ - if(!kbscan->ctl){ + if(lastc != Ctrl && lastc != Shift && !kbscan->ctl){ kbscan->collecting = 1; kbscan->nk = 0; } --- /sys/src/9/teg2/mkfile Tue Apr 15 22:49:03 2014 +++ /sys/src/9/teg2/mkfile Tue Apr 15 22:49:03 2014 @@ -117,10 +117,10 @@ arch.$O clock.$O fpiarm.$O main.$O mmu.$O screen.$O sdscsi.$O syscall.$O \ trap.$O: /$objtype/include/ureg.h -archtegra.$O devether.$0 ether8169.$O: etherif.h ../port/netif.h +archtegra.$O devether.$O ether8169.$O: etherif.h ../port/netif.h archtegra.$O devflash.$O flashtegra.$O flashigep.$O: ../port/flashif.h -fpiarm.$O: ../port/fpi.h ecc.$O flashtegra.$O flashigep.$O: ../port/nandecc.h io.h +fpi.$O fpiarm.$O fpimem.$O: ../port/fpi.h l.$O lexception.$O lproc.$O mmu.$O: arm.s mem.h l.$O rebootcode.$O: cache.v7.s main.$O: errstr.h init.h reboot.h