From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30528 invoked from network); 8 Dec 2020 00:59:39 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 8 Dec 2020 00:59:39 -0000 Received: from asquith.prosimetrum.com ([125.236.209.157]) by ewsd; Mon Dec 7 19:58:19 -0500 2020 Message-ID: <3081D214DA81F6DFFBB5552DC58A6020@prosimetrum.com> Date: Tue, 08 Dec 2020 13:59:12 +1300 From: umbraticus@prosimetrum.com To: 9front@9front.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: distributed mobile wrapper high-performance SVG over SOAP element service Subject: [9front] nusb/kb mouse handling Reply-To: 9front@9front.org Precedence: bulk This patch is tidier than the last one I sent. It does three things: 1. Only update button state if a button event was actually received. 2. Send b = 8 through instead of treating like b = 2. 3. Fix some typos. umbraticus diff -r 7a249c0196e5 sys/src/cmd/nusb/kb/kb.c --- a/sys/src/cmd/nusb/kb/kb.c Mon Dec 07 18:59:54 2020 +0100 +++ b/sys/src/cmd/nusb/kb/kb.c Tue Dec 08 13:38:54 2020 +1300 @@ -637,7 +637,7 @@ s->h = v; break; - case 0x0D0051: /* Conteact identifier */ + case 0x0D0051: /* Contact identifier */ s->id = v; break; @@ -684,7 +684,7 @@ { 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 @@ continue; /* combine all the slots */ - abs = x = y = z = b = 0; + bpress = abs = x = y = z = b = 0; for(i=0; ivalid) *l = *s; - /* convet absolute z to relative */ + /* convert absolute z to relative */ z += s->z; if(s->abs & 4) z -= l->z; @@ -803,11 +803,8 @@ } /* map to mouse buttons */ - b |= s->b & 1; - if(s->b & (4|8)) - b |= 2; - if(s->b & 2) - b |= 4; + bpress |= s->m; + b |= s->b & ~6 | (s->b & 2) << 1 | (s->b & 4) >> 1; /* X/Y are absolute? */ if((s->abs & 3) == 3){ @@ -829,6 +826,7 @@ if(z != 0) b |= z > 0 ? 8 : 16; + if(!bpress) b = lastb; if(abs || x != 0 || y != 0 || z != 0 || b != lastb){ lastb = b;