Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ScreenPad device support #2

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

Qonfused
Copy link
Owner

@Qonfused Qonfused commented Mar 31, 2023

This pull request adds native support for ASUS ScreenPad devices (e.g. Goodix GDX1515 and BOE BOE087F/BOE085F panels).

Tasks

  • Add ScreenPad device initialization for restoring backlight and connector power on boot/login.
    • Read last used backlight + power status from ioregistry.
  • Add ScreenPad backlight write/read methods (ref Screenpad Plus Backlight Control ASUS-ZenBook-Duo-14-UX481-Hackintosh#6).
    • Enforce valid writes in accepted backlight range (0x00 to 0xFF).
  • Add ScreenPad connector power toggle method.
    • Restore last used backlight value on re-enable.
  • Bind hotkeys to screenpad backlight and connector toggle methods.

- Add checks for screenpad device presence in DSTS.
- Set screenpad backlight to last value via DEVS backlight method.

TODO:
- Read connector power state (assumed powered after boot).
- Write/Read backlight to/from a persistent ioregistry key.
@Qonfused Qonfused added the enhancement New feature or request label Mar 31, 2023
@Qonfused Qonfused self-assigned this Mar 31, 2023
TODO:
- Store connector power and backlight level in ioregistry
- Implement backlight + power read method using the WMI DEVS methods (or defer to custom ACPI read methods)
- Bind backlight read and write methods to an IANE/ATK notification
- Trigger OSD from IANE/ATK notification
- Move backlight range handling to IANE/ATK
TODO:
- Bind to IANE/ATK notification
@Qonfused
Copy link
Owner Author

Qonfused commented Apr 1, 2023

What may make the most sense is applying and enforcing the screenpad on with the default backlight value from boot (0x64 or 100/255). Subsequent updates can instead be read from an ioregistry key updated on each backlight/power write.

This lessens the dependence on extracting backlight/power values from potentially variable WMI DSTS/DEVS methods, and instead only uses backlight + connector write methods (which are expected to be consistent).

The use of ioregistry for storing persistent values does need to be further explored.

@Qonfused
Copy link
Owner Author

Qonfused commented Apr 2, 2023

As a compromise, I've added fallbacks to the last stored backlight value in case DSTS methods fail to read the current device state.

@Qonfused Qonfused changed the title Add ScreenPad device support feat: Add ScreenPad device support Apr 18, 2023
@Qonfused Qonfused marked this pull request as draft April 20, 2023 17:38
@Qonfused
Copy link
Owner Author

A concern I had was how to integrate backlight handling w/ SMC keys. Screenpad backlight and power values do not necessarily need to be stored in order for their methods to function, as they are already stored in the EC registers accessible via WMI methods.

Most VirtualSMCAPI keys have some kind of class or method defining types/methods to memoize or otherwise control their internal state. Most commonly, there is an update() method that dispatches a kernel message to AsusSMC (from the daemon). This is all that should be necessary for our purposes since the same methods used for setting backlight + power on boot can be called remotely from the daemon.

This leaves only the SMC key + OSD display coupled with the AsusSMCDaemon and the WMI method handling with AsusSMC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Refactor OSD for screenpad backlight
1 participant