Hi, Dirk. On Mon, Jun 09, 2025 at 01:57:28AM -0700, Dirk Meier via sane-devel wrote: > in scanbd.conf filter "^scan$" works and calls the attached scan-function- > handler.script.
The filter matches for when the sensor named "scan" is triggered; we can see this happen in the first log file: Here is the previous poll where `scan` is found to still be `0`, and no action is taken: > scanbd: checking option scan number 91 (0) for device > fujitsu:fi-7280:1201263: value: 0 Here, it polls some other sensors to see if actions should be taken for them: > scanbd: get_sane_option_value > scanbd: checking option page-loaded number 84 (1) for device > fujitsu:fi-7280:1201263: value: 1 > scanbd: got the value already -> copy > scanbd: copy the value of option 84 > scanbd: checking option page-loaded number 84 (2) for device > fujitsu:fi-7280:1201263: value: 1 > scanbd: get_sane_option_value > scanbd: checking option cover-open number 86 (3) for device > fujitsu:fi-7280:1201263: value: 0 > scanbd: get_sane_option_value > scanbd: checking option power-save number 88 (4) for device > fujitsu:fi-7280:1201263: value: 0 Here, we start a new poll: > scanbd: polling thread for fujitsu:fi-7280:1201263, before cancellation point > scanbd: polling thread for fujitsu:fi-7280:1201263, after cancellation point > scanbd: polling device fujitsu:fi-7280:1201263 > scanbd: get_sane_option_value And here, we find that `scan` is now `1` (in technical terms, this means that _while checking_, scanbd found the scan button was being held down. It's possible to press the button so quickly that scanbd misses it while polling...) > scanbd: checking option scan number 91 (0) for device > fujitsu:fi-7280:1201263: value: 1 > scanbd: value trigger: numerical And then, scanbd takes the configured action: > scanbd: trigger action for scan for device fujitsu:fi-7280:1201263 with > script scan-function-handler.script Part of the configured action is that scanbd reads the value of the function switching and passes it as an environment variable: > scanbd: setting env: SCANBD_FUNCTION=0 And then it runs the configured script: > scanbd: using relative script path: scan-function-handler.script, expanded > to: /etc/scanbd/scan-function-handler.script > scanbd: waiting for child: /etc/scanbd/scan-function-handler.script > scanbd: child /etc/scanbd/scan-function-handler.script exited with status: 0 In the second log file you passed, scanbd never sees the `scan` button get pressed. Perhaps you didn't press `scan`, or perhaps you pressed it too quickly. > In scan-function-handler.script case 0) works fine. But case 1) shows: > "scanbd: > sig_term/int_handler called with signal 2" and nothing happens. > Commands of "case 1)" in an shell-script works fine but not as "case 1)" in > scan-function-handler.script. Case 2) and case 3) same as Case 1). > Any hint? The `scanbd: sig_term/int_handler called with signal 2` line you're reporting appears in both logs, this is just scanbd reporting that it received a signal 2 (SIGINT), i.e., someone pressed `^C` and/or sent SIGINT directly (perhaps systemd). The second log does not show an attempt to run your script at all. - Tricia