LinuxMCE Forums

General => Installation issues => Topic started by: huh on March 01, 2010, 04:50:19 am

Title: LG LCD Template
Post by: huh on March 01, 2010, 04:50:19 am
A number of people have contributed to building a template for a LG LCD as described here:

http://wiki.linuxmce.com/index.php/LG_42LB5D (http://wiki.linuxmce.com/index.php/LG_42LB5D)

As listed in the wiki, there should be a template here:  /usr/pluto/pnp/20_LGLCD.sh

but the only template is the 20_LG_TV which points to a 1915 template, not a 1905 as listed in the wiki.

When I plug in my LG tv and pick from the available templates ("20 LS7D (RS232)") is added to the system, but when looking at the ruby code, nothing is programmed (on/off, video select, etc).

Judging from this http://svn.linuxmce.org/trac.cgi/browser/branches/LinuxMCE-0810/src/pluto_main/Define_DeviceTemplate.h?rev=22816 (http://svn.linuxmce.org/trac.cgi/browser/branches/LinuxMCE-0810/src/pluto_main/Define_DeviceTemplate.h?rev=22816) looks to confirm that the template was never added.

Any suggestions?

Title: Re: LG LCD Template
Post by: MANDINGO on March 01, 2010, 07:21:46 am
i do not have that TV, but ill make it and put it into the CVS and commit a new pnp script into the SVN that will detect all the LG TV's in that series, ill post back when im done and its in  ;D

Thanks

Mandingo
Title: Re: LG LCD Template
Post by: huh on March 01, 2010, 03:21:12 pm
Thank you very much.   I do not have one of the models listed in the wiki, but from the manual I think those codes will work for my model as well. 
Title: Re: LG LCD Template
Post by: sedgington on March 14, 2010, 01:55:28 pm
Should I be looking here or elsewhere for the post that it has been done? Also any help on how to retrieve where you post it and install it would be greatly appreciated as I don't have experience with what you posted as the destination.

I'm having exactly the same problem getting rs232 to work on my LG TV--despite the fact that the commands work beautifully from the command line--a functional template would be great. The LG template description in the wiki andincluded in 7.10 gives me compile errors about expecting a $end and finding a kend. Even when I create a new template with only a single command and it says it compiles OK, when you test the command inside the web admin page they do not show up as being sent in the "follow log" for the TV (the send command on the advanced page for the AV device does show up). Any help greatly appreciated
Title: Re: LG LCD Template
Post by: huh on May 02, 2010, 09:13:57 am
i do not have that TV, but ill make it and put it into the CVS and commit a new pnp script into the SVN that will detect all the LG TV's in that series, ill post back when im done and its in  ;D

Thanks

Mandingo

Mandingo-  have you had a chance to look at this?  Per this post, it looks like if the code were to correctly read the plugged-in TV then the code would run as desired:  http://forum.linuxmce.org/index.php?topic=9822.0 (http://forum.linuxmce.org/index.php?topic=9822.0)

TIA
Title: Re: LG LCD Template
Post by: tkmedia on May 02, 2010, 06:42:05 pm
I submitted a Template for 37" LG which should work for any of the new LG series
Just use
template number 2126


I will try to tweak some of the PNP stuff shortly.

anyone want to test see me in irc  #linuxmce
ask for
tkmedia


tim
Title: Re: LG LCD Template
Post by: Rukus on July 26, 2010, 01:19:48 am
Tim,

I just bought a LG LD450, and I started testing your LG template. I've trying to do things like turn down the volume and/or mute the tv, but I'm not seeing the commands change the status on the TV. I believe I have correctly added the template to my MD which connected to my TV, but I was thinking that there might be something missing. Please let me know if you need for me to submit a screenshot for you.

Thanks,

Ernesto
Title: Re: LG LCD Template
Post by: Rukus on September 27, 2010, 10:27:21 pm
i do not have that TV, but ill make it and put it into the CVS and commit a new pnp script into the SVN that will detect all the LG TV's in that series, ill post back when im done and its in  ;D

Thanks

Mandingo

Mandingo,

Can you give me a hand with some of the code in the template? I'm having trouble with raising and lowering the volume.

Ernesto
Title: Re: LG LCD Template
Post by: b4rney on October 02, 2010, 12:56:43 am
Hey Guys,

I'm using tkmedias LG template 2126 to control my LG LH3000. It's great to hit menu and the TV turns on. Finish watching and after a while it turns off.

I had three small problems:
1. In order for it to pnp seemlessly I changed the pnp script on the md (/usr/pluto/pnp/20_LG_TV.sh) to point to this template.
2. The volume control didn't work. I have altered the ruby codes to send fixed upper and lower volume level commands as a short term fix.
3. I had to manually adjust the device id in the ruby codes to fit my installation.

Although I have a manually adjusted working set-up I don't have the ruby skills to make this all plug and play.

Hope this helps.
Barney
Title: Re: LG LCD Template
Post by: Rukus on October 02, 2010, 01:18:40 am
Hey Guys,

I'm using tkmedias LG template 2126 to control my LG LH3000. It's great to hit menu and the TV turns on. Finish watching and after a while it turns off.

I had three small problems:
1. In order for it to pnp seemlessly I changed the pnp script on the md (/usr/pluto/pnp/20_LG_TV.sh) to point to this template.
2. The volume control didn't work. I have altered the ruby codes to send fixed upper and lower volume level commands as a short term fix.
3. I had to manually adjust the device id in the ruby codes to fit my installation.

Although I have a manually adjusted working set-up I don't have the ruby skills to make this all plug and play.

Hope this helps.
Barney

Barney,

Can you provide us with the code you used, so I can test on the 20_LG_TV.sh template? This would go a long way ensuring the base template is working properly, and allow users to create model specific templates in the future.

Thanks,

Ernesto
Title: Re: LG LCD Template
Post by: huh on October 02, 2010, 01:22:49 am

Barney,

Can you provide us with the code you used, so I can test on the 20_LG_TV.sh template? This would go a long way ensuring the base template is working properly, and allow users to create model specific templates in the future.

Thanks,

Ernesto


Ditto- I'd like to test as well.
Title: Re: LG LCD Template
Post by: b4rney on October 02, 2010, 01:28:33 am
My changes globally change the LG pnp script to point to tkmedia's template. I don't know any other way to do it.

The script is very small so I'll post it here. The only change is the 2126 on the line before last.
Barney

Code: [Select]
#!/bin/bash

echo "LG TV Detection script queue $2"
/usr/pluto/bin/TestSerialPort -p $3 -P N81 -b 9600 -t "ka 01 01\r\n" -s "a 01 " -i 8

if [[ "$?" -ne 0 ]]; then
echo "It's not a LG TV"
/usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 0
else
echo "It is an LG TV"
/usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 2126
fi
Title: Re: LG LCD Template
Post by: Rukus on October 02, 2010, 01:36:36 am
My changes globally change the LG pnp script to point to tkmedia's template. I don't know any other way to do it.

The script is very small so I'll post it here. The only change is the 2126 on the line before last.
Barney

Code: [Select]
#!/bin/bash

echo "LG TV Detection script queue $2"
/usr/pluto/bin/TestSerialPort -p $3 -P N81 -b 9600 -t "ka 01 01\r\n" -s "a 01 " -i 8

if [[ "$?" -ne 0 ]]; then
echo "It's not a LG TV"
/usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 0
else
echo "It is an LG TV"
/usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 2126
fi


My bad dude, I meant the ruby code for volume up and down.

Ernesto
Title: Re: LG LCD Template
Post by: b4rney on October 02, 2010, 01:42:52 am
In the template ruby snippet just give the vol up and vol down fixed values.
Code: [Select]
print "raising volume from ", @volume, "\n"
cmd_313(15)
This is my vol up command. Pressing vol up just sets the volume at 9 (it is reduced to 64% in the script).

Not perfect but I have a fixed up .... a fixed down cmd_313(5) ... and mute works.
Barney
Title: Re: LG LCD Template
Post by: b4rney on October 04, 2010, 01:31:18 am
OK. Almost got this template 2126 fully working using manual (ugly hack) script adjustments.

I had to change several references with the wrong device id in the ruby codes (I'd missed one).

Now Volume and mute controls work normally. Only weirdness is that when the volume climbs to 9 the next step is 16 and the same in reverse. I think this is to do with the script.

I will keep trying and report back.
Barney
Title: Re: LG LCD Template
Post by: ladekribs on October 04, 2010, 09:00:50 am
Hi Barney,

how does Your #313 Set Volume look like now?
I get errors when using it.
Title: Re: LG LCD Template
Post by: b4rney on October 04, 2010, 05:35:16 pm
<removed link> please see solution further down the thread:
http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457

From memory you need to change the device id number on line 10 to your LG device id. I think I changed it in around 4 places in total on the template.

Also, check for a space in the 'ilevel.to_s' reference on line 10. I had a space after the dot (period) which broke mine.

My volume leap from 9 to 16 must be to do with the #313 script. There is a 64% reduction which works on values less than 10 but not above. Still trying to figure it out.

Barney

<edit>That space is also in the wiki referenced in post 1 of this thread. I have just removed that space in the wiki article.</edit>
Title: Re: LG LCD Template
Post by: b4rney on October 05, 2010, 12:22:00 am
Got a bit further. It seems the LG is expecting a hex value but we are sending decimal.
09 hex = 09 dec
10 hex = 16 dec

Now learning ruby syntax.
Barney
Title: Re: LG LCD Template
Post by: b4rney on October 05, 2010, 01:48:44 am
OK fixed the dec to hex problem. Here is #313 set volume:
Barney
Code: [Select]
@volume=level.to_i()
ilevel = (@volume).to_i
print "setting volume to ", ilevel , "\n"

if ilevel <16
  SendCommand("kf 01 0" + "%x" % ilevel,1000,4)
else
  SendCommand("kf 01 " + "%x" % ilevel,1000,4)
end
SetDeviceDataInDB( device_.devid_,device_.devid_.to_i , ilevel.to_s) # 120 = DEVICEDATA_Volume_Level_CONST
print "volume and corresponding device data set\n"
Title: Re: LG LCD Template
Post by: b4rney on October 05, 2010, 01:52:05 am
Looks like all we need to do to fix the template is replace the hard-coded device ids with:
Code: [Select]
device_.devid_.to_i
Can someone confirm this? My brain is fried.
Barney
Title: Re: LG LCD Template
Post by: tschak909 on October 08, 2010, 07:51:47 am
correct.

-Thom
Title: Re: LG LCD Template
Post by: b4rney on October 08, 2010, 01:24:47 pm
Thanks Thom,

OK, if anyone wants to test my working LG TV template please follow these steps.

1. Ensure that your LG TV has the same commands as device template 2126. Check your manual. As far as I can see (looking at recent LG manuals) most LGs share mostly the same RS232 commands.

2. Change the Plug and Play script  on your MD in /usr/pluto/pnp/20_LG_TV.sh to point to device template 2126. It should look like this.
Code: [Select]
#!/bin/bash

echo "LG TV Detection script queue $2"
/usr/pluto/bin/TestSerialPort -p $3 -P N81 -b 9600 -t "ka 01 01\r\n" -s "a 01 " -i 8

if [[ "$?" -ne 0 ]]; then
echo "It's not a LG TV"
/usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 0
else
echo "It is an LG TV"
/usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 2126
fi
Note! This is where we can add support for different models later. We can issue model specific commands and if we get a good ack we point to the relevant template, if not try the next one etc.

3. In Web Admin go to Advanced > Configuration > Device Templates. Select LG in the first box and 'apply filter' then find '37LH30 RS232' in the 'Device Template' box (or type 2126 in the bottom box and type 'GO'). Then click 'Pick Device Template'.

4. A new window will open. Near the top click 'Edit Ruby Codes'.

5. Another window will open with the codes.

6. Go to the inputs section. There are lots of different inputs (hdmi 1, hdmi2, AV1 etc). Change all the input commands from 'kb' to 'xb'. Check your manual to confirm this.

7. Go to #355 Process Initialize and copy and paste this:
Code: [Select]
# Initialize --- Date: 28.02.2008
# the docs are wrong.  they say responses are terminated with a \r.  In reality some sets do, others don't.
# some sets won't respond to ka 01 ff when the tv is off.  others do.
@mute = false;

# unfortunately we have to turn the device on if it's off to know that it's alive or else it won't respond to anything
@input=-1
for iRetry in 0...4
    print "Initializing unit\n"
# Query the current volume level
    conn_.Send("kf 1 ff\r")
    # wait 4 seconds for the status command, which won't work if the tv is off
    $buf = conn_.RecvDelimited("x", 4000)
    if( !$buf.nil? && !$buf.index("01 OK").nil? )
        print "Initialized ok - tv is on\n"
        # Use the returned response to set the volume
x = $buf.index("OK")
volume_level =$buf[x+2,2].to_i(16)
print "Setting volume to ", volume_level, "\n"
cmd_313(volume_level)
        return
    end
    print "TV is either off or not connected\n"

# try turning it on
    conn_.Send("ka 1 01\r")
    # wait 10 seconds for the TV to respond
sleep(10)
# Query the current volume level
    conn_.Send("kf 1 ff\r")
    # wait 4 seconds for the status command, which won't work if the tv is off
    $buf = conn_.RecvDelimited("x", 4000)
    if( !$buf.nil? && !$buf.index("01 OK").nil? )
        print "Initialized ok - tv was off\n"
        # Use the returned response to set the volume
x = $buf.index("OK")
volume_level =$buf[x+2,2].to_i(16)
print "Setting volume to ", volume_level, "\n"
cmd_313(volume_level)
# Turn TV off again
    conn_.Send("ka 1 00\r")
        return
    end

    print "TV is not connected\n"

    sleep(1)
end

#DisableDevice( device_.devid_, true )
print "The device wouldn't respond. Disabling it.\n"

8. Go to #313 Set Volume and copy and paste this.
Code: [Select]
@volume=level.to_i()
ilevel = (@volume).to_i
print "setting volume to ", ilevel , "\n"

if ilevel <16
  SendCommand("kf 01 0" + "%x" % ilevel,1000,4)
else
  SendCommand("kf 01 " + "%x" % ilevel,1000,4)
end
SetDeviceDataInDB( device_.devid_,device_.devid_.to_i , ilevel.to_s)
print "volume and corresponding device data set\n"

9. At the bottom of the page click 'Update'

10. Do a quick reload router. Or even a full reboot (can't remember what I did). The LG TV should be autodetected and you should be presented with the setup wizard to confirm the device and select your inputs etc

11. Come back here and let me know if it works.

Good luck,
Barney
Title: Re: LG LCD Template
Post by: ladekribs on October 08, 2010, 05:29:20 pm
Hi barney,

I made a short test before leaving, on my own template using your cmd 313 and 355, but I get errors after about 30 seconds:

Code: [Select]
05 10/08/10 17:23:56.542 GSDMessageTranslator isCmdImplemented = true <0xb5effb90>
05 10/08/10 17:23:56.542 #### Pre-Process Queue = 1 <0xb5effb90>
05 10/08/10 17:23:56.586 _QueueProc Pre - 89 : 0 <0xb7828b90>
05 10/08/10 17:23:56.586 GSD-Sleep Pre 89 : 0 <0xb7828b90>
05 10/08/10 17:23:56.586 Process Queue = 1 <0xb7828b90>
05 10/08/10 17:23:56.586 Parameter:  <0xb56feb90>
01 10/08/10 17:23:56.586 Error while calling method: Cannot call class method: cmd_89
error: undefined method `+' for nil:NilClass, line: 24
backtrace:
in: (eval): 24
from (eval):24:in `cmd_89'
from (eval):31
 <0xb56feb90>
01 10/08/10 17:23:56.586 For obscure reasons could not handle the message <0xb56feb90>
05 10/08/10 17:23:56.843 GSD-Sleep Post 89 : 250 <0xb7828b90>
05 10/08/10 17:23:56.843 _QueueProc Post - 89 : 250 <0xb7828b90>
05 10/08/10 17:24:02.359 GSDMessageTranslator isCmdImplemented = true <0xb5effb90>
05 10/08/10 17:24:02.360 #### Pre-Process Queue = 1 <0xb5effb90>
05 10/08/10 17:24:02.397 _QueueProc Pre - 90 : 0 <0xb7828b90>
05 10/08/10 17:24:02.397 GSD-Sleep Pre 90 : 0 <0xb7828b90>
05 10/08/10 17:24:02.397 Process Queue = 1 <0xb7828b90>
05 10/08/10 17:24:02.418 Parameter:  <0xb56feb90>
01 10/08/10 17:24:02.419 Error while calling method: Cannot call class method: cmd_90
error: undefined method `-' for nil:NilClass, line: 31
backtrace:
in: (eval): 31
from (eval):31:in `cmd_90'
from (eval):24
 <0xb56feb90>
01 10/08/10 17:24:02.419 For obscure reasons could not handle the message <0xb56feb90>
05 10/08/10 17:24:02.667 GSD-Sleep Post 90 : 250 <0xb7828b90>
05 10/08/10 17:24:02.668 _QueueProc Post - 90 : 250 <0xb7828b90>

do I have other faults in the template?


BR Stefan
Title: Re: LG LCD Template
Post by: b4rney on October 08, 2010, 06:04:46 pm
Stefan,

Here is my vol up and vol down, in case yours is different.
#89
Code: [Select]
print "raising volume from ", @volume, "\n"
cmd_313(@volume+1)
Vol Down
#90
Code: [Select]
print "raising volume from ", @volume, "\n"
cmd_313(@volume-1)
Title: Re: LG LCD Template
Post by: ladekribs on October 09, 2010, 11:47:40 am
Barney,

no they are the same, I will try to test Your 313 and 355 on template 37LH30 with my TV on tuesday, when back in place


BR Stefan
Title: Re: LG LCD Template
Post by: huh on October 10, 2010, 06:40:38 am
Barney-

Sorry for the late response- I have been trying to get this going on my 32LH40 but to no avail.  My codes are different, but the one for on and off are as listed in the ruby code. 

I know my serial to usb adapter works- I have a denon receiver that is plug and play and works great.

When I plug in the adapter with the LG TV- the detection script runs and the first time I think it detected the LG tv because I saw the message about it having finished the installation of software.  That said, Sarah did not prompt me to pick a room and the TV does not show up as a device.

I am still playing with the testserialport to make sure the correct signals are being sent.

Thanks
Title: Re: LG LCD Template
Post by: b4rney on October 10, 2010, 01:22:54 pm
Huh,

Doesn't sound like your LG is being detected.

I also have a Denon (2310) which works using my USB to RS232 adapter with no additional cables. However I need a cable between the Adapter (male rs232) and the LG TV as it requires a female connector. I'm not sure if I'm using a null modem (crossover) cable or a straight through cable.

I know that if you use the wrong connector it will still run the pnp script but fail to detect it.

I just downloaded the manual for the 32LH40 and the codes look almost identical. Which codes are you referring to?

Which template are you looking at (should be 2126)?

Barney
Title: Re: LG LCD Template
Post by: huh on October 11, 2010, 01:27:21 am
I agree- don't think it is being discovered.  My Denon receiver has a female connection- my usb to serial adapter has a male connection- so these two fit without a gender changer.

The LG tv, however also has a male connector, so I have a couple female/female adapters (not a cable- just a gender changer) that I use between my usb-to-serial and the tv.  I used the same usb-to-serial adapter that works on my denon receiver to connect the tv- but as just discussed, I have the gender changer in place.  I find it hard to believe that the coupler changes the wiring structure- I would guess it is just straight through, but no guarantees.

The manual says that I need to "use a crossed (reverse) cable".  So maybe I need a crossed cable to get it to work....  don't know.

Right now trying to get the TV to respond to a command....  I think I need a different cable.


Yep...   just looked at the AVR-2807 and it looks like it requires a straight through cable, the LG TV needs a null modem/cross over cable.  Have one shipping from CA- will post when I get it and can try again.
Title: Re: LG LCD Template
Post by: b4rney on October 11, 2010, 02:00:23 am
Very cheap on ebay. I'm buying one of each to test.

Weird thing is I've just received a null modem cable which doesn't work with my usb adapter. So now I don't know if I'm using a null modem usb>RS232 connector. But I also have those gender changes. They don't work either!!

My only working configuration is with an unknown female to female connector.
I'm not helping am I
 ;)
Barney
Title: Re: LG LCD Template
Post by: huh on October 11, 2010, 02:32:56 am
On the contrary- knowing the code works is half the battle  :)

I was misreading the code to acknowledge that the LG tv was a LG tv. 

This part:
/usr/pluto/bin/TestSerialPort -p /dev/ttyS0 -P N81 -b 9600 -t "ka 1 01\r\n" -s "a 01 " -i 8


Where I have inserted my serial port so I could manually run from a command line rather than the $3 (IIRC) that was originally in its place.
Title: Re: LG LCD Template
Post by: b4rney on October 11, 2010, 11:07:54 am
Thanks for the tip. Just used a similar command and got a response. I used ttyUSB0.

/usr/pluto/bin/TestSerialPort -p /dev/ttyUSB0 -P N81 -b 9600 -t "ka 1 01\r\n" -s "a 01 " -i 8

Response was
a 01 OK01x

Once this template is confirmed working we can use these commands to query the LG to figure out the model and launch the right template. New templates can be created based on this one for each model range.

I'd just like to see this template working for someone else.
Barney
Title: Re: LG LCD Template
Post by: b4rney on October 11, 2010, 09:27:19 pm
OK. Just made a change to script #355 Process Initialize in my earlier post:
http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457

I have set a fixed volume level. Please try this and report back.
Cheers
Barney
Title: Re: LG LCD Template
Post by: b4rney on October 11, 2010, 10:04:18 pm
Looks like we've got success with this template.

The only addition is the ability to set the initial volume within the device data of the template. That way users can choose a start-up volume to suit their own preferences.
 ;D
Title: Re: LG LCD Template
Post by: tschak909 on October 12, 2010, 06:30:55 am
Any start-up volume should not be stored in the template. I will not accept a template that accepts this or explicitly sets this. End of story.

-Thom
Title: Re: LG LCD Template
Post by: b4rney on October 12, 2010, 02:17:02 pm
Agreed.

Please see amended #355 Process Initialize in previous post.
http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457

We now query the TVs volume level and simply re-set it to the same level to initialize the device.
 ;)
Barney
Title: Re: LG LCD Template
Post by: ladekribs on October 12, 2010, 08:53:05 pm
Hi Barney,

I must have done something wrong with my setup, but I tested Your #313 and #355 on an other Linuxmce machine and they appear to be working on my 47LH4000

will qontinue testing

BR Stefan
Title: Re: LG LCD Template
Post by: b4rney on October 12, 2010, 11:46:40 pm
Hi Stefan,

I've made quite a few changes over the last couple of days. Maybe you tried a different version (I keep updating the same post with the improved configuration).

I'm pretty happy with it now. Let me know if it is fully working for you.

Barney
Title: Re: LG LCD Template
Post by: huh on October 18, 2010, 06:23:12 am
B4rney- got my null modem cable tonight and once plugged in, Sarah detects my TV and I am able to click through the options- it appears to work great on my 32LH40 (btw, using RGB and an audio cable because my latitude D810 has no other video outputs...)

The only problem I have discovered is with the audio up/down.  Surprisingly, mute works great, but volume up/down do not work.  I have confirmed that the correct command (kf 01 ___) are listed for command #313 Set Volume.

Maybe like ladekribs, something quirky happened with this installation (don't know what snapshot I'm using currently).  Will experiment and post back as I go.

Thanks again



Title: Re: LG LCD Template
Post by: ladekribs on October 19, 2010, 08:46:55 pm
B4arney,

I have Reinstalled core, replaced USB/serial adapter,
but while testing I messed up the template, could you please post your #373 Private Method Listing?

BR Stefan
Title: Re: LG LCD Template
Post by: posde on October 20, 2010, 08:04:33 am
If you messed up a template locally, you can always revert. in web admin - Advanced / sqlCVS / Diff - select the IR repo if you messed with the codes, select diff. Choose the change you made and select revert.
Title: Re: LG LCD Template
Post by: ladekribs on October 20, 2010, 10:03:18 am
Thank You POSDE,

actually I looked their but got confused , will try again with your instruction.



BR Stefan
Title: Re: LG LCD Template
Post by: b4rney on October 22, 2010, 11:42:08 am
Hey Guys,

Sorry for the delay.

@ladekribs, posde's advice is the best way to revert to the current template. Once done you can try again. Below is #373 Private Method Listing if you're sure that is your problem. This is simply the send command with additional arguments.
Code: [Select]
# Private - Date: 28.02.2008
# the docs are wrong.  they say responses are terminated with a \r.  In reality some sets do, others don't.

def SendCommand(command,timeout,retransmit)
for i in 0...retransmit
conn_.Send(command + "\r")
# wait up to 8 seconds since it may be very slow if this is an 'on' command

    buf = conn_.RecvDelimited("x", timeout)
   
    if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?))
print "Received good reply in less than ", timeout, "ms: ", buf, "\n"
return
else
buf = conn_.Recv(1000,1000);
print "Flushed buffer: ", buf, "invalid resonse in ", timeout, "seconds\n"
end
end
end
Title: Re: LG LCD Template
Post by: b4rney on October 22, 2010, 11:47:04 am
@huh

Sorry you're having problems. Make sure you have the latest #355 from the earlier post:
http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457

This now queries the TV for the current volume level then simply sets it to the same level. If this is working you should see the TVs volume bar appear after a 'quick reload router' as your md sends the command.

If not then try replacing cmd_313(volume_level) in #355 with a fixed number like this:
cmd_313(8)

This will simply set the volume to 8. This is not best practice but if it works it will help me diagnose the problem.

Please keep me informed as I'd like to nail this.
Barney
Title: Re: LG LCD Template
Post by: huh on October 23, 2010, 04:56:23 am
Thanks b4rney- I have a different issue ATM.  As discussed in another thread, my usb-to-serial devices keeps getting detected and asks me which room it is in.  If I ignore it for now, it asks in a short while and if I ignore it permanently then my TV isn't controlled.  And, setting it up again adds another device in the web admin.

I believe the answer in the other thread was to add a stand-alone pci to serial adapter and be done with it- not an option in my case where I am on a Dell Latitude D800.  The laptop does, however, have a serial port on the back.  When I plugged the TV into that, I initially thought the port was disable because nothing was detected.  Upon reboot, I saw that it was connected, so for kicks I changed the com from com1 to com2 and reboot LMCE (this is a MD BTW- not my core) with the TV connected.

I have not played with it a whole lot yet, but thus far it is not being detected....  not sure where to go, but am using a snapshot from september or so, so probably time to kill it and start again.

Title: Re: LG LCD Template
Post by: huh on October 24, 2010, 07:15:11 am
OK- manually set the comm port to TTSY2 in the admin page and using putty, I can control the tv- e.g. /usr/pluto/bin/TestSerialPort -p /dev/ttyS2 -P N81 -b 9600 -t "kf 01 08\r"  sets the volume at 8.


Manually, it works great.  I can control the volume, on/off, etc.  Not sure why LMCE doesn't control it directly- pushing the green MCE button on my remote does not turn on the TV as it did before and pushing volume up/down does not change the volume. I'm convinced the template works great, just something odd on my system...
Title: Re: LG LCD Template
Post by: b4rney on October 24, 2010, 10:12:35 pm
huh,

Did you try my suggestion above? Manually setting the volume control in the init script #355.
.... try replacing cmd_313(volume_level) in #355 with a fixed number like this:
cmd_313(8)

This will simply set the volume to 8. This is not best practice but if it works it will help me diagnose the problem.
From my experience it seems that if the LG isn't initialized properly then it won't work.

Also, I've had problems with usb to rs232 adapters (using various null modem cables). I've now bought 5 or 6 adapters. Only one works. Others fail to detect the LG despite running through the pnp scripts.
Barney
Title: Re: LG LCD Template
Post by: huh on October 25, 2010, 01:25:54 am
B4rney- I don't know how to test the command one I put in a discrete volume level into the code.  Instead of putting it in the template, I tried over a command line to make sure that I had the correct serial port set in the admin pages.  This way I was also able to test discrete volume commands:  e.g. set to level 6.  These worked just fine.  So as you said, maybe something didn't get initialized correctly.

I really need to can my install and go again with a new snapshot.  Esev, pos, lol3sol and merkur2k (to name a few) have really been adding a lot of patches in the recent past.  Going to wait until those get burned in a new snapshot and reinstall.   I will get serious about trying to resolve this then as well.

Thanks-

Title: Re: LG LCD Template
Post by: etNHGfU8 on October 31, 2010, 12:57:53 am
These questions correspond to posting: http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457 (http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457)

I have an LG 55LH40 connected to a hybrid which I'm hoping to get working effectively with LinuxMCE.

1. Ensure that your LG TV has the same commands as device template 2126. Check your manual. As far as I can see (looking at recent LG manuals) most LGs share mostly the same RS232 commands.

My ignorance prevented me from effectively performing this request.  After much looking around the LinuxMCE wiki I guessed that I had to basically jump down to the 3rd, 4th, and 5th entries in the list to confirm the commands.  My manual and the commands are different as the 6th entry notes some of the necessary changes.

Why not just create a new device template based on the existing template rather than modifying the existing template? The LG 55LH40 has an additional HDMI port (#4). Should an entirely new device template be created? According to my manual, 18 TVs are controlled by the same commands.

2. Change the Plug and Play script  on your MD in /usr/pluto/pnp/20_LG_TV.sh to point to device template 2126. It should look like this.

Does the hybrid use the same script?  I updated the script and disconnected the serial connection and reconnected but the connection was not acted upon. I also tried using the TV portion of the Setup Wizard but it failed to detect the serial connection as well. I can send commands directly to the serial connection and I know it works because I can turn off the TV and then turn it back on again.

I will do everything necessary to get this to work because I bought this specific TV because of the RS232 interface.  I also want to ensure that the next time I decide to reinstall from scratch that minimal configuration will be necessary and can all be done from the Setup Wizard.

Thanks, Tom
Title: Re: LG LCD Template
Post by: b4rney on November 01, 2010, 12:06:44 am
Hi Tom,

You are correct, the idea is to make new templates which will eventually be rolled into releases. At the moment I am just asking people to test the changes I have implemented in order to get it configured as a start point for new templates.

I have looked at your TV's manual and most of the commands are identical. Look at the section 'External Control through RS232' towards the end of the pdf.

Regarding your problem, when you plug in the TV via RS232 does it trigger the PnP scripts to run? It should! If not make sure you have a compatible Null Modem cable. I have had the most problems making the physical connections. I have 3 LG TVs. I can get 2 of them working using the same usb>rs232 plus a properly wired null modem cable. Sadly only one of my many usb>rs232 adapters actually works.  Don't ask me why, I ordered the same model from the same seller on ebay.

I'm happy to help you get your LG working. It is weird that you can send commands directly but yet it is not detected. There are many people with usb adapter problems (with advice from Thom to use PCI rs232 cards). Do you have several usb devices in your hybrid?

Reply here or PM me and I'll help as much as I can.
Barney
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 01, 2010, 03:33:10 am
I bought a RS232 to USB adapter (Cables Unlimted USB 2.0 to Serial DB9 Adapter) but it failed to work for me so I ordered up a Gigabyte motherboard COMM port Adapter and connected directly to the Null modem cable (StarTech.com Serial Null Modem Cable - DB-9 Female - DB-9 Female). I was then able to successfully send commands to the TV but LinuxMCE still failed to recognize the connection when I connected the TV to the computer. Could this be because I'm running a hybrid and not an MD?

I do have a number of USB devices on my system (USB-UIRT, remote, and wireless keyboard/mouse).

I'll do the rest of the configuration steps noted in your previous posting and see if I can get it set up manually for the time being.

- Tom
Title: Re: LG LCD Template
Post by: b4rney on November 01, 2010, 10:22:48 pm
Hi Tom,

It's a strange coincidence but .... the only LG TV that won't work on my system is in fact attached to the core/hybrid like yours.

I've had my hybrid launch the pnp scripts when plugged into the TV with a straight through rs232 cable but it doesn't detect the TV (this is normal behaviour when not using a null modem cable). I guess I'll have to check my pinouts.

I have bought some null modem cables on ebay which specify the pin crossovers as follows:
pin 2 ...to... pin 3
pin 3 ...to... pin 2
pin 4 ...to... pin 6
pin 5 ...to... pin 5
pin 6 ...to... pin 4
pin 7 ...to... pin 8
pin 8 ...to... pin 7
These work where others fail (but still not on my hybrid). Hope this helps.

Barney
Title: Re: LG LCD Template
Post by: ladekribs on November 03, 2010, 08:39:40 am
Hi Barney,

I did some more testing yesterday, after reinstalling core(twice) I carefully followed your steps,
 and then moved the core to the TV ,there all the relevant commands seems to work well,
I tested the init,volume up/down and mute and also power on when already on is faster, (that is good!)

next step will be to let the MD control the tv that is what failed for me last time.


BR Stefan
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 03, 2010, 03:55:35 pm
I confirmed that my null modem cable matched your pin-outs (which are consistent with those listed in the LG manual).

I also reattached the USB adapter and tried it and I was able to use it to communicate to the TV using TestSerialPort via ttyUSB1. It appears that I had been trying ttyUSB0 previously.

Unfortunately, neither approach triggers PNP capabilities.

Any idea what causes the 20_LG_TV.sh script to run or where it is ran from?

Thanks, Tom
Title: Re: LG LCD Template
Post by: ladekribs on November 03, 2010, 05:36:22 pm
I made a quick test on the MD now, and the odd thing is that now the pnp engine asks if i connected a 20ls7d tv and ignores the 37LH30 script. and the device gets disabled.

Title: Re: LG LCD Template
Post by: b4rney on November 04, 2010, 12:44:37 am
@ladekribs
Did you edit the 20_LG_TV.sh on the MD to point to template 2126?

@Tom
Not sure about why pnp won't detect the TV. Is it possible to manually add the LG in web admin from the 37LH30 Template (2126)?
Here is a screenshot of my AV Equipment screen.
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 04, 2010, 11:40:04 am
[quote author=b4rney link=topic=9729.msg75297#msg75297 date=1288827877
Not sure about why pnp won't detect the TV. Is it possible to manually add the LG in web admin from the 37LH30 Template (2126)?
[/quote]

I tried that yesterday.  After I specified it from web admin some stuff popped up on the TV monitor to specify additional settings but after selecting the necessary settings LinuxMCE complained that the TV was not accessible or something like that and I was forced to press OK to acknowledge the message.

As seen below, the operating system is detecting the connection and disconnection of the cable. LinuxMCE seems to behave oblivious to the actions.

From /var/log/syslog
Code: [Select]
...
Nov  3 09:30:53 dcerouter kernel: [511263.568076] usb 2-1: new full speed USB device using ohci_hcd and address 4
Nov  3 09:30:53 dcerouter kernel: [511263.747610] usb 2-1: configuration #1 chosen from 1 choice
Nov  3 09:30:53 dcerouter kernel: [511263.749200] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
Nov  3 09:30:53 dcerouter kernel: [511263.749470] ftdi_sio: Detected FT232RL
Nov  3 09:30:53 dcerouter kernel: [511263.749924] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB1
...
Nov  3 09:43:12 dcerouter kernel: [512002.105088] usb 2-1: USB disconnect, address 4
Nov  3 09:43:12 dcerouter kernel: [512002.108564] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
Nov  3 09:43:12 dcerouter kernel: [512002.108867] ftdi_sio 2-1:1.0: device disconnected
...
Nov  3 09:43:18 dcerouter kernel: [512008.260059] usb 2-1: new full speed USB device using ohci_hcd and address 5
Nov  3 09:43:18 dcerouter kernel: [512008.439420] usb 2-1: configuration #1 chosen from 1 choice
Nov  3 09:43:18 dcerouter kernel: [512008.441127] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
Nov  3 09:43:18 dcerouter kernel: [512008.441398] ftdi_sio: Detected FT232RL
Nov  3 09:43:18 dcerouter kernel: [512008.441854] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB1
...
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 04, 2010, 12:22:19 pm
After further searching I found the following entry in /var/log/pluto/Spawn_cdc_4016.log: "Problem installing pluto-generic-serial-device (100)."

I attempted to perform the installation from the command line but it failed as well.

Code: [Select]
tap@dcerouter:/var/log$ sudo apt-get install pluto-generic-serial-device
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libtcltk-ruby1.8 tcl8.4 tk8.4
Suggested packages:
  tclreadline
The following NEW packages will be installed:
  libtcltk-ruby1.8 pluto-generic-serial-device tcl8.4 tk8.4
0 upgraded, 4 newly installed, 0 to remove and 17 not upgraded.
Need to get 2750kB/6882kB of archives.
After this operation, 24.6MB of additional disk space will be used.
Do you want to continue [Y/n]?
WARNING: The following packages cannot be authenticated!
  tcl8.4 tk8.4 libtcltk-ruby1.8 pluto-generic-serial-device
Authentication warning overridden.
Err http://us.archive.ubuntu.com intrepid/main tk8.4 8.4.19-1
  404 Not Found [IP: 91.189.92.172 80]
Err http://us.archive.ubuntu.com intrepid-updates/universe libtcltk-ruby1.8 1.8.7.72-1ubuntu0.2
  404 Not Found [IP: 91.189.92.172 80]
Err http://archive.ubuntu.com intrepid/main tk8.4 8.4.19-1
  404 Not Found [IP: 91.189.88.45 80]
Err http://security.ubuntu.com intrepid-security/universe libtcltk-ruby1.8 1.8.7.72-1ubuntu0.2
  404 Not Found [IP: 91.189.92.166 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/t/tk8.4/tk8.4_8.4.19-1_i386.deb  404 Not Found [IP: 91.189.88.45 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/r/ruby1.8/libtcltk-ruby1.8_1.8.7.72-1ubuntu0.2_i386.deb  404 Not Found [IP: 91.189.92.166 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
tap@dcerouter:/var/log$

Are the packages still available for the Intrepid release?
Title: Re: LG LCD Template
Post by: b4rney on November 04, 2010, 01:16:19 pm
Hi Tom,

I only have pluto-generic-serial-dev on my system, version 2.0.0.44.10091623289.
Hope this helps.

Barney
Title: Re: LG LCD Template
Post by: ladekribs on November 05, 2010, 08:40:23 am
@Barney
Oops no I did not change the 20_LG_TV.sh on the MD I expected it to come from the Core, but i guess I created the MD before changing the script.
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 06, 2010, 10:15:26 pm
Barney, now that I got pluto-generic-serial-device installed, I completed the steps in http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457 (http://forum.linuxmce.org/index.php?topic=9729.msg74457#msg74457) and I'm now seeing an issue output in kern.log:

Code: [Select]
Nov  6 15:21:01 dcerouter kernel: [  303.532127] HDMI: detected monitor LG TV
Nov  6 15:21:01 dcerouter kernel: [  303.532131]        at connection type HDMI
Nov  6 15:21:01 dcerouter kernel: [  303.532154] ------------[ cut here ]------------
Nov  6 15:21:01 dcerouter kernel: [  303.532161] WARNING: at /build/buildd/linux-2.6.27/lib/vsprintf.c:600 vsnprintf+0x7ae/0x7b0()
Nov  6 15:21:01 dcerouter kernel: [  303.532167] Modules linked in: ztdummy zaptel crc_ccitt xt_TCPMSS ipt_MASQUERADE ipt_TTL iptable_mangle xt_tc\
pudp xt_mark xt_state iptable_nat bridge stp bnep sco rfcomm l2cap bluetooth nfsd auth_rpcgss exportfs ppdev autofs4 powernow_k8 cpufreq_ondemand \
cpufreq_powersave cpufreq_userspace cpufreq_conservative cpufreq_stats freq_table video output pci_slot sbs sbshc container battery nfs lockd nfs_\
acl sunrpc af_packet iptable_filter ip_tables x_tables ac nf_nat_irc nf_nat_ftp nf_nat nf_conntrack_irc nf_conntrack_ftp nf_conntrack_ipv4 nf_conn\
track sbp2 lp snd_hda_codec_nvhdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq snd_timer snd_seq_device snd joydev\
 ftdi_sio usbserial i2c_piix4 evdev pcspkr soundcore nvidia(P) parport_pc parport i2c_core snd_page_alloc button wmi ati_agp agpgart shpchp pci_ho\
tplug ipv6 ext3 jbd mbcache pata_acpi sr_mod cdrom sd_mod crc_t10dif usbhid hid pata_atiixp sg ohci1394 ata_generic r8169 ahci ieee1394 mii libata\
 scsi_m
Nov  6 15:21:01 dcerouter kernel: d ehci_hcd ohci_hcd dock usbcore sky2 raid10 raid456 async_xor async_memcpy async_tx xor raid1 raid0 multipath l\
inear md_mod thermal processor fan nbd fbcon tileblit font bitblit softcursor fuse
Nov  6 15:21:01 dcerouter kernel: [  303.532387] Pid: 4397, comm: hd-audio1 Tainted: P          2.6.27-17-generic #1
Nov  6 15:21:01 dcerouter kernel: [  303.532400]  [<c037e40b>] ? printk+0x1d/0x22
Nov  6 15:21:01 dcerouter kernel: [  303.532415]  [<c0131fd9>] warn_on_slowpath+0x59/0x90
Nov  6 15:21:01 dcerouter kernel: [  303.532427]  [<c037ffce>] ? account_scheduler_latency+0xe/0x220
Nov  6 15:21:01 dcerouter kernel: [  303.532437]  [<c0253f81>] ? number+0x291/0x2a0
Nov  6 15:21:01 dcerouter kernel: [  303.532451]  [<c0253f81>] ? number+0x291/0x2a0
Nov  6 15:21:01 dcerouter kernel: [  303.532460]  [<c011292e>] ? native_smp_send_reschedule+0x3e/0x60
Nov  6 15:21:01 dcerouter kernel: [  303.532476]  [<c012a300>] ? resched_task+0x60/0x70
Nov  6 15:21:01 dcerouter kernel: [  303.532485]  [<c012ae25>] ? check_preempt_wakeup+0x1a5/0x200
Nov  6 15:21:01 dcerouter kernel: [  303.532503]  [<c0254e2e>] vsnprintf+0x7ae/0x7b0
Nov  6 15:21:01 dcerouter kernel: [  303.532512]  [<c012b81b>] ? default_wake_function+0xb/0x10
Nov  6 15:21:01 dcerouter kernel: [  303.532522]  [<c0147720>] ? autoremove_wake_function+0x20/0x50
Nov  6 15:21:01 dcerouter kernel: [  303.532534]  [<c0121780>] ? __wake_up_common+0x40/0x70
Nov  6 15:21:01 dcerouter kernel: [  303.532546]  [<c0122aa0>] ? __wake_up+0x40/0x50
Nov  6 15:21:01 dcerouter kernel: [  303.532553]  [<c013271b>] ? wake_up_klogd+0x3b/0x40
Nov  6 15:21:01 dcerouter kernel: [  303.532560]  [<c01328e1>] ? release_console_sem+0x1c1/0x1d0
Nov  6 15:21:01 dcerouter kernel: [  303.532570]  [<c0254eba>] snprintf+0x1a/0x20
Nov  6 15:21:01 dcerouter kernel: [  303.532580]  [<f8c4a659>] snd_print_pcm_bits+0x69/0x70 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532613]  [<f8c53a70>] snd_hdmi_show_eld+0x120/0x150 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532644]  [<f8c4b729>] ? snd_hda_power_down+0x9/0x80 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532669]  [<f8c4c597>] ? codec_exec_verb+0x87/0xe0 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532693]  [<c01ad51e>] ? __slab_free+0xe/0xf0
Nov  6 15:21:01 dcerouter kernel: [  303.532710]  [<f8c53bb3>] ? snd_hdmi_get_eld+0xe3/0x2e0 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532734]  [<f8c53bb3>] ? snd_hdmi_get_eld+0xe3/0x2e0 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532759]  [<f8d1d6e2>] hdmi_unsol_event+0xd2/0x110 [snd_hda_codec_nvhdmi]
Nov  6 15:21:01 dcerouter kernel: [  303.532776]  [<f8c4a0a0>] ? process_unsol_events+0x0/0x70 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532800]  [<f8c4a0f3>] process_unsol_events+0x53/0x70 [snd_hda_codec]
Nov  6 15:21:01 dcerouter kernel: [  303.532819]  [<c0143885>] run_workqueue+0x95/0x160
Nov  6 15:21:01 dcerouter kernel: [  303.532828]  [<c0147856>] ? finish_wait+0x16/0x70
Nov  6 15:21:01 dcerouter kernel: [  303.532837]  [<c0143b28>] worker_thread+0x88/0xf0
Nov  6 15:21:01 dcerouter kernel: [  303.532847]  [<c0147700>] ? autoremove_wake_function+0x0/0x50
Nov  6 15:21:01 dcerouter kernel: [  303.532858]  [<c0143aa0>] ? worker_thread+0x0/0xf0
Nov  6 15:21:01 dcerouter kernel: [  303.532869]  [<c0147391>] kthread+0x41/0x80
Nov  6 15:21:01 dcerouter kernel: [  303.532880]  [<c0147350>] ? kthread+0x0/0x80
Nov  6 15:21:01 dcerouter kernel: [  303.532891]  [<c0105297>] kernel_thread_helper+0x7/0x10
Nov  6 15:21:01 dcerouter kernel: [  303.532903]  =======================
Nov  6 15:21:01 dcerouter kernel: [  303.532911] ---[ end trace c2cc802782e9d57d ]---
Nov  6 15:21:01 dcerouter kernel: [  303.532918] HDMI: supports coding type LPCM: channels = 2, rates = 44100 48000 88200, bits = 16

Any idea what's up?
Title: Re: LG LCD Template
Post by: b4rney on November 06, 2010, 10:36:26 pm
Hi Tom,

Sorry, that is way over my head. I doubt whether it is directly related to the LG template changes. Perhaps someone else can help ... anyone?

Barney
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 07, 2010, 01:49:18 pm
Barney, I'm going to assume that my comments in my previous posting were related to the apt-get update/upgrade that I did recently and are not related to the matters of this thread.

So now my question is how do I know if the template is working or not?  I'm not seeing any behavioral changes in the system.

I thought that at least the display would turn off when I select "Display off" after pressing the power button on my remote but that doesn't even occur.

I went through the Setup Wizard and confirmed that it knows that the TV is connected via the serial cable.

Title: Re: LG LCD Template
Post by: b4rney on November 07, 2010, 05:31:36 pm
Hi Tom,

I recently upgraded as well and although my template still worked the 20_LG_TV.sh pnp script got overwritten, so my TV was detected as the wrong template. Make sure you are still using template 2126.

When I quick reload router I usually see the tv volume flash up on screen as it is set by the MD (init script).
A few standard features:
1. Control the TV volume with any orbiter when playing media
2. When the TV is in standby pressing menu button turns on the TV
3. Likewise, when the MD goes into standby it will turn off the TV (after 10 minutes I think)

I don't use the display off command. You could set your MDs standby time to a smaller value if you prefer.

Let me know if you get it working.
Barney
Title: Re: LG LCD Template
Post by: ladekribs on November 25, 2010, 08:36:43 pm
Hi Barney,
Sorry for being so slow on testing, but finally I can confirm that it is working on my 47LH4000 LG TV.

these are my settings now

Code: [Select]
Power
#193 Off
SendCommand("ka 01 00",1000,2)
#192 On
SendCommand("ka 01 01",10000,4)
Inputs
#316 AV 1
SendCommand("xb 01 02",1000,4)
#317 AV 2
SendCommand("xb 01 21",1000,4)
#712 Component 1
SendCommand("xb 01 05",1000,4)
#361 HDMI
SendCommand("xb 01 90",1000,4)
#767 HDMI 2
SendCommand("xb 01 91",1000,4)
#930 HDMI 3
SendCommand("xb 01 92",1000,4)
#154 RGB
SendCommand("xb 01 60",1000,4)
#166 Tuner
SendCommand("xb 01 10",1000,4)
#873 Tuner - Digital
SendCommand("xb 01 00",1000,4)
General
#190 Enter/Go

Internal
#373 Private Method Listing
# Private - Date: 28.02.2008 # the docs are wrong. they say responses are terminated with a \r. In reality some sets do, others don't. def SendCommand(command,timeout,retransmit) for i in 0...retransmit conn_.Send(command + "\r") # wait up to 8 seconds since it may be very slow if this is an 'on' command buf = conn_.RecvDelimited("x", timeout) if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?)) print "Received good reply in less than ", timeout, "ms: ", buf, "\n" return else buf = conn_.Recv(1000,1000); print "Flushed buffer: ", buf, "invalid resonse in ", timeout, "seconds\n" end end end
#351 Process IDLE

#350 Process Incoming Data

#355 Process Initialize
# Initialize --- Date: 28.02.2008 # the docs are wrong. they say responses are terminated with a \r. In reality some sets do, others don't. # some sets won't respond to ka 01 ff when the tv is off. others do. @mute = false; # unfortunately we have to turn the device on if it's off to know that it's alive or else it won't respond to anything @input=-1 for iRetry in 0...4 print "Initializing unit\n" # Query the current volume level conn_.Send("kf 1 ff\r") # wait 4 seconds for the status command, which won't work if the tv is off $buf = conn_.RecvDelimited("x", 4000) if( !$buf.nil? && !$buf.index("01 OK").nil? ) print "Initialized ok - tv is on\n" # Use the returned response to set the volume x = $buf.index("OK") volume_level =$buf[x+2,2].to_i(16) print "Setting volume to ", volume_level, "\n" cmd_313(volume_level) return end print "TV is either off or not connected\n" # try turning it on conn_.Send("ka 1 01\r") # wait 10 seconds for the TV to respond sleep(10) # Query the current volume level conn_.Send("kf 1 ff\r") # wait 4 seconds for the status command, which won't work if the tv is off $buf = conn_.RecvDelimited("x", 4000) if( !$buf.nil? && !$buf.index("01 OK").nil? ) print "Initialized ok - tv was off\n" # Use the returned response to set the volume x = $buf.index("OK") volume_level =$buf[x+2,2].to_i(16) print "Setting volume to ", volume_level, "\n" cmd_313(volume_level) # Turn TV off again conn_.Send("ka 1 00\r") return end print "TV is not connected\n" sleep(1) end #DisableDevice( device_.devid_, true ) print "The device wouldn't respond. Disabling it.\n"
#384 Process Receive Command For Child

#356 Process Release

Numbers
#204 0
<$"mc 01 10\r"$>
#205 1
<$"mc 01 11\r"$>
#206 2
<$"mc 01 12\r"$>
#207 3
<$"mc 01 13\r"$>
#208 4
<$"mc 01 14\r"$>
#209 5
<$"mc 01 15\r"$>
#210 6
<$"mc 01 16\r"$>
#211 7
<$"mc 01 17\r"$>
#212 8
<$"mc 01 18\r"$>
#213 9
<$"mc 01 19\r"$>
Simple Control
#64 Skip Back - Channel/Track Lower
<$"mc 01 01\r"$>
#63 Skip Fwd - Channel/Track Greater
<$"mc 01 00\r"$>
Sound & Volume
#97 Mute
if(@mute) SendCommand("ke 01 00",10000,4) else SendCommand("ke 01 01",10000,4) end @mute=!@mute
#313 Set Volume
@volume=level.to_i() ilevel = (@volume).to_i print "setting volume to ", ilevel , "\n" if ilevel <16 SendCommand("kf 01 0" + "%x" % ilevel,1000,4) else SendCommand("kf 01 " + "%x" % ilevel,1000,4) end SetDeviceDataInDB( device_.devid_,device_.devid_.to_i , ilevel.to_s) print "volume and corresponding device data set\n"
#90 Vol Down
print "lowering volume from ", @volume, "\n" cmd_313(@volume-1)
#89 Vol Up
print "raising volume from ", @volume, "\n" cmd_313(@volume+1)

so now I can select tuner and change channels with the MCE remote.

Title: Re: LG LCD Template
Post by: b4rney on November 26, 2010, 12:44:51 am
Hi ladekribs,

That's great. Did this work by following the instructions in this thread or did you have to further customise your setup?

Barney
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 26, 2010, 02:00:41 am
I haven't had much chance to play with things lately but I do notice that a dialog flashes on screen during the boot with '37LH30' in it although I still see no behavioral differences.

Pressing the Main Menu button on my Gyration remote produces the following output in /var/log/pluto/DCERouter.log
Code: [Select]
08      11/25/10 18:31:39.477           Received Message from 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m) to 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m), type 1 id 192 Command:^[[35;1mOn^[[0m\
, retry none, parameters: <0x741fdb90>
08      11/25/10 18:31:39.477             Parameter 21(Force): 1 <0x741fdb90>
08      11/25/10 18:31:39.477             Parameter 97(PK_Pipe): 0 <0x741fdb90>
08      11/25/10 18:31:39.477             Parameter 98(PK_Device_Pipes):  <0x741fdb90>
08      11/25/10 18:31:39.478           Received Message from 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m) to 20 (^[[36;1mThe core/hybrid / Family Room^[[0m), type 1 id 192 Command:^[[35;1mOn^[[0m,\
 retry none, parameters: <0xaafeeb90>
08      11/25/10 18:31:39.478             Parameter 21(Force): 1 <0xaafeeb90>
08      11/25/10 18:31:39.478             Parameter 97(PK_Pipe): 0 <0xaafeeb90>
08      11/25/10 18:31:39.478             Parameter 98(PK_Device_Pipes):  <0xaafeeb90>
08      11/25/10 18:31:39.478             Parameter 125(Already processed): 1 <0xaafeeb90>
08      11/25/10 18:31:39.479           Received Message from 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m) to 43 (^[[36;1mVSX-36TX / Family Room^[[0m), type 1 id 192 Command:^[[35;1mOn^[[0m, retry \
none, parameters: <0xb6508b90>
08      11/25/10 18:31:39.479             Parameter 98(PK_Device_Pipes):  <0xb6508b90>
08      11/25/10 18:31:39.479           Received Message from 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m) to 43 (^[[36;1mVSX-36TX / Family Room^[[0m), type 1 id 91 Command:^[[35;1mInput Select^[[0\
m, retry none, parameters: <0xb6508b90>
08      11/25/10 18:31:39.479             Parameter 71(PK_Command_Input(VCR-2)): 283 <0xb6508b90>
08      11/25/10 18:31:39.479           Received Message from 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m) to 60 (^[[36;1m37LH30 RS232 / Family Room^[[0m), type 1 id 192 Command:^[[35;1mOn^[[0m, re\
try none, parameters: <0xb6508b90>
08      11/25/10 18:31:39.479             Parameter 98(PK_Device_Pipes):  <0xb6508b90>
08      11/25/10 18:31:39.479           Received Message from 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m) to 60 (^[[36;1m37LH30 RS232 / Family Room^[[0m), type 1 id 91 Command:^[[35;1mInput Select\
^[[0m, retry none, parameters: <0xb6508b90>
08      11/25/10 18:31:39.479             Parameter 71(PK_Command_Input(HDMI)): 361 <0xb6508b90>
05      11/25/10 18:31:39.479           ^[[33;1mThe target device 20 (routed to 20) has not registered.^[[0m <0xb6508b90>
08      11/25/10 18:31:39.582           Received Message from 21 (^[[36;1mOnScreen Orbiter / Family Room^[[0m) to 40 (^[[36;1mUSB UIRT 0038 / Family Room^[[0m), type 1 id 687 Command:^[[35;1mSet Screen\
 Type^[[0m, retry none, parameters: <0x741fdb90>
08      11/25/10 18:31:39.582             Parameter 48(Value): 0 <0x741fdb90>

My receiver starts correctly but the TV remains off even though it was obviously told to turn on based on the logged information. Device 60's "COM Port on PC" is set to /dev/ttyUSB0 and it's template is 2126.

The following still successfully starts the TV:
/usr/pluto/bin/TestSerialPort -p /dev/ttyUSB0 -P N81 -b 9600 -t "ka 00 01\r\n" -s "a 01 " -i 8

Suggestions?
Title: Re: LG LCD Template
Post by: b4rney on November 26, 2010, 10:51:22 am
Hi etNHGfU8,

Very strange that you can manually send the command. It seems that something must be wrong with your ruby commands.

I have found that command #355 is very important in initialising the TV. I use the following for power on:
Code: [Select]
conn_.Send("ka 1 01\r")
It is possible that you need to send this:
Code: [Select]
conn_.Send("ka 01 01\r")
Also, did lmce detect the LGTV and ask you what room etc?
Barney
Title: Re: LG LCD Template
Post by: ladekribs on November 26, 2010, 12:39:59 pm
@Barney,

yes I followed Your instructions and added som more commands as above,but I could not get it plug & play.
when I followed your instructions it kept asking if I had the LG 20LD(or what the name is), so I tried to rename the 20_LG_TV.sh
to 37_LH_TV.sh then it discovered the tv but kept on disabling and redetecting it in a loop. So I had to manually enter it.

@etNHGfU8,
have you tried sending commands from remote control resend A/V codes?


BR Stefan
Title: Re: LG LCD Template
Post by: b4rney on November 26, 2010, 12:51:42 pm
@Stefan

It sounds like your pnp script isn't correct.

Did you edit the pnp script (20_LG_TV.sh) on the MD to point to template 2126?

Barney
Title: Re: LG LCD Template
Post by: etNHGfU8 on November 27, 2010, 02:58:33 am
Very strange that you can manually send the command. It seems that something must be wrong with your ruby commands.
...
Also, did LinuxMCE detect the LGTV and ask you what room etc?

I tried adding
Code: [Select]
conn_.Send("ka 1 01\r")and
Code: [Select]
conn_.Send("ka 01 01\r")to numbers 0 and 1 for testing purposes but neither activated the TV when tested from the Edit IR codes page.

I did notice the following in theDCERouter.log file whenever a command was sent to the TV. I don't know if it is relevant or not.
Code: [Select]
05      11/26/10 19:34:53.192           ^[[33;1mThe target device 20 (routed to 20) has not registered.^[[0m <0xb6508b90>

The Device Log for Device 60 looks like this:
Code: [Select]
05 11/26/10 7:50:21.677 Going to rotate logs... <0xb5798b90>
05 11/26/10 16:42:36.059 GSDMessageTranslator isCmdImplemented = true <0xb5798b90>
05 11/26/10 16:42:36.289 #### Pre-Process Queue = 1 <0xb5798b90>
05 11/26/10 16:42:36.289 _QueueProc Pre - 192 : 0 <0xb6f9bb90>
05 11/26/10 16:42:36.289 GSD-Sleep Pre 192 : 0 <0xb6f9bb90>
05 11/26/10 16:42:36.289 Process Queue = 19 <0xb6f9bb90>
05 11/26/10 16:42:36.290 GSDMessageTranslator isCmdImplemented = false <0xb5798b90>
05 11/26/10 16:42:36.290 GSDMessageTranslator isCmdImplemented = true <0xb5798b90>
05 11/26/10 16:42:36.290 #### Pre-Process Queue = 1 <0xb5798b90>
01 11/26/10 16:42:54.004 Ruby was unable to handle the command in reasonable amount of time <0xb6f9bb90>
05 11/26/10 16:42:57.005 GSD-Sleep Post 192 : 3000 <0xb6f9bb90>
05 11/26/10 16:42:57.005 _QueueProc Post - 192 : 3000 <0xb6f9bb90>
05 11/26/10 16:42:57.005 _QueueProc Pre - 361 : 0 <0xb6f9bb90>
05 11/26/10 16:42:57.005 GSD-Sleep Pre 361 : 0 <0xb6f9bb90>
05 11/26/10 16:42:57.005 Process Queue = 20 <0xb6f9bb90>
01 11/26/10 16:43:15.000 Ruby was unable to handle the command in reasonable amount of time <0xb6f9bb90>
05 11/26/10 16:43:17.002 GSD-Sleep Post 361 : 2000 <0xb6f9bb90>
05 11/26/10 16:43:17.002 _QueueProc Post - 361 : 2000 <0xb6f9bb90>
05 11/26/10 16:43:23.142 GSDMessageTranslator isCmdImplemented = true <0xb5798b90>
05 11/26/10 16:43:23.142 #### Pre-Process Queue = 1 <0xb5798b90>
05 11/26/10 16:43:23.142 GSDMessageTranslator isCmdImplemented = false <0xb5798b90>
05 11/26/10 16:43:23.142 GSDMessageTranslator isCmdImplemented = true <0xb5798b90>
05 11/26/10 16:43:23.142 #### Pre-Process Queue = 2 <0xb5798b90>
05 11/26/10 16:43:23.162 _QueueProc Pre - 192 : 0 <0xb6f9bb90>
05 11/26/10 16:43:23.162 GSD-Sleep Pre 192 : 0 <0xb6f9bb90>
05 11/26/10 16:43:23.162 Process Queue = 21 <0xb6f9bb90>
01 11/26/10 16:43:41.000 Ruby was unable to handle the command in reasonable amount of time <0xb6f9bb90>
05 11/26/10 16:43:44.001 GSD-Sleep Post 192 : 3000 <0xb6f9bb90>
05 11/26/10 16:43:44.001 _QueueProc Post - 192 : 3000 <0xb6f9bb90>
05 11/26/10 16:43:44.001 _QueueProc Pre - 361 : 0 <0xb6f9bb90>
05 11/26/10 16:43:44.001 GSD-Sleep Pre 361 : 0 <0xb6f9bb90>
05 11/26/10 16:43:44.001 Process Queue = 22 <0xb6f9bb90>
01 11/26/10 16:44:02.001 Ruby was unable to handle the command in reasonable amount of time <0xb6f9bb90>
05 11/26/10 16:44:04.000 GSD-Sleep Post 361 : 2000 <0xb6f9bb90>
05 11/26/10 16:44:04.001 _QueueProc Post - 361 : 2000 <0xb6f9bb90>

So it appears that outside LinuxMCE the TV can be controlled but within LinuxMCE something is not set up correctly with respect to the serial connection. Device 20 does not have a log file.

I never got LinuxMCE to automatically detect the serial connection. I had to set it up manually (obviously wrong).

- Tom
Title: Re: LG LCD Template
Post by: b4rney on November 27, 2010, 01:40:49 pm
@Tom

I agree. I think if you can get lmce to detect and setup the LG it will probably work.

Before you manually added the TV did lmce detect the TV and run through the scripts at all? If not, I think it is a good idea to concentrate on getting it detected. There must be a link between the failure of lmce to detect the serial connection and every problem after that. By manually adding the device we just compound the problem.

Delete your manually added LGTV device.

I still think it could be a pinout problem either on the null modem or your rs232. Do you have an alternate null modem cable to try? It might be worth getting one from ebay just in case. Shouldn't cost too much. Or go back to trying your usb to rs232 adapter?

My pnp scripts launch even if I plug in the rs232 with a straight through cable. Only difference is it fails to identify the correct device.

Most of my problems have been hardware related. I only have one lmce controlled LG TV out of three in my home. If I use the exact same hardware (usb>rs232 plus null modem) from the working TV I can get the second TV working but not the third (the third LG being a different model).

The one that doesn't work is attached to my core. I've had it run the pnp scripts when a straight through rs232 is attached to the TV but not when correctly setup with the null modem. However, ladekribs has had his LG working on his core!
http://forum.linuxmce.org/index.php?topic=9729.msg75277#msg75277

I've also spent loads on different cables and usb to rs232 adapters (I'm waiting for more to arrive from ebay).

I know how frustrating it is!! Keep trying and let me know.
Barney
Title: Re: LG LCD Template
Post by: b4rney on December 04, 2010, 09:48:05 pm
I have received two new usb to RS232 adapters which both work perfectly. Very cheap from china via ebay. All of my LG TVs (3 of them) are now detected/configured using the altered template 2126.

I will continue testing.
Barney
Title: Re: LG LCD Template
Post by: b4rney on December 06, 2010, 11:07:10 pm
OK. I'm now having exactly the same issues as Tom (etNHGfU8) on my core.

TV is detected and configured (unlike Tom's).... but does not turn on/off as my other LGs do. I can manually issue the off/on command (TestSerialPort) which works fine.

Also, the LiveTV Tuner option (which I think is configured to select the DTV input) allows me to turn off the TV when I click 'Off' in the LiveTV menu. However, I don't have an aerial connected so I can't confirm if the tuner control works fully or not. I have copied Stefan's additional commands for controlling the DTV channels.

Next step is to trawl the logs.
Barney
Title: Re: LG LCD Template
Post by: b4rney on January 10, 2011, 12:33:53 am
The revised template is now working on all my LG TVs. Not sure what happened before.

Did a reboot and my Denon amp was detected, then my LG. Ran through the setup and it just started working.

Haven't tested the extra commands by ladekribs yet, but overall this is working well. Need to get it submitted soon.
Any more reports?
Barney
Title: Re: LG LCD Template
Post by: ladekribs on January 10, 2011, 10:52:11 am
Hi Barney,

still good with mine!
Title: Re: LG LCD Template
Post by: b4rney on January 10, 2011, 11:02:35 pm
Thanks Stefan,

Does the LG's digital tuner work using the lmce orbiter? I don't have an aerial attached to test. Any problems using it this way?

If you're happy I'll add your improvements to the thread and we can submit it.
Barney
Title: Re: LG LCD Template
Post by: ladekribs on January 11, 2011, 05:43:53 pm
Hi Barney

Yes the digital tuner works I have not programmed the tv with the channels in the right order, bute selecting either analog or digital works.


BR Stefan
Title: Re: LG LCD Template
Post by: Rukus on January 20, 2011, 01:32:43 am
I'm not sure if anyone else is having the same problem, but I keep getting the following message whenever I perform a router reload instead of the LG PNP script.

"You connected a Generic USB to RS232 dongle(Generic / Serial Ports)."

I also get the following output when I try to launch the LG script.

Quote
LG TV Detection script queue
Unknown: N81
TestSerialPort, v.2.0.0.44.11011423616
Usage: TestSerialPort [-p port] [-P N81|E81|O81] [-t transmit string]
[-s Search String] [-m message to log] [-i Timeout] [-b baud] [-h]
strings can include: \xx (xx is a hex char), \r and \n, and to delay x ms, \sxm
\~ means send a break
-M puts it in monitor mode where it just reports the state
  of hardware flow control until ctrl+c is pressed
It's not a LG TV
RESP: UNHANDLED

I hope this doesn't mean that my serial port is damaged, or malfunctioning. Please help.

Thanks,

Ernesto
Title: Re: LG LCD Template
Post by: tkmedia on February 23, 2011, 10:43:54 pm
Attention all LG Users: :o

A big thanks to merkur2k

The LG Template (2126) has been reworked and should be pnp for most newer LG TV's
Speed of input switching is amazing.
Many functions have been added and more to come.

Those that would like to use the new template should:
apt-get upgrade
sqlcvsupdate
delete your device.
reload router
let it get redetected.

Again big thanks to Merkur2k for his efforts.   :-*


Tim
Title: Re: LG LCD Template
Post by: b4rney on February 23, 2011, 11:21:28 pm
Excellent,

Thanks merkur2k.

Barney
Title: Re: LG LCD Template
Post by: huh on February 24, 2011, 07:23:06 am
Again big thanks to Merkur2k for his efforts.   :-*

Ditto- this template works great on my 32LH40.  I am using a serial -> serial cable (no usb at all) so had to manually add the template, but after stating as such, Sara appeared and everything is working great.

As a request- is there anyway for the TV to get an off signal before the MD shuts down?  I have an old Dell laptop with a very loud CPU fan in the bedroom, so I turn the laptop off at night.  Unfortunately, the TV does not shut off with the laptop and instead displays a no signal screensaver.  Otherwise, the commands are virtually instantaneous.  Changing the channel or volume seem just as quick as if I were using the factory remote (I am using a GYR3101-US, BTW) to send a RF signal to my laptop which LMCE then sends to my TV.


Thanks again- this works great!
Title: Re: LG LCD Template
Post by: posde on February 24, 2011, 07:43:29 am
If you turn off your laptop via the Orbiter, it should turn off the TV as well, afaik
Title: Re: LG LCD Template
Post by: etNHGfU8 on March 22, 2011, 10:45:28 pm
I continue to fail to be able to get my hybrid to interact with my LG TV.

I rebuilt my system from scratch again on March 9th, 2011 with the most recent snapshot available. It appeared that it contained all of the necessary changes.

Sara failed to recognize the TV during installation so today I finally went ahead and created the device from the admin using the 2126 device template at which point stuff showed up on the screen and took me to Sara to complete the installation. I also set the "COM Port on PC" to be the USB1 specific selection from the admin. I then pressed the Test code button for #192 On from the Edit IR codes page but nothing happened to the TV. Is there a log file somewhere that captured the action?

The following successfully turns on the TV:
/usr/pluto/bin/TestSerialPort -p /dev/ttyUSB1 -P N81 -b 9600 -t "ka 00 01\r\n" -s "a 01 " -i 8

- Tom
Title: Re: LG LCD Template
Post by: merkur2k on March 23, 2011, 03:36:10 pm
i have found that the "test code" button does not work for me...
the tv device itself makes a log, you can watch that (tail it on the command line or use the web admin). make sure the device is enabled and registered.
Title: Re: LG LCD Template
Post by: etNHGfU8 on March 24, 2011, 04:03:11 pm
Success!!!

Although I thought that Sara had forced a router restart it appears that one still needed to be done based on the log. So I rebooted the system and to my great delight the power button on my remote would cause the TV to turn off and on. Fortunately that is all of the functionality that I require.

If anyone can point me in a direction to track down why Sara failed to auto-detect the TV then I would attempt to track down the cause of that issue.

Thanks!!!

Now I'm off to figure out why the AVWizard doesn't want to show up during the reboot.  I need to change the UI since TV playback is showing a poor quality picture.
Title: Re: LG LCD Template
Post by: purps on March 29, 2011, 12:32:31 pm
When I plug in my LG, everything seems to work great, I follow the instructions, the commands work, fantastic.

However, whenever I restart or reload the MD, the detection script always runs again (and not just the LG script, there are a few others also for hardware that I don't even have; "denon" is one of them).

I have to cancel the wizard, reload, and then the script runs again. It does stop happening eventually, but it's 50/50 whether the TV will still be working afterwards (for instance last night it completely removed itself). What am I doing wrong? Should I be completing the wizard each time, or will that just keep adding new TVs?

TV is a 42LH4000. Any help would be much appreciated.

Cheers,
Matt.
Title: Re: LG LCD Template
Post by: tschak909 on March 29, 2011, 01:04:02 pm
It is a known bug that we are trying to track down. Sorry about that. :(

-Thom
Title: Re: LG LCD Template
Post by: purps on March 29, 2011, 01:52:47 pm
Not sure why you're apologising, but thank you anyway :)

Is there a quick and dirty workaround for now?

Cheers,
Matt.
Title: Re: LG LCD Template
Post by: tompin2 on April 24, 2011, 02:45:17 am
Hi Barney,

I'm having problems with the USB part, for some reason it is not using the port or not working and I don't know what is going on.  PNP does not detects the LG tv, but if I run manually try serial test script I can control the tv.  I´m using a USB so it is ttyUSB0 under port part.
I added manually the TV as I found on another post using the AV part on the wizard, then changing manually the port using webadmin.  Since  I did the serial hack, i´m able to see all the available "serial ports" under the MD, I just select from the drop down the /dev/ttyUSB0 and update and reload but nothing.
I know the cable is ok because i get response from the TV and also the USB to serial has a little LED so I´m able to see if there is activity.

Thanks for your help and to anyone that is reading, all the help is welcome!!  :)

Cheers,

Tomas
Title: Re: LG LCD Template
Post by: tompin2 on April 24, 2011, 04:50:28 pm
Hi to all,

I figure it out!  ;D, by default the device is disabled... I think I read that some time ago and now it just realized what does that ment.  On webadmin,A/V equipment, the Device## with template 2126,  under advance, the disabled option was checked!!!!
Uncheck, quick router reload, and voila!!!
I have to configure now the tunner! and the DENON receiver.
So, I neve got the PNP to detect the LCD but by adding it manually worked ok!, so in terms of this post, the template is good!

Thank for posting, without the information within this forum, this would have been impossible.

Shared info:  I have a core/hybrid and planning to do a raid5 but it is sitting only as core, as MD I´m using a ZOTAC MAG 330, connected to it LG 32LH70 LCD, I have only tested VDPAU video with online  FLASH videos with great success @HD and 1080p.
Two usb to rs232, that only worked with the serial hack, one for the TV and the other will be used for the DENON
If anyone needs any help with this similar configuration, I´m incredible new on this but I'll do my best to share my little experience.

Sorry for the spelling, english is not my native language

Thanks again,

Tomas
Title: Re: LG LCD Template
Post by: b4rney on April 24, 2011, 11:28:18 pm
Hi Tomas,

Glad you got it working. Lots of people have helped with this functionality, tkmedia created the original template, others have added their input in this thread and mercur2k improved and submitted the final template.

I know in recent builds the pnp doesn't work and I think manually adding it is the current solution. Did you use a recent build?

Personally I don't use or recommend raid any more. I've lost lots of data using it in the past. I just use a primary drive and back up to a secondary drive. I also backup my stable lmce using ping.

Barney
Title: Re: LG LCD Template
Post by: tompin2 on April 30, 2011, 03:44:26 am
Hi Barney,

Sorry for the delay,  I did used a recent build.  When you mean RAID is any kind (sw or hw), is it easy to setup a secondary disk as a backup?.   I always thought that sw raid was a good option because it is not hw dependent.  
At least that's what i read.   Any suggestions?. I agree that backup is always required, is it easy to setup PING?.

Thanks for your help

Cheers,

Tomas
Title: Re: LG LCD Template
Post by: b4rney on April 30, 2011, 11:28:21 pm
Hi Tomas,

Off topic but ....

I used software raid for a while and lost everything upgrading to 0810. I have a 1TB drive as my primary storage and I have a second 1TB drive which I told lmce to ignore. I copy the storage to the backup regularly using:
Code: [Select]
cp -u
The -u option only copies new files.

PING runs from a boot CD and can copy your lmce partition to this second HDD (or a network drive).

Hope this helps.
Barney
Title: Re: LG LCD Template
Post by: tompin2 on May 10, 2011, 03:08:47 am
Hi Barney, thanks for the info and sorry for the off topic, it wasnt my intention.

I'm having a problem now that I don't understand, the settings for the LG template are not permanent.  Everytime I reboot the MD or quick reload, the configurations of the serial port, and unchecked "Disable" option under advance  are lost.  Any ideas?
Apparently PNP is messing things up


Cheers,

TP.
Title: Re: LG LCD Template
Post by: purps on May 10, 2011, 03:33:59 pm
I've described this problem also http://forum.linuxmce.org/index.php?topic=9729.msg80343#msg80343
Title: Re: LG LCD Template
Post by: tompin2 on May 31, 2011, 04:38:10 am
Hi Purps,

Any hints on solving the problem?

Cheers,

T
Title: Re: LG LCD Template
Post by: purps on May 31, 2011, 11:02:14 am
Plugged my TV in again last night, and it wasn't even detected unfortunately. I believe it can be added manually, but I don't know how to do that. I assume it's in "A/V Equipment" in web admin, but I don't know what parameters are needed.
Title: Re: LG LCD Template
Post by: mhorst on June 16, 2011, 10:01:09 pm
I added it manually by selecting advanced -> configuration -> devices.
Selecting my MD.
Then create  child device.
Pick the 2126 template.

I then filled in the "COM port on PC" data, it has a drop down box and in my case it only has one value.

Seems to work, though it looks like not all volume change commands are processed or some are processed double.
Also, I cannot seem to find the On and Off commands.

I had some problems in getting my USB to serial port adapter working. When rebooting it doesn't work.
I then use minicom to talk to my TV, once that works I quit minicom and restart the router.
The device then does works (with the caveats described above).
So I need to figure out a way to put the com port settings that are done by minicom in some config file somewhere.
Anyway, that's a problem with my hardware, not with the TV template.
Title: Re: LG LCD Template
Post by: purps on June 17, 2011, 07:40:59 pm
Easy as that! Thanks mate.

Lights have gone haywire as mentioned in another thread http://forum.linuxmce.org/index.php?topic=11479.15, but apart from that, this LG TV control is absolutely superb. Have already added scenarios for the Wii and Mega Drive :)

Cheers,
Matt.
Title: Re: LG LCD Template
Post by: mhorst on June 19, 2011, 04:06:01 pm
You're welcome.

I'm still playing around a bit. Although the On/Off command is not visible in the webadmin when I select "Send a command to device", after running the setup wizard on the MD, my orbiter is capable of turning the TV on and off.
I can then also use the volume commands to control my TV. So that works nicely.

I'm still having a bit of trouble to get the thing working right after a reboot though. Last time the On/Off command worked, but the volume commands didn't. I think that means the com port is now OK after a reboot.
I played a bit with minicom and noticed the volume commands got an error; turned out that the TV thought it was muted and then volume commands give an error. After unmuting it via minicom and resetting the device it started working again.
Maybe I should add an unmute command to the template before a volume change. I'm not sure how the TV got muted (or if it really was; forgot tot test), but there is only one bit difference between the command to turn the TV on and to mute it. So maybe it's just my connection.
Title: Re: LG LCD Template
Post by: merkur2k on June 19, 2011, 05:27:43 pm
power control for audio/video devices happens automatically, that is why there are not specific on/off commands in orbiter. start a scenario that uses it and the tv will just turn on. let it idle for a few minutes (15 by default i believe) and it will turn off. It would be fairly easy to send an unmute with power on, but i think youre right that it was probably just your serial port since i have not encountered this problem (although i use an audio receiver for volume control). I also have noticed a problem with volume commands being doubled, but thats not something thats happening in the template, its somewhere deeper.
Title: Re: LG LCD Template
Post by: mhorst on September 11, 2011, 04:45:32 pm
It's been a while, but I finally found the reason why my volume commands sometimes work and sometimes not;
If the TV is already on while the MD starts, the volume works. If the TV is off while the MD starts the volume commands do not work (but everything else does).

I checked the ruby code in the template. During intialization, in the InitVolume function, it does something clever. It tries to retrieve the current volume from the TV, even turning the TV on and off again if necessary.
My guess is that my TV (an 26LV5500) doesn't like that, gets into some strange internal state, and no longer responds to volume commands after it has been quickly turned on and off again.

I placed the line "@volume = 10" at the start of the InitVolume function. That way the function assumes the volume has been retrieved successfully, and doesn't send any commands to the TV. This works, but I'll see if I can find out which part of the InitVolume function is actually causing the problem.

For now it looks like a problem with my TV's software, not with the template.
Title: Re: LG LCD Template
Post by: purps on September 12, 2011, 03:13:27 pm
My speakers are connected directly to the MD, so have not noticed this specifically, however I have noticed that when I switch over to the Wii or Mega Drive (so sound comes through the  TV) sometimes the volume doesn't work - pressing the buttons causes the volume to display, it just doesn't change.

A reload fixes the problem. Perhaps this is the same issue?

Cheers,
Matt.
Title: Re: LG LCD Template
Post by: b4rney on September 12, 2011, 10:28:16 pm
I occasionally have this problem. I think the ruby codes don't allow quite enough time for the TV to start when in standby. This means when the script queries the LG for the current volume there is no response so the LG is disabled.

You could try and extend this time.
Barney
Title: Re: LG LCD Template
Post by: purps on September 12, 2011, 10:50:52 pm
I occasionally have this problem. I think the ruby codes don't allow quite enough time for the TV to start when in standby. This means when the script queries the LG for the current volume there is no response so the LG is disabled.

You could try and extend this time.
Barney

OK. If your theory is correct, does that mean one shouldn't see this problem if the TV is already on when LMCE switches channel?

Cheers,
Matt.
Title: Re: LG LCD Template
Post by: b4rney on September 12, 2011, 11:20:38 pm
Yes Matt, that's the behaviour I've seen.
Title: Re: LG LCD Template
Post by: purps on September 13, 2011, 10:26:43 am
Okey doke, I'll see what the situation is.

Cheers,
Matt.
Title: Re: LG LCD Template
Post by: merkur2k on September 13, 2011, 06:18:55 pm
when i reworked the template, i changed all the delays to 0 since they didnt seem to be needed. you could try increasing the power on delay.