[sane-devel] HAL and scanners.

m. allan noah kitno455 at gmail.com
Mon Mar 17 19:16:23 UTC 2008


On Mon, Mar 17, 2008 at 2:36 PM, Étienne Bersac <bersace03 at gmail.com> wrote:
> Hi,
>
>
>  > you may have a chain of backend names. the udi is only useful if each
>  > backend can use it to get enough info from hal to indentify the
>  > scanner. i dont know what hal can provide in that case.
>
>  Here is an example of HAL device properties (stripped), you will notify
>  the scanner namespace added by Abel Deuring fdi and the
>  scanner.sane.name property added by hald-addon-scanner.
>
>  bersace at thilivren:~$ lshal --show /org/freedesktop/Hal/devices/usb_device_a53_1000_noserial_if0
>  udi = '/org/freedesktop/Hal/devices/usb_device_a53_1000_noserial_if0'
>   info.addons = {'hald-addon-scanner'} (string list)
>   info.bus = 'usb'  (string)
>   info.capabilities = {'scanner', 'scanner', 'access_control'} (string list)
>   info.linux.driver = 'usbfs'  (string)
>   info.parent = '/org/freedesktop/Hal/devices/usb_device_a53_1000_noserial'  (string)
>   info.subsystem = 'usb'  (string)
>   info.udi = '/org/freedesktop/Hal/devices/usb_device_a53_1000_noserial_if0'  (string)
>   scanner.access_method = 'proprietary'  (string)
>   scanner.api = {'sane'} (string list)
>   scanner.is_supported = true  (bool)
>   scanner.sane.backend = {'plustek', 'plustek'} (string list)
>   scanner.sane.name = 'plustek:libusb:001:005'  (string)
>   scanner.sane.supportstatus = {'complete'} (string list)
>   usb.bus_number = 1  (0x1)  (int)
>   usb.can_wake_up = true  (bool)
>   usb.device_class = 0  (0x0)  (int)
>   usb.device_protocol = 0  (0x0)  (int)
>   usb.device_revision_bcd = 256  (0x100)  (int)
>   usb.device_subclass = 0  (0x0)  (int)
>   usb.interface.class = 255  (0xff)  (int)
>   usb.is_self_powered = false  (bool)
>   usb.linux.device_number = 5  (0x5)  (int)
>   usb.max_power = 0  (0x0)  (int)
>   usb.num_configurations = 1  (0x1)  (int)
>   usb.num_ports = 0  (0x0)  (int)
>   usb.product = 'USB Vendor Specific Interface'  (string)
>   usb.product_id = 4096  (0x1000)  (int)
>   usb.speed = 12.0 (12) (double)
>   usb.speed_bcd = 4608  (0x1200)  (int)
>   usb.vendor = 'Portable Peripheral Co., Ltd'  (string)
>   usb.vendor_id = 2643  (0xa53)  (int)
>   usb.version = 1.0 (1) (double)
>   usb.version_bcd = 256  (0x100)  (int)
>
>  Backend can access almost all those info, especially usb.bus_number and
>  usb.linux.device_number.
>

in order for this to work, you would have to link to every backend in
the system, and call this function on the right lib, unless you add
'backend' as an argument to the function. most backends could
implement the function as returning a concatenation of 'libusb:', the
vendor and device ids. the backends that return something else would
actually have to talk to the scanner and get that info.

what would scsi look like? you would have to be able to get the device
file name from hal...

>  > now, we dont have to solve
>  > all the problems at once, but i dont think i see what problem hal
>  > integration is trying to solve. can you help me understand?
>
>  HAL easy hotplug while running sane_get_devices() several times is
>  suboptimal. Also, UDI are universal accross the desktop (not only Gnome
>  or KDE) and allow to easily pass a device as argument (think
>  gnome-volume-manager handle scanner button and launch gnome-scan passing
>  the emitting device for preselection in the device selector), etc. There
>  is much much other possibilities given with HAL.

i am not familiar with gnome-volume-manager, what does it have to do
with button presses? for the button press code to be done properly,
the backend has to be running and talking to the scanner, since only
the backend knows how to interpret the buttons. and, since only the
backend knows what name to use, it sounds like you would be better off
firing up the backend whenever hal finds it, and leaving it running?

allan
-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list