From 8dda0dc30af0de0f798773c42be18bf461fd2c9d Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 25 Jul 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-07-25 --- pc/devusb.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pc/devusb.c b/pc/devusb.c index 7046a97ed2f7004b678e96ac9b6d3e0661dfe805..20cb14c6faa5a69bfb1f7cf5b53e8eb70d607d1f 100644 --- a/pc/devusb.c +++ b/pc/devusb.c @@ -1690,10 +1690,10 @@ usbread(Chan *c, void *a, long n, vlong offset) free(s); nexterror(); } - l = snprint(s, READSTR, "%s %#6.6x\n", devstates[d->state], d->csp); + l = snprint(s, READSTR, "%s %#6.6lux\n", devstates[d->state], d->csp); for(i=0; iep); i++) if((e = d->ep[i]) != nil) /* TO DO: freeze e */ - l += snprint(s+l, READSTR-l, "%2d %#6.6x %10lud bytes %10lud blocks\n", i, e->csp, e->nbytes, e->nblocks); + l += snprint(s+l, READSTR-l, "%2d %#6.6lux %10lud bytes %10lud blocks\n", i, e->csp, e->nbytes, e->nblocks); n = readstr(offset, a, n, s); poperror(); free(s); @@ -1875,7 +1875,8 @@ usbwrite(Chan *c, void *a, long n, vlong) if(i < 8 || i > 1023) i = 8; e->maxpkt = i; - e->mode = strcmp(fields[3],"r")==0? OREAD: strcmp(fields[3],"w") == 0? OWRITE: ORDWR; + e->mode = strcmp(fields[3],"r") == 0? OREAD : + strcmp(fields[3],"w") == 0? OWRITE : ORDWR; e->periodic = 0; e->sched = -1; if(strcmp(fields[4], "bulk") == 0){ @@ -1930,10 +1931,13 @@ usbwrite(Chan *c, void *a, long n, vlong) break; default: /* sends DATA[01] */ - if((t -= Qep0) < 0 || t >= nelem(d->ep)) + if((t -= Qep0) < 0 || t >= nelem(d->ep)) { + print("t = %d\n", t); error(Eio); - if((e = d->ep[t]) == nil || e->mode == OREAD) + } + if((e = d->ep[t]) == nil || e->mode == OREAD) { error(Eio); /* can't happen */ + } n = writeusb(e, a, n, TokOUT); break; }