Some general comments. No need to address any of this in the initial patch.
A script controllable output is a feature that has been requested a few times, for UAV and micro-controller applications. Controlling HDMI power from script independent of the remote stuff would be potentially valuable. This this might interact with the stuff pf_notify_modeswitch, but not using HDMI as a remote input while using it as general output seems a reasonable restriction.
Script sees the remote through "key_remote" (modules/script_key_funcs.c) and get_usb_power. It looks like both will reflect the currently selected channel (this should be tested). This makes get_usb_power poorly named.
It would also be potentially useful to allow script to access all the channels independent of which is selected as the remote. The battery temp channel can already be accessed using get_temperature.
I experimented with sx160 a little bit:
HDMI +5v is only present in playback.
EnableHDMIPower/DisableHDMIPower similar to the g7x functions exist. On this camera, they boil down to
HdmiHpd5VOutput(state)
ChangePowerState(state)
These functions are identifiable (on both sx160 and g7x, so probably a usefully large number of cameras) by a reference to "HDMIConnectCnt", which should be quite easy to add to the sig finder. This string doesn't seem to be present on cameras without HDMI out (elph130, elph180) I don't see a HdmiHpd5VOutput eventproc on g7x
A HDMI to DVI adapter makes it easy to probe HDMI pins with a multimeter. Pinout on wikipedia:
https://en.wikipedia.org/wiki/Digital_Visual_Interface#/media/File:DVI_pinout.svg