[gentoo-commits] gentoo-x86 commit in app-laptop/laptop-mode-tools/files: laptop-mode-tools-1.64-ethernet-power.patch laptop-mode-tools-1.63-conf.patch laptop-mode-tools-1.63-udevadm.patch laptop-mode

2014-07-14 Thread Alon Bar-Lev (alonbl)
alonbl  14/07/14 16:37:17

  Removed:  laptop-mode-tools-1.64-ethernet-power.patch
laptop-mode-tools-1.63-conf.patch
laptop-mode-tools-1.63-udevadm.patch
laptop-mode-tools-1.63-killall.patch
laptop-mode-tools-1.63-pcie-aspm-silencing-stderr.patch
laptop-mode-tools-1.64-wireless-sysfsattr.patch
  Log:
  Cleanup
  
  (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 
BF20DC51)



[gentoo-commits] gentoo-x86 commit in app-laptop/laptop-mode-tools/files: laptop-mode-tools-1.64-ethernet-power.patch

2014-05-27 Thread Alon Bar-Lev (alonbl)
alonbl  14/05/27 16:41:38

  Added:laptop-mode-tools-1.64-ethernet-power.patch
  Log:
  Fix newer kernel compatibility, bug#50, thanks to Stefan Huber
  
  (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 
BF20DC51)

Revision  ChangesPath
1.1  
app-laptop/laptop-mode-tools/files/laptop-mode-tools-1.64-ethernet-power.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/laptop-mode-tools/files/laptop-mode-tools-1.64-ethernet-power.patch?rev=1.1view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/laptop-mode-tools/files/laptop-mode-tools-1.64-ethernet-power.patch?rev=1.1content-type=text/plain

Index: laptop-mode-tools-1.64-ethernet-power.patch
===
From c55b44f656c88aa1ef7307664f7040407d23e0de Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev alon.bar...@gmail.com
Date: Tue, 27 May 2014 19:35:11 +0300
Subject: [PATCH] ethernet: replace sysfs/enabled by 'ip link down'

backport of 8fff5eb2bfdde0
---
 usr/share/laptop-mode-tools/modules/ethernet | 59 +++-
 1 file changed, 22 insertions(+), 37 deletions(-)

diff --git a/usr/share/laptop-mode-tools/modules/ethernet 
b/usr/share/laptop-mode-tools/modules/ethernet
index 6fd06e2..0c922e2 100755
--- a/usr/share/laptop-mode-tools/modules/ethernet
+++ b/usr/share/laptop-mode-tools/modules/ethernet
@@ -24,6 +24,13 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES = 
x1 -a x$CONTROL_ETHE
MIITOOL=/bin/false
fi
 
+   if [ -x /bin/ip ]; then
+   IPTOOL=/bin/ip
+   else
+   log VERBOSE ip is not installed
+   IPTOOL=/bin/false
+   fi
+
 
if [ $ON_AC -eq 1 ]; then
if [ $ACTIVATE -eq 1 ]; then
@@ -52,43 +59,7 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES = 
x1 -a x$CONTROL_ETHE
fi

for DEVICE in $ETHERNET_DEVICES ; do
-DISABLED=0
-path=`readlink -f /sys/class/net/$DEVICE`
-   dev_path=
-log VERBOSE ethernet: $path
-if ! [ -z $path ]; then
-if [ -d $path/device ]; then
-  dev_path=`readlink -f $path/device`
-  log VERBOSE ethernet: $dev_path
-fi
-fi
-
-if ! [ -z $dev_path ]  [ -f $dev_path/enable ]; then
-if [ x$DISABLE_ETHERNET = x1 ]; then
-if [ -f $dev_path/enable ]; then
-echo 0  $dev_path/enable
-log VERBOSE ethernet: Disabling 
ethernet device $DEVICE
-DISABLED=1
-fi
-elif [ x$DISABLE_ETHERNET = x0 ]; then
-if [ -f $dev_path/enable ]; then
-echo 1  $dev_path/enable
-log VERBOSE ethernet: Re-enabling 
ethernet device $DEVICE
-DISABLED=0
-fi
-elif [ x$DISABLE_ETHERNET = x2 ]; then
-DISABLED=0 # Be safe. :-)
-else
-DISABLED=0 # Same here. Be safe. :-)
-   # For all other cases also, just 
disable it.
-fi
-else
-log VERBOSE $DEVICE does not seem to be supporting 
enable/disable
-fi
-
-   if [ x$DISABLED = x1 ]; then
-   continue
-   fi
+   log VERBOSE ethernet: $DEVICE
 
# Wakeup-on-LAN handling
if [ x$DISABLE_WAKEUP_ON_LAN = x1 ] ; then
@@ -152,6 +123,20 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES 
= x1 -a x$CONTROL_ETHE
log VERBOSE Could not restore speed for 
$DEVICE
fi
fi
+
+   # Shut down interface
+   if [ x$DISABLE_ETHERNET = x1 ]; then
+   if $IPTOOL link show $DEVICE | grep -q NO-CARRIER; then
+   log VERBOSE ethernet: Disabling ethernet 
device $DEVICE
+   $IPTOOL link set dev $DEVICE down
+   else
+   log VERBOSE ethernet: Not disabling ethernet 
device $DEVICE with active carrier.
+   fi
+   elif [ x$DISABLE_ETHERNET = x0 ]; then
+   $IPTOOL link set dev $DEVICE up
+   log VERBOSE ethernet: Re-enabling ethernet device 
$DEVICE
+   fi
+
done
 else
log VERBOSE Ethernet