Ubuntu 10.04 插上SD卡无法待机

                                          Ubuntu 10.04 插上SD卡无法待机

                                                    周银辉 

 

不习惯关机,而习惯合上笔记本盖子 让其休眠,但今天下午发现休眠不了,指示灯一直闪,貌似在告诉我它一直在“正在准备休眠中 ...”  后来,发现是我插入点SD卡在作怪,拔掉卡就可以正常休眠,不知道深层次点原因是什么,但我们可以通过在在休眠前unmount 掉SD卡来解决这个问题

找到/usr/sbin/pm-suspend这个符号链接,用文本编辑器打开它,加入如下代码:

 

umount  / media / yourSdCardName

 

其中yourSdCardName是你SD卡被mount上时的名称

下面是我的pm-suspend文件,仅供参考,我仅仅添加了umount /media/EOS_DIGITAL这句代码以及其注释,其他是系统自带的

ExpandedBlockStart.gif 代码
# !/bin/sh
#
 vim: noexpandtab
#
 Simple suspend script
#
#
 Copyright 2006 Red Hat, Inc.
#
#
 Based on work from:
#
    Bill Nottingham <notting@redhat.com>
#
    Peter Jones <pjones@redhat.com>
#
    David Zeuthen <davidz@redhat.com>
#
    Richard Hughes <richard@hughsie.com>
#
#
 This program is free software; you can redistribute it and/or modify
#
 it under the terms of version 2 of the GNU General Public License as
#
 published by the Free Software Foundation.
#
#
 This program is distributed in the hope that it will be useful,
#
 but WITHOUT ANY WARRANTY; without even the implied warranty of
#
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#
 GNU General Public License for more details.
#
#
 You should have received a copy of the GNU General Public License
#
 along with this program; if not, write to the Free Software
#
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

#  The rule here? Simplicity.
export STASHNAME = pm - suspend
export METHOD
= " $(echo ${0##*pm-} |tr - _) "
" /usr/lib/pm-utils/pm-functions "

# umount my sd card, EOS_DIGITAL is the sd card name, by ZhouYinhui
umount  / media / EOS_DIGITAL

#  return code tracking for when suspend fails
r = 0

help()
{
    echo 
" ${0##*/} [options] "
    echo
    echo 
" Options can change how suspend or hibernate is done. "
    run_hooks sleep help
    sleep_module_help
    exit 
0
}

if  [  " $(id -u) "   !=   " 0 "  ]; then
    echo This utility may only be run by the root user. 
1 >& 2
    exit 
1
fi

remove_suspend_lock()
{
    release_lock 
" ${STASHNAME}.lock "
}

try_lock 
" ${STASHNAME}.lock "   ||  exit  1

#  make sure we release the lock no matter how we exit
trap  remove_suspend_lock  0

#  clean up from the last run
rm  - rf  " ${STORAGEDIR} "
mkdir 
- " ${STORAGEDIR} "
#  save our parameter list.
-f   " $PARAMETERS "  ]  ||  echo ''  > " $PARAMETERS "
add_parameters 
$PM_CMDLINE
update_parameters

while  [  $ #  -gt 0 ]
do
    [ 
" $1 "   =   " --help "  ]  &&  help
    shift
done


command_exists 
" check_$METHOD "   &&  command_exists  " do_$METHOD "   ||  {
    log 
" pm-utils does not know how to $METHOD on this system. "
    exit 
1
}

" check_$METHOD "   ||  {
    log 
" This system does not support $METHOD as a sleep method. "
    exit 
1
}

case 
" $METHOD "   in
    suspend
* )     ACTION = suspend;   REVERSE = resume ;;
    hibernate)     ACTION
= hibernate; REVERSE = thaw ;;
    
* )        echo  " Cannot happen.  Please file a bug against pm-utils. "
            exit 
1  ;;
esac

init_logfile 
" ${PM_LOGFILE} "
log 
" Initial commandline parameters: $PM_CMDLINE "
load_hook_blacklist
load_hook_parameters

#  run the sleep hooks
log  " $(date): Running hooks for $ACTION. "
if  run_hooks sleep  " $ACTION $METHOD " ; then
        
#  Sleep only if we know how and if a hook did not inhibit us.
    log  " $(date): performing $METHOD "
    sync
    
" do_$METHOD "   ||  r = 128
    log 
" $(date): Awake. "
else
    log 
" $(date): Inhibit found, will not perform $METHOD "
fi
log 
" $(date): Running hooks for $REVERSE "
#  run the sleep hooks in reverse with the wakeup action
if  run_hooks sleep  " $REVERSE $METHOD "  reverse; then
        log 
" $(date): Finished. "
else  
        exit 
$ ((r + 1 ))
fi
exit 
$r

 

 

 

 

转载于:https://www.cnblogs.com/zhouyinhui/archive/2010/08/24/1807642.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值