Anthony Wright wrote:
Alexander E. Patrakov wrote:
Anthony Wright wrote:
ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c '/sbin/modprobe $$MODALIAS ; [ -e /sys$$DEVPATH/driver -o -e /sys$$DEVPATH/device/driver ] '"

This is indeed too long. Maybe (untested, relies on obsolete PHYSDEVDRIVER variable, will certainly break with linux-2.6.18):

ENV{PHYSDEVDRIVER}=="?*", GOTO="driver_already_loaded"
ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
# <other modprobe rules>
LABEL="driver_already_loaded"

Having given this some more thought, below is a modified version of my original suggestion. It's based on Alexander's suggestion so has a lot less impact on the 26-modprobe.rules file (it adds two lines), but rather than using the potentially obselete ENV(PHYSDEVDRIVER), it tests for a link from the device to a driver in the /sys filesystem. It's a bit ugly, but it's the closest I can get without adding a new directive to udev. It does the job correctly and the test are similar to how udev would implement an internal directive.

ACTION=="add", PROGRAM="/bin/sh -c '[ -e /sys$$DEVPATH/driver -o -e /sys$$DEVPATH/device/driver ]'", GOTO="driver_already_loaded"
ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
# <other modprobe rules>
LABEL="driver_already_loaded"

Cheers,

Tony.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to