I don't know of any specific documentation, but it's pretty easy: Devices, any kind of device, can export a match, based on specific properties of the subsystem it belongs to. In most cases its the same propery/id that is used inside the kernel, to find a (already loaded) driver which will bind this device. Any unique string, hardware ID's, whatever, are stuffed into a modalias, prefixed by "<subsystem>:" to be unique. PCI and USB are pretty obvious, they just stuff all their hardware ID'S into a string, in a defined order, and let every device export that value to userspace by MODALIAS environment key and the "modalias" sysfs file. Other subsystem may have simple strings to match, they define themselves. Now, the drivers contain "match id tables" which are used by the core to bind devices to drivers. These tables area made available to file2alias.c in the module postprocessing, and will end up in the module file itself. The string is mangled to contain wildcards, so they can just be fnmatch()'d against the modalias value, which the devices export. The string embedded in the modules are extracted by depmod, and put into the modules.aliases file in /lib/modules/. Every time modprobe is called with an alias, it searches through this file and loads all modules which contained a matching alias string. Udev does nothing but stupidly running modprobe for every device which contains MODALIAS in the event environment, and passes $MODALIAS as an argument to modprobe. Only if we change the format of the current pnp device aliases to something like: pnp*:XYZ2324:* pnp*:ABC1234:* and create a "modalias" file at every pnp device, and add MODALIAS to the uevent. The modalias must contains all ID's which belong to that device in one single string, separated and terminated by a special character, something like: pnp:ABC1234:XYZ2324:RST3445: That's how acpi should work with this patch now. Kay --
This all sounds like good stuff that I'd like PNP to have. Is there any reason I shouldn't implement pnp_device_uevent()? Any backwards- compatibility issues? I think that sounds like a better solution than doing this PNP ID mangling. Bjorn --
Yeah, people probably use the current aliases in modprobe.conf files, Sure, that will go with the acpi aliases + acpi modalias, or if you change pnp to have proper pnp aliases + pnp modalias, then with them, yes. Thanks, Kay --
Since PNP currently doesn't generate any uevents or modalias files, I expect that a non-ACPI system will be unable to autoload modules for ISAPNP or PNPBIOS devices. Right? Bjorn --
They do create events, but without modalias. The shell script hack, which udev runs, will make the event behave like it contained one. Kay --
I'm finally looking at this again; sorry for the long hiatus. I'm
working on a patch to add PNP uevent support, modalias sysfs files
for PNP, and file2alias.c changes to match, and I just want to
make sure I'm understanding this correctly.
Before your file2alias.c changes[1], I think we generated this:
alias pnp:dPNP0500* 8250_pnp
We relied on the udev shell hack to run "modprobe -a pnp:dPNP0500"
based on the contents of /sys/bus/pnp/devices/00:05/id.
With your file2alias.c changes, we now generate this:
alias acpi*:PNP0500:* 8250_pnp
alias pnp:dPNP0500* 8250_pnp
On ACPI systems, this works fine because "acpi*:PNP0500:*" matches
the ACPI-generated uevents like:
MODALIAS=acpi:PNP0501:PNP0500:
We can load 8250_pnp without relying on the udev shell hack
*on ACPI systems*.
I thought the object of your file2alias.c changes was to remove the
need for the udev shell hack, but don't we still require it on
non-ACPI systems because they won't emit the ACPI uevents?
Bjorn
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=22454c...
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=5e4c65...
--
Sounds good, just in mind, that there are custom modprobe configs out there, that rely on the current pnp alias format, like: alias pnp:dPNP0510 irtty-sir alias pnp:dPNP0511 irtty-sir alias pnp:dPNP0700 floppy alias pnp:dPNP0303 atkbd alias pnp:dPNP0f13 psmouse ... We should make sure, that this still works, which wouldn't if we just Yes, the plan is to move that rule from the default udev rule set to the isapnp package. Thanks, Kay --
My thought is to make PNP emit uevents with modaliases like "MODALIAS=pnp:PNP0501:PNP0500:" and make file2alias generate aliases like "alias pnp*:PNP0500:* 8250_pnp". Modprobe configs like "alias pnp:dPNP0510 irtty-sir" would still work but would continue to depend on the udev shell hack. If we just move the udev shell hack to the isapnp package, those "alias pnp:dPNP0510 irtty-sir" configs would then depend on isapnp, which doesn't seem like quite what we want. We can certainly have PNP0510 ACPI devices that don't depend on isapnp. All I want to do now is *enable* more conventional configs like "alias pnp*:PNP0510:* irtty-sir" to work without extra hacks. I don't have any plan for actually removing the hacks or doing --
Looks good, and it is how they should look like. The current pnp aliases are totally broken and useless for any usual modalias The way the current shell hack is done, is that it gets disabled Hmm, I guess there is no way around that. :) Thanks, Kay --
