Skip to content

zhen-zen/YogaSMC

Repository files navigation

YogaSMC CI Join the chat at https://gitter.im/YogaSMC/community

This driver consists of YogaSMC, YogaWMI and YogaVPC.

Each component can be derived for different targets. Currently ThinkPad and IdeaPad series (all other consumer brands) are supported. Support for generic Intel HID event & 5 button array, and HP system (both laptop and desktop, requires vanilla EC) is experimental.

Command to driver can be sent with ioio, e.g. ioio -s IdeaVPC ConservationMode true.

The driver will update the status in ioreg, while details are available in system log, e.g. log stream --predicate 'senderImagePath contains "YogaSMC"'.

Companion userspace apps, YogaSMCPane and YogaSMCNC are also available with GUI configuration and notification service.

YogaSMC

Allow syncing SMC keys like sensors reading and battery conservation mode.

Based on acidanthera/VirtualSMC

Customized sensor reading

The EC field name for corresponding SMC key is read from Info.plist. If there's no FieldUnit object at desired offset, you can add an OperationRegion like SSDT-THINK.dsl in SSDTSample.

Variant IdeaSMC IdeaSMC (Game Zone) DYSMC
Fan reading Need testing
Fan control ☑️ TBD TBD
Sensor reading Generic

YogaWMI

Support for parsing WMI devices and properties. On some devices, it could act as YogaVPC with access to extensive device control method.

(For Thunderbolt WMI interface, see al3xtjames/ThunderboltPkg instead.)

Based on the-darkvoid/macOS-IOElectrify (Dolnor/IOWMIFamily) and bmfparser (pali/bmfdec)

DYWMI

  • WMIS Sensor reading, check SSDT-WMIS.dsl in SSDTSample if the system is affected
  • WMIV Event driver, see DYVPC

IdeaWMI

  • GZFD Game Zone control center, see header for available functions
  • WBAT Extra battery information (requires patching related methods like battery ones)
  • WMI2 Fn+esc (obsolete paper looking function), currently assigned to Fn mode toggle
  • WMIS Fn+S (super resolution function), currently assigned to Fn mode toggle
  • WMIY (AMW1) Yoga Mode detection and disabling keyboard/touchpad when flipped

ThinkWMI (WIP)

Based on lenovo/thinklmi (iksaif/thinkpad-wmi)

YogaVPC

Intercepting events on vendor-specific Virtual Power Controller (VPC) devices and sync states, some instructions are on project boards.

Currently available functions:

  • EC reading
  • DYTC setting (available for idea/think, might need appropriate OS version for XOSI)
  • Automatic backlight and LED control
  • Clamshell mode (need additional patch on _LID like SSDT-RCSM.dsl in SSDTSample)
Variant IdeaVPC ThinkVPC YogaHIDD DYSMC
_HID VPC2004 LEN0268
LEN0068
INT33D5
INTC1051
(WMIV)
Reference ideapad-laptop thinkpad_acpi intel-hid hp-wmi
Hotkey polling ☑️
Conservation mode N/A TBD
Battery threshold Not supported N/A TBD
Charging control Need testing Need testing N/A TBD
DYTC N/A N/A
Fan reading Need testing N/A SMC
Fan control Need testing N/A TBD
Fn lock mode Native N/A TBD
LED control Not supported N/A TBD
Keyboard backlight N/A TBD

EC reading:

When Rehabman's battery patching method RE1B RECB present (or SSDT-ECRW.dsl in SSDTSample), desired EC fields can be read using following commands:

  • One byte at specific offset: ioio -s YogaVPC ReadECOffset 0xA4 for field at offset 0xA4
  • Bulk reading: ioio -s YogaVPC ReadECOffset 0x1006 for 0x10 bytes at offset 0x06 (add total bytes to read before offset)
  • Dump whole EC area: ioio -s YogaVPC ReadECOffset 0x10000
  • Known EC field name: ioio -s YogaVPC ReadECName B1CY (no larger than 1 byte due to OS constraint)

YogaSMCPane

The preference pane provides a graphical user interface for basic information and settings, such as battery conservation mode and backlight.

YogaSMCNC

The notification application receives EC events and displays them on OSD. Corresonding actions will also be triggered for function keys. The configuration can be customized at ~/Library/Preferences/org.zhen.YogaSMC.plist after closing the app.

Only a few models support dual fan reading and control, which could be enabled manually via debug prefpane or SecondThinkFan in preference plist.

For unknown events in preset, feel free to submit a PR like #40.

If you want to add new actions, the easiest approach is to use the script action and fill the AppleScript in option field. be295da is a good example to add it as a built-in action, which may be replaced with native one later.

Installation

The kext should work out-of-the-box. If you have modified _QXX methods before, please remove the patches.

Some features may rely on methods accessing EC, please consider ECEnabler for EC fields larger than 8-bits.

The YogaSMCAlter.kext is a variant without SMC keys support and the dependencies of Lilu and VirtualSMC. It's designed for quick loading / unloading without reboot when debugging.

Building

  1. Copy latest debug version of Lilu.kext and VirtualSMC.kext into the folder
  2. git clone --depth 1 https://github.com/acidanthera/MacKernelSDK
  3. In Xcode, Select build target on upper left and click the button on the left

Credits