[sane-devel] Sane API

Alexander Pevzner pzz at apevzner.com
Wed Oct 21 14:32:39 BST 2020


On 10/21/20 3:04 PM, Thierry HUCHARD wrote:
> I don't see why notifications should be made by sane.
> It is the system that takes care of the connection / disconnection of 
> the devices!

Because only backends knows, how system events are mapped to scanner PnP 
events.

Applications should not be responsible to poll USB bus for USB-level 
events, which some knowledge how to distinguish mouse from scanner, poll 
DNS-SD events, with some knowledge, which services are registered by 
scanners and so on.

May be in printer world it could work, because there are only one device 
class, used by USB printers, and only 3 service types, used by DNS-SD to 
advertise a printer, and these is no such thing as SCSI printer, but 
scanner hardware is MUCH more chaotic.

>> - If some scanner is identified by multiple backends, it would be nice
>> to let user app to automatically choose one of the list. For this
> 
> I'm for leaving the choice to the user, the automatic choice criteria 
> are generally subjective choice
> criteria (specific to the developer), generally they limit the 
> possibilities.

This is UI (user interface) - level decision, our goal is to provide a 
mechanism that makes this decision possible to be implemented.

>> For the following things we just don't have appropriate SANE_Value_Type:
>> - Scanner resolution if a form of X*Y pair. This is important, to
>> support "asymmetrical" resolutions (300*600, for example)
> 
> This change could easily be implemented without SANE-1.0.

OK, but how?

>> For the following options we don't have enough discipline:
>> - SANE_NAME_SCAN_SOURCE. There is no common names for ADF simplex/ADF
>> duplex, ADF front/ADF back
> 
> It's only discipline!

Yes, but in result, every application that care must be aware about all 
existent variants.

The existent situation needs at least to be documented, and well-known 
names needs to be added to the documentation and C header file.

> Indeed, sane_read should be allowed to return the scanner data without 
> processing it!

And it actually affects behavior of some other options and API calls.

For example, if backend doesn't decode, it should not be obliged to 
return accurate data from sane_get_parameters. List of possible color 
modes could be different for "raw" and decoded modes (in raw mode 
backend may support mode that it cannot decode). Scan region settings 
may or may not work in the "raw" mode. All emulated options unlikely to 
work in the "raw" mode, and so on,

-- 

	Wishes, Alexander Pevzner (pzz at apevzner.com)



More information about the sane-devel mailing list