sane-dll(5)

๐Ÿ’… sane-dll โ€” the SANE dynamic backend loader (yes bestie, the loader loader) ๐ŸŽ€

okay so this page is brought to you by the sane-dll(5) girlies, part of SANE โ€” Scanner Access Now Easy. strap in, this one's actually iconic.


โœจ NAME โœจ

sane-dll โ€” the SANE dynamic backend loader. it loads backends. that's it. that's the whole vibe. ๐Ÿฆ‹


๐ŸŒธ DESCRIPTION ๐ŸŒธ

the sane-dll library implements a SANE (Scanner Access Now Easy) backend whose whole personality is giving other backends access. like, it's the friend who introduces you to all their other friends. it can give you access to an arbitrary number of other SANE backends, and those backends can show up in one of two ways:

  • they're pre-loaded at the time the sane-dll library gets built ๐Ÿ‘‘
  • or, on systems that support dynamic loading of shared libraries, they get loaded at runtime โญ

in that second case? adding support for a brand-new backend is literally just: install the relevant library in /usr/lib64/sane and add an entry to the dll.conf configuration file. that's it. no cap. in other words โ€” no applications need to be modified or recompiled to add support for new devices. not a single one. she did that. ๐Ÿ’…


๐ŸŽ€ DEVICE NAMES ๐ŸŽ€

this backend expects device names shaped like this:

backend:device

where backend is the name of the backend and device is the name of the device in that backend that should be addressed. iykyk.

now, plot twist ๐Ÿ™ˆ โ€” if the device name does not contain a colon (:), then the entire string gets treated as the device string for the default backend. and what's the default backend, you ask? it's the backend listed last in the configuration file (sneak peek below ๐Ÿ‘€) or the first pre-loaded backend (if there are any).


๐Ÿ’– CONFIGURATION ๐Ÿ’–

the contents of the dll.conf file is a list of backend names that may be loaded dynamically upon demand. so demanding of them. main character energy fr.

  • empty lines? ignored ๐Ÿ’€
  • everything after a hash mark (#)? also ignored โœจ

a sample configuration file is shown below, feast your eyes:

net
# this is a comment
pnm
mustek

it's also possible to add a file in /etc/sane.d/dll.d that contains the list of backends to be added. backends mentioned in a file included in this directory will be added before any backends listed in dll.conf. files in /etc/sane.d/dll.d can be freely named ๐Ÿซถ โ€” they shall follow the format conventions as apply for dll.conf.

๐Ÿ’ก note that backends that were pre-loaded when building this library do not have to be listed in this configuration file. like, if a backend was preloaded, then that backend will always be present, regardless of whether it's listed in the configuration file or not. she doesn't need the invite, she's already in the group chat.

the list of preloaded backends is determined by macro PRELOADABLE_BACKENDS in file backend/Makefile.in of the SANE source code distribution. after changing the value of this macro, it is necessary to reconfigure, rebuild, and reinstall SANE for the change to take effect. all three. no skipping steps bestie ๐Ÿ˜ญ

๐Ÿฆ‹ Aliases, aka the glow-up for ugly device names ๐Ÿฆ‹

aliases are defined in the config file dll.aliases. it can contain entries of the form:

alias SomeName SaneDeviceName
alias "Some Name" SaneDeviceName
hide SaneDeviceName

for example:

alias Epson net:somehost:epson:/dev/sgX
alias "Siemens ST400" st400:/dev/sgY
hide net:somehost:pnm:0
hide net:somehost:pnm:1
alias "Read from file" pnm:0
hide pnm:1

aliased device names are automatically hidden. periodt.

the idea is that users don't have to deal with complicated device names (especially for networked devices โ€” those names are a lot ๐Ÿ’€), and to hide other exported devices which might confuse them. and note: a hidden device can still be accessed if the device name is known โ€” it just doesn't appear on the list. she's private, not gone. ๐Ÿ™ˆ


โญ FILES โญ

  • /etc/sane.d/dll.aliases โ€” the list of aliased or hidden backends.
  • /etc/sane.d/dll.conf โ€” the backend configuration file (see also the description of SANE_CONFIG_DIR below ๐Ÿ‘‡).
  • /usr/lib64/sane/libsane-dll.a โ€” the static library implementing this backend.
  • /usr/lib64/sane/libsane-dll.so โ€” the shared library implementing this backend (present on systems that support dynamic loading).

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

  • SANE_CONFIG_DIR โ€” this environment variable specifies the list of directories that may contain the configuration file. on *NIX systems, the directories are separated by a colon (:), under OS/2, they are separated by a semi-colon (;). if this variable is not set, the configuration file is searched in two default directories: first, the current working directory (".") and then in /etc/sane.d. if the value of the environment variable ends with the directory separator character, then the default directories are searched after the explicitly specified directories. for example, setting SANE_CONFIG_DIR to "/tmp/config:" would result in directories tmp/config, ., and /etc/sane.d being searched (in this order). order matters bestie ๐Ÿซถ
  • SANE_DEBUG_DLL โ€” if the library was compiled with debug support enabled, this environment variable controls the debug level for this backend. e.g., a value of 128 requests all debug output to be printed. smaller levels reduce verbosity. here's the chart, no table but we make it cute:
    • 0 โ€” print severe errors only
    • 1 โ€” print normal errors and important messages
    • 2 โ€” print normal messages
    • 3 โ€” print debugging messages
    • 4 โ€” print everything

example:

export SANE_DEBUG_DLL=3

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

sane(7), scanimage(1), sane-"backendname"(5)


๐Ÿ’œ AUTHOR ๐Ÿ’œ

David Mosberger โ€” the icon, the legend, the blueprint ๐ŸŒŸ


okay that's the whole page, you're officially a sane-dll expert now ๐Ÿงš this little masterpiece is from 13 Jul 2008, so yeah she's vintage but she's still serving ๐Ÿ’€โœจ go forth and load those backends bestie, mwah ๐Ÿ’–๐Ÿ“

๐Ÿ“ฆ where this page comes from