From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <9front-bounces@9front.inri.net> X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from 9front.inri.net (9front.inri.net [168.235.81.73]) by inbox.vuxu.org (Postfix) with ESMTP id 4D3D32A4F4 for ; Sun, 14 Jan 2024 22:30:01 +0100 (CET) Received: from duke.felloff.net ([216.126.196.34]) by 9front; Sun Jan 14 16:28:13 -0500 2024 Message-ID: <0D913CCE4BB41F2B69426CB225F5D0CE@felloff.net> Date: Sun, 14 Jan 2024 22:28:01 +0100 From: cinap_lenrek@felloff.net To: 9front@9front.org In-Reply-To: <147EB4543ABBB0841A8F54F2B9AB766B@gaff.inri.net> 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: content-addressed JSON over YAML wrapper high-performance service-scale database Subject: Re: [9front] recent kernel changes break built-in wacom serial tablet on Reply-To: 9front@9front.org Precedence: bulk another possibility: at startup, it aux/wacom asks the device for the resolution that it will later use for scaling: int query(Tablet* t) { uchar buf[11]; if(write(t->ser, "&0*", 3) < 3) return -1; do { if(read(t->ser, buf, 1) < 1) return -1; } while(buf[0] != 0xC0); if(readn(t->ser, buf+1, 10) < 10) return -1; t->xmax = (buf[1] << 9) | (buf[2] << 2) | ((buf[6] >> 5) & 3); t->ymax = (buf[3] << 9) | (buf[4] << 2) | ((buf[6] >> 3) & 3); t->pmax = buf[5] | (buf[6] & 7); t->version = (buf[9] << 7) | buf[10]; if(write(t->ser, "1", 1) < 1) return -1; return 0; } if this procress goes wrong for some reason (because theres maybe garbage in the fifo?), we might end up with a out-of-range t->ymax, causing the y-corrdinate to become stuck at eigther extreme? adding a debug print here would be helpfull, and maybe just calling query() multiple times to see if the values stay consistent: fprint(2, "query: xmax=%d ymax=%d pmax=%d version=%d\n", t->xmax, t->ymax, t->pmax, t->version); ... if(query(t) < 0) sysfatal("%r"); + if(query(t) < 0) sysfatal("%r"); + if(query(t) < 0) sysfatal("%r"); and finally, we should add a debug print in readpacket() *BEFORE* the scaling: m->b = head & 7; m->x = (buf[0] << 9) | (buf[1] << 2) | ((buf[5] >> 5) & 3); m->y = (buf[2] << 9) | (buf[3] << 2) | ((buf[5] >> 3) & 3); m->p = ((buf[5] & 7) << 7) | buf[4]; fprint(2, "readpacket: b=%x x=%d y=%d p=%d\n", m->b, m->x, m->y, m->p); ... in any case, lets make sure we understand what is actually happening because i dont know of any way how our recent changes could have screwed up your tablet :( -- cinap