public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] pm-suspend problem
@ 2015-10-12 21:46 Philip Webb
  2015-10-12 22:08 ` Alec Ten Harmsel
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Philip Webb @ 2015-10-12 21:46 UTC (permalink / raw
  To: Gentoo User

I want to be able to suspend my machine to RAM overnight or when I'm out.
The pkg to use seems to be Pm-utils, which I've installed.
'pm-suspend' does suspend, but only briefly :
after  5 s , it restarts automatically & everything is back as before.
The log file shows this happening quite clearly.

What am I doing wrong ?  Am I using the correct tool ?

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-12 21:46 [gentoo-user] pm-suspend problem Philip Webb
@ 2015-10-12 22:08 ` Alec Ten Harmsel
  2015-10-12 22:48   ` Philip Webb
  2015-10-13  9:25 ` [gentoo-user] " Alberto Luaces
  2015-10-14  4:08 ` Roman Dobosz
  2 siblings, 1 reply; 12+ messages in thread
From: Alec Ten Harmsel @ 2015-10-12 22:08 UTC (permalink / raw
  To: gentoo-user

On Mon, Oct 12, 2015 at 05:46:00PM -0400, Philip Webb wrote:
> I want to be able to suspend my machine to RAM overnight or when I'm out.

Just curious, you don't need to answer: why? Why not just power it off
or lock it?

> The pkg to use seems to be Pm-utils, which I've installed.
> 'pm-suspend' does suspend, but only briefly :
> after  5 s , it restarts automatically & everything is back as before.
> The log file shows this happening quite clearly.
> 
> What am I doing wrong ?  Am I using the correct tool ?

What desktop environment are you using? OpenRC or systemd? Lastly, do
you have support for suspending to RAM compiled into the kernel?

If you are using a desktop environment, it should have the suspend
functionality built into it. If you are using systemd, it should be as
simple as a `systemctl suspend`.

Alec


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-12 22:08 ` Alec Ten Harmsel
@ 2015-10-12 22:48   ` Philip Webb
  2015-10-14  0:39     ` Philip Webb
  0 siblings, 1 reply; 12+ messages in thread
From: Philip Webb @ 2015-10-12 22:48 UTC (permalink / raw
  To: gentoo-user

151012 Alec Ten Harmsel wrote:
> On Mon, Oct 12, 2015 at 05:46:00PM -0400, Philip Webb wrote:
>> I want to be able to suspend my machine to RAM overnight or when I'm out.
> Just curious why : why not just power it off or lock it ?

It's not relevant to the problem,
but I don't want to switch off the router which connects to my ISP,
as it cb a nuisance to reconnect again.  No, no further comment re this !

>> The pkg to use seems to be Pm-utils, which I've installed.
>> 'pm-suspend' does suspend, but only briefly :
>> after  5 s , it restarts automatically & everything is back as before.
>> The log file shows this happening quite clearly.
>> What am I doing wrong ?  Am I using the correct tool ?
> What desktop environment are you using ?  OpenRC or systemd ?
> If you are using a desktop environment,
> it should have the suspend functionality built into it.

The latter are not DE's : I use Fluxbox + OpenRC.

> Do you have support for suspending to RAM compiled into the kernel ?

I believe so.

Thanks for the prompt response, but this doesn't help much.

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-user] Re: pm-suspend problem
  2015-10-12 21:46 [gentoo-user] pm-suspend problem Philip Webb
  2015-10-12 22:08 ` Alec Ten Harmsel
@ 2015-10-13  9:25 ` Alberto Luaces
  2015-10-14  4:08 ` Roman Dobosz
  2 siblings, 0 replies; 12+ messages in thread
From: Alberto Luaces @ 2015-10-13  9:25 UTC (permalink / raw
  To: gentoo-user

Philip Webb writes:

> What am I doing wrong ?

I don't know.

> Am I using the correct tool ?

Yes, it works for me in all my computers, but they use a different linux
distribution.

-- 
Alberto



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-12 22:48   ` Philip Webb
@ 2015-10-14  0:39     ` Philip Webb
  2015-10-14  3:27       ` Daniel Frey
  0 siblings, 1 reply; 12+ messages in thread
From: Philip Webb @ 2015-10-14  0:39 UTC (permalink / raw
  To: gentoo-user

151012 Philip Webb wrote:
> I want to be able to suspend my machine to RAM overnight or when I'm out.
> The pkg to use seems to be Pm-utils, which I've installed.
> 'pm-suspend' does suspend, but only briefly :
> after  5 s , it restarts automatically & everything is back as before.
> The log file shows this happening quite clearly.
> I'm using Fluxbox + OpenRC ; 'suspend to Ram' is compiled in the kernel.

I've done further Google research.
Many other people have had similar problems over the past few years
& the only regular suggestion is that there's a problem with ECHI etc :
I haven't tried following that up, as it's not recent.

I tested Mint 17.2 Xfce , which I have installed in another partition
& which is very quick'n'slick : suspend has the same effect as with Gentoo.
I've tried changing a few BIOS settings with no apparent effect,
but -- mysteriously -- Gentoo (but not Mint) is now actually suspending,
but doesn't wake up when the power button or a key is pressed, as it should ;
I can power off & restart normally afterwards.
'dmesg' + 'syslog' simply show an immediate restart after the suspend.

The result of all this is that I can't suspend to RAM & restart later :
that merely means that I have to repopulate my workspaces after each reboot,
but that's something I know by rote & can easily live with.

However, the one good + surprising outcome concerns the I/net.
Getting back in touch with my ISP can be slow + unpredictable,
tho' it always works after a few tries, which involve powering everything off.
However, I've discovered that if I don't switch off the router,
'dhcpcd' simply reconnects after a reboot (in Mint too)
& the I/net is immediately available : that's what I really care about.

So I can power the machine off while I'm asleep or out
iff I don't switch off the power-bar which also feeds the router.

If anyone has further thoughts on this subject,
they mb of more general interest, but for now I can carry on.

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-14  0:39     ` Philip Webb
@ 2015-10-14  3:27       ` Daniel Frey
  2015-10-14  4:00         ` Philip Webb
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Frey @ 2015-10-14  3:27 UTC (permalink / raw
  To: gentoo-user

On 10/13/2015 05:39 PM, Philip Webb wrote:
> but doesn't wake up when the power button or a key is pressed, as it should ;
> I can power off & restart normally afterwards.
> 'dmesg' + 'syslog' simply show an immediate restart after the suspend.

There was a kernel change some time back that disable usb wakeup on all
USB hubs. Userspace needs to explicitly enable them or device wakeup
will not work.

I wrote a script some time back to do that but it can probably be done
with a udev rule.

Dan




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-14  3:27       ` Daniel Frey
@ 2015-10-14  4:00         ` Philip Webb
  2015-10-14  4:59           ` Daniel Frey
  0 siblings, 1 reply; 12+ messages in thread
From: Philip Webb @ 2015-10-14  4:00 UTC (permalink / raw
  To: gentoo-user

151013 Daniel Frey wrote:
> On 10/13/2015 05:39 PM, Philip Webb wrote:
>> but doesn't wake up when the power button or a key is pressed ;
>> I can power off & restart normally afterwards.
>> 'dmesg' + 'syslog' simply show an immediate restart after the suspend.
> There was a kernel change some time back
> that disabled usb wake-up on all USB hubs.
> Userspace needs to explicitly enable them or device wakeup will not work.
> I wrote a script some time back to do that,
> but it can probably be done with a udev rule.

Don't be coy ! -- can you post your script here ?
what would such a udev rule look like ?

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-user] Re: pm-suspend problem
  2015-10-12 21:46 [gentoo-user] pm-suspend problem Philip Webb
  2015-10-12 22:08 ` Alec Ten Harmsel
  2015-10-13  9:25 ` [gentoo-user] " Alberto Luaces
@ 2015-10-14  4:08 ` Roman Dobosz
  2 siblings, 0 replies; 12+ messages in thread
From: Roman Dobosz @ 2015-10-14  4:08 UTC (permalink / raw
  To: gentoo-user; +Cc: Philip Webb

On Mon, 12 Oct 2015 17:46:00 -0400
Philip Webb <purslow@ca.inter.net> wrote:

> I want to be able to suspend my machine to RAM overnight or when I'm out.
> The pkg to use seems to be Pm-utils, which I've installed.
> 'pm-suspend' does suspend, but only briefly :
> after  5 s , it restarts automatically & everything is back as before.
> The log file shows this happening quite clearly.
> 
> What am I doing wrong ?  Am I using the correct tool ?

From my experience it may depend on the hardware you use. For example, 
on one of my laptops suspending worked ootb, on the other I have to 
switch off the wake on lan functionality in bios (otherwise it wasn't 
even able to properly power off), while on my wife laptop it's pretty 
random thing - suspending work most the times, but sometimes it just 
not. If you have particular hw (like Sony Vaio laptops) there is a need 
to pass "acpi_sleep=nonvs" to the kernel to make it work.

Hope that helps.

-- 
      -^-  _
   _ /O)_\//
  (_(|__(_(_) grf.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-14  4:00         ` Philip Webb
@ 2015-10-14  4:59           ` Daniel Frey
  2015-10-14 17:09             ` Philip Webb
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Frey @ 2015-10-14  4:59 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1508 bytes --]

On 10/13/2015 09:00 PM, Philip Webb wrote:
> 151013 Daniel Frey wrote:
>> On 10/13/2015 05:39 PM, Philip Webb wrote:
>>> but doesn't wake up when the power button or a key is pressed ;
>>> I can power off & restart normally afterwards.
>>> 'dmesg' + 'syslog' simply show an immediate restart after the suspend.
>> There was a kernel change some time back
>> that disabled usb wake-up on all USB hubs.
>> Userspace needs to explicitly enable them or device wakeup will not work.
>> I wrote a script some time back to do that,
>> but it can probably be done with a udev rule.
> 
> Don't be coy ! -- can you post your script here ?
> what would such a udev rule look like ?
> 

Hah - sorry about that. Most people apparently use udev to do that. I
wrote my script first and used it instead. I never really looked into
udev as my script [kludge?] still works, I just tried it.

I posted it in the Docs, Tips & Tricks forum [1] some time back & it's
also on pastebin [2]. Use at your own risk! I've attached it here as
well, hopefully we're allowed to do that on this list. The forum post
lists how to use it.

Wow, 18,000 views to the forum post. I wonder if that's good or bad?

It requires root, so you may want to put it in /sbin/. Run it with no
options and it'll display a usage page. All it does is do some searching
in the /sys/devices tree and tries to find appropriate items to show.


Dan

[1] https://forums.gentoo.org/viewtopic-t-933934-highlight-usbwakeup.html

[2] http://pastebin.com/cYstsSSa





[-- Attachment #2: usbwakeup --]
[-- Type: text/plain, Size: 13065 bytes --]

#!/bin/bash

# This script attempts to read /sys/devices/ and identify usb ports and devices
# that can be toggled to enable wakeup from sleep.
# 
# Version: 2.0
# Date written: August 20, 2012
# 
# Copyright (C) 2012  danomac @ gentoo forums
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.

# Return code documentation
#
#  1: No parameter / unknown parameter specified
#  2: Multiple actions requested, can only process one at a time
#  3: Effective user ID not root (root is required)
#
#  7: No action requested
#  8: Quiet and verbose requested at the same time! Use one or the other.
#  9: Kernel Dmesg` option requested with action other than list
#
# Internal errors:
#
# 10: toggleall() - first parameter missing (internal error)
# 11: toggleusbdevice() - first parameter not specified (internal error)
# 12: toggleusbdevice() - second parameter not specified (internal error)
# 13: toggleusbdevice() - third parameter needed but not specified! (internal error)


function listusbwakeup () {
	# If quiet option is set, notify user it's being ignored
	if $QUIET; then echo "Quiet option set; ignoring..."; echo ""; fi

	# Initialize counter (to total items found later)
	COUNT=0

	echo "Listing USB hubs/devices and their wakeup status..."

	# If verbose output is requested, switch to full detail view
	if $VERBOSE
	then
		echo "
USB ID :: Device* :: Status
     Device full path
     Vendor :: Device Description
---------------------------------"
	else
		echo "
USB ID    :: Device* :: Status :: Device Description
----------------------------------------------------"
	fi

	# Search for all wakeup files under /sys/devices
	for i in `find /sys/devices -type f -name wakeup`;
	do
		# Extract the directory name where wakeup file resides
		DEVDIRNAME=`dirname $i`

		# Extract the actual device name (remove the power directory)
	        DEVNAME=`dirname $DEVDIRNAME`

		# Now remove the directory path, leaving only the device's proper name (usb4, 4-1, etc)
		DEVPROPERNAME=`basename $DEVNAME`

		# Check for a product name. If none is found we most likely aren't interested in it.
		if [ -e $DEVDIRNAME/../product ]
		then
			# We found one! Find other relevant information, if none found use a placeholder.
			if [ -e $DEVDIRNAME/../product ]; then PRODUCT=`cat $DEVDIRNAME/../product`; else PRODUCT="No product name"; fi
			if [ -e $DEVDIRNAME/../manufacturer ]; then VENDOR=`cat $DEVDIRNAME/../manufacturer`; else VENDOR="No vendor name"; fi
			if [ -e $DEVDIRNAME/../idVendor ]; then IDVENDOR=`cat $DEVDIRNAME/../idVendor`; else IDVENDOR="No VendorID"; fi
			if [ -e $DEVDIRNAME/../idProduct ]; then IDPRODUCT=`cat $DEVDIRNAME/../idProduct`; else IDPRODUCT="No Product ID"; fi

			# If verbose output is selected, switch to full detail view
			if $VERBOSE
			then
				echo "$IDVENDOR:$IDPRODUCT :: $DEVPROPERNAME :: `cat $i`"
				echo "     $DEVNAME"
				echo "     $VENDOR :: $PRODUCT"
				echo ""
			else
				echo "$IDVENDOR:$IDPRODUCT :: $DEVPROPERNAME :: `cat $i` :: $PRODUCT"
			fi

			# Increment our totals counter
			COUNT=`expr $COUNT + 1`
		fi
	done;
	
	# Need to format the output differently for normal mode by adding an extra blank line
	if ! $VERBOSE; then echo ""; fi
	echo "*Use the Device column to identify hubs/devices to be toggled."

	# If there's no results indiciate so
	if [ $COUNT -eq 0 ]
	then 
		echo "" 
		echo "  NO USB hubs/devices found, or none are toggle-able!"
	else
		# Hey, we have results, show the total found
		echo ""
		echo "$COUNT USB hubs/devices listed."
	fi

	# If the dmesg hints were requested, show them
	if $KERNELDMESG
	then
		echo "
Hints from dmesg (use this to try to identify your keyboard and mouse, you
may need to reboot to see anything relevant, see help for more info):
"

		dmesg | grep ^input
	fi
}

function toggleusbdevice () {
	# toggleusbdevice (enabledevice:boolean, enableall:boolean, devname:string)
	# First parameter is boolean. True to enable device; False to 
	# disable device.
	# Second parameter is boolean. True to enable all relevant devices found,
	# false to enable one device, specified in parameter 3.
	# Third parameter is the name of the device from the Device column of list 
	# output

	# Make sure both parameters are passed to this function!
	if [ -z "$1" ]; then exit 11; fi
	if [ -z "$2" ]; then exit 12; fi

	# If specifying a single device to be changed, make sure parameter 3
	# exists!
	if ! $2
	then
		if [ -z "$3" ]; then exit 13; fi
	fi

	# Verbose detail is used throughout this function. Echo extra detail if
	# requested
	if $VERBOSE; then echo "Starting to parse wakeup devices found..."; fi

	# Search for all wakeup files under /sys/devices
	for i in `find /sys/devices -type f -name wakeup`;
	do
		# Extract the directory name where wakeup file resides
		DEVDIRNAME=`dirname $i`

		# Extract the actual device name (remove the power directory)
	        DEVNAME=`dirname $DEVDIRNAME`

		# Now remove the directory path, leaving only the device's proper name (usb4, 4-1, etc)
		DEVPROPERNAME=`basename $DEVNAME`

		# Are we updating one specific device or all of them?
		if ! $2
		then
			# Update individual device
			if $VERBOSE; then echo "Is this device ($DEVPROPERNAME) the same as the requested device ($3)?"; fi

			# Check for a product name. If none is found we most likely aren't interested in it.
			if [ "$DEVPROPERNAME" == "$3" ]
			then
				if $VERBOSE; then echo "YES! Attempting to change."; fi

				if $1
				then
					if $VERBOSE || ! $QUIET; then echo "Attempting to enable device ($DEVPROPERNAME)..."; fi
					# Enable device
					echo "enabled" > $i

					if $VERBOSE || ! $QUIET
					then
						if [ $? -ne 0 ]; then echo "Failed."; else echo "Success!"; fi
					fi

					exit 0
				else
					# Disable device
					if $VERBOSE || ! $QUIET; then echo "Attempting to disable device ($DEVPROPERNAME)..."; fi
					# Enable device
					echo "disabled" > $i

					if $VERBOSE || ! $QUIET
					then
						if [ $? -ne 0 ]; then echo "Failed."; else echo "Success!"; fi
					fi

					exit 0
				fi
			else
				if $VERBOSE; then echo "...no."; fi
			fi
		else
			# Update all devices

			if $VERBOSE; then echo "Does this device ($DEVPROPERNAME) look like a USB hub/device?"; fi

			# Check for a product name. If none is found we most likely aren't interested in it.
			if [ -e $DEVDIRNAME/../product ]
			then
				# If verbose output is selected, switch to full detail view
				if $VERBOSE; then echo "YES!"; fi

				if $1
				then
					if $VERBOSE || ! $QUIET; then echo "Attempting to enable device ($DEVPROPERNAME)..."; fi
					# Enable device
					echo "enabled" > $i

					if $VERBOSE || ! $QUIET
					then
						if [ $? -ne 0 ]; then echo "Failed."; else echo "Success!"; fi
					fi
				else
					# Disable device
					if $VERBOSE || ! $QUIET; then echo "Attempting to disable device ($DEVPROPERNAME)..."; fi

					# Enable device
					echo "disabled" > $i

					if $VERBOSE || ! $QUIET
					then
						if [ $? -ne 0 ]; then echo "Failed."; else echo "Success!"; fi
					fi
				fi
			else
				if $VERBOSE; then echo "...no."; fi
			fi
		fi
	done;

	# If updating only one device and we get this far it wasn't found.
	if ! $2; then echo "Device not found."; fi
}

function showhelp () {
	# If quiet option is passed notify user it's being ignored
	if $QUIET; then echo "Quiet option set; ignoring..."; fi

	echo "
$0: a script that lists and toggles wakeup on usb hubs

Usage: $0 [options] [action] [parameters]

Actions:
	-l : list available usb hubs/devices that can be toggled and their 
	     current status (enabled/disabled)

	-a : enable wakeup on all discovered usb hubs/devices

	     Use caution with this; it's better to identify individual
	     hubs/devices rather than enable them all. You might find
	     your computer woke itself unintentionally.

	-x : disable wakeup on all discovered usb hubs/devices

	-e : enable wakeup on specific hub/device (requires parameter, 
	     see below.)

	-d : disable wakeup on specific hub/device (requires parameter, 
	     see below.)

	-h : this screen

Options:
	-q : Quiet mode for all but help and list actions

	-v : Enable verbose output

	-k : Try to show hints from dmesg (list action only)
       
	     This dmesg option will show lines starting with input 
	     in order to try to identify devices.

             It is usually presented as /sys/devices/*/usb?/*/input/input?.
	     If nothing useful is displayed, try rebooting as relevant 
	     information can be out of the buffer if the PC has been on for 
	     some time. 

Parameters:
	Both -e and -d actions require a parameter to search for, use -l to list.

	The parameter needed is in the Device column.

	Sample output of $0 -l:
		Listing USB devices and their wakeup status...

		USB ID    :: Device* :: Status :: Device Description
		----------------------------------------------------
		1d6b:0001 :: usb4 :: enabled :: UHCI Host Controller
		046d:c508 :: 4-1 :: enabled :: USB Receiver
		046d:c221 :: 4-2.1 :: enabled :: Gaming Keyboard

	The identifier needed for the parameter is usb4, 4-1, or 4-2.1.

No arguments will show this screen.
"
}

# Start of "main" routine

# Make sure user is root (script will not work as user)
if [ $EUID -ne 0 ]; then echo "This script must be run as root."; exit 3; fi

# Initialize variables:
#     QUIET=quiet mode (no echo) - default false. Toggled with -q option.
#     KERNELDMESG=dmesg list option in list mode. Default false, toggled with
#          -k option
#     ACTION=default 0; used to make sure more than one action are not 
#          specified at the same time. 
#     VERBOSE=default false. Extra detail in some actions.
QUIET=false
KERNELDMESG=false
VERBOSE=false
ACTION=0

# Show help if no arguments provided at all
if  [ $# -eq 0 ]; then showhelp; exit 1; fi

# Process arguments passed, setting environment appropriately.
while getopts “hkqvlaxe:d:” OPTION
do
	case $OPTION in
		h)      # Help action
		        # Make sure multiple actions are not chosen.
			if [ $ACTION -ne 0 ]; then echo "You can only declare one action at a time."; echo ""; showhelp; exit 2; fi

			ACTION=1
			;;
		q)      # Quiet option
			QUIET=true
			;;
		k)      # Kernel dmesg in list mode option
			KERNELDMESG=true
			;;
		v)      # Verbose option
			VERBOSE=true
			;;
		l)      # List action
		        # Make sure multiple actions are not chosen.
			if [ $ACTION -ne 0 ]; then echo "You can only declare one action at a time."; echo ""; showhelp; exit 2; fi

			ACTION=2
			;;
		a)      # Enable all USB hubs/devices action
		        # Make sure multiple actions are not chosen.
			if [ $ACTION -ne 0 ]; then echo "You can only declare one action at a time."; echo ""; showhelp; exit 2; fi

			ACTION=3
			;;
		x)      # Disable all USB hubs/devices action
		        # Make sure multiple actions are not chosen.
			if [ $ACTION -ne 0 ]; then echo "You can only declare one action at a time."; echo ""; showhelp; exit 2; fi

			ACTION=4
			;;
		e)      # Enable specific hub/device via find command action
		        # Make sure multiple actions are not chosen.
			if [ $ACTION -ne 0 ]; then echo "You can only declare one action at a time."; echo ""; showhelp; exit 2; fi

			ACTION=5

			# Save arguments passed for later
			ENABLEUSB=$OPTARG

			;;
		d)      # Disable specific hub/device via find command action
		        # Make sure multiple actions are not chosen.
			if [ $ACTION -ne 0 ]; then echo "You can only declare one action at a time."; echo ""; showhelp; exit 2; fi

			ACTION=6

			# Save arguments passed for later
			DISABLEUSB=$OPTARG
			;;
		?)      # Unknown parameter
			showhelp
			exit 1
			;;
	esac
done

# Some sanity checks
# Quiet and verbose can't be set at the same time
if $QUIET && $VERBOSE; then echo "You can't specify quiet (-q) and verbose (-v) at the same time."; echo ""; exit 8; fi

# Kernel DMESG can only be used with the list action
if $KERNELDMESG && (( $ACTION != 2 )); then echo "The hints from dmesg option (-k) can only be used with the list (-l) action."; echo ""; exit 9; fi

# Make sure an action was selected!
if (($ACTION == 0 )); then echo "You haven't requested an action!"; exit 7; fi

# We seem to be safe, so actually perform the request
case $ACTION in
	1)	# help action
		showhelp
		exit
		;;
	2)	# list action
		listusbwakeup
		exit
		;;
	3)	# enable all devices
		toggleusbdevice true true
		exit
		;;
	4)	# disable all devices
		toggleusbdevice false true
		exit
		;;
	5)	# enable one device
		toggleusbdevice true false $ENABLEUSB
		exit
		;;
	6)	# disable one device
		toggleusbdevice false false $DISABLEUSB
		exit
		;;
esac

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-14  4:59           ` Daniel Frey
@ 2015-10-14 17:09             ` Philip Webb
  2015-10-14 18:11               ` Mick
  0 siblings, 1 reply; 12+ messages in thread
From: Philip Webb @ 2015-10-14 17:09 UTC (permalink / raw
  To: gentoo-user

151013 Daniel Frey wrote:
> On 10/13/2015 09:00 PM, Philip Webb wrote:
>> 151013 Daniel Frey wrote:
>>> On 10/13/2015 05:39 PM, Philip Webb wrote:
>>>> but doesn't wake up when the power button or a key is pressed ;
>>> There was a kernel change some time back
>>> that disabled usb wake-up on all USB hubs.
>>> Userspace needs to explicitly enable them or device wakeup will not work.
>>> I wrote a script some time back to do that,
>>> but it can probably be done with a udev rule.
>> Don't be coy ! -- can you post your script here ?
>> what would such a udev rule look like ?
> Hah - sorry about that. Most people apparently use udev to do that.
> I wrote my script first and used it instead. I never really looked
> into udev as my script [kludge?] still works, I just tried it.
> I posted it in the Docs, Tips & Tricks forum [1] some time back
> & it's also on pastebin [2].  Use at your own risk !
> I've attached it here as well.  The forum post lists how to use it.
> Wow, 18,000 views to the forum post. I wonder if that's good or bad ?
> It requires root, so you may want to put it in /sbin/.
> Run it with no options and it'll display a usage page.
> All it does is do some searching in the /sys/devices tree
> and tries to find appropriate items to show.
> [1] https://forums.gentoo.org/viewtopic-t-933934-highlight-usbwakeup.html
> [2] http://pastebin.com/cYstsSSa

-- script snipped --

Thanks lots ! -- I looked up [1], which has useful extra advice.

However, it occurs to me that my keyboard (Sanyo 1989) is PS/2 ,
so the script will help only to enable restart via the mouse.
There's a PS/2 setting on the mobo, which I've enabled,
but might there also be something in the kernel which needs enabling ?

Lots of people seem to have problems with suspend/restart
& it seems to be somewhat random & vary with different makes of mobo,
so any further suggestions here may help others in future too.

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-14 17:09             ` Philip Webb
@ 2015-10-14 18:11               ` Mick
  2015-10-15  3:27                 ` Daniel Frey
  0 siblings, 1 reply; 12+ messages in thread
From: Mick @ 2015-10-14 18:11 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: Text/Plain, Size: 1347 bytes --]

On Wednesday 14 Oct 2015 18:09:04 Philip Webb wrote:

> -- script snipped --
> 
> Thanks lots ! -- I looked up [1], which has useful extra advice.
> 
> However, it occurs to me that my keyboard (Sanyo 1989) is PS/2 ,
> so the script will help only to enable restart via the mouse.
> There's a PS/2 setting on the mobo, which I've enabled,
> but might there also be something in the kernel which needs enabling ?

PS/2 should just work™.  It plugs straight into the MoBo chipset IRQs (via 
LAPIC these days) and does not rely on userspace applications.


> Lots of people seem to have problems with suspend/restart
> & it seems to be somewhat random & vary with different makes of mobo,
> so any further suggestions here may help others in future too.

Yes, I've had my fair share depending on MoBos, especially older builds.  I 
even had laptops with dodgy suspend to RAM performance:  it wouldn't suspend 
at all, or it would and then not wake up properly (screen wouldn't come on 
again).

In my experience suspend to RAM could break from one kernel to another on 
buggy MoBos, or between different video card kernel drivers (for radeon at 
least).

Note: some modern MoBos have S4 disabled at the BIOS by default, to make sure 
that USB ports continue to charge mobile phones and tablets.

-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] pm-suspend problem
  2015-10-14 18:11               ` Mick
@ 2015-10-15  3:27                 ` Daniel Frey
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Frey @ 2015-10-15  3:27 UTC (permalink / raw
  To: gentoo-user

On 10/14/2015 11:11 AM, Mick wrote:
> 
> PS/2 should just work™.  It plugs straight into the MoBo chipset IRQs (via 
> LAPIC these days) and does not rely on userspace applications.
> 

It should but on some boards it doesn't. I specifically remember an
older ASUS board that had a jumper by the PS2 port that was defaulted to
NOT wake. You had to move that jumper, then go into the BIOS under power
options and set wake from keyboard to "space bar" in order for it to work.

I haven't had a PS2 keyboard in ages now - I don't think the motherboard
on the Intel board I have even has a PS2 port, so I didn't think of the
possibility of the PS2 keyboard not working. :-)

Dan


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-10-15  3:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12 21:46 [gentoo-user] pm-suspend problem Philip Webb
2015-10-12 22:08 ` Alec Ten Harmsel
2015-10-12 22:48   ` Philip Webb
2015-10-14  0:39     ` Philip Webb
2015-10-14  3:27       ` Daniel Frey
2015-10-14  4:00         ` Philip Webb
2015-10-14  4:59           ` Daniel Frey
2015-10-14 17:09             ` Philip Webb
2015-10-14 18:11               ` Mick
2015-10-15  3:27                 ` Daniel Frey
2015-10-13  9:25 ` [gentoo-user] " Alberto Luaces
2015-10-14  4:08 ` Roman Dobosz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox