[sane-devel] Identifying identical scanners dynamically turned on and off

Martin Zackrisson martin.zackrisson at cmb.gu.se
Fri Mar 23 11:05:39 UTC 2012



On 03/23/2012 12:37 AM, Olaf Meeuwissen wrote:
> These days the USB devices stay at the same place below /sys/ even 
> when power cycled. Only when replugging to a *different* USB port will 
> this location change. I'm not sure what happens when you reboot. 
> Assuming that you know which scanner shows up where in /sys/, you can 
> then use the busnum and devnum "files" to construct the device names 
> that the epson2 backend groks. So with $ cat 
> /sys/bus/usb/devices/usb2/2-4/busnum 2 $ cat 
> /sys/bus/usb/devices/usb2/2-4/devnum 3 you'd use 
> `epson2:libusb:002:003` for the device name. When power cycling, on 
> the `devnum` will change. Note that there is a libsysfs-dev package 
> which may be useful here. Hope this helps, 
The path on my machine was similar but didn't have the files you 
specified but your guidance led to this command which gives me the 
proper addresses of all attached scanners:

$ sane-find-scanner -v -v | sed -n -E 's/^found USB.*(libusb.*$)/\1/p'

Thanks for the help,

Martin




More information about the sane-devel mailing list