alexpevzner / sane-airscan

Scanner Access Now Easy - universal driver for eSCL (Apple AirScan) and WSD
Other
277 stars 39 forks source link

Ricoh SP 220SNw problem #267

Open Nacos opened 1 year ago

Nacos commented 1 year ago

Hi,

Tested on Ricoh SP 220SNw. Firmware version of MFU is 1.15 (last one available)

airscan-discover

[devices]
  RICOH SP 220SNw (f028ed) = http://192.168.1.50:631/eSCL/, eSCL
  RICOH SP 220SNw (f028ed) = https://192.168.1.50:443/eSCL/, eSCL

Scan start, MFU warms up and the display says : "Scaning ESCL". No scan is performed

Scanning attempt was made using

scanimage -o test.jpg -d "airscan:e0:RICOH SP 220SNw (f028ed)" > scanimage.log 2>&1

Debug logs attached scanimage-RICOH-SP-220SNw-(f028ed).log scanimage.log

Issue looks suspiciously similar to #203

alexpevzner commented 1 year ago

Hi @Nacos,

log looks truncated. Everything is OK up to the scan request, scan request also looks OK and returns URL to the image, but attempt to fetch the image never ends.

How did it finish? Have you terminated it with Ctrl-C before completion?

And there was no scanning noise from the device, correct?

alexpevzner commented 1 year ago

And another question. Are you able to build sane-airscan by yourself, in order to experiment a little bit with it?

Nacos commented 1 year ago

Hi @alexpevzner,

Thanks for your answer.

The scan will kind of "hang" there until I forcefully terminate it with a Ctrl-C or another method (kill/etc...). I hear no scanning/motor noise from the device when attempting to scan.

However, you are right: when this log was captured/copied, the scanimage command was still running (in the "hanging" state described above). That may be why this log looks truncated to you.

If you want a full trace including the logs related to the termination of scanimage command (with a Ctrl-C), i can provide you this trace in a few days (I do not have permanent access to this hardware).

FYI, the computer attempting the scan is a Kunutu 22.04 LTS machine. SANE installed packages versions are :

apt list --installed | grep sane

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libkf5sane-data/jammy,jammy,now 21.12.3-0ubuntu1 all  [installé, automatique]
libkf5sane5/jammy,now 21.12.3-0ubuntu1 amd64  [installé, automatique]
libsane-common/jammy,jammy,now 1.1.1-5 all  [installé, automatique]
libsane-hpaio/jammy,now 3.21.12+dfsg0-1 amd64  [installé, automatique]
libsane1/jammy,now 1.1.1-5 amd64  [installé, automatique]
sane-airscan/jammy,now 0.99.27-1build1 amd64  [installé]
sane-utils/jammy,now 1.1.1-5 amd64  [installé]
xsane-common/jammy,jammy,now 0.999-11ubuntu1 all  [installé, automatique]
xsane/jammy,now 0.999-11ubuntu1 amd64  [installé]
Nacos commented 1 year ago

I never attempted to build SANE related software from sources but I can try. This may take some time though as I have a limited access to this hardware. (hardware is installed at a relative's house)

Should I try to build it on the latest version of master branch ?

alexpevzner commented 1 year ago

sane-airscan uses non-standard build process, and builds actually very simple. No ./configure or something like this, just make

After successful build, libsane-airscan.so.1 will be generated in your copy of source directory. Instead of bothering with make install, which potentially will conflict with package installation, I suggest you to simple replace /usr/lib/libsane-airscan.so.1 installed from the package with the symbolic link to the libsane-airscan.so.1 that you've built by yourself. It should be enough.

Yes, please use the master branch. When you will be ready, let me know, I want to ask you to perform some small modifications of the source to verify an idea that I currently have.

Nacos commented 1 year ago

Hi @alexpevzner ,

I have been able to build sane-airscan from source (last commit is b1cd63f32bb5fb3e38bf787a3a3a7b52dc3ecf22) and replace the library with the following commands :

sudo mv /usr/lib/x86_64-linux-gnu/sane/libsane-airscan.so.1 /usr/lib/x86_64-linux-gnu/sane/libsane-airscan.so.1.default
sudo cp /home/xxxxx/sane-airscan/libsane-airscan.so.1 /usr/lib/x86_64-linux-gnu/sane/libsane-airscan.so.1
sudo chmod 644 /usr/lib/x86_64-linux-gnu/sane/libsane-airscan.so.1

For your information, I did try to test the scan (hey we never know if a newer version works!) and it still hangs (log files attached). scanimage-zeroconf.log scanimage-RICOH-SP-220SNw-(f028ed).log

I await your instructions

Thanks

alexpevzner commented 1 year ago

Hi @Nacos,

Could you please try to manually configure device to use HTTPS?

In the /etc/sane.d/airscan.conf file please add the following lines:

[devices]
  RICOH SP 220SNw (f028ed) = https://192.168.1.50:443/eSCL/, eSCL
Nacos commented 1 year ago

Hi,

I have configured the device to use HTTPS as per your instructions. I tried to perform a scan again. According to the logs, I'm now using HTTPS and still the same issue.

Thanks

alexpevzner commented 1 year ago

Hi!

Could you please tweak a code a bit?

In the file airscan-escl.c, line 842 find the following line of code:

uri = http_uri_new_relative(ctx->base_uri, location, true, false);

and replace it with the following:

uri = http_uri_new_relative(ctx->base_uri, location, true, true);

(the only difference is in the last function parameter, which becomes true)

Nacos commented 1 year ago

Hi,

I have made the requested changes

username@machine:~/github/sane-airscan$ vim airscan-escl.c 
username@machine:~/github/sane-airscan$ git diff
diff --git a/airscan-escl.c b/airscan-escl.c
index 5721cf5..3a3609a 100644
--- a/airscan-escl.c
+++ b/airscan-escl.c
@@ -839,7 +839,7 @@ escl_scan_decode (const proto_ctx *ctx)
     }

     /* Validate and save location */
-    uri = http_uri_new_relative(ctx->base_uri, location, true, false);
+    uri = http_uri_new_relative(ctx->base_uri, location, true, true);
     if (uri == NULL) {
         err = eloop_eprintf("ScanJobs request: invalid location received");
         goto ERROR;

and recompiled the code again (make clean && make) and installed it with

sudo cp ./libsane-airscan.so.1 /usr/lib/x86_64-linux-gnu/sane/libsane-airscan.so.1
sudo chmod 644 /usr/lib/x86_64-linux-gnu/sane/libsane-airscan.so.1

Symptoms are still the same. Here are the logs