[sane-devel] As instructed by /etc/udev/rules.d/libsane.rules

Alesh Slovak alesh.slovak at avasys.jp
Mon Nov 16 05:04:58 UTC 2009


Hi Allan,

Thanks for your comments.

m. allan noah wrote:
>> We can't use a static rules file because each distro uses slightly different
>> syntax. And even then, we can't keep up with all the changes distros
>> themselves keep making to their udev rules files resulting in breakage
>> nearly every time a new version of a distro is released. This happened again
>> with this months round of distro updates.
> 
> Have you ever noticed that SANE itself does not have this problem-
> Why? Because we use a license that allows the distros to repackage our
> code, and they generate the rules in the proper format. Perhaps you
> could do the same? (though, they may not release often enough to keep
> up with you)
epkowa uses exactly the same license and some distros do package it. This is not 
the issue. The problem is, as you mention, that our main goal is to provide day 
one support for devices. We can't do this by having distros package our driver. 
That is the only thing standing in the way of epkowa being a part of SANE as far 
as we are concerned. Even if we were to include epkowa in SANE, we would still 
need to release our own packages to meet our hardware release schedules. iscan, 
the SANE frontend for epkowa that we ship, is a different matter because it 
requires some proprietary bits, but it is irrelevant to this discussion.

>> I have been thinking about modifying SANE's udev rules generation script in
>> some way to allow for adding new rules and trying somehow to convince
>> distros to package that up so third parties could use it in their install
>> scripts to safely add new rules, maybe to a "third party" rules file or
>> something.
>>
>> What do people think about this idea?
> 
> That's fine, but it would require that the distro patch our tool to
> output their preferred format. I assume most of them do this already,
> but cannot be sure.
As far as I understood, they do this already, and if they don't, there shouldn't 
be any need to start if the additions/changes I am suggesting were to be made. 
The only difference for distributors is that they would need to start packaging 
the udev rules generation script whereas now they only use it once to generate 
the rules files they package.

>> I suppose at least one possible benefit to SANE would be that the number of
>> users coming to you for support relating to this problem should be
>> drastically reduced.
> 
> I don't know about that. We will just end up telling users to download
> a .desc file from someplace, and run a script as root, but then the
> vendor has not patched the script, and it makes the wrong format, or
> they blow away the wrong udev file, etc etc...
If all a third party provides is a .desc file, how can anything really go wrong 
like you say? What I am suggesting is trying to avoid the very problems you 
describe. Essentially, all I am arguing for is some kind of an "API" that allows 
third party SANE backends to "register" their scanners so they can be properly 
identified as such. A command line like `sane-add-usb-rule <vendor-id> 
<product-id>` that a third party package could call from the post install script 
would do the trick. Of course, I am open to other ideas anyone may have.

I suppose you're right in that people will likely always come to you first when 
their scanner doesn't work and you'll have to point them to a 3rd party driver 
when your own drivers don't support their model. I still think it will make 
things quieter on that front though, as a lot less breakage will occur for 
people who are already using third party drivers.

>> Another possibility might be to convince distros to ship the desc files and
>> the udev rules generation script and have third parties add their desc files
>> to a folder and trigger a regeneration of the rules.
> 
> Sounds dangerous.
More dangerous than third parties directly fiddling with udev rules files like 
we do now in epkowa? Or having the user scan as root?

By dangerous are you thinking about malicious or incorrectly written .desc 
files? Or something else?

>> Any thoughts, or is this going outside the scope of SANE?
> 
> Well, you've seen yourself just how many random variations there are
> on device perms. So, I'm inclined to give the distros the info they
> need, and make specific rule generation their problem. That should
> encourage a bit more standardization on their part. If we find the man
> power to release sane a little more frequently, that would also help.
Again, this doesn't solve the problem I am trying to solve. I need to provide 
users with day one support for their scanners. I'd really like to do that 
without users having to scan as root or fiddle with udev rules.

It may be that this is a problem that is more appropriately handled at the 
distro level, but I was hoping that including a script or something in SANE 
itself would help get distros on board and provide a standardized "API" of sorts 
for adding scanner permissions. This is upstream after all.

Happy scanning,
-- 
Alesh Slovak                    Linux Team -- AVASYS Corporation
alesh.slovak at avasys.jp          http://avasys.jp



More information about the sane-devel mailing list