Skip to content

Commit e1a8303

Browse files
committed
fix: make endpoint 0 stall not a noop
1 parent ffee1f8 commit e1a8303

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/machine/usb.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ func handleStandardSetup(setup usb.Setup) bool {
217217
} else if setup.WValueL == 0 { // ENDPOINTHALT
218218
if usbStallHandler[setup.WIndex&0x7F] != nil {
219219
return usbStallHandler[setup.WIndex&0x7F](setup)
220-
} else {
221-
isEndpointHalt = false
222220
}
221+
isEndpointHalt = false
223222
}
224223
SendZlp()
225224
return true
@@ -230,9 +229,8 @@ func handleStandardSetup(setup usb.Setup) bool {
230229
} else if setup.WValueL == 0 { // ENDPOINTHALT
231230
if usbStallHandler[setup.WIndex&0x7F] != nil {
232231
return usbStallHandler[setup.WIndex&0x7F](setup)
233-
} else {
234-
isEndpointHalt = true
235232
}
233+
isEndpointHalt = true
236234
}
237235
SendZlp()
238236
return true

src/machine/usb/msc/msc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (m *msc) run(b []byte, isEpOut bool) {
204204
m.state = mscStateNeedReset
205205
m.stallEndpoint(usb.MSC_ENDPOINT_IN)
206206
m.stallEndpoint(usb.MSC_ENDPOINT_OUT)
207-
m.stallEndpoint(0)
207+
m.stallEndpoint(usb.CONTROL_ENDPOINT)
208208
return
209209
}
210210

src/machine/usb/msc/setup.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ func (m *msc) stallEndpoint(ep uint8) {
121121
} else if ep == usb.MSC_ENDPOINT_OUT {
122122
m.rxStalled = true
123123
machine.SetStallEPOut(usb.MSC_ENDPOINT_OUT)
124+
} else if ep == usb.CONTROL_ENDPOINT {
125+
machine.SetStallEPIn(usb.CONTROL_ENDPOINT)
124126
}
125127
}
126128

0 commit comments

Comments
 (0)