Sending CECActivateSource with OSMC remote while screensaver is on

Hi

When I try to turn my TV on using OSMC remote, I have to press the Home button twice: first to stop the screensaver and go to the Home screen, and second to send CECActivateSource to turn on the TV. I’ve tried to add <escape>CECActivateSource</escape> in <Screensaver> section in ~/.kodi/userdata/keymaps/osmc/gen.xml, but it didn’t help. The same when I add it to the <FullscreenVideo> section. In Kodi logs I can see the following when the screensaver starts and stops:

------ Window Init (/home/osmc/.kodi/addons/screensaver.atv4/resources/skins/default/1080i/screensaver-atv4.xml) ------
------ Window Deinit (/home/osmc/.kodi/addons/screensaver.atv4/resources/skins/default/1080i/screensaver-atv4.xml) ------

Is it possible to add the action for this type of window, so that I can turn on the TV with only one Home button press, no matter if the screensaver is on or off?

It might be worth using the suspend option instead

How would I configure the keymap and CEC in order to use the suspend option?

You wouldn’t need to – once you suspend the device and resume it, the TV will be woken up.

I’d like to suspend and resume it with the OSMC remote using Home button. And only this button should turn on/off the TV. Is this possible?

The device and TV? This should work just fine.

I still cannot understand how. What should I do to suspend and resume the device with the Home button? Now the remote just sends CECActivateSource and CECStandby (long-press), but it doesn’t suspend the device.

You would change the Home button to suspend, and OSMC should handle the CEC side of things.

The screensaver isn’t a window so you can’t keymap to it. If the screensaver is active, and perhaps suspend as well, the first button press is consumed by the waking up and it doesn’t get sent to the keymapping system at all. You can set your CEC options such that the system turns on when the screensaver turns off or the system comes out of suspend if I recall correctly, but I think this may be a bit prone to having the TV turn on when you don’t intend for it to.

In Kodi’s CEC settings you have to configure the “devices to power off during shutdown” option. The settings for startup/shutdown in that screen apply to suspend the same as power on/off.

I’ve noticed that the screensaver generates a window with ID 13001. I’m not sure if it is generic or hardcoded, so I’ve just put this into osmc/gen.xml:

<global>
        <keyboard>
                <escape>CECActivateSource</escape>
                <escape mod="longpress">CECStandby</escape>
        </keyboard>
</global>

Generally it works, but now always, I don’t know why. Logs show that it detects the Home button press correctly when the screensaver is active, but for some reason it doesn’t detect the Home button longpress at screensaver. It works only in the Home screen. After all, turning on the TV with one press is more important for me than turning it off, so the issue is solved.

Thank you guys for your advice, I’ll try to play with suspend function, maybe it will be more convenient.

Due to the highly customized nature of the OSMC keymap making the home button fully dedicated requires a bit more keymapping than just that. You could turn off the OSMC keymap at settings > system > input > peripherals, which would allow for less mappings that needed to be overridden (you would probably still need to dig through keyboard.xml to see if there is other window specific mappings for that key) or use the following keymap in your userdata (this is actually in my long-press keymap guide at the end)…

<keymap>
	<global>
		<keyboard>
			<escape>CECActivateSource</escape>
			<escape mod="longpress">CECStandby</escape>
		</keyboard>
	</global>
	<FullscreenVideo>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</FullscreenVideo>
	<FullscreenGame>
		<keyboard>
			<escape/>
		</keyboard>
	</FullscreenGame>
	<Visualisation>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</Visualisation>
	<MusicOSD>
		<keyboard>
			<escape/>
		</keyboard>
	</MusicOSD>
	<slideshow>
		<keyboard>
			<escape/>
		</keyboard>
	</slideshow>
	<VideoOSD>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</VideoOSD>
	<VideoMenu>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</VideoMenu>
	<VideoBookmarks>
		<keyboard>
			<escape/>
		</keyboard>
	</VideoBookmarks>
	<Videos>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</Videos>
	<VideoPlaylist>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</VideoPlaylist>
	<MusicInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</MusicInformation>
	<MusicPlaylist>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</MusicPlaylist>
	<SongInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</SongInformation>
	<MovieInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</MovieInformation>
	<PictureInfo>
		<keyboard>
			<escape/>
		</keyboard>
	</PictureInfo>
	<PVROSDChannels>
		<keyboard>
			<escape/>
		</keyboard>
	</PVROSDChannels>
	<PVRChannelGuide>
		<keyboard>
			<escape/>
		</keyboard>
	</PVRChannelGuide>
	<AddonInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</AddonInformation>
	<yesnodialog>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</yesnodialog>
	<selectdialog>
		<keyboard>
			<escape/>
		</keyboard>
	</selectdialog>
	<contextmenu>
		<keyboard>
			<escape/>
		</keyboard>
	</contextmenu>
	<addonsettings>
		<keyboard>
			<escape/>
		</keyboard>
	</addonsettings>
	<addonbrowser>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</addonbrowser>
	<filemanager>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</filemanager>
	<interfacesettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</interfacesettings>
	<systeminfo>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</systeminfo>
	<eventlog>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</eventlog>
	<playersettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</playersettings>
	<mediasettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</mediasettings>
	<pvrsettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</pvrsettings>
	<servicesettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</servicesettings>
	<gamesettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</gamesettings>
	<profiles>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</profiles>
	<systemsettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</systemsettings>
	<music>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</music>
	<pictures>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</pictures>
	<skinsettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</skinsettings>
	<musicplaylisteditor>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</musicplaylisteditor>
	<games>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</games>
	<programs>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</programs>
</keymap>
1 Like