Top | ![]() |
![]() |
![]() |
![]() |
LdmModalias * | ldm_modalias_new () |
const gchar * | ldm_modalias_get_driver () |
const gchar * | ldm_modalias_get_match () |
const gchar * | ldm_modalias_get_package () |
gboolean | ldm_modalias_matches () |
gboolean | ldm_modalias_matches_device () |
An LdmModalias is a mapping from an fnmatch
style modalias match to
the required package name and kernel module.
This is used in hardware detection to determine which package provides
the required kernel modules for any given hardware. At the most simple
level, we attempt to match the “match” field, which is an
fnmatch
style string, to each device's “modalias” field, which is
an explicit string set by the kernel.
This allows for automatic hardware detection and association with each LdmPlugin.
The primary use of LdmModalias is by the LdmModaliasPlugin implementation, which adds a new modalias for every line in a file to allow hardware matching.
For example, if we're trying to match an NVIDIA GPU which has the following modalias:
pci:v000010DEd00001C60sv00001558sd000065A4bc03sc00i00
as set by the kernel, we might have a “match” line that looks like:
pci:v000010DEd00001C60sv*sd*bc03sc*i*
Then all that is left is a simple comparison to check if the driver can be supported by the given match. Once we verify a match, we also know from the “driver” and “package” fields what the end user would need to have installed on their system for the “driver” to be activated. This helps immensely in detecting support for drivers.
LdmModalias * ldm_modalias_new (const gchar *match
,const gchar *driver
,const char *package
);
const gchar *
ldm_modalias_get_driver (LdmModalias *modalias
);
This function will return the driver name (i.e "wl") associated with this particular modalias match.
const gchar *
ldm_modalias_get_match (LdmModalias *modalias
);
This function will return the fnmatch-style match line used to check if this LdmModalias matches a given hardware device on the system.
const gchar *
ldm_modalias_get_package (LdmModalias *modalias
);
This function will return the name of the package or bundle that contains the corresponding driver required to enable hardware support.
gboolean ldm_modalias_matches (LdmModalias *modalias
,const gchar *match_string
);
If the given match_string matches our own fnmatch style match, this function will return true, indicating compatibility.
gboolean ldm_modalias_matches_device (LdmModalias *modalias
,LdmDevice *match_device
);
This is a simple wrapper around ldm_modalias_matches, and will simply pass the device's “modalias” for testing.
“driver”
property“driver” gchar *
The associated kernel driver
Flags: Read / Write / Construct Only
Default value: NULL
“match”
property“match” gchar *
The fnmatch style string that would create a match
Flags: Read / Write / Construct Only
Default value: NULL
“package”
property“package” gchar *
The package or bundle containing this driver match
Flags: Read / Write / Construct Only
Default value: NULL