RF Remote power button

Hey guys,

I have a Rii i25 mini remote. I hade the rf powerbutton (lower left) remapped so it wouldn’t shut down my Vero4K+, it tends to get pressed accidentally. Since an update this remapping is no longer working, but I can’t figure out how to fix it! Looking in the debug log I see:

2022-01-13 13:46:59.028 T:2751 DEBUG : Keyboard: scancode: 0x8e, sym: 0x323, unicode: 0x0000, modifier: 0x0
2022-01-13 13:46:59.028 T:2751 DEBUG : HandleKey: sleep (0xf0df) pressed, action is CECActivateSource
2022-01-13 13:46:59.301 T:3722 DEBUG : Thread Timer 3417481408 terminating
2022-01-13 13:47:02.663 T:2751 DEBUG : ToggleDeviceState - waking up CEC device…
2022-01-13 13:47:02.663 T:2751 DEBUG : LogindUPowerSyscall: Received PrepareForSleep with arg 1

So you can see the remapping is still active (action is CECActivateSource) but the last line sais logind still gets triggered tot perform a shutdown.

I tried setting HandlePowerKey=ignore in /etc/systemd/logind.conf (even though /etc/systemd/logind.conf.d/000-osmc-ignore-power-key.conf exists with the same setting), didn’t help.

Tried running > systemd-inhibit --what=handle-power-key sleep 1000 < which also didn’t do anything.

Where I’m coming now is editing /lib/udev/rules.d/98-lircd.rules, but I wouldnt know what to do.

Running > ir-keytable -t --device=/dev/input/by-path/platform-xhci-hcd.0.auto-usb-0:1:1.0-event-kbd < the powerkey doesn’t show up.

The keyboard keycode for the button is 142 in showkey and 61663 in keymap.xml.
I’m on Kodi 19.3.0, 20211220osmc

Does anyone know how t remap this button?

Thanks!

Willem

If you noop it in Kodi is the system still shutting down?..

<keymap>
	<global>
		<keyboard>
			<sleep>noop</sleep>
		</keyboard>
	</global>
</keymap>

If it is then first I would go back to the 000-osmc-ignore-power-key.conf and add in

HandleSuspendKey=ignore
HandleHibernateKey=ignore

If that works let us know so @sam_nazarko can update that file on our end.

3 Likes

Thank you!

noop-ing it in the keymap did not do anything, but adding the two lines to 000-osmc-ignore-power-key.conf worked!

Restored my old keymap and everything works as I like it! Nice!

Cheers!

Willem

1 Like

Glad to hear it. When that issue came up before with a power button I didn’t think of a remote sending out a sleep command so I didn’t think to include those lines. Now that we know it is an easy enough fix to make.

On a side note if you wanted to keep that button for a useful power function you could probably keymap (in Kodi) the short press to “CECActivateSource” and map a long press to “CECStandby”. With this accidentally pressing the button when using Kodi should effectively do nothing unless you are accidentally holding it down for over a second.

1 Like

Hopefully the issue is now addressed with the following commit:

I’d appreciate it if you could test this and provide feedback before we potentially release this as an update to other users. To test this update:

  1. Login via the command line
  2. Run the following command to add the staging repository:
    echo 'deb http://apt.osmc.tv buster-devel main' | sudo tee /etc/apt/sources.list.d/osmc-devel.list
  3. Run the following commands to update: sudo apt-get update && sudo apt-get dist-upgrade && reboot
  4. Your system should have have received the update.

Please see if the issue is resolved.

I also recommend you remove /etc/apt/sources.list.d/osmc-devel.list after updating.

I’d also recommend you deactivate the staging repository. You can do so with the following command:
sudo rm /etc/apt/sources.list.d/osmc-devel.list.

Please note that we will automatically disable this update channel after 14 days on your device in case you forget to do so to ensure that your system reverts to the stable update channel.

Hi Sam,

I’ll test this, hopefully this weekend.

Thanks!

Is there a reason why we are adding the hibernate key to the ignore list but not suspend with this commit?

I installed the test version and I can confirm it doesn’t work without this line:

HandleSuspendKey=ignore

I added this line back manually and the desired behaviour returned.

Willem

1 Like

Just an oversight, where I assumed the first line was for power key.
I’ve now added the other key.

2 Likes