SimulPiscator / AirSane

Publish SANE scanners to MacOS, Android, and Windows via Apple AirScan.
GNU General Public License v3.0
247 stars 26 forks source link

no further scan possible after canceling the preview scan in AIC #41

Closed meiser79 closed 3 years ago

meiser79 commented 3 years ago

Hi,

while AIC scanned the preview, I pressed the cancel button. After this, I couldn't scan anymore. I had to power-off and power-on my scanner. I own a Brother DCP-1510 which uses the brother4 SANE driver (deb package version 0.4.9-1), running on Ubuntu 20.04.

The log shows which indicates that airsaned "hangs" at _saneopen(brother4:bus1;dev2)

document format requested: image/jpeg document format used: image/png using color gamma of 0.555555 sane_init(nullptr, nullptr) sane_open(brother4:bus1;dev2) -> 0x7fd4c001cbc0 [mode] := "24bit Color" -> reload options [source] := "FlatBed" [resolution] := 100dpi [tl-x] := 0mm [tl-y] := 0mm [br-x] := 212mm [br-y] := 356mm sane_start(0x7fd4c001cbc0) with options: [br-x] = 211.881mm [br-y] = 355.567mm [mode] = "24bit Color" [resolution] = 100dpi [source] = "FlatBed" [tl-x] = 0mm [tl-y] = 0mm sane_cancel(0x7fd4c001cbc0) -> pressed cancel during preview scan sane_close(0x7fd4c001cbc0) sane_exit() document format requested: image/jpeg document format used: image/png using color gamma of 0.555555 sane_init(nullptr, nullptr) sane_open(brother4:bus1;dev2)

Thanks in advance for having a look. Best regards, meiser

SimulPiscator commented 3 years ago

I think I understand why this happens (though IMHO the brother backend should handle this situation more gracefully). It will take me a few days (or weeks) before I have time to fix it, I will let you know.

SimulPiscator commented 3 years ago

I added a call to sane_cancel() that might have been missing. The SANE docs are not very clear about how to properly abort a scan. Maybe it works for you now -- it works for me with the genesys backend as it did before.

meiser79 commented 3 years ago

Sorry to say, the behaviour is still the same. AirSane sends a lot of "503 Service Unavailable".

SimulPiscator commented 3 years ago

I did not get similar bug reports from users with other backends, so I tend to see this as a bug in the brother4 backend. AirSane closes the backend properly, this should not leave the device in an undefined state.

meiser79 commented 3 years ago

I can stop a preview scan in xscanimage, and afterwards start a new preview scan (scanner connected via saned). So I have the impression that the issue is not brother4 backend related.

SimulPiscator commented 3 years ago

Whatever the reason, I'm sorry to say I have no idea how to fix this issue.

meiser79 commented 3 years ago

When using the SANE airscan backend with xscanimage, cancelling the preview scan also brings the scanner in the undefined state.

The debug output shows:

Error: Failed restore value of option tl-x: Invalid argument.
Error: Failed restore value of option tl-y: Invalid argument.
Error: Failed restore value of option br-x: Invalid argument.
Error: Failed restore value of option br-y: Invalid argument.

Here's the full debug log: xscanimage-airscan-backend.txt

Maybe this helps.