Skip to content

Commit caace15

Browse files
ZeerixMausy5043
authored andcommitted
Added automatic driver loading (#469)
* 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
1 parent 3daacb3 commit caace15

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

scripts/etc/init.d/rcS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ echo
296296

297297
# depmod needs to update modules.dep before using modprobe
298298
depmod -a
299+
300+
# coldplug modules
301+
echo "Loading drivers."
302+
find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
303+
echo "Finished loading drivers."
304+
299305
if [ "$drivers_to_load" != "" ] ; then
300306
echo "Loading additional drivers."
301307
for driver in $drivers_to_load

scripts/etc/mdev.conf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# mdev.conf
2+
#
3+
# Provide user, group, and mode information for devices. If a regex matches
4+
# the device name provided by sysfs, use the appropriate user:group and mode
5+
# instead of the default 0:0 660.
6+
#
7+
# Syntax:
8+
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
9+
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
10+
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
11+
#
12+
# [-]: do not stop on this match, continue reading mdev.conf
13+
# =: move, >: move and create a symlink
14+
# !: do not create device node
15+
# @|$|*: run @cmd if $ACTION=add, $cmd if $ACTION=remove, *cmd in all cases
16+
17+
# support module loading on hotplug
18+
$MODALIAS=.* 0:0 660 @modprobe -b "$MODALIAS"

0 commit comments

Comments
 (0)