There are scanbd, scanbuttond, which poll the usb events and trigger a script, if a scanner button was pressed:
https://sourceforge.net/projects/scanbd/
http://scanbuttond.sourceforge.net/ https://github.com/jdam6431/scanbuttond
https://sourceforge.net/projects/scanbd/
http://scanbuttond.sourceforge.net/ https://github.com/jdam6431/scanbuttond