Showing posts with label Shell Scripting. Show all posts
Showing posts with label Shell Scripting. Show all posts

Tuesday, October 6, 2009

Iphone RemoteControl for Emtec N200

How-To use any web-capable PDA as a RC for your N200
(Edit: Description adapted to newer, faster version)
(Edit2: Installation hints added, 'roadmap' extended)

NOTE: The information below is outdated, the pastebin-links have expired, and a fellow Reader has posted an alternate, better, and prettier version here:
Blog of Adicon

There are several reasons why you could want this:
  • Your table already hosts a zoo of remotes.
  • Your PDA doesn't feel flimsy like the default remote.
  • Your PDA uses a rechargeable battery. (priceless in the right moment)
  • Your device has more functions than buttons on the remote.
  • You get RSI from the awkward button placing or the funny shape of your hand.
  • Works through cabinet doors and even with poor aiming.
  • You can call your PDA-Phone if you lose it in the house.
  • You already use your PDA to control other AV-devices.
Some of these may not apply to you, but at least some should speak to you too. For me, 1, 4, 8 and sometimes 7 carried the most weight.

Screenshot of it in action (http://n200/cgi-bin/pda.cgi):

Mute Power
Media
Info
SubsBack ^Vol
+
Audio< Enter
/Go
>
PrevNext v Vol
-
FR FF StopPlay /
Pause
Chap
<
Chap
>
10sec
<
30sec
>
Zoom
-
Zoom
+
RepSlow
01 2
34
56 7
89


As you can see, I believe simplicity is one expression of elegance.
(Plus, it loads fast too and has nearly no dead space)

So, what do you need?
  • Emtec N200 or compatible device (feedback please!)
  • An IPhone or other web-enabled PDA (feedback please!)
  • telnet access to the device.
  • 2 scripts, 1 and 2, which are downloaded/used during the below installation steps.

Device preparation:
Some startscripts and the system area of the device will need to be modified, this is a one-time action, and has proven useful in other ways too. The device needs Internet Access during the installation to download the above scripts, or the 2 'wget'-commands will need to be adapted/replaced.
Now you need the telnet access to execute the following commands:

1. Make Root-Filesystem writeable:

/ # mount -o remount,rw /

2. Installing busybox1.9.1 with mkfifo support:

/ # mkdir -p /opt/bin
/ # cd /opt/bin
/ # wget http://moviecube.free.fr/Binaries/busybox1.9.1/busybox1.9.1
/ # chmod +x busybox1.9.1
/ # for i in top netcat strings mkfifo ether-wake nc; do ln -s busybox1.9.1 $i; done

3. Installing the WebUI

/ # cd /tmp_orig/www/cgi-bin
/ # wget -O - http://ralexs.pastebin.com/pastebin.php?dl=m2ccfab9b |sed "s/.$//" >pda.cgi
/ # chmod +x pda.cgi

4. Installing input redirection for DvdPlayer binary

/ # vi /usr/local/etc/rcS

Then go to this page, select all the text from the bottom textbox, and copy-paste it into the second line of the file currently open in the editor, /usr/local/etc/rcS

5. Setting launch trigger, committing changes and reboot

/ # touch /tmp_orig/loadExtScript
/ # sync
/ # mount -o remount,ro /
/ # reboot -f


Done!

Now just navigate -on whatever device- to:
http://IP.OF.UR.N200/cgi-bin/pda.cgi

On the Iphone you have to scale the page to the right size at first use. Can somebody test with a WinMobile device?

Note for developers concerning the major changes from V1:
The old version of this script used an input redirection based on "tail -f". That proved to be ineffective and slower. The new script uses "dd bs=1" and "mkfifo", which is why the installation requires the download/install of the enhanced busybox.

My current 'development version' of the script has more buttons. I've added "GoTo/Search" and "Root". "Eject", "TV Sys", and "Option" are still missing, because I did not (yet)find/integrate their codes. "Option" is not really needed though, because all its functions are available with direct keys.
The keycode behind the "Root"-Button is '/'. This *may* provide a way to build an http-file-browser, but i still need to do some testing.
StandBy-Mode, something missing from the default N200 may also be added to the next version (Also pending further testing/cleaning).
Step Nr.4 from the above steps will be replaced by a simpler wget command (I dont have the original rcS anymore, and have not yet looked for the 'unyaffs' incantation to extract a virgin copy).
I will post a new version soon, check back in 2,3 days.

The work described here was inspired by these two forum posts.

thanks to commenter l.lenzen for pointing out 2 problems with the above description, and thanks to 'triw' on the Emtect Moviecube forum for pointing towards 2 fixes, which I integrated in the above description.

have fun, ralexs