[sane-devel] HP5590: scanbd integration is ready

Bernard Badr bb3138 at live.de
Sat Jun 23 12:49:12 BST 2018


Dear sane maintainers and users of scanbd and HP5590

I would like to provide integration of HP5590 family backend with scanbd.
This allows triggering scanning actions by pressing scanner buttons.

# HP5590: scanbd integration is ready. 
   * Added read-only parameter --button-pressed for getting ID of last button pressed.
   * Example usage:
      * Read last button pressed in the shell: "scanimage -d hp5590:libusb:... -h | grep button-pressed"
      * Integrate to scanbd by adding actions with
         * device filter = "^hp5590.*" and action filter = "^button-pressed.*"
         * using string-trigger with from-value = "none"
         * and to-value = "scan", "collect", "file", "email", "copy"
   * Code extension uses code snippets by Cesello.
   * White space fixes. Adjusted indents and replaced tabs by spaces for better formatting.


# Example configuration for scanbd to be included in "scanbd.conf"

"hp5590.conf"
=============
device hp5590 {
    # Device matching
    filter = "^hp5590.*"
    desc = "HP5590 Scanner Family"
       
    action do-scan {
        filter = "^button-pressed.*"
        desc   = "hp5590: Scan button pressed"
        script = "scan_action.script"
        string-trigger {
            from-value  = "none"
            to-value    = "scan"
        }
    }

    action do-collect {
        filter = "^button-pressed.*"
        desc   = "hp5590: Collect button pressed"
        script = "scan_action.script"
        string-trigger {
            from-value  = "none"
            to-value    = "collect"
        }
    }

    action do-file {
        filter = "^button-pressed.*"
        desc   = "hp5590: File button pressed"
        script = "scan_action.script"
        string-trigger {
            from-value  = "none"
            to-value    = "file"
        }
    }

    action do-email {
        filter = "^button-pressed.*"
        desc   = "hp5590: Email button pressed"
        script = "scan_action.script"
        string-trigger {
            from-value  = "none"
            to-value    = "email"
        }
    }

    action do-copy {
        filter = "^button-pressed.*"
        desc   = "hp5590: Copy button pressed"
        script = "scan_action.script"
        string-trigger {
            from-value  = "none"
            to-value    = "copy"
        }
    }
}


# Example scan action script
   * Do not forget to chmod +x
   * Adjust script actions to personal needs.

"scan_action.script"
====================
#!/bin/bash
echo scan_action.script as $0
echo device = $SCANBD_DEVICE
echo action = $SCANBD_ACTION
scanfile="$HOME/tmp/scans/scan-$(date +%s).pnm"
echo scanfile = "$scanfile"
case $SCANBD_ACTION in
do-scan)
    scanimage -d "$SCANBD_DEVICE" > "$scanfile"
    ;;
do-collect)
    scanimage -d "$SCANBD_DEVICE" > "$scanfile"
    ;;
do-file)
    scanimage -d "$SCANBD_DEVICE" > "$scanfile"
    ;;
do-email)
    scanimage -d "$SCANBD_DEVICE" > "$scanfile"
    ;;
do-copy)
    scanimage -d "$SCANBD_DEVICE" > "$scanfile"
    ;;
*)
    echo Warning: Unknown scanbd action: "$SCANBD_ACTION"
    ;;
esac


Please find the merge request here: https://gitlab.com/sane-project/backends/merge_requests/5

Feedback of testers and users of scanbd and HP5590 is welcome!

Best regards
  Bernard



More information about the sane-devel mailing list