Revision 82887262 usb-linux.c
b/usb-linux.c | ||
---|---|---|
100 | 100 |
int iso_urb_idx; |
101 | 101 |
int iso_buffer_used; |
102 | 102 |
int max_packet_size; |
103 |
int inflight; |
|
103 | 104 |
}; |
104 | 105 |
|
105 | 106 |
struct USBAutoFilter { |
... | ... | |
184 | 185 |
|
185 | 186 |
static void set_iso_started(USBHostDevice *s, int ep) |
186 | 187 |
{ |
187 |
get_endp(s, ep)->iso_started = 1; |
|
188 |
struct endp_data *e = get_endp(s, ep); |
|
189 |
if (!e->iso_started) { |
|
190 |
e->iso_started = 1; |
|
191 |
e->inflight = 0; |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
static int change_iso_inflight(USBHostDevice *s, int ep, int value) |
|
196 |
{ |
|
197 |
struct endp_data *e = get_endp(s, ep); |
|
198 |
|
|
199 |
e->inflight += value; |
|
200 |
return e->inflight; |
|
188 | 201 |
} |
189 | 202 |
|
190 | 203 |
static void set_iso_urb(USBHostDevice *s, int ep, AsyncURB *iso_urb) |
... | ... | |
282 | 295 |
{ |
283 | 296 |
USBHostDevice *s = opaque; |
284 | 297 |
AsyncURB *aurb; |
298 |
int urbs = 0; |
|
285 | 299 |
|
286 | 300 |
while (1) { |
287 | 301 |
USBPacket *p; |
... | ... | |
289 | 303 |
int r = ioctl(s->fd, USBDEVFS_REAPURBNDELAY, &aurb); |
290 | 304 |
if (r < 0) { |
291 | 305 |
if (errno == EAGAIN) { |
306 |
if (urbs > 2) { |
|
307 |
fprintf(stderr, "husb: %d iso urbs finished at once\n", urbs); |
|
308 |
} |
|
292 | 309 |
return; |
293 | 310 |
} |
294 | 311 |
if (errno == ENODEV && !s->closing) { |
... | ... | |
306 | 323 |
/* If this is a buffered iso urb mark it as complete and don't do |
307 | 324 |
anything else (it is handled further in usb_host_handle_iso_data) */ |
308 | 325 |
if (aurb->iso_frame_idx == -1) { |
326 |
int inflight; |
|
309 | 327 |
if (aurb->urb.status == -EPIPE) { |
310 | 328 |
set_halt(s, aurb->urb.endpoint & 0xf); |
311 | 329 |
} |
312 | 330 |
aurb->iso_frame_idx = 0; |
331 |
urbs++; |
|
332 |
inflight = change_iso_inflight(s, aurb->urb.endpoint & 0xf, -1); |
|
333 |
if (inflight == 0 && is_iso_started(s, aurb->urb.endpoint & 0xf)) { |
|
334 |
fprintf(stderr, "husb: out of buffers for iso stream\n"); |
|
335 |
} |
|
313 | 336 |
continue; |
314 | 337 |
} |
315 | 338 |
|
... | ... | |
670 | 693 |
break; |
671 | 694 |
} |
672 | 695 |
aurb[i].iso_frame_idx = -1; |
696 |
change_iso_inflight(s, p->devep, +1); |
|
673 | 697 |
} |
674 | 698 |
} |
675 | 699 |
} |
Also available in: Unified diff