mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
For both interrupt and isochronous (the patch was unclear which one it
applied to, but I'd think both), honor the timeout that's been set. Return 0 bytes to be consistant with what libusb expects. By default, the timeout will be zero, so only applications that change the default will see a change. The patch only seems to apply to the interrupt end points, but it should also apply to isochronous endpoints as well. Submitted by: Maurice Castro PR: 110122 Approved by: re (blanket)
This commit is contained in:
parent
dcf43907af
commit
dc0c82bc3f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171073
@ -714,11 +714,16 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag)
|
||||
}
|
||||
sce->state |= UGEN_ASLP;
|
||||
DPRINTFN(5, ("ugenread: sleep on %p\n", sce));
|
||||
error = tsleep(sce, PZERO | PCATCH, "ugenri", 0);
|
||||
error = tsleep(sce, PZERO | PCATCH, "ugenri",
|
||||
sce->timeout);
|
||||
sce->state &= ~UGEN_ASLP;
|
||||
DPRINTFN(5, ("ugenread: woke, error=%d\n", error));
|
||||
if (sc->sc_dying)
|
||||
error = EIO;
|
||||
if (error == EAGAIN) {
|
||||
error = 0; /* timeout, return 0 bytes */
|
||||
break;
|
||||
}
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
@ -779,17 +784,22 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag)
|
||||
}
|
||||
sce->state |= UGEN_ASLP;
|
||||
DPRINTFN(5, ("ugenread: sleep on %p\n", sce));
|
||||
error = tsleep(sce, PZERO | PCATCH, "ugenri", 0);
|
||||
error = tsleep(sce, PZERO | PCATCH, "ugenri",
|
||||
sce->timeout);
|
||||
sce->state &= ~UGEN_ASLP;
|
||||
DPRINTFN(5, ("ugenread: woke, error=%d\n", error));
|
||||
if (sc->sc_dying)
|
||||
error = EIO;
|
||||
if (error == EAGAIN) {
|
||||
error = 0; /* timeout, return 0 bytes */
|
||||
break;
|
||||
}
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
|
||||
while (sce->cur != sce->fill && uio->uio_resid > 0 && !error) {
|
||||
if(sce->fill > sce->cur)
|
||||
if (sce->fill > sce->cur)
|
||||
n = min(sce->fill - sce->cur, uio->uio_resid);
|
||||
else
|
||||
n = min(sce->limit - sce->cur, uio->uio_resid);
|
||||
|
Loading…
Reference in New Issue
Block a user