mirror of
https://github.com/linux-msm/bootrr.git
synced 2026-02-25 13:12:03 -08:00
Handles drivers with spaces in their names, and simplify slightly by using globbing to unwrap the bus for loop. It's necessary to add the final '*' in the "for driver in" loop in bootrr-generate-template on POSIX sh. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
52 lines
1.5 KiB
Bash
Executable File
52 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# This will output a list of template bootrr rules for the
|
|
# current system based on what is currently found in sysfs. Some
|
|
# editing will be required for usability and maintainability,
|
|
# this is just a helper to get started.
|
|
|
|
ncpus=$(cat /proc/cpuinfo | grep ^processor | wc -l)
|
|
max_cpu=$(expr ${ncpus} - 1)
|
|
|
|
if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver ]; then
|
|
echo assert_cpufreq_enabled cpufreq-enabled ${max_cpu}
|
|
fi
|
|
if [ -f /sys/devices/system/cpu/cpuidle/current_driver ]; then
|
|
echo assert_cpuidle_enabled cpuidle-enabled ${max_cpu}
|
|
fi
|
|
|
|
# Find drivers with bound devices
|
|
for driver_path in /sys/bus/*/drivers/* ; do
|
|
devs=$(find "$driver_path" -type l -printf "\"%p\" " |
|
|
grep -v module$)
|
|
if [ "${devs}" = "" ]; then
|
|
continue
|
|
fi
|
|
|
|
driver="$(basename "$driver_path")"
|
|
|
|
# Check for the driver
|
|
echo assert_driver_present \"${driver}-driver-present\" \"${driver}\"
|
|
|
|
# Check for each instance of the driver
|
|
find "$driver_path" -type l | grep -v module$ | while read -r dev ; do
|
|
d=$(cd ${dev} ; pwd -P | sed s,.*/,,)
|
|
echo assert_device_present ${d}-probed \"${driver}\" ${d}
|
|
done
|
|
|
|
echo
|
|
done
|
|
|
|
# Sound card display names are symbolic links to their numbered
|
|
# directories
|
|
for card in $(find /proc/asound -type l | sed s,/proc/asound/,,g) ; do
|
|
# Check for the first playback and capture PCM only for
|
|
# now
|
|
if [ -d /proc/asound/${card}/pcm0p ]; then
|
|
echo assert_soundcard_present ${card}-playback ${card} pcm0p
|
|
fi
|
|
if [ -d /proc/asound/${card}/pcm0c ]; then
|
|
echo assert_soundcard_present ${card}-capture ${card} pcm0c
|
|
fi
|
|
done
|