From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pb-smtp2.pobox.com ([64.147.108.71]) by ewsd; Fri Nov 20 15:57:59 -0500 2020 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 53F1FA1703 for <9front@9front.org>; Fri, 20 Nov 2020 15:57:52 -0500 (EST) (envelope-from unobe@cpan.org) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date :in-reply-to:references:mime-version:content-type :content-transfer-encoding:subject:to:from:message-id; s=sasl; bh=G+xaUjybgqFHE1JenFidA4AnTqs=; b=oteZZu2Vo5b2RskNBHJ3YeBSODXl QlPVO14FT5trbVADPQWZjhhNbtUvAtZR/tgi4whj34QsPpJiHrECJtP+K2Lec/KW mbSrvhbVU8dCgetii3lCrv2TwdGH8kr7NB1CbIcFJ/pZg0UuEkTl8bEkbnsacp8q 6YCTlkI0AwXObDA= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 4C4A4A1702 for <9front@9front.org>; Fri, 20 Nov 2020 15:57:52 -0500 (EST) (envelope-from unobe@cpan.org) Received: from [10.0.1.4] (unknown [47.34.135.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 8C09EA1701 for <9front@9front.org>; Fri, 20 Nov 2020 15:57:51 -0500 (EST) (envelope-from unobe@cpan.org) Date: Fri, 20 Nov 2020 20:57:48 +0000 In-Reply-To: <20201120125824.typpmodrlnro2wnc@wololo.home.arpa> References: <20201120125824.typpmodrlnro2wnc@wololo.home.arpa> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9front] bug: nusb fails to set report protocol with a stall error To: 9front@9front.org From: Romano Message-ID: <7209E756-564E-429D-A1E5-62D0495D783D@cpan.org> X-Pobox-Relay-ID: 0DB13FD0-2B73-11EB-850F-74DE23BA3BAF-09620299!pb-smtp2.pobox.com List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: converged private interface YAML over ACPI database-based package I had noticed this consistently on my rpi4, but hadn't had time to look at = it=2E It generally occurs when I plug in my Logitech MX Ergo mouse=2E On November 20, 2020 12:58:24 PM UTC, Nick Owens = wrote: >on my desktop with usb3, i see 'setproto: Stall Error' with certain >devices=2E > >when using nusb/kb with my tex shinobi, i see a stall error, but only >for the builtin trackpoint=2E > >when using nusb/joy i see a stall error with my ps4 controller=2E > >with a short test, i just removed the command to set the interface >protocol, and now both devices work=2E > >after looking at the HID 1=2E11 spec, it seems like if a HID interface >descriptor has an interface subclass of 0, support for set protocol is >optional=2E > >here is a patch which avoids setproto for devices which might not >support it, and it works for both my tex shinobi and ps4 controller=2E > >thoughts? > >diff --git a/sys/src/cmd/nusb/joy/joy=2Ec b/sys/src/cmd/nusb/joy/joy=2Ec >--- a/sys/src/cmd/nusb/joy/joy=2Ec >+++ b/sys/src/cmd/nusb/joy/joy=2Ec >@@ -222,6 +222,12 @@ setproto(KDev *f, int eid) > proto =3D Reportproto; > }else > kbfatal(f, "no report"); >+ >+ // if a HID's subclass code is 0, it may not support setproto, >+ // and is always initialized in report mode=2E >+ if(((iface->csp>>8)&0xFF) =3D=3D 0) >+ return 0; >+ > return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, id, nil, >0); > } >=20 >diff --git a/sys/src/cmd/nusb/kb/kb=2Ec b/sys/src/cmd/nusb/kb/kb=2Ec >--- a/sys/src/cmd/nusb/kb/kb=2Ec >+++ b/sys/src/cmd/nusb/kb/kb=2Ec >@@ -368,6 +368,12 @@ setproto(Hiddev *f, int eid) > } > proto =3D Bootproto; > } >+ >+ // if a HID's subclass code is 0, it may not support setproto, >+ // and is always initialized in report mode=2E >+ if(((iface->csp>>8)&0xFF) =3D=3D 0) >+ return 0; >+ > return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, iface->id, >nil, 0); > } >=20