@@ -213,11 +213,11 @@ 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 setup .WIndex < usb .NumberOfEndpoints && usbStallHandler [setup . WIndex & 0x7F ] != nil {
216
+ if idx := setup .WIndex & 0x7F ; idx < usb .NumberOfEndpoints && usbStallHandler [idx ] != nil {
217
217
// Host has requested to clear an endpoint stall. If the request is addressed to
218
218
// an endpoint with a configured StallHandler, forward the message on.
219
219
// The 0x7F mask is used to clear the direction bit from the endpoint number
220
- return usbStallHandler [setup . WIndex & 0x7F ](setup )
220
+ return usbStallHandler [idx ](setup )
221
221
}
222
222
isEndpointHalt = false
223
223
}
@@ -228,11 +228,11 @@ func handleStandardSetup(setup usb.Setup) bool {
228
228
if setup .WValueL == 1 { // DEVICEREMOTEWAKEUP
229
229
isRemoteWakeUpEnabled = true
230
230
} else if setup .WValueL == 0 { // ENDPOINTHALT
231
- if setup .WIndex < usb .NumberOfEndpoints && usbStallHandler [setup . WIndex & 0x7F ] != nil {
231
+ if idx := setup .WIndex & 0x7F ; idx < usb .NumberOfEndpoints && usbStallHandler [idx ] != nil {
232
232
// Host has requested to stall an endpoint. If the request is addressed to
233
233
// an endpoint with a configured StallHandler, forward the message on.
234
234
// The 0x7F mask is used to clear the direction bit from the endpoint number
235
- return usbStallHandler [setup . WIndex & 0x7F ](setup )
235
+ return usbStallHandler [idx ](setup )
236
236
}
237
237
isEndpointHalt = true
238
238
}
0 commit comments