Author Topic: LG LCD Template  (Read 55541 times)

b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #60 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

etNHGfU8

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: LG LCD Template
« Reply #61 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.


b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #62 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

ladekribs

  • Veteran
  • ***
  • Posts: 86
    • View Profile
Re: LG LCD Template
« Reply #63 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.


b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #64 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

etNHGfU8

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: LG LCD Template
« Reply #65 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?

b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #66 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

ladekribs

  • Veteran
  • ***
  • Posts: 86
    • View Profile
Re: LG LCD Template
« Reply #67 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

b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #68 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

etNHGfU8

  • Regular Poster
  • **
  • Posts: 47
    • View Profile
Re: LG LCD Template
« Reply #69 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

b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #70 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

b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #71 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

b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #72 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

b4rney

  • Guru
  • ****
  • Posts: 454
    • View Profile
Re: LG LCD Template
« Reply #73 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

ladekribs

  • Veteran
  • ***
  • Posts: 86
    • View Profile
Re: LG LCD Template
« Reply #74 on: January 10, 2011, 10:52:11 am »
Hi Barney,

still good with mine!