github bassidus/lgpowercontrol v4.2

3 hours ago

A release about who owns the TV: when this computer may turn it off, and when it may take the input for itself. 4.1 introduced sharing a TV with a console or a set-top box; this release finishes that idea and fixes the two places where it got the answer wrong.

Updating keeps your TV pairing, so the TV does not have to be paired again. It does not keep your settings. Update by cloning into a fresh directory and filling in the configuration file again:

git clone https://github.com/bassidus/lgpowercontrol.git
cd lgpowercontrol
nano lgpowercontrol.conf
sudo ./install.py

This replaces the git stash / git pull recipe from 4.1. Settings move between releases — two keys change shape in this one — and carrying an old configuration file across can silently disable a feature or keep a key nothing reads any more.

Changed

  • POWER_OFF_ONLY_ON_HDMI is gone. It and HDMI_INPUT held the same input in two different spellings, so the input had to be typed twice and nothing caught HDMI_INPUT="1" sitting next to POWER_OFF_ONLY_ON_HDMI="2". The name had also stopped describing what the key did, since it gates the input switch at wake as well as the power-off.

    The number now lives in HDMI_INPUT alone, and SHARED_TV is a plain 0/1 flag. If you set POWER_OFF_ONLY_ON_HDMI="2" in 4.1, the same setup is now:

    HDMI_INPUT="2"
    SHARED_TV="1"
    
  • Logging is off by default. An installation nobody has had trouble with has no reason to be in the journal. Turn it on with LOGGING="1" when something needs looking at, which is what the troubleshooting section already asked for. Configuration files written before this release say LOGGING="on" or "off", and both are still understood, so copying your old settings back in keeps whatever you had.

Added

  • The TV can be left on when the computer suspends or shuts down. Set POWER_OFF_AT_SUSPEND="0" or POWER_OFF_AT_SHUTDOWN="0". This suits a TV that gets switched over to another device by hand after the computer is already asleep or off — the previous shared-TV setting could not cover that case, because at the moment of suspending the TV is still showing this computer. Waking the computer turns the TV back on as before, and the idle behaviour is unaffected.

  • The input is switched at wake again on a shared TV. In 4.1, setting the shared-TV key turned the input switch off outright, so anyone with both keys set never got their input back — including on an ordinary wake with nothing else using the TV. The two cases are now told apart from the wake loop itself, at no extra round-trip: a TV found asleep is one this computer's own magic packet woke, so the picture is ours to claim, while a TV that was already on keeps whatever it is showing.

  • A test suite, and a virtual webOS TV to run it against. 210 cases against the source need no TV, no root and no network and finish in a fifth of a second; 25 more drive a test double that speaks SSAP faithfully enough that the control library cannot tell the difference. It exists for the branches a real television cannot be made to produce on request — an endpoint answering 404, a refused pairing, a connection dropped in the middle of a command — which were previously verified by reading them.

  • A walkthrough of the internals at lgpowercontrol.ath.cx, for anyone reading the code: the wake loop, the guard, the timing race at suspend, and the idle escalation, drawn out.

Fixed

  • The input was still taken on boot with something else playing — the exact case the shared-TV setting exists to prevent. Two branches of the wake loop concluded the TV had been asleep on evidence that did not show it: a single unanswered poll, which at boot is the network rather than the TV, and any reported transition, which an already-awake TV also reports. It now takes two misses in a row, and a transition only counts when the state it is leaving is not an awake one. Reported against the branch before release.

  • A TV that had gone to standby on its own still answers the foreground-app query, with an empty app id. The guard logged that as TV on , not on com.webos.app.hdmi1, which reads like a formatting bug and hides what happened. It now says the TV is already in standby.

  • "TV was already on" appeared one second after the screen was turned off, directly under a line saying the screen had just been turned on. Both a returning SCREEN_OFF and someone watching the other source reach that line, and only the second one is worth reading; the message now names the state that caused it.

  • A resume with the network still down wrote thirty journal lines to say one thing — fifteen from the command layer and fifteen from the wake loop, interleaved, with the reason on the half that got duplicated. It is one line per attempt now, and the line carries the reason.

Don't miss a new lgpowercontrol release

NewReleases is sending notifications on new releases.