9front - general discussion about 9front
 help / color / mirror / Atom feed
From: vp@a-b.xyz
To: 9front@9front.org
Subject: nusb/joy vs. off brand joy
Date: Sat, 5 Oct 2019 01:00:53 +0000	[thread overview]
Message-ID: <6637C84E04F30150EEDC5C0F16095682@a-b.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 473 bytes --]

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)

             reply	other threads:[~2019-10-05  1:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05  1:00 vp [this message]
2019-10-05  7:46 ` [9front] " Rodrigo G. López

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=6637C84E04F30150EEDC5C0F16095682@a-b.xyz \
    --to=vp@a-b.xyz \
    --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).