Thinstation / thinstation

A framework for making thin and light Linux based images for x86 based machines and thinclients.
https://www.thinstation.net/
778 stars 188 forks source link

Freerdp session prevents power button from working #773

Closed klemens-st closed 1 year ago

klemens-st commented 1 year ago

When freerdp session is active, pressing the power button on the client machine (or issuing shutdown command via hypervisor) should trigger Thinstation shutdown as it normally does. But when freerdp is running, it is not the case, nothing happens when the power button is pressed.

Is there a way to work around this in TS config? I could probably override it in BIOS, I can also long press the power button to trigger instant power off but would prefer a cleaner option

This is critical in my deployment as users will be working with a windows app on touchscreens and the app, in its simplicity, hides all power/disconnect buttons.

Doncuppjr commented 1 year ago

Interesting. Might talk to the freerdp folks.

Sent from Yahoo Mail for iPhone

On Thursday, April 13, 2023, 3:57 AM, Klemens Starybrat @.***> wrote:

When freerdp session is active, pressing the power button on the client machine (or issuing shutdown command via hypervisor) should trigger Thinstation shutdown as it normally does. But when freerdp is running, it is not the case, nothing happens when the power button is pressed.

Is there a way to work around this in TS config? I could probably override it in BIOS, I can also long press the power button to trigger instant power off but would prefer a cleaner option

This is critical in my deployment as users will be working with a windows app on touchscreens and the app, in its simplicity, hides all power/disconnect buttons.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

klemens-st commented 1 year ago

I got to the bottom of this.

The response I got on Freerdp matrix channel was

if your power button is emitting a keyboard event (most likely) and you have grab-keyboard enabled then this is expected. you might need to configure your environment to not forward such events to freerdp (X11? Wayland? Windows?)

but this did not help because the power button is an acpi event and TS treats it as such.

I noticed the problem only occurs when I am using a window manager. In my tests I was using an allmodules build with xfwm4 and package freerdp as the only application package. When I launched freerdp after booting I experienced the problem as described in my first message. But without xfwm4 the problem was gone.

Turned out the culprit was package xfce4-power-manager. The acpi package does not handle the power button when it detects a power manager: https://github.com/Thinstation/thinstation/blob/1da99c8b8291ab61a86c1936a020913a72de649a/ts/build/packages/acpi/build/extra/etc/acpi/powerbtn.sh#L53-L55

And for some reason the way that particular power manager works is it handles the power button perfectly fine but after starting a freerdp session it no longer works correctly. There might be similar issues with other apps but I only tested freerdp.

Solution: if you want xfwm4 and launch freerdp from that window manager, disable the xfce4-power-manager package. With Thinstation configured for a single freerdp session without a window manager the problem does not exist.