<div dir="ltr"><div dir="ltr"><div>Hi,</div><div><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 4, 2024 at 10:11 AM Ove Laurum <<a href="mailto:laurum.tech@gmail.com">laurum.tech@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks Ralph,<div><br></div><div>I found the code on GitLab. Very useful.<br><div><br></div><div>I also managed to add my scanner to the config file /etc/sane.d/avision.conf</div><div>usb 0x0638 0x2b6a<br></div></div></div></blockquote><div><br></div><div>Great.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div></div><div><br></div><div>I didn't get much of a trace out until I ran it as root, see abbreviated output below</div><div>SANE_DEBUG_AVISION=100 scanimage -L<br></div><div>(I don't think I can use the -d option unless the device is listed with "scanimage -L")</div><div><br></div><div>When I do:</div><div>SANE_DEBUG_AVISION=50 sane-find-scanner</div><div>I get no trace, is that because the backend is not involved at this stage?</div></div></div></blockquote><div><br></div><div>Yeah, that won't work. sane-find-scanner is not using the SANE API at all. It merely looks for devices that might be scanners.</div><div>You should use scanimage or another SANE frontend instead. This *should* work once the avision backend knows about your scanner.</div><div>I *think* that you can use -d avision to pick the first avision device.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><br></div><div>In the trace that I did get, it looks like the backend is opening the correct device "libusb:001:003" and tries a first command which is "Inquiry".</div><div>It builds the query and tries to write it but fails with error code 9.</div><div><br></div><div>I am running the command as root (not as sudo) so it should not be a permissions issue unless the backend is run by a different user.</div><div>If I run as an unprivileged user then I do not even get this far. In that case it tries to access the scanner but fails and is not even getting to the stage of Attaching to the scanner.</div><div>Also worth noting is that my Canon LiDE220 works fine with sane, which is another indicator that it is unlikely a permissions issue.<br></div></div></div></blockquote><div><br></div><div>Permissions are generally handled by udev which has rules based on USB ids to give permissions to non-root users.</div><div>Just adding the USB ids to the backend will not be sufficient. You *could* add the USB ids to a udev file such as /lib/udev/hwdb.d/20-sane.hwdb followed by running something like <br></div><div><span class="gmail-ILfuVd" lang="en"><span class="gmail-hgKElc"><b><br></b></span></span></div><div><span class="gmail-ILfuVd" lang="en"><span class="gmail-hgKElc"><b>udevadm control --reload-rules</b></span></span></div><div><span class="gmail-ILfuVd" lang="en"><span class="gmail-hgKElc"><b><br></b></span></span></div><div><span class="gmail-ILfuVd" lang="en"><span class="gmail-hgKElc">...as root. This should allow you to connect to the device<b> </b>as a regular scanning user.<b><br></b></span></span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div></div><div><br></div><div>So based on the trace and on the source code it looks like it is: </div><div><ul><li>Attaching to the scanner.</li><li><code>SANE_Status</code> = <code>SANE_STATUS_GOOD</code> in reply to <code>sanei_usb_open</code></li><li>starts building an inquiry</li><li>tries to send the inquiry</li><li>fails to do <code>sanei_usb_write_bulk</code></li><li>sanei_usb.c responds with error</li></ul></div><div>How can I see log entries from sanei_usb.c code?</div><div><br></div></div></div></blockquote><div><br></div><div>I believe SANE_DEBUG_SANEI_USB=5 will give you some info about sanei USB operations. Greater value gives you more info.</div><div><br></div></div><div class="gmail_quote">Cheers,</div><div class="gmail_quote">Ralph<br></div></div>