Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usage with scanbd: invalid argument when script is executed directly #39

Closed
nyn44e opened this issue Jan 15, 2022 · 7 comments
Closed

Comments

@nyn44e
Copy link

nyn44e commented Jan 15, 2022

Hi,

first of all thanks for making this great script. It's a real time-saver.

I have a Fujitsu S1500 connected to a raspberrypi that also runs scanbd to enable me to scan stuff by pressing the button on the scanner.
Scanbd is configured to execute the script scan.sh upon signal from the button:

scan.sh
#!/bin/sh
now=`date +"%Y-%m-%d-%H%M"`
/home/pi/sane-scan-pdf/scan -d -r 300 -v -m Lineart --skip-empty-pages -o /home/pi/scans/scan-$now.pdf

This works great when I press the button. However, when I execute the script directly via ./scan.sh, I get the following error message from scanadf:
scanadf: open of device fujitsu failed: Invalid argument

If I just execute scanadf > tmp.jpg (or something) it scans fine.

If I change the DEVICE name in sane-scan-pdf/scan to the actual SANE-name of the scanner,

scanimage -L
device `net:localhost:fujitsu:ScanSnap S1500:300802' is a FUJITSU ScanSnap S1500 scanner

I can execute the script directly and I can scan with pressing the button, however there's a delay of almost 25s between press of the button and the start of the scan.

If I disable scanbd I can execute the script directly, no problems.

All of that makes me think that the script is somehow trying to call upon the scanner device directly or at least locally which it should not. It's supposed to go through scanbd.

Is there a way to just get rid of the device specification and let scanadf pick the device (which does work, see above)?
I cannot figure out how to achieve this and would appreciate any help.

Kind regards,
nyn

@rocketraman
Copy link
Owner

rocketraman commented Jan 15, 2022

I have a Fujitsu S1500 as well. I'll install scanbd here and see if I can reproduce.

I'm assuming you've configured scanbd as recommended?

@nyn44e
Copy link
Author

nyn44e commented Jan 15, 2022

I followed several instruction pages to configure scanbd since the original README (https://github.com/mdengler/scanbd/blob/master/doc/README.txt) is a little dated.

The major difference to the instructions in the link is that I use systemd (scanbm.socket) to listen for requests to the scanner in the network instead of inetd/xinetd. But since that part seems to be working (I can scan pressing the button or access the scanner through the network from a different machine with Xsane) I started testing with calling scanadf directly.

Thank you for looking into it.

@rocketraman
Copy link
Owner

I'm on Fedora but these arch instructions seem to be pretty up to date, and use systemd. Does this sound something like your local configuration?

https://wiki.archlinux.org/title/Scanner_Button_Daemon

@rocketraman
Copy link
Owner

rocketraman commented Jan 16, 2022

@nyn44e I tried to install scanbd but was unsuccessful (compile error I don't have time to resolve).

That being said, I've committed c892202 to the repo, which allows an empty device argument i.e. --device "". With an empty device argument, no -d parameter will be set for scanadf. If your evaluation of the problem is correct, this should allow you to move forward.

BTW, on my machine, not specifying any -d argument causes a long pause (I believe while scanadf is trying to enumerate devices) and also a crash in scanadf. But let me know if it works for you.

@nyn44e
Copy link
Author

nyn44e commented Jan 16, 2022

I'm on Fedora but these arch instructions seem to be pretty up to date, and use systemd. Does this sound something like your local configuration?

https://wiki.archlinux.org/title/Scanner_Button_Daemon

Those are pretty much the configuration guidelines I followed for scanbd.

@nyn44e
Copy link
Author

nyn44e commented Jan 16, 2022

@nyn44e I tried to install scanbd but was unsuccessful (compile error I don't have time to resolve).

That being said, I've committed c892202 to the repo, which allows an empty device argument i.e. --device "". With an empty device argument, no -d parameter will be set for scanadf. If your evaluation of the problem is correct, this should allow you to move forward.

BTW, on my machine, not specifying any -d argument causes a long pause (I believe while scanadf is trying to enumerate devices) and also a crash in scanadf. But let me know if it works for you.

Thank you very much for the new commit. That fixed it. It will now scan instantly, whether I press the button or just execute the script. Thanks a lot!

@rocketraman
Copy link
Owner

Great to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants