Debug LG Smart TV App With Web Inspector


Following my previous post LG Smart TV Emulator From Command Line, here is the process for debugging html apps running on LG device. It should not take more than 5 minutes to complete after jWebSocket and LG_Smart_TV_SDK_Installer are downloaded.

Required steps:

  1. Rub jWebSocket server
  2. Put LG_Inspector into USB
  3. Run web inspector

Run jWebSocket server

As described in previous post, its safe to use regular jWebSocket server configured for LG TV.

  1. download jWebSocket server
  2. update conf/jWebSocket.xml
  3. run server

Simple config updates are required. Make sure to update loginname and password for guest and user roles:

<firstname>jWebSocket Guest User</firstname>
<lastname>(Guest Role)</lastname>
<firstname>jWebSocket Authenticated User</firstname>
<lastname>(User Role)</lastname>

…and run it from command line (make sure to provide proper paths for jWebSocket):

SET "JWEBSOCKET_PATH=c:/Program Files/jWebSocket"
java -jar "%JWEBSOCKET_PATH%/libs/jWebSocketServer-1.0.jar" ^
-config "%JWEBSOCKET_PATH%\conf\jWebSocket.xml"

You should see following lines confirming the jWebSocket server runs.

2014-04-16 14:19:44,696 INFO  - TCPEngine: TCP engine 'tcp0' started' at port 87
87 with default timeout infinite...
2014-04-16 14:19:45,384 INFO  - TCPEngine: SSL engine 'tcp0' started' at port 97
97 with default timeout infinite.
2014-04-16 14:19:45,386 INFO  - TokenServer: Token server 'ts0' started.
2014-04-16 14:19:45,386 INFO  - JWebSocketFactory: jWebSocket server startup com

Put LG_Inspector into USB

This process works with NetCast3 and should probably work with NetCast4 as well, the same should be valid for Win64 vs. Win32 LG SDK:

  1. download and unapck Win64_LG_Smart_TV_SDK_Installer
  2. rename unpacked LG_Smart_TV_SDK_Installer.exe to .zip and unpack
  3. unpack InstallerData/Disk1/InstData/
  4. navigate to unpacked Resource1/$USER_HOME$/com.lge.sdk/com.lde.sdk.resources/LGInspector
  5. copy content of NetCast3_TV folder into USB:/lgapps/installed/123456/LG_Inspector
  6. modify USB:/lgapps/installed/123456/LG_Inspector/LG_Inspector.js
  7. run the app on TV device

Make sure LG_Inspector.js configuration points to your PC and jWebSocket configuration (default port is 8787)

var ws_ip = "";

Once you run the app on TV you should see jWebSocket log in console:

2014-04-16 14:35:43,011 INFO  - TCPConnector: Started TCP connector '01.39600.7'
 on port 39600 with timeout infinite
2014-04-16 14:35:43,553 INFO  - SystemPlugIn: User 'LG_DTV' successfully logged
in from / (01.39600.7).

Run web inspector

You can run web inspector on your PC using common browser (chrome works). If you run NetCast3 inspector on TV, use NetCast3 inspector for debugging (same should be valid for NetCast4 versions):

  1. unpack …/Resource1/$USER_HOME$/com.lge.sdk/com.lde.sdk.resources/LGInspector/NetCast3_IDE_zg_ia_sf.jar
  2. make sure you can access unpacked folder from your http server (apache etc.)
  3. open…/inspector.html in a browser

After inspector.html is loaded, you should see following lines in jWebSocket console:

2014-04-16 14:43:32,341 INFO  - TCPConnector: Started TCP connector '01.51032.8'
 on port 51032 with timeout infinite
2014-04-16 14:43:32,377 INFO  - SystemPlugIn: User 'LG_IDE' successfully logged
in from /0:0:0:0:0:0:0:1 (01.51032.8).

You might need to click some other tab before you see DOM content in Elements tab.

Where to go from here:

Leave a comment

Please be polite and on topic. Your e-mail will never be published.