diff -Nru laptop-mode-tools-1.58/debian/changelog laptop-mode-tools-1.60/debian/changelog --- laptop-mode-tools-1.58/debian/changelog 2011-10-19 10:17:09.000000000 +0000 +++ laptop-mode-tools-1.60/debian/changelog 2011-12-21 14:45:08.000000000 +0000 @@ -1,3 +1,32 @@ +laptop-mode-tools (1.60-1ubuntu1) precise; urgency=low + + * Merge with Debian testing. (LP: #906291) Remaining Ubuntu changes: + - debian/rules: Do not ship obsolete acpi/apm scripts. + + -- Mahyuddin Susanto Mon, 19 Dec 2011 19:24:23 +0700 + +laptop-mode-tools (1.60-1) unstable; urgency=low + + * [709f521] New Upstream Release + (Closes: 647564) + - [8389588] Change Intel HDA Audio's default power save timeout to 2 seconds + - [cc40bd1] usb autosuspend black-/whitelist arg in quotes. + Thanks to Simon Que + - [5a4e08a] add readme-debugging.txt + - [be147e0] Helper tools to provide suspend/hibernate functionality + - [49afd31] Kill lm-polling-daemon when init stop is called + - [68b0ff5] Add pm-helper tool to take care of suspend / hibernate. + - [c7e3038] Use native hibernation helper tool from LMT + - [a569b29] Check for block device's existence. + Thanks to Simon Que (Chromium Project) + - [ab704b2] Use proper device for iwconfig. + Thanks to bs.net (Closes: 639388) + * [8fa914a] Drop some of the Recommends to Suggests. + Thanks to Clea F. Rees (Closes: #640155) + * [75c51b3] Drop duplicate changelog + + -- Ritesh Raj Sarraf Sat, 05 Nov 2011 12:59:34 +0530 + laptop-mode-tools (1.58-3ubuntu1) precise; urgency=low * Merge with Debian testing. Remaining Ubuntu changes: diff -Nru laptop-mode-tools-1.58/debian/control laptop-mode-tools-1.60/debian/control --- laptop-mode-tools-1.58/debian/control 2011-10-19 10:16:39.000000000 +0000 +++ laptop-mode-tools-1.60/debian/control 2011-12-21 14:45:39.000000000 +0000 @@ -12,7 +12,8 @@ Package: laptop-mode-tools Architecture: all Depends: ${misc:Depends}, lsb-base (>= 3.0-10), util-linux (>= 2.13), psmisc -Recommends: acpid | apmd | pbbuttonsd | pmud, hdparm, sdparm, hal, ethtool, net-tools, wireless-tools, udev +Recommends: hdparm, sdparm, ethtool, net-tools, wireless-tools, udev +Suggests: acpid | apmd | pbbuttonsd | pmud, hal Conflicts: noflushd Description: Tools for Power Savings based on battery/AC status Laptop mode is a Linux kernel feature that allows your laptop to save @@ -28,3 +29,4 @@ . laptop-mode-tools uses the Linux kernel's Laptop Mode feature and thus is also used on Desktops and Servers to conserve power + diff -Nru laptop-mode-tools-1.58/debian/docs laptop-mode-tools-1.60/debian/docs --- laptop-mode-tools-1.58/debian/docs 2011-08-02 17:52:54.000000000 +0000 +++ laptop-mode-tools-1.60/debian/docs 2011-12-21 14:34:25.000000000 +0000 @@ -1,3 +1,2 @@ README Documentation/laptop-mode.txt -Documentation/revision-history.txt diff -Nru laptop-mode-tools-1.58/debian/laptop-mode-tools.preinst laptop-mode-tools-1.60/debian/laptop-mode-tools.preinst --- laptop-mode-tools-1.58/debian/laptop-mode-tools.preinst 1970-01-01 00:00:00.000000000 +0000 +++ laptop-mode-tools-1.60/debian/laptop-mode-tools.preinst 2011-12-21 14:34:25.000000000 +0000 @@ -0,0 +1,41 @@ +#!/bin/sh +# preinst script for laptop-mode-tools +# +# see: dh_installdeb(1) + +set -e + +# Remove a no-longer used conffile +rm_conffile() { + local PKGNAME="$1" + local CONFFILE="$2" + + [ -e "$CONFFILE" ] || return 0 + + local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')" + local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \ + sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" + if [ "$md5sum" != "$old_md5sum" ]; then + echo "Obsolete conffile $CONFFILE has been modified by you." + echo "Saving as $CONFFILE.dpkg-bak ..." + mv -f "$CONFFILE" "$CONFFILE".dpkg-bak + else + echo "Removing obsolete conffile $CONFFILE ..." + rm -f "$CONFFILE" + fi +} + +case "$1" in +install|upgrade) + # ideally this clean-up should have been done at the same time + # as we stopped shipping the file, but since we had releases in + # between we will compare with the version shipping this clean-up + # instead of the first version not shipping the file + if dpkg --compare-versions "$2" lt "1.51-2"; then + rm_conffile laptop-mode-tools "/etc/pm/sleep.d/99laptop-mode" + fi +esac + +#DEBHELPER# + +exit 0 diff -Nru laptop-mode-tools-1.58/debian/patches/debian-changes laptop-mode-tools-1.60/debian/patches/debian-changes --- laptop-mode-tools-1.58/debian/patches/debian-changes 2011-10-19 10:17:14.000000000 +0000 +++ laptop-mode-tools-1.60/debian/patches/debian-changes 2011-12-21 14:54:21.000000000 +0000 @@ -1,54 +1,32 @@ -Description: Undocumented upstream changes - This patch has been created by dpkg-source during the package build - but it might have accumulated changes from several uploads. Please - check the changelog to (hopefully) learn more on those changes. +Description: + TODO: Put a short summary on the line above and replace this paragraph + with a longer explanation of this change. Complete the meta-information + with other relevant fields (see below for details). To make it easier, the + information below has been extracted from the changelog. Adjust it or drop + it. + . + laptop-mode-tools (1.60-1ubuntu1) precise; urgency=low + . + * Merge with Debian testing. (LP: #906291) Remaining Ubuntu changes: + - debian/rules: Do not ship obsolete acpi/apm scripts. +Author: Mahyuddin Susanto +Bug-Ubuntu: https://bugs.launchpad.net/bugs/906291 ---- /dev/null -+++ laptop-mode-tools-1.58/laptop-mode-tools.preinst -@@ -0,0 +1,41 @@ -+#!/bin/sh -+# preinst script for laptop-mode-tools -+# -+# see: dh_installdeb(1) -+ -+set -e -+ -+# Remove a no-longer used conffile -+rm_conffile() { -+ local PKGNAME="$1" -+ local CONFFILE="$2" -+ -+ [ -e "$CONFFILE" ] || return 0 -+ -+ local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')" -+ local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \ -+ sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" -+ if [ "$md5sum" != "$old_md5sum" ]; then -+ echo "Obsolete conffile $CONFFILE has been modified by you." -+ echo "Saving as $CONFFILE.dpkg-bak ..." -+ mv -f "$CONFFILE" "$CONFFILE".dpkg-bak -+ else -+ echo "Removing obsolete conffile $CONFFILE ..." -+ rm -f "$CONFFILE" -+ fi -+} -+ -+case "$1" in -+install|upgrade) -+ # ideally this clean-up should have been done at the same time -+ # as we stopped shipping the file, but since we had releases in -+ # between we will compare with the version shipping this clean-up -+ # instead of the first version not shipping the file -+ if dpkg --compare-versions "$2" lt "1.51-2"; then -+ rm_conffile laptop-mode-tools "/etc/pm/sleep.d/99laptop-mode" -+ fi -+esac -+ -+#DEBHELPER# -+ -+exit 0 ---- laptop-mode-tools-1.58.orig/etc/init.d/laptop-mode -+++ laptop-mode-tools-1.58/etc/init.d/laptop-mode +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- laptop-mode-tools-1.60.orig/etc/init.d/laptop-mode ++++ laptop-mode-tools-1.60/etc/init.d/laptop-mode @@ -6,63 +6,54 @@ # # config: /etc/laptop-mode/laptop-mode.conf @@ -140,8 +118,8 @@ ;; status) ---- laptop-mode-tools-1.58.orig/etc/power/scripts.d/laptop-mode -+++ laptop-mode-tools-1.58/etc/power/scripts.d/laptop-mode +--- laptop-mode-tools-1.60.orig/etc/power/scripts.d/laptop-mode ++++ laptop-mode-tools-1.60/etc/power/scripts.d/laptop-mode @@ -28,7 +28,7 @@ if [ -w /proc/sys/vm/laptop_mode ]; then $LMODE "stop" ;; @@ -151,88 +129,3 @@ ;; esac elif [ -x logger ]; then ---- laptop-mode-tools-1.58.orig/usr/share/laptop-mode-tools/modules/laptop-mode -+++ laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/laptop-mode -@@ -187,21 +187,18 @@ if [ "$ACTIVATE_WITH_POSSIBLE_DATA_LOSS" - set_sysctl /proc/sys/fs/xfs/xfsbufd_centisecs 3000 - fi - -- case "$KLEVEL" in -- "2.4") -- log "VERBOSE" "Adjusting 2.4 kernel parameters to enable laptop mode." -- set_sysctl /proc/sys/vm/laptop_mode 1 -- set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $AGE $AGE 60 20 0" -- ;; -- "2.6") -- log "VERBOSE" "Adjusting 2.6 kernel parameters to enable laptop mode." -- set_sysctl /proc/sys/vm/laptop_mode "$LM_SECONDS_BEFORE_SYNC" -- set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$AGE" -- set_sysctl /proc/sys/vm/dirty_expire_centisecs "$AGE" -- set_sysctl /proc/sys/vm/dirty_ratio "$LM_DIRTY_RATIO" -- set_sysctl /proc/sys/vm/dirty_background_ratio "$LM_DIRTY_BACKGROUND_RATIO" -- ;; -- esac -+ if [ -f /proc/sys/vm/bdflush ]; then -+ log "VERBOSE" "Adjusting 2.4 kernel parameters to enable laptop mode." -+ set_sysctl /proc/sys/vm/laptop_mode 1 -+ set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $AGE $AGE 60 20 0" -+ else -+ log "VERBOSE" "Adjusting 2.6+ kernel parameters to enable laptop mode." -+ set_sysctl /proc/sys/vm/laptop_mode "$LM_SECONDS_BEFORE_SYNC" -+ set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$AGE" -+ set_sysctl /proc/sys/vm/dirty_expire_centisecs "$AGE" -+ set_sysctl /proc/sys/vm/dirty_ratio "$LM_DIRTY_RATIO" -+ set_sysctl /proc/sys/vm/dirty_background_ratio "$LM_DIRTY_BACKGROUND_RATIO" -+ fi - if [ $CONTROL_MOUNT_OPTIONS -eq 1 ]; then - log "VERBOSE" "Remounting filesystems." - # The -r flag makes 'read' preserve backslashes read from -@@ -316,19 +313,16 @@ else - set_sysctl /proc/sys/fs/xfs/xfssyncd_centisecs $((100*$DEF_XFS_SYNC_INTERVAL)) - set_sysctl /proc/sys/fs/xfs/xfsbufd_centisecs $((100*$DEF_XFS_BUFD_INTERVAL)) - fi -- case "$KLEVEL" in -- "2.4") -- log "VERBOSE" "Adjusting 2.4 kernel parameters to disable laptop mode." -- set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $U_AGE $B_AGE 60 20 0" -- ;; -- "2.6") -- log "VERBOSE" "Adjusting 2.6 kernel parameters to disable laptop mode." -- set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$U_AGE" -- set_sysctl /proc/sys/vm/dirty_expire_centisecs "$B_AGE" -- set_sysctl /proc/sys/vm/dirty_ratio "$NOLM_DIRTY_RATIO" -- set_sysctl /proc/sys/vm/dirty_background_ratio "$NOLM_DIRTY_BACKGROUND_RATIO" -- ;; -- esac -+ if [ -f /proc/sys/vm/bdflush ]; then -+ log "VERBOSE" "Adjusting 2.4 kernel parameters to disable laptop mode." -+ set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $U_AGE $B_AGE 60 20 0" -+ else -+ log "VERBOSE" "Adjusting 2.6+ kernel parameters to disable laptop mode." -+ set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$U_AGE" -+ set_sysctl /proc/sys/vm/dirty_expire_centisecs "$B_AGE" -+ set_sysctl /proc/sys/vm/dirty_ratio "$NOLM_DIRTY_RATIO" -+ set_sysctl /proc/sys/vm/dirty_background_ratio "$NOLM_DIRTY_BACKGROUND_RATIO" -+ fi - if [ $CONTROL_MOUNT_OPTIONS -eq 1 ] ; then - log "VERBOSE" "Remounting filesystems." - # The -r flag makes 'read' preserve backslashes read from ---- laptop-mode-tools-1.58.orig/usr/sbin/laptop_mode -+++ laptop-mode-tools-1.58/usr/sbin/laptop_mode -@@ -1140,4 +1140,4 @@ else - log "VERBOSE" "Battery level polling is disabled." - fi - --return 0; -+exit 0; ---- laptop-mode-tools-1.58.orig/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon -+++ laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon -@@ -10,7 +10,7 @@ - # risks data loss). - INTERVAL=150 - --while ( true ) ; do -+while :; do - sleep $INTERVAL - - /usr/sbin/laptop_mode auto diff -Nru laptop-mode-tools-1.58/Documentation/readme-debugging.txt laptop-mode-tools-1.60/Documentation/readme-debugging.txt --- laptop-mode-tools-1.58/Documentation/readme-debugging.txt 1970-01-01 00:00:00.000000000 +0000 +++ laptop-mode-tools-1.60/Documentation/readme-debugging.txt 2011-10-14 07:40:08.000000000 +0000 @@ -0,0 +1,30 @@ +When you suspect a problem with the way power management is reflecting on your machine +please enable the following laptop-mode-tools options to extract more information as to +what might be causing the problem + + +VERBOSE_OUTPUT=1 +# +# Set this to 1 if you want to see a lot of information when you start/stop +# laptop_mode. +# + +LOG_TO_SYSLOG=1 +# Set this to 1 if you want to log messages to syslog. All of laptop-mode-tools messages +get logged into syslog. This helps further in debugging the problem. + + + +DEBUG=1 +# Run in shell debug mode +# Enable this if you would like to execute the entire laptop-mode-tools program +# in shell debug mode. Warning: This will create a lot of text output. +# +# This shell debug mode output will be listed on the terminal where laptop-mode-tools' +# init script it called. + +# If you are debugging an individual module, perhaps you would want to enable +# each module specific debug mode (available in module conf files) + +# Further details and documentation about more of the options of laptop-mode-tools is +# available in the man page diff -Nru laptop-mode-tools-1.58/Documentation/revision-history.txt laptop-mode-tools-1.60/Documentation/revision-history.txt --- laptop-mode-tools-1.58/Documentation/revision-history.txt 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/Documentation/revision-history.txt 2011-10-14 07:40:08.000000000 +0000 @@ -1,3 +1,21 @@ +1.60 - Fri Oct 14 13:08:09 IST 2011 + * Use proper device reference for iwconfig (Debian BTS: #639388) + * Check for block device's existence. Thanks to Simon Que + * Add suspend/resume helper tools: pm-helper, pm-suspend, pm-hibernate + * What laptop-mode-tools is stopped from init, also kill polling daemon + * Reliable and much better locking mechanics + * Make polling dameon lock safe + * Make lmt-udev distro neutral. Thanks to Simon Que + * Change Intel HDA Audio's default power save timeout to 2 seconds + +1.59 - Mon Aug 8 00:56:48 IST 2011 + * really don't call batt-poll-daemon inside from the flock instance + * USB auto-suspend whitelist + * Add myself as the maintainer + * Don't call true which forks a subshell + * Use exit instead of return + * Check for files instead of kernel version numbers. + 1.58 - Sat Jul 23 23:21:22 IST 2011 * Initialize the PATH variable within us. This helps when our caller did not have a proper environment diff -Nru laptop-mode-tools-1.58/etc/laptop-mode/conf.d/auto-hibernate.conf laptop-mode-tools-1.60/etc/laptop-mode/conf.d/auto-hibernate.conf --- laptop-mode-tools-1.58/etc/laptop-mode/conf.d/auto-hibernate.conf 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/etc/laptop-mode/conf.d/auto-hibernate.conf 2011-10-14 07:40:08.000000000 +0000 @@ -40,7 +40,7 @@ # The hibernation command that is to be executed when auto-hibernation # is triggered. # -HIBERNATE_COMMAND=/usr/sbin/pm-hibernate +HIBERNATE_COMMAND=/usr/share/laptop-mode-tools/module-helpers/pm-hibernate # diff -Nru laptop-mode-tools-1.58/etc/laptop-mode/conf.d/intel-hda-powersave.conf laptop-mode-tools-1.60/etc/laptop-mode/conf.d/intel-hda-powersave.conf --- laptop-mode-tools-1.58/etc/laptop-mode/conf.d/intel-hda-powersave.conf 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/etc/laptop-mode/conf.d/intel-hda-powersave.conf 2011-10-14 07:40:08.000000000 +0000 @@ -28,7 +28,7 @@ NOLM_AC_INTEL_HDA_POWERSAVE=0 # Number of seconds to wait before you want the device to time out -INTEL_HDA_DEVICE_TIMEOUT=10 +INTEL_HDA_DEVICE_TIMEOUT=2 # Disable controller on Device timeout # This saves more power diff -Nru laptop-mode-tools-1.58/etc/laptop-mode/conf.d/usb-autosuspend.conf laptop-mode-tools-1.60/etc/laptop-mode/conf.d/usb-autosuspend.conf --- laptop-mode-tools-1.58/etc/laptop-mode/conf.d/usb-autosuspend.conf 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/etc/laptop-mode/conf.d/usb-autosuspend.conf 2011-10-14 07:40:08.000000000 +0000 @@ -26,6 +26,12 @@ # Set to 0 to disable CONTROL_USB_AUTOSUSPEND="auto" +# Set this to use opt-in/whitelist instead of opt-out/blacklist for deciding +# which USB devices should be autosuspended. +# AUTOSUSPEND_USE_WHITELIST=0 means AUTOSUSPEND_*_BLACKLIST will be used. +# AUTOSUSPEND_USE_WHITELIST=1 means AUTOSUSPEND_*_WHITELIST will be used. +AUTOSUSPEND_USE_WHITELIST=0 + # The list of USB IDs that should not use autosuspend. Use lsusb to find out the # IDs of your USB devices. # Example: AUTOSUSPEND_USBID_BLACKLIST="046d:c025 0123:abcd" @@ -36,6 +42,16 @@ # Example: AUTOSUSPEND_USBID_BLACKLIST="usbhid usb-storage" AUTOSUSPEND_USBTYPE_BLACKLIST="" +# The list of USB IDs that should use autosuspend. Use lsusb to find out the +# IDs of your USB devices. +# Example: AUTOSUSPEND_USBID_WHITELIST="046d:c025 0123:abcd" +AUTOSUSPEND_USBID_WHITELIST="" + +# The list of USB driver types that should use autosuspend. The driver +# type is given by "DRIVER=..." in a USB device's uevent file. +# Example: AUTOSUSPEND_USBTYPE_WHITELIST="usbhid usb-storage" +AUTOSUSPEND_USBTYPE_WHITELIST="" + # Trigger auto-suspension of the USB deivce under conditional circumstances BATT_SUSPEND_USB=1 LM_AC_SUSPEND_USB=0 diff -Nru laptop-mode-tools-1.58/etc/rules/lmt-udev laptop-mode-tools-1.60/etc/rules/lmt-udev --- laptop-mode-tools-1.58/etc/rules/lmt-udev 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/etc/rules/lmt-udev 2011-10-14 07:40:08.000000000 +0000 @@ -2,7 +2,24 @@ # /usr is not guaranteed to be mounted when udev starts ( - . /lib/udev/hotplug.functions - wait_for_file /usr/sbin/laptop_mode - exec /usr/sbin/laptop_mode "$@" + if [ -e /lib/udev/hotplug.functions ]; then + . /lib/udev/hotplug.functions + wait_for_file /usr/sbin/laptop_mode + exec /usr/sbin/laptop_mode "$@" + else + local file=$1 + local timeout=$2 + [ "$timeout" ] || timeout=120 + + local count=$timeout + while [ $count != 0 ]; do + [ -e "/usr/sbin/laptop_mode" ] && exec /usr/sbin/laptop_mode "$@" && return 0 + sleep 1 + count=$(($count - 1)) + done + + mesg "$file did not appear before the timeout!" + exit 1 + fi + ) & diff -Nru laptop-mode-tools-1.58/laptop-mode-tools.spec laptop-mode-tools-1.60/laptop-mode-tools.spec --- laptop-mode-tools-1.58/laptop-mode-tools.spec 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/laptop-mode-tools.spec 2011-10-14 07:40:08.000000000 +0000 @@ -3,7 +3,7 @@ Summary: Tools for power savings based on battery/AC status Name: laptop-mode-tools -Version: 1.58 +Version: 1.59 Release: 1 License: GPL Group: System Environment/Base @@ -95,6 +95,12 @@ %changelog +* Fri Oct 14 2011 Ritesh Raj Sarraf - 1.60-1 +- Updated to release 1.60. + +* Mon Aug 8 2011 Ritesh Raj Sarraf - 1.59-1 +- Updated to release 1.59. + * Sat Jul 23 2011 Ritesh Raj Sarraf - 1.58-1 - Updated to release 1.58. diff -Nru laptop-mode-tools-1.58/README laptop-mode-tools-1.60/README --- laptop-mode-tools-1.58/README 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/README 2011-10-14 07:40:08.000000000 +0000 @@ -2,6 +2,7 @@ ------------------------ Author: Bart Samwel (bart@samwel.tk, http://www.samwel.tk/bart/) +Maintainer: Ritesh Raj Sarraf (rrs@researchut.com, http://www.researchut.com) Installation diff -Nru laptop-mode-tools-1.58/release-checklist laptop-mode-tools-1.60/release-checklist --- laptop-mode-tools-1.58/release-checklist 1970-01-01 00:00:00.000000000 +0000 +++ laptop-mode-tools-1.60/release-checklist 2011-10-14 07:40:08.000000000 +0000 @@ -0,0 +1,8 @@ +* Update version in usr/sbin/laptop_mode +* Put release date in Documentation/revision-history +* Update laptop-mode-tools.spec +* Create git tarball using 'git archive --format=tar --prefix=laptop-mode-tools_N.NN/ GIT_VERSION_TAG | gzip > laptop-mode-tools_N.NN.tar.gz +* Update Bart's site +* Update freshmeat +* Update Launchpad's Release page +* Send Release Announcement diff -Nru laptop-mode-tools-1.58/usr/sbin/laptop_mode laptop-mode-tools-1.60/usr/sbin/laptop_mode --- laptop-mode-tools-1.58/usr/sbin/laptop_mode 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/sbin/laptop_mode 2011-10-14 07:40:08.000000000 +0000 @@ -35,7 +35,7 @@ # The laptop mode tools version number. Extracted by the installer makefile # as well, so don't change the format! -LMTVERSION=1.58 +LMTVERSION=1.60 # This script is loaded from multiple scripts to set the config defaults # and to read the configuration on top of those. Only when the command is @@ -147,6 +147,7 @@ # So, Event-2 acquire LMT_REQ_LOCK and waits to acquire LMT_INVOC_LOCK (which is acquire by Event-1) LMT_REQ_LOCK="/var/lock/lmt-req.lock" LMT_INVOC_LOCK="/var/lock/lmt-invoc.lock" +LMT_BATTPOLL_LOCK="/var/lock/lmt-battpoll.lock" FLOCK=`which flock` checkint () @@ -443,6 +444,69 @@ if [ "$NOLM_HD_IDLE_TIMEOUT_SECONDS" != "" ] ; then NOLM_HD_IDLE_TIMEOUT=$(seconds_to_hdparm_S $NOLM_HD_IDLE_TIMEOUT_SECONDS) fi + + + + # Determine the power state. + + # First try /sys/class/power_supply/* + FOUND_SYS_CLASS_POWER_SUPPLY_AC=0 + export ON_AC=0 + for POWER_SUPPLY in /sys/class/power_supply/* ; do + if [ -f $POWER_SUPPLY/type ] ; then + if [ "$(cat $POWER_SUPPLY/type)" = "Mains" ] ;then + log "VERBOSE" "Determining power state from $POWER_SUPPLY/online." + FOUND_SYS_CLASS_POWER_SUPPLY_AC=1 + if [ "$(cat $POWER_SUPPLY/online)" = 1 ] ; then + ON_AC=1 + fi + fi + fi + done + + if [ $FOUND_SYS_CLASS_POWER_SUPPLY_AC = 1 ] ; then + # Already found it! + log "VERBOSE" "Not trying other options, already found a power supply." + elif [ -d /proc/acpi/ac_adapter ] ; then + log "VERBOSE" "Determining power state from /proc/acpi/ac_adapter." + ADAPTERS_FOUND=0 + ON_AC=0 + for ADAPTER in /proc/acpi/ac_adapter/* ; do + if [ -f $ADAPTER/state ] ; then + ADAPTERS_FOUND=1 + STATUS=`awk '/^state: / { print $2 }' $ADAPTER/state` + if [ "$STATUS" = "on-line" ] ; then + ON_AC=1 + fi + fi + done + if [ "$ADAPTERS_FOUND" -eq 0 ] ; then + ON_AC=1 + fi + elif [ -f /proc/pmu/info ] ; then + log "VERBOSE" "Determining power state from /proc/pmu/info." + if ( grep -q "^AC Power.*0$" /proc/pmu/info ) ; then + log "VERBOSE" "/proc/pmu/info indicates absence of AC power." + ON_AC=0 + else + # It is possible that there is no AC Power = 1 in the file, + # but we always assume AC power when we're not sure. + ON_AC=1 + log "VERBOSE" "/proc/pmu/info indicates presence of AC power." + fi + elif [ -f /proc/apm ] ; then + log "VERBOSE" "Determining power state from /proc/apm." + read D1 D2 D3 APM_AC_STATE D0 $LMT_BATTPOLL_LOCK; + if $FLOCK -n -x -w 1 7; then + log "VERBOSE" "Lock acquisition on descriptor 7 succeeded with pid $$"; + if ! pidof -x lm-polling-daemon ; then + log "VERBOSE" "On battery and there was no polling daemon yet, starting the polling daemon." + + # If there is no polling daemon, we start one. + /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > /dev/null 2> /dev/null & + fi + else + log "VERBOSE" "Lock acquisition on descriptor 7 failed with pid $$"; + fi + + # If we are called from the init script with the stop command, lm-polling-daemon + # should be killed. + if [ x$INITSCRIPT_STOP = x1 ]; then + log "VERBOSE" "On Battery, but init script stop is called. Killing lm-polling-daemon" + killall -q lm-polling-daemon + fi + else + log "ERR" "Unknown ON_AC state: $ON_AC"; + fi +else + log "VERBOSE" "Battery level polling is disabled." +fi + lock_retry () { - ( $FLOCK -n -x -w 1 8 || exit 0; +if $FLOCK -n -x -w 1 8; then i=10; while [ $i -ge 1 ] do - log "ERR" "Couldn't acquire lock. Retrying.... PID is $$\n" - $FLOCK -x -w 1 9 && lmt_main_function "$@" && break; - i=$(( $i - 1 )) + $FLOCK -x -w 1 9 && lmt_main_function "$@" && break; + log "VERBOSE" "Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is $$\n" + i=$(( $i - 1 )) done - ) 8>$LMT_REQ_LOCK +else + exit 0; +fi } # Check and acquire locks and then exec. -( - ( $FLOCK -n -x -w 1 8; ) 8>$LMT_REQ_LOCK -) & ( - ( - ($FLOCK -n -x -w 1 9 && lmt_main_function "$@";) || lock_retry "$@" - ) 9<>$LMT_INVOC_LOCK -) & - +exec 8>$LMT_REQ_LOCK; +if $FLOCK -n -x -w 1 8; then + log "VERBOSE" "Prelim lock acquisition on descriptor 8 with pid $$"; +else + log "VERBOSE" "Couldn't acquire prelim lock on descriptor 8 with pid $$"; +fi -# We do a special run of battery polling daemon here so that it does not get -# plagued by the lock. We need the polling daemon to be independent of any locks -if [ x$ENABLE_BATTERY_LEVEL_POLLING = x1 ] ; then - log "VERBOSE" "Battery level polling is enabled." - if [ x$ON_AC = x1 ] ; then - log "VERBOSE" "On AC, stopping the polling daemon." - # In AC mode we disable the polling daemon. - killall -q lm-polling-daemon - else - if ! pidof -x lm-polling-daemon ; then - log "VERBOSE" "On battery and there was no polling daemon yet, starting the polling daemon." - - # If there is no polling daemon, we start one. - /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > /dev/null 2> /dev/null & - fi - fi +exec 9>$LMT_INVOC_LOCK; +if $FLOCK -n -x -w 1 9; then + $FLOCK -u 8; ## Release the invoc lock; + log "VERBOSE" "Prelim lock acquisition on descriptor 9 with pid $$"; + log "VERBOSE" "Now invoking lmt_main_function with arguments -- $@"; + lmt_main_function "$@"; else - log "VERBOSE" "Battery level polling is disabled." + log "VERBOSE" "Couldn't acquire prelim lock on descriptor 9 with pid $$"; + log "VERBOSE" "Now invoking lock_retry with arguments -- $@"; + lock_retry "$@"; fi -return 0; +$FLOCK -u 8; +$FLOCK -u 9; + + +exit 0; diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon 2011-10-14 07:40:08.000000000 +0000 @@ -10,7 +10,7 @@ # risks data loss). INTERVAL=150 -while ( true ) ; do +while :; do sleep $INTERVAL /usr/sbin/laptop_mode auto diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/pm-helper laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/pm-helper --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/pm-helper 1970-01-01 00:00:00.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/pm-helper 2011-10-14 07:40:08.000000000 +0000 @@ -0,0 +1,28 @@ +#!/bin/sh + + +MEM=0; +DISK=0; + +target=`basename $0 | cut -d '-' -f2` + + +case "$target" in + suspend) MEM=1 ;; + hibernate) DISK=1 ;; + *) echo "Unrecognized command" + exit 1 ;; +esac + +# Sync buffers first. +sync; + +# Freezer on preference +if [ x$MEM = x1 ]; then + echo "mem" > /sys/power/state +elif [ x$DISK = x1 ]; then + echo "disk" > /sys/power/state +else + ## Nothing to do. + echo ; +fi diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/pm-hibernate laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/pm-hibernate --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/pm-hibernate 1970-01-01 00:00:00.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/pm-hibernate 2011-10-14 07:40:08.000000000 +0000 @@ -0,0 +1,28 @@ +#!/bin/sh + + +MEM=0; +DISK=0; + +target=`basename $0 | cut -d '-' -f2` + + +case "$target" in + suspend) MEM=1 ;; + hibernate) DISK=1 ;; + *) echo "Unrecognized command" + exit 1 ;; +esac + +# Sync buffers first. +sync; + +# Freezer on preference +if [ x$MEM = x1 ]; then + echo "mem" > /sys/power/state +elif [ x$DISK = x1 ]; then + echo "disk" > /sys/power/state +else + ## Nothing to do. + echo ; +fi diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/pm-suspend laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/pm-suspend --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/module-helpers/pm-suspend 1970-01-01 00:00:00.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/module-helpers/pm-suspend 2011-10-14 07:40:08.000000000 +0000 @@ -0,0 +1,28 @@ +#!/bin/sh + + +MEM=0; +DISK=0; + +target=`basename $0 | cut -d '-' -f2` + + +case "$target" in + suspend) MEM=1 ;; + hibernate) DISK=1 ;; + *) echo "Unrecognized command" + exit 1 ;; +esac + +# Sync buffers first. +sync; + +# Freezer on preference +if [ x$MEM = x1 ]; then + echo "mem" > /sys/power/state +elif [ x$DISK = x1 ]; then + echo "disk" > /sys/power/state +else + ## Nothing to do. + echo ; +fi diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/battery-level-polling laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/battery-level-polling --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/battery-level-polling 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/battery-level-polling 2011-10-14 07:40:08.000000000 +0000 @@ -5,18 +5,23 @@ if [ x$ENABLE_BATTERY_LEVEL_POLLING = x1 ] ; then log "VERBOSE" "Battery level polling is enabled." - if [ x$ON_AC = x1 ] ; then - log "VERBOSE" "On AC, stopping the polling daemon." - # In AC mode we disable the polling daemon. - killall -q lm-polling-daemon + if [ x$BLACKLIST_IN_FLOCK = x1 ]; then + log "VERBOSE" "Battery polling daemon blacklisted in flock" else - if ! pidof -x lm-polling-daemon ; then - log "VERBOSE" "On battery and there was no polling daemon yet, starting the polling daemon." + if [ x$ON_AC = x1 ] ; then + log "VERBOSE" "On AC, stopping the polling daemon." + + # In AC mode we disable the polling daemon. + killall -q lm-polling-daemon + else + if ! pidof -x lm-polling-daemon ; then + log "VERBOSE" "On battery and there was no polling daemon yet, starting the polling daemon." - # If there is no polling daemon, we start one. - #/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > /dev/null 2> /dev/null & - /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon & + # If there is no polling daemon, we start one. + #/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > /dev/null 2> /dev/null & + /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon & + fi fi fi else diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/hdparm laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/hdparm --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/hdparm 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/hdparm 2011-10-14 07:40:08.000000000 +0000 @@ -16,6 +16,11 @@ local dev=${1#/dev/} local MEDIA= local BUS= + + # Make sure the drive exists before checking anything. + if ! [ -e $1 ]; then + return 1; + fi # If we are running udev, this is the most portable way # It assumes more or less recent udev (> 070) diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/laptop-mode laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/laptop-mode --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/laptop-mode 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/laptop-mode 2011-10-14 07:40:08.000000000 +0000 @@ -187,21 +187,18 @@ set_sysctl /proc/sys/fs/xfs/xfsbufd_centisecs 3000 fi - case "$KLEVEL" in - "2.4") - log "VERBOSE" "Adjusting 2.4 kernel parameters to enable laptop mode." - set_sysctl /proc/sys/vm/laptop_mode 1 - set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $AGE $AGE 60 20 0" - ;; - "2.6") - log "VERBOSE" "Adjusting 2.6 kernel parameters to enable laptop mode." - set_sysctl /proc/sys/vm/laptop_mode "$LM_SECONDS_BEFORE_SYNC" - set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$AGE" - set_sysctl /proc/sys/vm/dirty_expire_centisecs "$AGE" - set_sysctl /proc/sys/vm/dirty_ratio "$LM_DIRTY_RATIO" - set_sysctl /proc/sys/vm/dirty_background_ratio "$LM_DIRTY_BACKGROUND_RATIO" - ;; - esac + if [ -f /proc/sys/vm/bdflush ]; then + log "VERBOSE" "Adjusting 2.4 kernel parameters to enable laptop mode." + set_sysctl /proc/sys/vm/laptop_mode 1 + set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $AGE $AGE 60 20 0" + else + log "VERBOSE" "Adjusting 2.6+ kernel parameters to enable laptop mode." + set_sysctl /proc/sys/vm/laptop_mode "$LM_SECONDS_BEFORE_SYNC" + set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$AGE" + set_sysctl /proc/sys/vm/dirty_expire_centisecs "$AGE" + set_sysctl /proc/sys/vm/dirty_ratio "$LM_DIRTY_RATIO" + set_sysctl /proc/sys/vm/dirty_background_ratio "$LM_DIRTY_BACKGROUND_RATIO" + fi if [ $CONTROL_MOUNT_OPTIONS -eq 1 ]; then log "VERBOSE" "Remounting filesystems." # The -r flag makes 'read' preserve backslashes read from @@ -316,19 +313,16 @@ set_sysctl /proc/sys/fs/xfs/xfssyncd_centisecs $((100*$DEF_XFS_SYNC_INTERVAL)) set_sysctl /proc/sys/fs/xfs/xfsbufd_centisecs $((100*$DEF_XFS_BUFD_INTERVAL)) fi - case "$KLEVEL" in - "2.4") - log "VERBOSE" "Adjusting 2.4 kernel parameters to disable laptop mode." - set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $U_AGE $B_AGE 60 20 0" - ;; - "2.6") - log "VERBOSE" "Adjusting 2.6 kernel parameters to disable laptop mode." - set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$U_AGE" - set_sysctl /proc/sys/vm/dirty_expire_centisecs "$B_AGE" - set_sysctl /proc/sys/vm/dirty_ratio "$NOLM_DIRTY_RATIO" - set_sysctl /proc/sys/vm/dirty_background_ratio "$NOLM_DIRTY_BACKGROUND_RATIO" - ;; - esac + if [ -f /proc/sys/vm/bdflush ]; then + log "VERBOSE" "Adjusting 2.4 kernel parameters to disable laptop mode." + set_sysctl /proc/sys/vm/bdflush "30 500 0 0 $U_AGE $B_AGE 60 20 0" + else + log "VERBOSE" "Adjusting 2.6+ kernel parameters to disable laptop mode." + set_sysctl /proc/sys/vm/dirty_writeback_centisecs "$U_AGE" + set_sysctl /proc/sys/vm/dirty_expire_centisecs "$B_AGE" + set_sysctl /proc/sys/vm/dirty_ratio "$NOLM_DIRTY_RATIO" + set_sysctl /proc/sys/vm/dirty_background_ratio "$NOLM_DIRTY_BACKGROUND_RATIO" + fi if [ $CONTROL_MOUNT_OPTIONS -eq 1 ] ; then log "VERBOSE" "Remounting filesystems." # The -r flag makes 'read' preserve backslashes read from diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/usb-autosuspend laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/usb-autosuspend --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/usb-autosuspend 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/usb-autosuspend 2011-10-14 07:40:08.000000000 +0000 @@ -3,25 +3,29 @@ # Laptop mode tools module: usb-autosuspend. # -blacklisted() { - for usbid in $AUTOSUSPEND_USBID_BLACKLIST; do +# Check whether a USB device is listed by ID +listed_by_id() { + device=$1 + list=$2 + for usbid in $list; do if ! echo $usbid | grep -q ':'; then - log "MSG" "WARNING: Invalid entry \"$usbid\" in AUTOSUSPEND_USBID_BLACKLIST." + log "MSG" "WARNING: Invalid entry \"$usbid\" in \"$2\"." fi vendor=$(echo $usbid | cut -d: -f1) product=$(echo $usbid | cut -d: -f2) - grep -qi $vendor $1/idVendor 2>/dev/null\ - && grep -qi $product $1/idProduct 2>/dev/null\ + grep -qi $vendor $device/idVendor 2>/dev/null\ + && grep -qi $product $device/idProduct 2>/dev/null\ && return 0 done return 1 } # Check whether the USB driver type is blacklisted -blacklisted_by_type() { +listed_by_type() { device=$1 device_base=`basename $device` - for driver_type in $AUTOSUSPEND_USBTYPE_BLACKLIST; do + list=$2 + for driver_type in $list; do if grep -q DRIVER=$driver_type $device/uevent; then return 0 fi @@ -39,6 +43,21 @@ return 1 } +# Checks whether a device is blacklisted by either ID or driver type +blacklisted() { + listed_by_id $1 "$AUTOSUSPEND_USBID_BLACKLIST"\ + || listed_by_type $1 "$AUTOSUSPEND_USBTYPE_BLACKLIST"\ + || return 1 + return 0 +} + +# Checks whether a device is whitelisted by either ID or driver type +whitelisted() { + listed_by_id $1 "$AUTOSUSPEND_USBID_WHITELIST"\ + || listed_by_type $1 "$AUTOSUSPEND_USBTYPE_WHITELIST"\ + || return 1 + return 0 +} if [ x$CONTROL_USB_AUTOSUSPEND = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_USB_AUTOSUSPEND = xauto ]; then if [ $ON_AC -eq 1 ]; then @@ -77,11 +96,25 @@ fi if [ "$DEVICE_LIST" != "" ]; then - for usb_device in $DEVICE_LIST; - do + for usb_device in $DEVICE_LIST; do usb_device=`basename $usb_device`; - if ! blacklisted /sys/bus/usb/devices/$usb_device; then - if ! blacklisted_by_type /sys/bus/usb/devices/$usb_device; then + + USE_DEVICE=0 + if [ x$AUTOSUSPEND_USE_WHITELIST = x1 ]; then + if whitelisted /sys/bus/usb/devices/$usb_device; then + USE_DEVICE=1 + else + log "VERBOSE" "Device $usb_device not whitelisted, skipping auto suspend." + fi + else + if ! blacklisted /sys/bus/usb/devices/$usb_device; then + USE_DEVICE=1 + else + logger "Device $usb_device is blacklisted, skipping auto suspend." + fi + fi + + if [ x$USE_DEVICE = x1 ]; then if [ -f /sys/bus/usb/devices/$usb_device/power/autosuspend ]; then echo $AUTOSUSPEND_TIMEOUT > /sys/bus/usb/devices/$usb_device/power/autosuspend; log "VERBOSE" "Enabling auto suspend mode for usb device $usb_device." @@ -98,13 +131,8 @@ else log "VERBOSE" "Not enabling auto power level for usb device $usb_device" fi - else - log "VERBOSE" "Device $usb_device has blacklisted driver type, skipping auto suspend." - fi - else - log "VERBOSE" "USB device $usbid is in the autosuspend blacklist." fi - done + done fi else AUTOSUSPEND_TIMEOUT=0 diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/wireless-ipw-power laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/wireless-ipw-power --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/wireless-ipw-power 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/wireless-ipw-power 2011-10-14 07:40:08.000000000 +0000 @@ -85,7 +85,7 @@ # Inverting return values, we get "0" for wireless device, # and "1" for non-wireless device. - ($IWCONFIG $IFNAME 2>&1 | grep -q "no wireless extensions.") && ret=1 || ret=0 + ($IWCONFIG $dev 2>&1 | grep -q "no wireless extensions.") && ret=1 || ret=0 if [ "$ret" = "0" ]; then # add the interface name to the list WIFI_IFNAMES="$WIFI_IFNAMES ${DEVICE##*/}" diff -Nru laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/wireless-iwl-power laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/wireless-iwl-power --- laptop-mode-tools-1.58/usr/share/laptop-mode-tools/modules/wireless-iwl-power 2011-07-23 18:05:46.000000000 +0000 +++ laptop-mode-tools-1.60/usr/share/laptop-mode-tools/modules/wireless-iwl-power 2011-10-14 07:40:08.000000000 +0000 @@ -40,7 +40,7 @@ # Inverting return values, we get "0" for wireless device, # and "1" for non-wireless device. - ($IWCONFIG $IFNAME 2>&1 | grep -q "no wireless extensions.") && ret=1 || ret=0 + ($IWCONFIG $dev 2>&1 | grep -q "no wireless extensions.") && ret=1 || ret=0 if [ "$ret" = "0" ]; then # add the interface name to the list WIFI_IFNAMES="$WIFI_IFNAMES ${DEVICE##*/}"