JPersson77 / LGTVCompanion

Power On and Off WebOS LG TVs together with your PC
MIT License
988 stars 40 forks source link

[OTH] LGC2 unable to connect? #243

Open dellycowboy opened 1 month ago

dellycowboy commented 1 month ago

I don't seem to be able control either of my LG C2 screens connected to my Windows 11 PC

The error I see in the logs is as follows

[ . . ][D---][ LEFT ] --- Starting work: POWER OFF ----------------- [ . . ][D---][ LEFT ] > > > SEND > > >: [webOS handshake] [ . . ][D---][ LEFT ] < < < RECV < < <: {"type":"error","id":"register_0","error":"409 firstuse step is now in progress","payload":{}} [ . . ][-I--][ LEFT ] User rejected or cancelled the pairing prompt [ . . ][D---][ LEFT ] Work queue is empty [ . . ][D---][ LEFT ] Closing connection [ . . ][D---][ LEFT ] Socket closed gracefully [ . . ][D---][ LEFT ] The I/O operation has been aborted because of either a thread exit or an application request (onRead)

I am currently having to run both screens in Factory mode because once you go back to User mode TPC and GSR turn back on which is clearly infuriating for a PC user!

Could this be the cause of the inability to make a successful network command, incidentally, both screens are detected although weirdly it detects a 3rd instance of one of the screens with an IP address I don't see in either TVs network settings pages.

Any ideas?

dellycowboy commented 1 month ago

Ok I answered my own question, I took the plunge and exited Factory mode, which is obviously what the "first use step is now in progress" meant and I can now connect!

The 3rd instance must have been an old cached WIFI connection of one of the screens which is also connected via Ethernet so just removed it from the list and all is well.

Not I need to figure out how to disable TPC and GSR because it is back on 🤦‍♂️

JPersson77 commented 1 month ago

Hi,

Yeah was going to ask you to exit factory mode. Instead check out the documentarion on how to open the service menu where asbl (tpc/gsr) can be disabled

https://github.com/JPersson77/LGTVCompanion/blob/master/Docs/Commandline.md#accessing-the-service-menu-lgtv-companion-and-lgtvcli

dellycowboy commented 1 month ago

Thanks yea, I already have the Service controller and it lets me change TPC and GSR, the issue is once I return to User mode the device factory resets to First Use and they are defaulted to back on again!

Also I think there is an error in your documentation or I am missing something

"LGTVcli.exe" -settings_other "{"svcMenuFlag": false}" device1

return the error

{"command":"settings_other","error":"Invalid JSON: [json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing object key - invalid literal; last read: '{s'; expected string literal"}

I removed the " around the {} and it didnt error but nothing happens.

This works "LGTVcli.exe" -button IN_START device1 But as above I am unable to disable TPC and GSR as they just come back on again.

JPersson77 commented 1 month ago

I don't know if there is some confusion on the terminology. Might be on my end.

Entering "factory mode" sounds to me like you are pushing INSTOP, which will indeed factory reset stuff. This is not what you want.

Service menu is IN_START, and after having changed GSR/TPC you should be able to exit the service menu again by pushing IN_START. Factory mode or a factory reset should not be invoked by this.

If your service menu looks truncated, you may need to set the svcMenuFlag. If the service menu looks allright and you can see all the options then it is fine.

I think you are right about the documentation. Double quotes (") in JSON should be escaped with backward slashes:

LGTVcli.exe -settings_other "{\"svcMenuFlag\": false}" device1

dellycowboy commented 1 month ago

Hmm.. ok thanks for the suggestions, I will try it again making sure to use IN START to exit.

dellycowboy commented 1 month ago

Ok I found a guide that showed me how to get to the full menu using P-ONLY and then EXIT. Then as you said IN START followed by HOME and I think I am ok now.

Worth noting it seems neither of my LGC2s liked being told to open that menu via the command line!

image

JPersson77 commented 1 month ago

Good to hear! The first command line attempt failed on the handshake, maybe due to insuffic8ent pairing or similar. Or maybe the TV was in factory mode.

The second one was probably successful. The app is using a now well known hack to execute internal command that are not exposed via the api. Unfortunately response from such an operation can not be relayed to the user as it is never sent to the app.