From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from yow.a-b.xyz ([45.32.152.219]) by ewsd; Fri Oct 4 21:00:44 EDT 2019 Received: by yow.a-b.xyz (OpenSMTPD) with ESMTPSA id 7ee5d02f (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Sat, 5 Oct 2019 03:00:37 +0200 (CEST) Message-ID: <6637C84E04F30150EEDC5C0F16095682@a-b.xyz> To: 9front@9front.org subject: nusb/joy vs. off brand joy Date: Sat, 5 Oct 2019 01:00:53 +0000 From: vp@a-b.xyz MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-lszejvtkywkquedzmjerikqznk" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: interface-oriented cloud-oriented manager This is a multi-part message in MIME format. --upas-lszejvtkywkquedzmjerikqznk Content-Disposition: inline Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit I had no restraint and have helped myself to a White Shark® "DoubleShock", "PC-compatible", "gaming only", ultra-cheap game controller. Nusb/joy complains about not finding a suitable endpoint because it demands: ep->dir == Ein while my controller happens to report a both-way endpoint. Allowing the Eboth endpoint makes it work fine, but I don't know if this could be troublesome for other controllers. Patch is attached. -- kvik --upas-lszejvtkywkquedzmjerikqznk Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit diff -r b73f589b3c7d sys/src/cmd/nusb/joy/joy.c --- a/sys/src/cmd/nusb/joy/joy.c Sat Sep 07 02:13:35 2019 +0200 +++ b/sys/src/cmd/nusb/joy/joy.c Sat Oct 05 00:49:16 2019 +0000 @@ -431,7 +431,7 @@ for(i = 0; i < nelem(ud->ep); i++){ if((ep = ud->ep[i]) == nil) continue; - if(ep->type == Eintr && ep->dir == Ein && ep->iface->csp == JoyCSP) + if(ep->type == Eintr && (ep->dir == Ein || ep->dir == Eboth) && ep->iface->csp == JoyCSP) break; } if(ep == nil) --upas-lszejvtkywkquedzmjerikqznk--