Marcus,
I was suspecting there is more than one issue, but didn't manage to dive
into it. With your last kernel diff:
https://marc.info/?l=openbsd-bugs&m=160991986510827&w=2
and below sane-backends diff makes my Canon MG3250 USB scanner work
consistenly.
This is awesome, thank you Marcus!
I'll be testing more over next coming days, but so far this looks good.
Small comment below about the sane backends diff.
On Sat, Jan 09, 2021 at 11:12:56PM +0100, Marcus Glocker wrote:
>
> Hello Mikolaj,
>
> I think you're mixing up two different issues now.
>
> The first issue is with our ugen(4) implementation, where the DATA
> toggle gets out of sync with xhci(4), and therefore after the first
> successful data exchange, all following will fail, until you
> detach/attach the device which will reset the DATA toggle again.
>
> The second issue seems to be a bug in the sane-backends software. I
> had a problem related to that with my PIXMA scanner as well. It could
> be the same issue you're seeing. I've opened an issue upstream for
> that:
>
> https://gitlab.com/sane-project/backends/-/issues/412
>
> In the meantime I've also provided a patch upstream for the issue.
> They are currently checking whether it's the right fix to do. Can you
> try this patch with our sane-backends port as well, and see whether if
> fixes your issue?
>
>
> Index: graphics/sane-backends/Makefile
> ===================================================================
> RCS file: /cvs/ports/graphics/sane-backends/Makefile,v
> retrieving revision 1.95
> diff -u -p -u -p -r1.95 Makefile
> --- graphics/sane-backends/Makefile 20 Dec 2020 09:56:36 -0000 1.95
> +++ graphics/sane-backends/Makefile 9 Jan 2021 22:07:38 -0000
> @@ -5,7 +5,7 @@ BROKEN-alpha= ICE hp5590.c:1141: error:
> COMMENT= API for accessing scanners, backends
>
> DISTNAME= sane-backends-1.0.31
> -REVISION= 1
> +REVISION= 2
>
> SHARED_LIBS += sane 2.1 # unknown
>
> Index: graphics/sane-backends/patches/patch-backend_pixma_pixma_io_sanei_c
> ===================================================================
> RCS file: graphics/sane-backends/patches/patch-backend_pixma_pixma_io_sanei_c
> diff -N graphics/sane-backends/patches/patch-backend_pixma_pixma_io_sanei_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ graphics/sane-backends/patches/patch-backend_pixma_pixma_io_sanei_c
> 9 Jan 2021 22:07:38 -0000
> @@ -0,0 +1,15 @@
> +$OpenBSD$
> +
Could it make sense to add https://gitlab.com/sane-project/backends/-/issues/412
as a comment to this diff?
> +Index: backend/pixma/pixma_io_sanei.c
> +--- backend/pixma/pixma_io_sanei.c.orig Sun Aug 23 13:59:20 2020
> ++++ backend/pixma/pixma_io_sanei.c Tue Jan 5 15:30:06 2021
> +@@ -538,8 +538,7 @@ pixma_wait_interrupt (pixma_io_t * io, void *buf, unsi
> + #endif
> + error = map_error (sanei_usb_read_int (io->dev, buf, &count));
> + }
> +- if (error == PIXMA_EIO ||
> +- (io->interface == INT_BJNP && error == PIXMA_EOF)) /* EOF is a
> bjnp timeout error! */
> ++ if (error == PIXMA_EIO || error == PIXMA_EOF)
> + error = PIXMA_ETIMEDOUT; /* FIXME: SANE doesn't have ETIMEDOUT!!
> */
> + if (error == 0)
> + error = count;
--
Regards,
Mikolaj