~laptop-mode-tools-dev/laptop-mode-tools/debian

« back to all changes in this revision

Viewing changes to usr/sbin/laptop_mode

  • Committer: Ritesh Raj Saarraf
  • Date: 2011-07-23 10:24:38 UTC
  • mfrom: (1.1.272 LMT-Main)
  • Revision ID: rrs@researchut.com-20110723102438-k85kixvnz2988mb2
MergeĀ formĀ Main

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
# set externally (Debian init system)
224
224
unset VERBOSE
225
225
 
226
 
 
227
 
# The main workhorse.
228
 
lmt_main_function ()
 
226
lmt_load_config ()
229
227
{
230
228
    # Source config. Some config settings have been moved from the main config file
231
229
    # to modular configuration files, and to support existing laptop-mode.conf
445
443
    if [ "$NOLM_HD_IDLE_TIMEOUT_SECONDS" != "" ] ; then
446
444
            NOLM_HD_IDLE_TIMEOUT=$(seconds_to_hdparm_S $NOLM_HD_IDLE_TIMEOUT_SECONDS)
447
445
    fi
448
 
 
 
446
}
 
447
 
 
448
 
 
449
# The main workhorse.
 
450
lmt_main_function ()
 
451
{
449
452
    if [ "$1" = "status" ] ; then
450
453
            # Display a status report.
451
454
            log "STATUS" "Mounts:"
1090
1093
    fi
1091
1094
}
1092
1095
 
 
1096
lmt_load_config
1093
1097
 
1094
1098
lock_retry ()
1095
1099
{
1113
1117
        ($FLOCK -n -x -w 1 9 && lmt_main_function "$@";) || lock_retry "$@"
1114
1118
  ) 9<>$LMT_INVOC_LOCK
1115
1119
) &
 
1120
 
 
1121
 
 
1122
# We do a special run of battery polling daemon here so that it does not get
 
1123
# plagued by the lock. We need the polling daemon to be independent of any locks
 
1124
if [ x$ENABLE_BATTERY_LEVEL_POLLING = x1 ] ; then
 
1125
        log "VERBOSE" "Battery level polling is enabled."
 
1126
        if [ x$ON_AC = x1 ] ; then
 
1127
                log "VERBOSE" "On AC, stopping the polling daemon."
 
1128
 
 
1129
                # In AC mode we disable the polling daemon.
 
1130
                killall -q lm-polling-daemon
 
1131
        else
 
1132
                if ! pidof -x lm-polling-daemon ; then
 
1133
                        log "VERBOSE" "On battery and there was no polling daemon yet, starting the polling daemon."
 
1134
                        
 
1135
                        # If there is no polling daemon, we start one.
 
1136
                        /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > /dev/null 2> /dev/null &
 
1137
                fi
 
1138
        fi
 
1139
else
 
1140
        log "VERBOSE" "Battery level polling is disabled."
 
1141
fi