PDA

View Full Version : Wake On Lan from Touch



PasTim
2017-12-20, 03:56
I have a Touch that I usually use with an SD card. That works fine.

If I want to connect to my music server that also works providing the server is up. If the server is down, and the last time I powered down the Touch it was connected to the server, and I turn on the Touch, it sends a Wake On Lan (WOL) to wake the server up. All good so far.

However, if the Touch was connected to the SD card when it was powered off, when it is powered up it does not send a WOL to the server, and there seems to be no way of persuading it to do so (including trying to add a library at the server's network address).

So what I need is a way of sending a WOL from the Touch to my server when I want to. Is there a Touch 'App' that would help? I looked but couldn't find one. Alternatively, is there a way of running a local linux command from the Touch screen? I might be able to create a linux command to do what I want, if only I could run it.

Any ideas out there?

I know many people never power stuff down, but I prefer to do so.

PasTim
2017-12-20, 04:30
I even found the command I need. The busybox application on the Touch includes ether-wake. That can take a MAC direct, or can look at /etc/ethers to find a hostname to MAC conversion, in format


aa:bb:cc:dd:ee:ff host


and 'host' also exists with the IP address in /etc/hosts as


mmm.nnn.ooo.ppp host


The command I need to execute is then


ether-wake host


This works if I log in using ssh to the Touch (and then disable Touch Remote Login afterwards since it is a security risk).

How can I get the Touch to execute it?

ralphy
2017-12-20, 06:05
You'll likely need to create an applet that creates an item in the touch menu that executes the WOL when you choose it.

This thread (http://forums.slimdevices.com/showthread.php?86684-create-a-custom-menu-in-touch) should help.

PasTim
2017-12-20, 08:17
You'll likely need to create an applet that creates an item in the touch menu that executes the WOL when you choose it.

This thread (http://forums.slimdevices.com/showthread.php?86684-create-a-custom-menu-in-touch) should help.
My mind was wandering in the direction of an applet, and I was thinking of trying to comprehend the code in one of the ones I use, so thanks very much for the link. That will help a lot. My coding skills are, ahem , a touch out of date....

PasTim
2017-12-20, 14:52
Even though I know no lua, and the suggested thread missed out a vital 2nd file (the metalua), looking at the code there, plus a couple of applets already installed, and a surprise find in an ancient WOLapplet for squeezeplay (from http://wiki.slimdevices.com/index.php/SqueezePlay_Applets) I managed to cobble together a menu item that sends a WOL to my server. It's just a one-line menu item in the extras menu. It needs some tidying up, and some form of user acknowledgement that it's done something, but it does work.

I chose not to try and redevelop the squeezeplay one, which is much more sophisticated, allowing configuration of one or more music server MACs. I suspect there are critical differences between squeezeplay and the touch.

My very short and simple one just executes the ether-wake host command I mentioned in the 1st post. That required me to log onto the Touch (once assuming I don't need a full reset) and create an entry /etc/ethers for my server. If I change server I just need to change that rather than the applet.

I have a simple apache web server (on my music server), about which I know very little, but just enough to place an applet repo xml file into /var/www/html/touch , along with a zip of the applet. I then added repo http://ip-address/touch to my plugins directory on the server, and on the touch installed the applet.

If anyone else wants something like this (to execute any terminal command line that will run on the touch - see https://www.busybox.net/screenshot.html) I'm happy to share more information.

Thanks again to Ralphy.