SimulPiscator / AirSane

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

Incompatibility with scanbd #54

Closed ShadesJeff closed 3 years ago

ShadesJeff commented 3 years ago

AirSane is working nicely when using saned alone with my scanner, but when I introduce scanbd to make the on-scanner buttons works, AirSane errors when opening the scanner.

I started AirSane with the following command: sudo -u saned airsaned --debug=true --access-log=- --local-scanners-only=false

and got the following output:

git commit: 6919551 (branch master, rev 168)
build date: 2021-03-27T06:06:33Z
reading device options from '/etc/airsane/options.conf'
enumerating  devices...
sane_init(nullptr, nullptr)
sane_get_devices() ...
... sane_get_devices() -> SANE_Status Success
sane_exit()
found: net:localhost:fujitsu:ScanSnap iX500:1225526 (FUJITSU ScanSnap iX500)
sane_init(nullptr, nullptr)
sane_open(net:localhost:fujitsu:ScanSnap iX500:1225526) -> SANE_Status Error during device I/O
sane_exit()
error: failed to open device

The standard SANE front-ends (scanimage and scanadf) work properly, e.g.:

sudo -u saned scanimage -L
device `net:localhost:fujitsu:ScanSnap iX500:1225526' is a FUJITSU ScanSnap iX500 scanner
SimulPiscator commented 3 years ago

Unfortunately, I cannot do anything about this. scanbd needs exclusive access to the scanner device, and will only release it during script execution. If you try to actually scan using scanimage while scanbd is active, I think it will fail as well.

ShadesJeff commented 3 years ago

Actually, running the following command does produce output: sudo -u saned scanimage -b --format png -d 'net:localhost:fujitsu:ScanSnap iX500:1225526' --source 'ADF Front' --resolution 150

So, I think AirSane should also work...

Unfortunately, scanbd is terribly documented, but it is configured such that the scanbd service proxies requests for the scanner from clients through the net interface and then releases the scanner to execute those requests. So, while scanbd does have exclusive access to the device 'fujitsu:ScanSnap iX500:1225526' it shares the scanner as device 'net:localhost:fujitsu:ScanSnap iX500:1225526' and accessing that device with the saned interface should work and does with the native clients.

ShadesJeff commented 3 years ago

As expected, AirScan does work with scanbd if configured correctly. In my case, the default scanbm.socket configuration only allows 1 socket connection at a time. When I increased this limit to 64, then AirScan works as anticipated.

It is unclear to me why this value did not need to be increased for scanimage to work... only for AirScan to work.