挂起使计算机进入睡眠状态,然后立即唤醒

挂起使计算机进入睡眠状态,然后立即唤醒

摘自重复的答案: https://askubuntu.com/a/693766/115908

sudo -s
echo RP06 > /proc/acpi/wakeup
echo RP07 > /proc/acpi/wakeup
echo RP08 > /proc/acpi/wakeup

解决了我的问题

[原始问题]

计算机将会暂停几秒钟,然后无需触摸鼠标上的任何东西,也无需移动它,也不用触摸键盘,它就会自动唤醒。

我曾尝试使用:cat /usr/local/sbin/select-resume-devices

看起来,我选择微软键盘并保存。这没什么区别:

在此处输入图片描述

#!/bin/bash
# 
# Script to create resume udev rules for USB devices
#
# Depends on zenity
# 09/05/2012 - V1.0 by Nicolas Bernaerts

# udev file to generate
UDEV_FILE="/etc/udev/rules.d/90-hid-wakeup-enable.rules"

# set separator as CR
IFS=$'\n'

# list all USB devices, excluding root & hubs
LIST_DEVICE=(`lsusb | grep -v "0000:0000" | grep -iv "hub" | sed 's/^.*[0-9a-f]\:[0-9a-f]* \(.*\)$/\1/g'`)

# loop thru the devices array to generate zenity parameter
for DEVICE in "${LIST_DEVICE[@]}"
do
  # if needed, remove [xxx] from device name as it gives trouble with grep
  DEVICE=`echo "$DEVICE" | sed 's/\[.*\]//g'`

  # add it to the parameters list
  ARR_PARAMETER=( FALSE ${DEVICE} ${ARR_PARAMETER[@]} )
done

# display the dialog box to choose devices
TITLE="Wakeup - Enable USB devices"
TEXT="Please, select USB devices you want to use to resume your computer"
CHOICE=`zenity --list --width=600 --height=250 --text=$TEXT --title=$TITLE --checklist --column "Select" --column "Device name" "${ARR_PARAMETER[@]}"`

# slit the device choice into an array
IFS="|" read -a ARR_CHOICE <<< "$CHOICE"

# if at least one device has been selected, initialise udev rules file
[ ${#ARR_CHOICE[@]} -gt 0 ] && echo "# udev rule for USB wake-up of selected devices" > $UDEV_FILE
[ ${#ARR_CHOICE[@]} -gt 0 ] && echo "#" >> $UDEV_FILE

# loop thru the selected devices to create udev rules
for DEVICE_NAME in "${ARR_CHOICE[@]}"
do
  # get current device data
  DEVICE_DATA=`lsusb | grep "${DEVICE_NAME}" | sed 's/^.*ID \([0-9a-f]*\):\([0-9a-f]*\).*$/\1|\2/g'`
  DEVICE_VENDOR=`echo $DEVICE_DATA | cut -d"|" -f1`
  DEVICE_PRODUCT=`echo $DEVICE_DATA | cut -d"|" -f2`

  # create udev rule for current device
  DEVICE_RULE="SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"$DEVICE_VENDOR\", ATTRS{idProduct}==\"$DEVICE_PRODUCT\" RUN+=\"/usr/local/sbin/enable-wakeup \$env{DEVPATH}\" "

  # add udev rule for current device
  echo "# ${DEVICE_NAME}" >> $UDEV_FILE
  echo ${DEVICE_RULE} >> $UDEV_FILE
done

# if at least one device has been selected, display notification
TITLE="USB resume enabled"
TEXT="Your USB devices are resume enabled.\nTo finalize configuration you have to do one of these actions :\n- replug USB devices\n- reboot the computer"
[ ${#ARR_CHOICE[@]} -gt 0 ] && notify-send --icon=media-eject $TITLE $TEXT

我的wakeup长相

hutber@hutber:~$ cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
PEG0      S4    *enabled   pci:0000:00:01.0
PEGP      S4    *disabled  pci:0000:01:00.0
PEG1      S4    *disabled
PEGP      S4    *disabled
PEG2      S4    *disabled
PEGP      S4    *disabled
SIO1      S3    *disabled  pnp:00:00
PS2K      S4    *disabled
PS2M      S4    *disabled
UAR1      S4    *disabled  pnp:00:01
RP01      S4    *enabled   pci:0000:00:1c.0
PXSX      S4    *disabled
RP02      S4    *disabled
PXSX      S4    *disabled
RP03      S4    *disabled
PXSX      S4    *disabled
RP04      S4    *disabled
PXSX      S4    *disabled
RP05      S4    *disabled
PXSX      S4    *disabled
RP06      S4    *enabled   pci:0000:00:1c.5
PXSX      S4    *disabled  pci:0000:04:00.0
RP07      S4    *enabled   pci:0000:00:1c.6
PXSX      S4    *enabled   pci:0000:05:00.0
RP08      S4    *enabled   pci:0000:00:1c.7
PXSX      S4    *disabled  pci:0000:06:00.0
RP09      S4    *enabled   pci:0000:00:1d.0
PXSX      S4    *disabled  pci:0000:08:00.0
RP10      S4    *disabled
PXSX      S4    *disabled
RP11      S4    *disabled
PXSX      S4    *disabled
RP12      S4    *disabled
PXSX      S4    *disabled
RP13      S4    *disabled
PXSX      S4    *disabled
RP14      S4    *disabled
PXSX      S4    *disabled
RP15      S4    *disabled
PXSX      S4    *disabled
RP16      S4    *disabled
PXSX      S4    *disabled
RP17      S4    *disabled  pci:0000:00:1b.0
PXSX      S4    *disabled
RP18      S4    *disabled
PXSX      S4    *disabled
RP19      S4    *disabled
PXSX      S4    *disabled
RP20      S4    *disabled
PXSX      S4    *disabled
RP21      S4    *disabled
PXSX      S4    *disabled
RP22      S4    *disabled
PXSX      S4    *disabled
RP23      S4    *disabled
PXSX      S4    *disabled
RP24      S4    *disabled
PXSX      S4    *disabled
GLAN      S4    *enabled   pci:0000:00:1f.6
XHC   S4    *enabled   pci:0000:00:14.0
XDCI      S4    *disabled
HDAS      S4    *disabled  pci:0000:00:1f.3
CNVW      S4    *disabled

相关内容