9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Romano <unobe@cpan.org>
To: 9front@9front.org
Subject: Re: [9front] bug: nusb fails to set report protocol with a stall error
Date: Fri, 20 Nov 2020 20:57:48 +0000	[thread overview]
Message-ID: <7209E756-564E-429D-A1E5-62D0495D783D@cpan.org> (raw)
In-Reply-To: <20201120125824.typpmodrlnro2wnc@wololo.home.arpa>

I had noticed this consistently on my rpi4, but hadn't had time to look at it. It generally occurs when I plug in my Logitech MX Ergo mouse.

On November 20, 2020 12:58:24 PM UTC, Nick Owens <mischief@offblast.org> wrote:
>on my desktop with usb3, i see 'setproto: Stall Error' with certain
>devices.
>
>when using nusb/kb with my tex shinobi, i see a stall error, but only
>for the builtin trackpoint.
>
>when using nusb/joy i see a stall error with my ps4 controller.
>
>with a short test, i just removed the command to set the interface
>protocol, and now both devices work.
>
>after looking at the HID 1.11 spec, it seems like if a HID interface
>descriptor has an interface subclass of 0, support for set protocol is
>optional.
>
>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.
>
>thoughts?
>
>diff --git a/sys/src/cmd/nusb/joy/joy.c b/sys/src/cmd/nusb/joy/joy.c
>--- a/sys/src/cmd/nusb/joy/joy.c
>+++ b/sys/src/cmd/nusb/joy/joy.c
>@@ -222,6 +222,12 @@ setproto(KDev *f, int eid)
> 		proto = 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.
>+	if(((iface->csp>>8)&0xFF) == 0)
>+		return 0;
>+
>	return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, id, nil,
>0);
> }
> 
>diff --git a/sys/src/cmd/nusb/kb/kb.c b/sys/src/cmd/nusb/kb/kb.c
>--- a/sys/src/cmd/nusb/kb/kb.c
>+++ b/sys/src/cmd/nusb/kb/kb.c
>@@ -368,6 +368,12 @@ setproto(Hiddev *f, int eid)
> 		}
> 		proto = Bootproto;
> 	}
>+
>+	// if a HID's subclass code is 0, it may not support setproto,
>+	// and is always initialized in report mode.
>+	if(((iface->csp>>8)&0xFF) == 0)
>+		return 0;
>+
>	return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, iface->id,
>nil, 0);
> }
> 


  reply	other threads:[~2020-11-20 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 12:58 Nick Owens
2020-11-20 20:57 ` Romano [this message]
2020-11-21 20:57 ` Nick Owens
2020-11-20 21:43 [9front] " Romano
2020-11-20 22:19 ` Nick Owens
2020-11-21 12:48 ` cinap_lenrek

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=7209E756-564E-429D-A1E5-62D0495D783D@cpan.org \
    --to=unobe@cpan.org \
    --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).