SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Media Extender
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Media Extender Discussion related to any SageTV Media Extender used directly by SageTV. Questions, issues, problems, suggestions, etc. relating to a SageTV supported media extender should be posted here. Use the SageTV HD Theater - Media Player forum for issues related to using an HD Theater while not connected to a SageTV server.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-03-2007, 03:24 PM
wvpolekat wvpolekat is offline
Sage Advanced User
 
Join Date: Apr 2007
Location: Buckhannon, WV
Posts: 134
Send a message via AIM to wvpolekat Send a message via MSN to wvpolekat
HOW-TO: Shutdown your MVP remotely

I have seen where several people have wanted the ability to shut down their MVP remotely. There is a add-on that is supposed to act as a sleep function, but I did not have much luck with it. And, it still does not provide an "on demand" way of doing it.

There are a few ways this can be done. Some are cleaner than others.

If you haven't yet, try telnetting to your MVP with the command "telnet ip.addr.of.mvp" from a DOS prompt.

You will be greeted with a login prompt.
Code:
Welcome to MediaMVP!

(none) login:
Login with the username "root" and no password:
Code:
Welcome to MediaMVP!

(none) login: root


BusyBox v1.2.2 (2006.11.10-19:12+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ #
From here, you can have a look around, it is impossible to hurt it, the worst you could do is have to power cycle the MVP.

Back to our topic... There are a couple commands that look promising, namely "halt" and "reboot". While reboot will do just that to the MVP, if your goal is an off state, it won't work. Halt will shut it down, but you will need to remove the power cable for a few seconds to get it going again, not very handy.

So, let's dig a little bit further...

Looking at running processes reveals some that look interesting "/sagetv/miniclient"...:

Code:
~ # ps
  PID  Uid     VmSize Stat Command
    1 root        144 S   init
    2 root            SWN [ksoftirqd/0]
    3 root            SW< [events/0]
    4 root            SW< [khelper]
    5 root            SW< [kthread]
   12 root            SW< [kblockd/0]
   30 root            SW  [pdflush]
   31 root            SW  [pdflush]
   33 root            SW< [aio/0]
   32 root            SW  [kswapd0]
   68 root         68 S   init
   69 root        216 S   /bin/sh /etc/rcS
   96 root        160 R   /sbin/udhcpc -f -i eth0 -p /tmp/udhcpc.pid
   99 root            Z   [telnetd]
  100 root        116 R   /usr/sbin/telnetd
  121 root            Z   [miniclient]
  122 root            Z   [miniclient]
  123 root            Z   [miniclient]
  124 root            Z   [miniclient]
  133 root       4992 S   /sagetv/miniclient 10.254.254.2
  134 root       4992 S   /sagetv/miniclient 10.254.254.2
  135 root       4992 R   /sagetv/miniclient 10.254.254.2
  136 root       4992 S   /sagetv/miniclient 10.254.254.2
  137 root       4992 S   /sagetv/miniclient 10.254.254.2
  139 root        268 S   -sh
  140 root        164 R   ps
~ #
So, taking our newfound knowledge, what happens if we kill them?
Code:
~ # killall miniclient
~ #
Well, that doesn't look very exciting on the surface. But in reality, the MVP has gone into it's "soft off" state, no display and no power LED on the front.

Success! And we can power it back up with the power button on the remote.

So, in short, if someone wants to remotely shut down the MVP in the kids room, bedroom or whatever, simply telnet to it and issue the command "killall miniclient" and you will be rewarded with success.

This can be drawn upon further with some creativity to automate shutting the MVP down at a certain time or a number of other possibilities.

If others want to go deeper into how to use something like expect to script it and run int on a schedule, we can discuss that as well if the demand or interest is there.

There could be some effect on the Sage server from the client just disappearing, but I doubt it.
Reply With Quote
  #2  
Old 05-03-2007, 06:16 PM
banmj's Avatar
banmj banmj is offline
Sage Advanced User
 
Join Date: Jun 2005
Posts: 112
Just tried this. It works great. I've been looking for a way to do this or a while.Thaks.
Reply With Quote
  #3  
Old 05-03-2007, 07:10 PM
wvpolekat wvpolekat is offline
Sage Advanced User
 
Join Date: Apr 2007
Location: Buckhannon, WV
Posts: 134
Send a message via AIM to wvpolekat Send a message via MSN to wvpolekat
I was doing some more digging, and I took a look at the init script /etc/rcS and found some things that could be helpful:

Code:
/etc # cat rcS
#!/bin/sh
/bin/mount /proc
/bin/mount -t sysfs sysfs /sys
/sbin/ifconfig lo 127.0.0.1
# Default to finding server address
SERVER="0.0.0.0"
NICTYPE="0"
eval `/sagetv/mvpnet`
/sbin/ifconfig eth0 up
insmod /lib/modules/os_core.ko
insmod /lib/modules/av_core.ko
insmod /lib/modules/ircombo.ko
insmod /lib/modules/smallgfx.ko
mount -t ramfs /dev/ram1 /tmp

if [ "$NICTYPE" -eq "0" ]; then
    echo Wired mode
    /sbin/udhcpc -f -i eth0 -p /tmp/udhcpc.pid &
else
    echo Wireless mode e:$ESSID w:$WEP k:$KEY m:$MODE
    insmod /wireless/firmware_class.ko
    insmod /wireless/pcmcia_core.ko
    insmod /wireless/pcmcia.ko
    insmod /wireless/acx.ko
    insmod /wireless/mvp_cf.ko
    /bin/sleep 5
    # Needed for carrier...
    CARRIER=`/bin/cat /sys/class/net/eth0/carrier`
    if [ "$CARRIER" -eq "1" ]; then
        /sbin/udhcpc -f -i eth0 -p /tmp/udhcpc.pid &
    else
        NEWMAC=`cat /sys/class/net/eth0/address | awk -F : '{printf "%s:%s:%s:%s
:%s:%02x\n", $1, $2, $3, $4, $5, strtonum("0x"$6)+1}'`
        /sbin/ifconfig wlan0 hw ether $NEWMAC
        /wireless/iwconfig wlan0 essid $ESSID
        /wireless/iwconfig wlan0 sens 3
        if [ "$WEP" -eq "1" ]; then
            /wireless/iwconfig wlan0 key $KEY
            /wireless/iwconfig wlan0 key on
        fi
        if [ "$MODE" -eq "0" ]; then
            /wireless/iwconfig wlan0 mode ad-hoc
        else
            /wireless/iwconfig wlan0 mode managed
        fi
        /sbin/udhcpc -f -i wlan0 -p /tmp/udhcpc.pid &
    fi
fi

/usr/sbin/telnetd

while [ ! -f /tmp/lan ];
do
echo Waiting for lan
sleep 1
done

while [ "1" = "1" ];
do
/sagetv/ledtest 1
/sagetv/mvppower 1
if [ "$SERVER" == "0.0.0.0" ]; then
   IP=`/sagetv/miniclient`
else
   IP=$SERVER
   # Run this to clear the screen
   /sagetv/miniclient
fi
/sagetv/miniclient $IP 2>&1 > /dev/null
powerdown=$?
if [ "$powerdown" -ge 1 ]
then
   /sagetv/ledtest 0
   /sagetv/mvppower 0
   /sagetv/mvpwait
fi
done
It looks like we can use the commands in this to do soemthing.

Of particular interest is the last if statement:

Code:
if [ "$powerdown" -ge 1 ]
then
   /sagetv/ledtest 0
   /sagetv/mvppower 0
   /sagetv/mvpwait
fi
Which means if the variable "$powerdown" is greater than or equal to 1, do the 3 commands that follow. I haven't looked to find out where $powerdown is defined, but I have a couple ideas I will try once CSI is over.

Specifically,

Code:
powerdown=1
/etc/rcS
This working or not will depend on if $powerdown is set by an eariler part of the init script.

Update:

I slipped in doing this during a commercial. It appears that it will just restart it.

But, I think I can work up a command to do this more cleanly than just killing them.

"/sagetv/mvppower 0" doesn't work as expected. So, there is still more reasearch to do. I may see if I can get one of the lower level linux hackers at work to take a look and see what they can do with it.
Reply With Quote
  #4  
Old 05-23-2007, 12:52 PM
jquinlan jquinlan is offline
Sage Advanced User
 
Join Date: Jan 2005
Posts: 106
How about a sleep timer for the MVP clients?

Then I guess the next step would be the TV. How to shut it down after the MVP goes off. Some TVs may do this after a signal loss for a period of time, but some won’t.

Or is this already available. I have not updated to 6 yet.
Reply With Quote
  #5  
Old 05-23-2007, 03:38 PM
ke6guj ke6guj is offline
Sage Icon
 
Join Date: Jan 2005
Posts: 2,355
Quote:
Originally Posted by jquinlan View Post
How about a sleep timer for the MVP clients?
Have you checked out flachbar's sleep timers? The original, http://forums.sagetv.com/forums/showthread.php?t=16310 , is configurable in many way to sleep in a set time period, or to turn off at a sertain time. It even has the ability to send IR commands to a usb-uirt (to turn off the tv?) when going to sleep. I dunno if it will work with the MVP, when Dirk was doing the main work on it, it doesn't look like he had an MVP.

Then there is his MVP auto-sleep timer, http://forums.sagetv.com/forums/show...34&postcount=9 , that will auto sleep the MVP, or a SageClient, if there aren't any keypresses in a set time, such as 2 hours. It is currenly only for SageMC usage, but it is on his to-do list to adapt it to the default UI.
__________________
- Jack
__________________________________________
Server: AMD Phenom 9750, 2GB RAM, 2 Hauppauge PVR500, 1 Firewired DCT6200, 1 HDHomerun tuning 2 QAM channels, Vizio 37" HDTV LCD, 1 USB-UIRT

Clients: 1 MediaMVP, 1 Placeshifter Client, & 1 SageTV Client.
Reply With Quote
  #6  
Old 05-23-2007, 08:54 PM
jquinlan jquinlan is offline
Sage Advanced User
 
Join Date: Jan 2005
Posts: 106
Thanks for the info, I will have to check them out.
Reply With Quote
  #7  
Old 08-08-2007, 03:41 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
I have added a button to remotely shutdown or reboot a connected MVP to the 2.17 version of my webserver. Thanks for investigating and finding this.
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #8  
Old 08-15-2007, 07:59 AM
Franc Franc is offline
Sage Advanced User
 
Join Date: Jun 2006
Posts: 182
So all this is possible, yet no-one has found a way yet to send a wake-on-lan package from the MVP to power up the SageTV server?
Reply With Quote
  #9  
Old 08-15-2007, 08:06 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
Do you know of a WOL package which will run on the MVP?

B
Reply With Quote
  #10  
Old 08-15-2007, 08:10 AM
Franc Franc is offline
Sage Advanced User
 
Join Date: Jun 2006
Posts: 182
On my linux server (which I can access from anywhere) I have a package called "wakeonlan" that I installed as an RPM which I use to wake up the SageTV server. You type "wakeonlan <MAC address of Sage server>" and of it goes...

The MVP being a linux box, one should be able to run it, but something like RPM doesn't exist on it of course...
Reply With Quote
  #11  
Old 08-15-2007, 09:02 AM
amg amg is offline
Sage Advanced User
 
Join Date: Jan 2005
Posts: 161
Here is a VERY small Java program that I found that should work... I think it would need to be built-in to the SAGE MVP software.
__________________
unRaid Server:Quad-Core Xenon, 20 GB Ram, openDCT/sageTV Dockers, HDHR,HDHR Prime
Network Encoder:Dell Inspiron 1000 Laptop, 512MB Ram, Windows XP, HDPVR
Reply With Quote
  #12  
Old 08-15-2007, 09:08 AM
Franc Franc is offline
Sage Advanced User
 
Join Date: Jun 2006
Posts: 182
Quote:
Originally Posted by amg View Post
Here is ...
where?
Reply With Quote
  #13  
Old 08-15-2007, 09:25 AM
amg amg is offline
Sage Advanced User
 
Join Date: Jan 2005
Posts: 161
Doh!

http://www.jibble.org/wake-on-lan/WakeOnLan.java
__________________
unRaid Server:Quad-Core Xenon, 20 GB Ram, openDCT/sageTV Dockers, HDHR,HDHR Prime
Network Encoder:Dell Inspiron 1000 Laptop, 512MB Ram, Windows XP, HDPVR
Reply With Quote
  #14  
Old 08-15-2007, 10:11 AM
Franc Franc is offline
Sage Advanced User
 
Join Date: Jun 2006
Posts: 182
ehmmm..... it looks like there's no java on the MVP to run this
Reply With Quote
  #15  
Old 08-15-2007, 11:52 AM
wvpolekat wvpolekat is offline
Sage Advanced User
 
Join Date: Apr 2007
Location: Buckhannon, WV
Posts: 134
Send a message via AIM to wvpolekat Send a message via MSN to wvpolekat
You can't do WOL for the Sage server from the MVP. Since it needs the sage server to boot, you wont be able to run your WOL app until the Sage box is up. I believe that all the MVP has on it natively is a simple bootstrap loader to get the OS from the server.
Reply With Quote
  #16  
Old 08-15-2007, 11:55 AM
Franc Franc is offline
Sage Advanced User
 
Join Date: Jun 2006
Posts: 182
I don't think that is true, because Linux will simply boot up once you start up the MVP. It loads the graphical shell from the server, but the basic linux system is hardcoded into the MVP. The problem would be to add extra code and have it saved, but I figure that as long as it is only turned of with the remote (soft turn off) it should remember the extra code.

But I'm just guessing.
Reply With Quote
  #17  
Old 08-15-2007, 12:01 PM
wvpolekat wvpolekat is offline
Sage Advanced User
 
Join Date: Apr 2007
Location: Buckhannon, WV
Posts: 134
Send a message via AIM to wvpolekat Send a message via MSN to wvpolekat
Should be easy enough to test, if you can telnet to it when it is in the "no streaming server found" state.
Reply With Quote
  #18  
Old 08-15-2007, 12:05 PM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
The real issue is that you have to put the mod (whatever it is) on the box every time it is started up. If you're cool with that (I am sure you can script a telnet session or something) then consider using the power on event to poke your linux server with ping. When the port is triggered it kicks of the WOL. A low cost server for this would be the Buffalo routers all the DDWRT and Tomato guys love.

Put your WOL poke after
Code:
while [ ! -f /tmp/lan ];
do
echo Waiting for lan
sleep 1
done
With the server stopped telnet is still alive.

B
Reply With Quote
  #19  
Old 08-15-2007, 12:12 PM
Franc Franc is offline
Sage Advanced User
 
Join Date: Jun 2006
Posts: 182
Hang on, slow I'm not that good with coding and programming...

What you're saying is: use the linux server with the wakeonlan software to do the actual WOL? And have the MVP trigger the linux server to start the wol

That doesn't sound too bad!

The fact that the MVP will loose any extra code when completely shut down is not a big issue to start with. My MVPs are usually on anyways, so they will keep the code and when I hit ON on the remote it should trigger the linux box...

So I get the idea, but the actual coding....?

And yeah: you can still telnet to it when the Sage server is down, I tested that. Don't know what it does when it is in the "Failed to locate GUI server" state, but that's not really relevant, I want to use this after a successfull startup when the Sage server has gone into standby (I have it do that after 15 minutes of inactivity).

Oh, sorry for the hijack
Reply With Quote
  #20  
Old 09-22-2007, 05:51 PM
joat joat is offline
Sage User
 
Join Date: Dec 2006
Location: Virginia
Posts: 25
WOL is actually a BIOS function. While you should be able to do it with your server as the target, you won't be able to wake the MVP. A work around might be to hook the MVP to an X10 outlet.

- joat
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MVP and Powerline Networking: Incompatible? mdnttoker SageTV Media Extender 24 11-07-2007 12:11 AM
Hauppauge Media MVP problem tktplz SageTV Media Extender 9 03-01-2007 03:31 PM
SageTV software with Hauppage MVP problems continued dbritton SageTV Media Extender 4 11-07-2006 06:59 AM
Problem with reconnecting MVP after shutdown RalfH SageTV Media Extender 4 03-09-2006 11:31 PM
MVP Never Progresses past "Starting Application" MrApollinax SageTV Media Extender 49 01-03-2006 04:25 PM


All times are GMT -6. The time now is 04:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.