fix: keep virtual USB responsive under bulk OUT backpressure

This commit is contained in:
tongtong committed 2026-11-13 02:35:00 +08:00
1 parent a339465392
commit 5aa575f182
3 files changed
+37 -4

No files matched your search

+13
View File
@@ -61,6 +61,19 @@ def main():
submit(s,11,1,3,1);assert reply(s,11,-32)==0
wait_until(lambda:received==[b'from-usb'],'bulk OUT delivery')
print('PASS: USB/IP list/import/exclusivity, descriptor stalls, fragmented ADB header/payload, ZLP, bulk OUT, URB unlink and invalid endpoint',flush=True)
# The backend deliberately stops reading after the first eight bytes.
# A blocked bulk OUT must not block unrelated control/IN completions.
payload=b'B'*(1024*1024)
for seq in range(100,112):submit(s,seq,0,2,len(payload),payload)
submit(s,1000,1,0,18,setup=bytes([128,6,0,1,0,0,18,0]))
for _ in range(13):
h=receive(s,48);command,seq=struct.unpack('!2I',h[:8]);assert command==3
if seq==1000:
assert struct.unpack('!I',h[24:28])[0]==18
receive(s,18);break
assert 100<=seq<112
else:raise AssertionError('control transfer starved behind bulk OUT')
print('PASS: blocked 12 MiB bulk OUT does not starve USB control requests',flush=True)
submit(s,12,1,1,1024*1024+1);assert s.recv(1)==b''
print('PASS: oversized URB rejected',flush=True)
finally: