drivers - Network device drivers sub-package¶
Drivers are provided as external modules deployed in this sub-package. The documentation related to available drivers is compiled in the Extensions section of this documentation.
Driver automatic discovery and registering¶
They are automatically registered by an introspection mechanism of included modules, which is implemented at the drivers sub-package toplevel.
This package level module provides the package directory exploration mechanisme, for finding modules which provide HAL device classes and add them to the known devices.
All modules are analyzed, except those which name starts with a double underscore. Candidate modules must publish a dictionary named HAL_DEVICE_CLASSES providing the mapping table between devices symbolic names and corresponding implementation classes.
Collected dictionaries are merged into the global one published here, at package level. Extension distribution packages providing such classes must thus deploy them in the <PYCSTBOX_LIB_ROOT>/hal/drivers directory.
Existing entries will be replaced in case of duplicate names, and a warning will be issued in the log. Implementors are thus strongly encouraged to choose identifiers carefully so that name clashes have almost no chance to occur, for instance by prefixing them by the maker name (ex: worldcompany.motionsensor).
However, since the modules are loaded by name order, one can take advantage of this behavior to replace an existing device by a new version.