[sane-devel] Location of some backend's files

m. allan noah anoah at pfeiffer.edu
Mon Dec 4 02:06:32 CET 2006


On Sun, 3 Dec 2006, JKD wrote:

> El Sun, 03 de Dec de 2006, a las 11:13:07AM -0500, m. allan noah dijo:
>> On Sun, 3 Dec 2006, JKD wrote:
>>
>>> Hello,
>>>
>>> I'm hp3900 backend's developer. Due to this backend supports some
>>> scanners and new devices could be supported in the future I'm thinking
>>> about the possibility to create different config files for each
>>> scanner capabilities to maintain code's structure legible.
>>
>> but you will have to add code that parses these files, and builds them
>> into an array of structs. having that array compiled into the backend
>> will be faster, and maybe less code.
>
> Code to parse files would be done the first time. Sources wouldn't
> need to be rewriten each time a new scanner is added. Due to config is
> out of code, application's size is much lower and only is necessary to
> allocate dynamic memory for one scanner instead of all supported
> scanners.

the app will not be smaller, unless you are talking about dozens of 
scanners. the packed c structs will be smaller than your parsing code.

> Another advantage is that any change in structs wouldn't affect
> configuration causing compilation problems.

i do not understand this point. perhaps something lost in translation?

> The only disadvantage as you
> say is that there is a little lapsus of time (may be not perceptible)
> when using "sane_open" function. But after sane_open, backend works
> as fast as it was before.
>
>>> It's not simple configuration which user should change but internal
>>> values to program RTS8822 chip in each case (area constrains to scan,
>>> sensor timing values, motor curves...) so I wouldn't set them at
>>> sane.d/hp3900.conf
>>
>> if they are not user-changeable, then why do they need to be a separate
>> file?
>
> Because it's easier for any developer or anyone who wants to try to
> support his new scanner, under his own responsability, editing desired
> values without compiling backend in each change (It's faster in
> this way). For security reasons these files can be "read only" so normal
> users can not make any change.
>

ok, so if you only anticipate this being used by an advanced user, then 
why not put overrides for all these settings in your regular config file? 
that is how all the other backends do it, IIRC. you could have a default 
series of slow, small parameters that are used for any unknown scanners, 
and the user can change them.

>>>
>>> Is there any standard path in SANE to locate such files? Something
>>> like sane.d/backend's name/ or may be /usr/share/backend's name/
>>>
>>
>> i would consider it a security risk to have such a low-level control file
>> read from the home-dir of the user, and non-linux systems may not have a
>> /usr/share, but they will have the sane.d config-file dir, so perhaps
>> sane.d/backendname/ is best (though i dont see the need for it...)
>>
> If all of you think that it's not a good idea I'll keep config inside
> code.

i should have stated that i also am only a single backend developer, so i 
dont speak for SANE at all, just myself.

allan

>
> Jonathan Bravo Lopez
>
>
>

-- 
"so don't tell us it can't be done, putting down what you don't know.
money isn't our god, integrity will free our souls" - Max Cavalera



More information about the sane-devel mailing list