Author Topic: remote control of wdtv live  (Read 39517 times)

December 31, 2009, 08:05:52 AM
Read 39517 times

rezmus

  • Sr. Member

  • Offline
  • ****

  • 418
i don;t know if it was mentioned before but there is simple way to control osd from console, just send

Code: [Select]
echo % > /tmp/ir_injection
where % is char assigned to button u want to send, here;s table

Code: [Select]
POWER - w
HOME - o
UP - u
LEFT - l
ENTER - n
RIGHT - r
DOWN - d
BACK - T
STOP - t
OPTION - G
REWIND - H
PLAY/PAUSE - p
FORWARD - I
PREVIOUS - [
NEXT - ]
SEARCH - E
EJECT - X

for example

Code: [Select]
echo X > /tmp/ir_injection
do the same as EJECT button.

it should be quite easy to modify redindian's web-based remote control page to make it work on live.
« Last Edit: December 31, 2009, 08:26:51 AM by rezmus »

December 31, 2009, 10:12:01 AM
Reply #1

avdija

  • Newbie

  • Offline
  • *

  • 22
wow, TNX man. just what i was looking for.

December 31, 2009, 02:02:23 PM
Reply #2

rezmus

  • Sr. Member

  • Offline
  • ****

  • 418
i have modified redindian's web-based remote control to work with live, u can get it here

http://wdtv.org/web_remote_wdtv_live.zip

i tested it on apache, but should work with lighttpd (included it wdlxtv) as well.

January 01, 2010, 05:39:49 AM
Reply #3

migube

  • Full Member

  • Offline
  • ***

  • 245
Great !
That's what I was looking for !

I copied the directory in lightthttpd /var/www
It shows as actiavted plugin, I can click on the remote buttons, but it does not seem to do the job.

Lighhttpd logs shows:

2010-01-01 13:39:14: (mod_fastcgi.c.2569) unexpected end-of-file (perhaps the fastcgi process died): pid: 1349 socket: unix:/var/log/lighttpd/php.socket-0
2010-01-01 13:39:14: (mod_fastcgi.c.3354) response not received, request sent: 954 on socket: unix:/var/log/lighttpd/php.socket-0 for /remote/index.php?, closing connection

-----
WdTvLive - LG BD390 - Philips 47PFL8404h - Logitech  Z5400 - DM7000 - Synology 107+
If you developed some application or know about some new WDTVLive app.bin or binary files, please update the Wiki on http://wiki.wdlxtv.com/Appz

January 01, 2010, 06:51:19 AM
Reply #4

wookienz

  • Newbie

  • Offline
  • *

  • 37
nice work, any problems if we wind this into Mr_Miyagis back end web portal?

community coding is getting somewhere!

January 01, 2010, 07:09:57 AM
Reply #5

migube

  • Full Member

  • Offline
  • ***

  • 245
good idea wookienz, does it work in that lighthttpd version/config?
tx
-----
WdTvLive - LG BD390 - Philips 47PFL8404h - Logitech  Z5400 - DM7000 - Synology 107+
If you developed some application or know about some new WDTVLive app.bin or binary files, please update the Wiki on http://wiki.wdlxtv.com/Appz

January 01, 2010, 08:03:23 AM
Reply #6

rezmus

  • Sr. Member

  • Offline
  • ****

  • 418
@migube: check your php config, seems some probs with php, i will check it with brads lighttpd / php at the weekend

@wookienz: i don;t mind at all, but you should ask redindian (u will find him on this board) - it's his code for old wdtv, i just made it work on live

January 14, 2010, 02:56:16 PM
Reply #7

KostyaY0

  • Newbie

  • Offline
  • *

  • 9
Lighhttpd logs shows:

2010-01-01 13:39:14: (mod_fastcgi.c.2569) unexpected end-of-file (perhaps the fastcgi process died): pid: 1349 socket: unix:/var/log/lighttpd/php.socket-0
2010-01-01 13:39:14: (mod_fastcgi.c.3354) response not received, request sent: 954 on socket: unix:/var/log/lighttpd/php.socket-0 for /remote/index.php?, closing connection

I have same problems...  :(
Does anybody resolve it?

January 14, 2010, 04:31:35 PM
Reply #8

linuxjunkie

  • Newbie

  • Offline
  • *

  • 8
to make this work on WDXLTV (lighttpd) you need to follow the two command below

1) modify the index.php

 remove the '&' symbol from below (i doubt this needs to be backgrounded so & is not really needed anyways)

          exec( "reboot > /dev/null &" );
      else
         exec( "echo $button > /tmp/ir_injection &" );

 --- should be (will work this way)

     exec( "reboot > /dev/null " );
      else
        exec( "echo $button > /tmp/ir_injection " );


2) ssh or telnet to your WDTVlive and run the command below
       * this allows the web to send commands to the ir_injection as it's only writable by root (non web user)

   chmod a+w /tmp/ir_injection  


** You will have to run the second comment any time you ever power (unplug the power), but then again you will probably have to copy over the web portion again too.

I am not sure if there is a better way as I just found all these goodies the other day, but I noticed the 'net.mounts' file just gets run on boot, so I have added these lines to it to keep these settings across rebooting.

#FILE: net.mounts
chmod a+w /tmp/ir_injection
ln -s /tmp/media/usb/USB1/60BE-C38E/web.remote/ /var/www/

## /tmp/media/usb/USB1/60BE-C38E/ -- is the location of my USB stick. web.remote is the root of the web folder

« Last Edit: January 14, 2010, 04:46:12 PM by linuxjunkie »

January 14, 2010, 04:39:48 PM
Reply #9

deevus

  • Newbie

  • Offline
  • *

  • 13
Thanks. Worked a charm.

January 15, 2010, 03:14:32 AM
Reply #10

KostyaY0

  • Newbie

  • Offline
  • *

  • 9
linuxjunkie
Thank You!

January 15, 2010, 07:20:11 PM
Reply #11

slowpoke

  • Newbie

  • Offline
  • *

  • 31
    • pintoland
well i have a little time and i  create this

Code: [Select]
#!/bin/bash

while true
do
  read -sn1 a
  case "$a" in
  
  A)  echo "up" ;echo u > /tmp/ir_injection;;
B)  echo "down";echo d > /tmp/ir_injection;;
C)  echo "right";echo r > /tmp/ir_injection;;
D)  echo "left";echo l > /tmp/ir_injection;;
p)  echo "power";echo w > /tmp/ir_injection;;
h)  echo "home";echo o > /tmp/ir_injection;;
e)  echo "enter";echo n > /tmp/ir_injection;;
b)  echo "back";echo T > /tmp/ir_injection;;  
s)  echo "stop";echo t > /tmp/ir_injection;;
o)  echo "option";echo G > /tmp/ir_injection;;
H)  echo "rewind";echo H > /tmp/ir_injection;;
g)  echo "play/pause";echo p > /tmp/ir_injection;;
q)  echo "forward";echo I > /tmp/ir_injection;;
w)  echo "previous";echo [ > /tmp/ir_injection;;
n)  echo "next";echo ] > /tmp/ir_injection;;
v)  echo "search";echo E > /tmp/ir_injection;;
x)  echo "eject";echo x > /tmp/ir_injection;;
1) exit;;
esac
done

is a bash script

anyone can change the letters in the script exept A),B),C) and D),this letters detected the arrow keys automatically

work simple

save like
Code: [Select]
#nano /tmp/PICK_A_NAME
#sh /tmp/PICK_A_NAME

and show what u choose, to exit press 1  in this case(u can change that)
 
« Last Edit: January 15, 2010, 07:30:25 PM by slowpoke »
always in the intertubes

January 18, 2010, 09:00:11 AM
Reply #12

choekstr

  • Sr. Member

  • Offline
  • ****

  • 269
Nice script slowpoke!  Technically the arrow keys return ^[[A and ^[[B and ^[[C and ^[[D with the first ^[ being an ESC character.  However the first two chars, ESC and [ are ignored and the last char, A/B/C/D are picked up and so it works.  In the end the result is what you expect but the reason is just slightly different.  No biggie, just pointing it out.

I modified it a bit further to add a little bit of usability and to add onto your work.

Code: [Select]
#!/bin/bash
D=/tmp/ir_injection

banner()
{
        clear
        echo "UP: A      DOWN: B      LEFT: D      RIGHT: C"
        echo "POWER: p   HOME: h      ENTER: e     BACK: b"
        echo "STOP: s    OPTION: o    REW: H       PLAY/PAUSE: g"
        echo "FWD: q     PREV: w      NEXT: n      SEARCH: v"
        echo "EJECT: x   EXIT: 1"
        echo
        echo "Key sent: $SENT"
        echo
}
while true
do
  banner
  read -sn1 -p"Key to send: $REPLY"
  case "$REPLY" in

        A)  SENT=up;echo u >$D;;
        B)  SENT=down;echo d >$D;;
        C)  SENT=right;echo r >$D;;
        D)  SENT=left;echo l >$D;; 
        p)  SENT=power;echo w >$D;;
        h)  SENT=home;echo o >$D;;
        e)  SENT=enter;echo n >$D;;
        b)  SENT=back;echo T >$D;;
        s)  SENT=stop;echo t >$D;;
        o)  SENT=option;echo G >$D;;
        H)  SENT=rewind;echo H >$D;;
        g)  SENT=play/pause;echo p >$D;;
        q)  SENT=forward;echo I >$D;;
        w)  SENT=previous;echo [ >$D;;
        n)  SENT=next;echo ] >$D;;
        v)  SENT=search;echo E >$D;;
        x)  SENT=eject;echo x >$D;;
        1) exit;;
        *)  SENT="NOT IMPLEMENTED";;
esac
done

As previously mentioned, just cut and paste this into a file and run with 'sh filename':
Code: [Select]
#nano /tmp/PICK_A_NAME
#sh /tmp/PICK_A_NAME

Enjoy!
--
Chris

January 18, 2010, 10:20:58 AM
Reply #13

cgmark

  • Full Member

  • Offline
  • ***

  • 107
From some of the reverse engineering stuff I have been doing, here is how to read directly the code of the IR sensor.
#devmem 0x001051c

0x001051c holds the data of the last IR signal decoded for any NEC protocol remote.
So if you want to use a remote you already own to control the box , take a remote you already own, set it for a device like a DVD player that is NEC protocol , hitachi uses that a lot.
Next point the remote at the WDTV box, and press the same button a couple times.
type : devmem 0x001051c

You should see something like:
0xD12EAF50  

If you get 0x00000000 it means no code received that was NEC type. Use the WDTV box remote to get test its working. When you use the original remote to see codes you have to issue the devmem command VERY quickly after pressing the remote button as the cpu clears the bit when an official command is received so it will read 0x00000000 a split second after the button on the  original remote.

Then you just need to use a script like the ones posted above to take that value and map it to the letter/remote function on the WDTV box you want it to be.
Not the script because I don't have time to do it right now but basically something like
if 0xD12EAF50 then echo A > /temp/ir_injection


« Last Edit: January 18, 2010, 10:28:35 AM by cgmark »

January 18, 2010, 11:10:20 AM
Reply #14

choekstr

  • Sr. Member

  • Offline
  • ****

  • 269
is it => 1s (your comment on split second) that the 0x001051c memory location is cleared?  If so, then just a delay of 1s and a read would suffice.  We could just do something like this:
Code: [Select]
while true; do
    if [ $(devmem 0x001051c) != "0x00000000" ]; then
        act_on_remote_code()
        sleep 1
    fi
done
#Obviously a bit more needed but this gets the point across.

This would be very trivial to write if one wanted to use a remote control that wasn't a programmable universal remote.  I just use a learning remote and this isn't needed I send actual WD TV remote codes instead.

We just need you to expose the extra remote options (Vol UP/DOWN, one key subtitles, one key chapters, etc) and then this would be a perfect daemon to stay running and act on all the extra remote codes.

Great info BTW!

--
Chris