File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,10 @@ func handleStandardSetup(setup usb.Setup) bool {
213
213
if setup .WValueL == 1 { // DEVICEREMOTEWAKEUP
214
214
isRemoteWakeUpEnabled = false
215
215
} else if setup .WValueL == 0 { // ENDPOINTHALT
216
- if usbStallHandler [setup .WIndex & 0x7F ] != nil {
216
+ if setup .WIndex < usb .NumberOfEndpoints && usbStallHandler [setup .WIndex & 0x7F ] != nil {
217
+ // Host has requested to clear an endpoint stall. If the request is addressed to
218
+ // an endpoint with a configured StallHandler, forward the message on.
219
+ // The 0x7F mask is used to clear the direction bit from the endpoint number
217
220
return usbStallHandler [setup .WIndex & 0x7F ](setup )
218
221
}
219
222
isEndpointHalt = false
@@ -225,7 +228,10 @@ func handleStandardSetup(setup usb.Setup) bool {
225
228
if setup .WValueL == 1 { // DEVICEREMOTEWAKEUP
226
229
isRemoteWakeUpEnabled = true
227
230
} else if setup .WValueL == 0 { // ENDPOINTHALT
228
- if usbStallHandler [setup .WIndex & 0x7F ] != nil {
231
+ if setup .WIndex < usb .NumberOfEndpoints && usbStallHandler [setup .WIndex & 0x7F ] != nil {
232
+ // Host has requested to stall an endpoint. If the request is addressed to
233
+ // an endpoint with a configured StallHandler, forward the message on.
234
+ // The 0x7F mask is used to clear the direction bit from the endpoint number
229
235
return usbStallHandler [setup .WIndex & 0x7F ](setup )
230
236
}
231
237
isEndpointHalt = true
You can’t perform that action at this time.
0 commit comments