Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] Seagate Personal Cloud NAS SRPD20 WOL

Need help with peripherals or devices?
Post Reply
Message
Author
tony_p
Posts: 3
Joined: 2024-03-05 23:29

[Solved] Seagate Personal Cloud NAS SRPD20 WOL

#1 Post by tony_p »

Hi folks,

I have a Seagate NAS running Debian Bookworm. I'm unable to get it to sleep, or resume from sleep via a WOL packet like it does with the original firmware.

I searched though the original firmware and found the required code.

It doesn't actually sleep, it shuts down and can be woken by WOL.

I figured out the box needs 2 things to accomplish this - the ethtool eth0 wol needs to be set to "g", and 2 GPIOs need to be set.

Debian 12 (and perhaps earlier versions) already automatically sets eth0 WOL to g, but for the sake of completeness, this can be manually set with

Code: Select all

ethtool -s eth0 wol g
The GPIO code for enabling WOL in the ethernet chip on the Seagate is

Code: Select all

echo 59 > /sys/class/gpio/export
echo 61 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio59/direction
echo out > /sys/class/gpio/gpio61/direction
echo 1 > /sys/class/gpio/gpio59/value
echo 1 > /sys/class/gpio/gpio61/value
echo 59 > /sys/class/gpio/unexport
echo 61 > /sys/class/gpio/unexport
Issue poweroff, and the NAS can be woken via WOL magic packet.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: [Solved] Seagate Personal Cloud NAS SRPD20 WOL

#2 Post by fabien »

Hello tony_p, welcome to the forum!

Thank you for sharing your solution.
tony_p wrote: 2024-03-05 23:49 The GPIO code for enabling WOL in the ethernet chip on the Seagate is
Where/how did you find this GPIO code sequence?

tony_p
Posts: 3
Joined: 2024-03-05 23:29

Re: Share your Debian SCRIPTS

#3 Post by tony_p »

NOT FOR DEBIAN!

This code is from the stock firmware on the Seagate Personal Cloud NAS, SRPD20, and possibly others in the family. It is here for informative purposes on the GPIO code required to enable WOL in these devices running Debian.

Code: Select all

#!/bin/sh

set -e

GPIO_PM_SYSPATH=/sys/devices/platform/netxbig-gpio-pm
GPIO_SYSPATH=/sys/class/gpio
GPIO_PM=false
DART=false

log_and_die()
{
	printf "$@\n" >&2
	exit 1
}

dart_gpio_set_wol()
{
	local val=$1

	echo 59 > $GPIO_SYSPATH/export
	echo 61 > $GPIO_SYSPATH/export

	echo out > $GPIO_SYSPATH/gpio59/direction
	echo out > $GPIO_SYSPATH/gpio61/direction
	echo 0 > $GPIO_SYSPATH/gpio59/value
	echo 0 > $GPIO_SYSPATH/gpio61/value

	echo "$val" > $GPIO_SYSPATH/gpio59/value
	echo 1 > $GPIO_SYSPATH/gpio61/value

	echo 59 > $GPIO_SYSPATH/unexport
	echo 61 > $GPIO_SYSPATH/unexport
}

usage()
{
	cat <<- EOF
		Usage: $(basename $0) command
		Configure wake-up sources for sleeping states.

		Generic commands:
		  --help |-h    display this help

		Dummy commands (needed by 'fake' sleepmode API):
		  --enable       
		  --disable
		  --enable-button
		  --disable-button
		  --is-enabled-button
		  --set-power-on
		  --set-power-off
		  --is-poweroff

		Wake-up on LAN commands:
		  --enable-wol
		  --disable-wol
		  --is-enabled-wol

		Alarm (scheduling) commands (and RTC aliases):
		  --enable-scheduling
		  --disable-scheduling
		  --is-enabled-scheduling
		  --enable-rtc
		  --disable-rtc
		  --is-enabled-rtc
		  --read-schedule
		  --clear-schedule
		  --schedule [time in secs] or [cron in UTC time +:+:+:+:+:+]
	EOF
}

[ "$(ls -A $GPIO_PM_SYSPATH 2>/dev/null)" ] && GPIO_PM=true
nexus_hardware.sh | grep -q "^n090.01$" && DART=true

[ $# -ge 1 ] || log_and_die "Command missing\n\n$(usage)"

# Handle Commands
case $1 in
	--help|-h)
		usage
		;;
	# 'Fake' sleepmode compatibility.
	--enable|--disable|--set-power-on|--set-power-off)
		# Do nothing (compatibility options).
		;;
	--is-poweroff)
		echo "no"
		;;
	# Button (always enabled).
	--enable-button)
		# Do nothing.
		;;
	--disable-button)
		log_and_die "Button wakeup can't be disabled"
		;;
	--is-enabled-button)
		echo "yes"
		;;
	--enable-wol)
		pm-wakeup --wol g
		if $GPIO_PM; then
			pm-gpio --wol yes
		elif $DART; then
			dart_gpio_set_wol 1
		fi
		;;
	--disable-wol)
		pm-wakeup --wol d
		if $GPIO_PM; then
			pm-gpio --wol no
		elif $DART; then
			dart_gpio_set_wol 0
		fi
		;;
	--is-enabled-wol)
		if pm-wakeup --wol | grep -q g; then
			$GPIO_PM && pm-gpio --wol || echo yes
		else
			echo no
		fi
		;;
	--enable-rtc|--enable-scheduling)
		if $GPIO_PM; then
			pm-gpio --rtc yes
		fi
		;;
	--disable-rtc|--disable-scheduling)
		pm-wakeup --alarm 0
		if $GPIO_PM; then
			pm-gpio --rtc no
		fi
		;;
	--is-enabled-rtc|--is-enabled-scheduling)
		if [ -n "$(pm-wakeup --alarm)" ]; then
			$GPIO_PM && pm-gpio --rtc || echo yes
		else
			echo no
		fi
		;;
	--read-schedule)
		pm-wakeup --alarm
		;;
	--clear-schedule)
		# RTC alarm can be disabled by writing a date in the past.
		pm-wakeup --alarm 0
		;;
	--schedule)
		# Synchronize RTC with system time.
		hwclock -u -w
		[ $# -ge 2 ] || log_and_die "Missing date argument\n\n$(usage)"
		pm-wakeup --alarm "$2"
		;;
	*) log_and_die "Unknown argument: $1\n\n$(usage)" ;;
esac

Last edited by tony_p on 2024-03-06 21:55, edited 1 time in total.

tony_p
Posts: 3
Joined: 2024-03-05 23:29

Re: [Solved] Seagate Personal Cloud NAS SRPD20 WOL

#4 Post by tony_p »

fabien wrote: 2024-03-06 11:38 Hello tony_p, welcome to the forum
Thank you for having me. I won't be able to contribute much as I only run Debian on a Seagate NAS, but every small piece helps.
Where/how did you find this GPIO code sequence?
I'm guessing that you would prefer the short version, as opposed to the long version where I list every file I looked at and every test I ran? :)
I found the information in the stock firmware in a script called /sbin/pm-config-hw.
It has been shared here - viewtopic.php?p=794765#p794765

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: [Solved] Seagate Personal Cloud NAS SRPD20 WOL

#5 Post by fabien »

Totally agree, every small piece helps. Thanks again for your contribution.
tony_p wrote: 2024-03-06 21:25 I'm guessing that you would prefer the short version, as opposed to the long version where I list every file I looked at and every test I ran? :)
I found the information in the stock firmware in a script called /sbin/pm-config-hw.
It has been shared here - viewtopic.php?p=794765#p794765
You did a great job. I moved your post with the script you found here as it is a better place for it.

Post Reply