From: Andrew Sichevoi Date: Tue, 5 Jun 2012 05:39:30 +0000 (+0400) Subject: Added initramfs script for setting backglight level on boot up X-Git-Url: http://git.thekondor.net/?a=commitdiff_plain;h=811b4abae59a4d28f2e5f3a1ca92d342b75429da;p=scripts.git Added initramfs script for setting backglight level on boot up --- diff --git a/initramfs/backlight-level b/initramfs/backlight-level new file mode 100755 index 0000000..8d00c64 --- /dev/null +++ b/initramfs/backlight-level @@ -0,0 +1,49 @@ +#!/bin/sh + +### +### This script is distributed in the terms of GNU GPL v3.0+ +### (c) Andrew Sichevoi, http://thekondor.net +### +### Name: backlight-level +### Description: Initramfs script to setup initial display's backglight during the boot +### Notes: The script should be run on 'local-top' stage +### +### Arguments +### name : backlight_level +### type : integer, [0..15] +### required: optional +### default : 10 +### + +PREREQ="" +prereqs() +{ + echo "${PREREQ}" +} + +case "${1}" in + prereqs) + exit 0; + ;; +esac + +. /scripts/functions + +DEFAULT_BACKLIGHT_LEVEL=10 +BACKLIGHT_LEVEL= +for arg in $(cat /proc/cmdline); do + case ${arg} in + backlight_level=*) + BACKLIGHT_LEVEL=${arg#backlight_level=} + ;; + esac +done + +if [ -z ${BACKLIGHT_LEVEL} ]; then + log_warning_msg "Using default backlight level: '${DEFAULT_BACKLIGHT_LEVEL}'" + BACKLIGHT_LEVEL=${DEFAULT_BACKLIGHT_LEVEL} +fi + +echo ${BACKLIGHT_LEVEL} > /sys/class/backlight/acpi_video0/brightness + +exit 0