Skip to content

Power Management Subsystem Enhancements and Bugfixes#74

Merged
jandryuk merged 7 commits intoOpenXT:masterfrom
crogers1:brightness
Oct 25, 2022
Merged

Power Management Subsystem Enhancements and Bugfixes#74
jandryuk merged 7 commits intoOpenXT:masterfrom
crogers1:brightness

Conversation

@crogers1
Copy link
Copy Markdown
Contributor

@crogers1 crogers1 commented Oct 7, 2022

This PR contains a series of commits that provide enhancements and bugfixes for the current power management subsystem. Some of the features provided in this PR depend on some forthcoming changes in other components like glass and xenmgr to fully function, but it can be merged safely before those are ready. Refer to each commit for more information.

@crogers1 crogers1 requested a review from jandryuk October 7, 2022 20:24
@crogers1
Copy link
Copy Markdown
Contributor Author

crogers1 commented Oct 7, 2022

Depends on OpenXT/idl#45

Comment thread xcpmd/src/prototypes.h
Comment thread xcpmd/src/db-helper.c
Comment thread xcpmd/src/battery.c Outdated
Comment thread xcpmd/src/battery.c Outdated
Comment thread xcpmd/src/modules.c Outdated
Comment thread xcpmd/src/db-helper.c Outdated
Comment thread xcpmd/src/db-events-module.c Outdated
Comment thread xcpmd/src/modules.c Outdated
Comment thread xcpmd/src/Makefile.am Outdated
Comment thread xcpmd/configure.ac
Comment thread xcpmd/src/rules.c
@crogers1
Copy link
Copy Markdown
Contributor Author

Updated. Addressed comments.

Comment thread xcpmd/src/battery.c Outdated
Chris Rogers and others added 7 commits October 11, 2022 15:30
  This module allows xcpmd to react to events occuring to the db
  with respect to power management actions. For example, this will
  allow xcpmd to define rules that increase or decrease the screen
  brightness when the fn keys are pressed. vGlass handles the input
  and calls xcpmd add_var over dbus and the rule ensures backlightSet
  is called with the new brightness value.  This is just one example
  of a rule that can be defined to react to db events.

  Add the sources and module spec to the Makefile.

  This commit also includes enhancements and bugfixes to db-helper
  so we can make use of the db-events.

Signed-off-by: Chris Rogers <crogers122@gmail.com>
Signed-off-by: Chris Rogers <crogers122@gmail.com>
  This module defines three actions to take for host power events
  triggered by a ruleset in xcpmd. The calls are ultimately punted
  to xenmgr where the shutdown or reboot action is executed.

Signed-off-by: Chris Rogers <crogers122@gmail.com>
  Moved backlight module into xcpmd so that xcpmd can be
  responsible for handling brightness. Integrated backlight
  module functions into xcpmd's acpi module, and updated makefile
  accordingly. Brightness is no longer dependent on glass and
  can be handled almost entirely inside xcpmd minus user generated
  actions to adjust brightness from keystrokes or UIVM slider.

Signed-off-by: nate <zogbyn@ainfosec.com>
Signed-off-by: Chris Rogers <crogers122@gmail.com>
- added logic to allow xcpmd to receive lid_state_changed signals over
dbus. once that signal is received, xenstore's lid_state value is then
updated. this allows guest vm's to accurately be aware of lid state
changes.
- note that after OpenXT restarts, xenstore will not contain any lid_state
information until the lid is closed/opened. when qemu tries to retrieve
lid state in this situation, it will simply tell guest vm's that the lid
is open to avoid unwanted sleeping/suspending issues.
- code to handle lid events triggered from acpi was removed, as it is
now deprecated and will not be used.

Signed-off-by: Reed McFadden <mcfaddenr@ainfosec.com>
Signed-off-by: Chris Rogers <crogers122@gmail.com>
Signed-off-by: Chris Rogers <crogers122@gmail.com>
  Add a reasonable default power management ruleset for xcpmd. This
  is only parsed into the db if no existing ruleset exists. A user
  can further modify the ruleset directly through the db after this
  has been parsed and added. The rule syntax is straightforward
  to convey meaning in plain english, but the section below will
  clarify some of the rules and variables.

  - critical_batt is the battery percentage we consider to be a
    critical level
  - normal_batt is used as conditional to set the backlight on
    battery power to the 'batt_dim_backlight' level. This reads
    as "when we have sufficient battery power, set the backlight
    to the most recent level when we were last using battery
    power." There is a separate rule to use the 'critical_backlight'
    var to set the backlight percentage level when we are on a
    critical level of battery.
  - 'ac_dim_backlight' is the same as 'batt_dim_backlight' for when
    we're using AC power.
  - 'shutdown_on_idle` is a 1 or 0 (bool) to tell the workstation
    to shutdown after the period of time specified by 'shutdown_idle'
    if the user has not interacted with the system. 'shutdown_idle'
    is in minutes.

Signed-off-by: Chris Rogers <crogers122@gmail.com>
Copy link
Copy Markdown
Contributor

@jandryuk jandryuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - thanks.

This depends on IDL, and IDL depends on a XenMmgr PR. Holding off merge for the time being.

@jandryuk
Copy link
Copy Markdown
Contributor

xcpmd/src/default.rules needs to get installed into POLICY_FILE_PATH "/usr/share/xcpmd/default.rules"

@jandryuk
Copy link
Copy Markdown
Contributor

This commit adds rule installation, and bitbake packages it in the xcpmd package:
jandryuk@b3a7696

I haven't tested xcpmd loading them yet since I have some rules in place.

@jandryuk jandryuk merged commit 22a9f06 into OpenXT:master Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants