Skip to content

Commit

Permalink
Added automatic driver loading (#469)
Browse files Browse the repository at this point in the history
* Added automatic driver loading
When the config file sets enable_autoload_drivers=1, the installer will
enable driver loading on hotplug events using mdev.conf, and it will try
to load drivers for already connected devices.

* * Fixed modprobe for module aliases that contain whitespace

* * Removed enable_autoload_drivers option, enabling it by default
  • Loading branch information
Zeerix authored and Mausy5043 committed Jul 22, 2017
1 parent 3daacb3 commit caace15
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/etc/init.d/rcS
Expand Up @@ -296,6 +296,12 @@ echo

# depmod needs to update modules.dep before using modprobe
depmod -a

# coldplug modules
echo "Loading drivers."
find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
echo "Finished loading drivers."

if [ "$drivers_to_load" != "" ] ; then
echo "Loading additional drivers."
for driver in $drivers_to_load
Expand Down
18 changes: 18 additions & 0 deletions scripts/etc/mdev.conf
@@ -0,0 +1,18 @@
# mdev.conf
#
# Provide user, group, and mode information for devices. If a regex matches
# the device name provided by sysfs, use the appropriate user:group and mode
# instead of the default 0:0 660.
#
# Syntax:
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
#
# [-]: do not stop on this match, continue reading mdev.conf
# =: move, >: move and create a symlink
# !: do not create device node
# @|$|*: run @cmd if $ACTION=add, $cmd if $ACTION=remove, *cmd in all cases

# support module loading on hotplug
$MODALIAS=.* 0:0 660 @modprobe -b "$MODALIAS"

0 comments on commit caace15

Please sign in to comment.