On Sat, Jan 02, 2021 at 10:02:47AM +0000, Mikolaj Kucharski wrote:
> > Index: dev/usb/ugen.c
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/usb/ugen.c,v
> > retrieving revision 1.109
> > diff -u -p -u -p -r1.109 ugen.c
> > --- dev/usb/ugen.c 25 Dec 2020 12:59:52 -0000 1.109
> > +++ dev/usb/ugen.c 2 Jan 2021 08:22:42 -0000
> > @@ -389,6 +389,10 @@ ugenopen(dev_t dev, int flag, int mode,
> > }
> > }
> > sc->sc_is_open[endpt] = 1;
> > +
> > + if (sce->pipeh)
> > + usbd_clear_endpoint_stall(sce->pipeh);
> > +
> > return (0);
> > }
> >
>
> Above diff makes my scanner fail straight away.
>
> # unset SANE_DEBUG_PIXMA
> # unset SANE_DEBUG_SANEI_USB
> # time scanimage --device-name pixma:04A91762_860FE4 \
> --format png --mode gray --resolution 300 --output-file
> debug-scan-loop.png
> mem:device-resp.xml:7: parser error : Opening and ending tag mismatch:
> contents line 3 and param_set
> </ivec:param_set>
> ^
> mem:device-resp.xml:8: parser error : Opening and ending tag mismatch: cmd
> line 3 and ivec:contents
> </ivec:contents>
> ^
> mem:device-resp.xml:9: parser error : Extra content at the end of the document
> </cmd>
> ^
> scanimage: sane_read: Error during device I/O
> 0m00.62s real 0m00.00s user 0m00.02s system
Ups, right. I just noticed that I've tested with a wrong kernel
containing the usbd_clear_endpoint_stall() at the pipe close. Testing
with the right kernel it looks same here:
# scanimage -d pixma:04A91912_454382 -o scan.png
mem:device-resp.xml:7: parser error : Opening and ending tag mismatch:
contents line 3 and param_set
</ivec:param_set>
^
mem:device-resp.xml:8: parser error : Opening and ending tag mismatch:
cmd line 3 and ivec:contents
</ivec:contents>
^
mem:device-resp.xml:9: parser error : Extra content at the end of the
document
</cmd>
^
scanimage: sane_read: Error during device I/O
So doing the EP reset on pipe opening also doesn't seem to be a
solution.