* bug: nusb fails to set report protocol with a stall error
@ 2020-11-20 12:58 Nick Owens
2020-11-20 20:57 ` [9front] " Romano
2020-11-21 20:57 ` Nick Owens
0 siblings, 2 replies; 3+ messages in thread
From: Nick Owens @ 2020-11-20 12:58 UTC (permalink / raw)
To: 9front
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);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] bug: nusb fails to set report protocol with a stall error
2020-11-20 12:58 bug: nusb fails to set report protocol with a stall error Nick Owens
@ 2020-11-20 20:57 ` Romano
2020-11-21 20:57 ` Nick Owens
1 sibling, 0 replies; 3+ messages in thread
From: Romano @ 2020-11-20 20:57 UTC (permalink / raw)
To: 9front
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);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug: nusb fails to set report protocol with a stall error
2020-11-20 12:58 bug: nusb fails to set report protocol with a stall error Nick Owens
2020-11-20 20:57 ` [9front] " Romano
@ 2020-11-21 20:57 ` Nick Owens
1 sibling, 0 replies; 3+ messages in thread
From: Nick Owens @ 2020-11-21 20:57 UTC (permalink / raw)
To: 9front
fixed in commit f1d2fdde4a5a.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-21 20:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 12:58 bug: nusb fails to set report protocol with a stall error Nick Owens
2020-11-20 20:57 ` [9front] " Romano
2020-11-21 20:57 ` Nick Owens
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).