From: umbraticus@prosimetrum.com
To: 9front@9front.org
Subject: nusb/kb screwing up trackball button state
Date: Sun, 08 Nov 2020 18:18:15 +1300 [thread overview]
Message-ID: <347D35C11FD832DD3A2CD9723F571D4E@prosimetrum.com> (raw)
diff -r eef7bc730924 sys/src/cmd/nusb/kb/kb.c
--- a/sys/src/cmd/nusb/kb/kb.c Fri Nov 06 18:15:15 2020 -0800
+++ b/sys/src/cmd/nusb/kb/kb.c Sun Nov 08 17:56:48 2020 +1300
@@ -65,6 +65,7 @@
int y;
int z;
+ int binfo;
int b;
int m;
@@ -602,6 +603,7 @@
case 0x090008:
m = 1<<(l[Usage] - 0x090001);
Button:
+ s->binfo = 1;
s->m |= m;
s->b &= ~m;
if(v != 0)
@@ -629,7 +631,7 @@
s->h = v;
break;
- case 0x0D0051: /* Conteact identifier */
+ case 0x0D0051: /* Contact identifier */
s->id = v;
break;
@@ -677,7 +679,7 @@
char err[ERRMAX], mbuf[80];
uchar lastk[64], uk, dk;
int i, c, nerrs, lastb, nlastk;
- int abs, x, y, z, b;
+ int abs, x, y, z, b, binfo;
Hidreport p;
Hidslot lasts[nelem(p.s)], *s, *l;
Hiddev *f = a;
@@ -766,7 +768,7 @@
continue;
/* combine all the slots */
- abs = x = y = z = b = 0;
+ abs = x = y = z = b = binfo = 0;
for(i=0; i<p.ns; *l = *s, i++){
s = &p.s[i];
@@ -777,7 +779,7 @@
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;
@@ -795,8 +797,9 @@
}
/* map to mouse buttons */
- b |= s->b & 1;
- if(s->b & (4|8))
+ binfo |= s->binfo;
+ b |= s->b & ~6;
+ if(s->b & 4)
b |= 2;
if(s->b & 2)
b |= 4;
@@ -818,6 +821,7 @@
}
}
+ if(binfo == 0) b = lastb;
if(z != 0)
b |= z > 0 ? 8 : 16;
next reply other threads:[~2020-11-08 5:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-08 5:18 umbraticus [this message]
2020-11-08 5:29 ` [9front] " umbraticus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=347D35C11FD832DD3A2CD9723F571D4E@prosimetrum.com \
--to=umbraticus@prosimetrum.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).