[sane-devel] Why cant the Snapscan drv load the firmware automatically ?

Oliver Schwartz Oliver.Schwartz@gmx.de
Thu, 26 Jul 2001 23:17:21 +0200


> Is there a reason why this shall be done "by hand" ?

The driver has little to no means to find out if the firmware has been 
downloaded before. To be on the safe side, it would have to be downloaded 
before every scan. This is clearly not desirable. 

However, there are other, more capable tools that already exist for that 
task. Those tools run as a daemon and monitor the USB bus directly.

Since I've been planning to write up some instructions for an automatic 
firmware download I might as well do it here and now:

- Get the 'usbmgr' tool (it's allready included in SuSE distributions, don't 
know about others). If you don't have it: It's available from 

The following assumes that you compiled usbmgr for configuration files in 
/etc/usbmgr and that usbmgr is up and running (the best idea is to run it at 
system startup).

- Write a shell script named 'firmware' and place it in /etc/usbmgr (don't 
forget to make it executable with chmod +x):

--- snip ---

if [ "$ACTION" == "add" ]; then
   /usr/local/bin/acerfirm /usr/local/etc/acer/u64v120.bin

--- snip ---

You may have to adjust the path to acerfirm and your firmware file. In older 
versions of usbmgr you have to test $1 for "start" instead of "add" in 
$ACTION - consult the documentation of usbmgr for details.

- Next, find out the vendor and product ID of your scanner. Do a 
'cat /proc/bus/usb' - you should find some lines similar to the ones below

P:  Vendor=04a5 ProdID=2040 Rev= 1.00
S:  Manufacturer=Color
S:  Product= FlatbedScanner 13                                                

Now usbmgr has to be configured to execute the script 'firmware' if your 
scanner device is plugged onto the USB bus. This is done by creating a file 
named 'script' containing the name of the firmware script. The 'script' file 
has to be placed in a directory made up from your vendor / product id:

echo "firmware" > /etc/usbmgr/vendor/#VENDOR_ID#/#PRODUCT_ID#/script

You have to replace #VENDOR_ID# and #PRODUCT_ID# by the ids of your scanner - 
just use the hex notation as given in /proc/bus/usb/devices (e.g. in my case 
it's /etc/usbmgr/vendor/04a5/2040/script).

That's it - usbmgr will now download the firmware as soon as you switch on 
your scanner or plug it to the USB port.

If it doesn't work immediately take a look at your syslog files (usally 

Additionally you may configure usbmgr to load the 'scanner' kernel module - 
it's basically a file with contents 'scanner' at 

Good luck,