diff options
author | Sigrid <ftrvxmtrx@gmail.com> | 2020-12-08 11:47:15 +0100 |
---|---|---|
committer | Sigrid <ftrvxmtrx@gmail.com> | 2020-12-08 11:47:15 +0100 |
commit | 07805ac8927ca8034a2e1bc39ef1b6a20f80806c (patch) | |
tree | a34794c62dd7ec9be5e80f75a0e8049c292916f8 | |
parent | 3d9abd96aea42e7e1134e0f241cb57275a29bc71 (diff) | |
download | plan9front-07805ac8927ca8034a2e1bc39ef1b6a20f80806c.tar.xz |
nusb/kb: update button state if event was actually received, fix typos (thanks umbraticus)
-rw-r--r-- | sys/src/cmd/nusb/kb/kb.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/src/cmd/nusb/kb/kb.c b/sys/src/cmd/nusb/kb/kb.c index 7b9ed9f2c..e00c85b99 100644 --- a/sys/src/cmd/nusb/kb/kb.c +++ b/sys/src/cmd/nusb/kb/kb.c @@ -637,7 +637,7 @@ hidparse(int t, int f, int g[], int l[], int, void *a) s->h = v; break; - case 0x0D0051: /* Conteact identifier */ + case 0x0D0051: /* Contact identifier */ s->id = v; break; @@ -684,7 +684,7 @@ readerproc(void* a) { char err[ERRMAX], mbuf[80]; uchar lastk[64], uk, dk; - int i, c, nerrs, lastb, nlastk; + int i, c, nerrs, bpress, lastb, nlastk; int abs, x, y, z, b; Hidreport p; Hidslot lasts[nelem(p.s)], *s, *l; @@ -774,7 +774,7 @@ readerproc(void* a) continue; /* combine all the slots */ - abs = x = y = z = b = 0; + bpress = abs = x = y = z = b = 0; for(i=0; i<p.ns; *l = *s, i++){ s = &p.s[i]; @@ -785,7 +785,7 @@ readerproc(void* a) if(l == &lasts[nelem(lasts)-1] || !l->valid) *l = *s; - /* convet absolute z to relative */ + /* convert absolute z to relative */ z += s->z; if(s->abs & 4) z -= l->z; @@ -808,6 +808,7 @@ readerproc(void* a) b |= 2; if(s->b & 2) b |= 4; + bpress |= s->m; /* X/Y are absolute? */ if((s->abs & 3) == 3){ @@ -825,7 +826,9 @@ readerproc(void* a) y += s->y; } } - + + if(bpress == 0) + b = lastb & 7; if(z != 0) b |= z > 0 ? 8 : 16; |