diff options
author | 2014-05-27 16:41:38 +0000 | |
---|---|---|
committer | 2014-05-27 16:41:38 +0000 | |
commit | de90bb73e62fc63caf69b7223c11360f1a1efeac (patch) | |
tree | 7a093123d668d697cc7dba0007efc517c40cbfcc /app-laptop/laptop-mode-tools/files | |
parent | install mans (diff) | |
download | gentoo-2-de90bb73e62fc63caf69b7223c11360f1a1efeac.tar.gz gentoo-2-de90bb73e62fc63caf69b7223c11360f1a1efeac.tar.bz2 gentoo-2-de90bb73e62fc63caf69b7223c11360f1a1efeac.zip |
Fix newer kernel compatibility, bug#511110, thanks to Stefan Huber
(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key BF20DC51)
Diffstat (limited to 'app-laptop/laptop-mode-tools/files')
-rw-r--r-- | app-laptop/laptop-mode-tools/files/laptop-mode-tools-1.64-ethernet-power.patch | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/app-laptop/laptop-mode-tools/files/laptop-mode-tools-1.64-ethernet-power.patch b/app-laptop/laptop-mode-tools/files/laptop-mode-tools-1.64-ethernet-power.patch new file mode 100644 index 000000000000..315f10982f88 --- /dev/null +++ b/app-laptop/laptop-mode-tools/files/laptop-mode-tools-1.64-ethernet-power.patch @@ -0,0 +1,97 @@ +From c55b44f656c88aa1ef7307664f7040407d23e0de Mon Sep 17 00:00:00 2001 +From: Alon Bar-Lev <alon.barlev@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 module is disabled." +-- +1.8.5.5 + |