Utility library for some Lenovo IdeaPad laptops. Supports IdeaPad Intel and AMD Models (15IIL05 and 15ARE05)

Overview

ideapad

A Rust utility library for some Lenovo IdeaPad specific functionality.

A Fair Warning

This crate calls raw ACPI methods, which on the best case scenario when called on unsupported systems results in
a AE_NOT_FOUND (acpi method not found) error, on the worst case you'll call an existing method, which might do anything to your system.

This crate tries to safeguard against this by providing a profiles feature (see below for more details), which enforces different methods for different models, however you could easily circumvent this by providing an arbitrary profile.

All in all, don't use this crate on unsupported systems.

Supported Models

This crate has been tested on the Ideapad 15ILL05, although theoretically it should also work on the Ideapad AMD models.

Model Product Names
Ideapad 15ILL05 81YK
Ideapad AMD 81YQ (15ARE05), 81YM (14ARE05)

Dependencies

Features

Battery Conservation

Battery conservation (mode) is a feature that allows you to save battery life by limiting the battery percentage to 60%.

ideapad::initialize()?;

if ideapad::battery_conservation_mode::enabled()? {
    println!("Battery conservation mode is enabled");
} else if ideapad::battery_conservation_mode::disabled()? {
    println!("Battery conservation mode is disabled");
} else {
    panic!("what");
}

battery_conservation_mode::enable()?;
println!("Battery conservation mode should be enabled now...");

if battery_conservation_mode::enabled()? {
    println!("...and it is.")
} else {
    panic!("...but it isn't!");
}

battery_conservation_mode::disable()?;
println!("Battery conservation mode should be disabled now...");

if battery_conservation_mode::disabled()? {
    println!("...and it is.")
} else {
    panic!("...but it isn't!");
}

This mode conflicts with rapid charging, because once the battery percentage is 60%, rapid charging will still try to charge the battery more, but it can't, unnecessarily straining the battery.

There are various ways to mitigate this problem, provided by this crate:

  • Ignore: Ignore this problem entirely.
  • Switch: Switch off rapid charging, then enable battery conservation mode.
  • Error: Return an error to the caller.

For more information see ideapad::Handler.

ideapad::initialize()?;
ideapad::rapid_charge::enable()?;
ideapad::battery_conservation_mode::enable()?; // the default handler is to switch
assert!(ideapad::rapid_charge::disabled()?);

ideapad::rapid_charge::enable()?;
ideapad::battery_conservation_mode::enable_unchecked()?; // another handler is to ignore the problem entirely
assert!(rapid_charge::enabled()?);

let error = ideapad::battery_conservation_mode::enable_strict().unwrap_err(); // another handler is to error
assert!(matches!(error, ideapad::battery_conservation_mode::Error::RapidChargeEnabled));

// you can arbitrarily choose which handler to use
ideapad::rapid_charge::enable_with_handler(ideapad::Handler::Ignore)?;
ideapad::rapid_charge::enable_with_handler(ideapad::Handler::Switch)?;
ideapad::rapid_charge::enable_with_handler(ideapad::Handler::Error)?;

Rapid Charging

Rapid charging is a feature that allows you to charge your laptop faster. I have no idea how this works.

ideapad::initialize()?;

if ideapad::rapid_charge::enabled()? {
    println!("Rapid charge is enabled");
} else if ideapad::rapid_charge::disabled()? {
    println!("Rapid charge is disabled");
} else {
    panic!("what");
}

rapid_charge::enable()?;
println!("Rapid charge should be enabled now...");

if rapid_charge::enabled()? {
    println!("...and it is.")
} else {
    panic!("...but it isn't!");
}

rapid_charge::disable()?;
println!("Rapid charge should be disabled now...");

if battery_conservation_mode::disabled()? {
    println!("...and it is.")
} else {
    panic!("...but it isn't!");
}

This mode conflicts with battery conservation. See the Battery Conservation section above for more information.

ideapad::initialize()?;
ideapad::battery_conservation_mode::enable()?;
ideapad::rapid_charge::enable()?; // the default handler is to switch
assert!(ideapad::battery_conservation_mode::disabled()?);

ideapad::battery_conservation_mode::enable()?;
ideapad::rapid_charge::enable_unchecked()?; // another handler is to ignore the problem entirely
assert!(battery_conservation_mode::enabled()?);

let error = ideapad::rapid_charge::enable_strict().unwrap_err(); // another handler is to error
assert!(matches!(error, ideapad::rapid_charge::Error::BatteryConservationEnabled));

// you can arbitrarily choose which handler to use
ideapad::rapid_charge::enable_with_handler(ideapad::Handler::Ignore)?;
ideapad::rapid_charge::enable_with_handler(ideapad::Handler::Switch)?;
ideapad::rapid_charge::enable_with_handler(ideapad::Handler::Error)?;

System Performance Mode

System performance mode are a variety of presets that can be set to improve the performance of your laptop.

  • Extreme Performance: As the name suggests, this mode will set the system to the highest performance possible. For gamers, I guess.
  • Intelligent Cooling: This mode throttles the CPU and lowers the fan noise.
  • Battery Saving: This mode will set the system to the lowest possible performance.

Profiles

Note that this feature is not provided by Lenovo and is provided by this crate.

Profiles store ACPI methods and values that are used to set the system to a specific state. There are built in ones, see Supported Models above, but you can also create your own (if you know what you're doing!).

Supported Operating Systems

Currently, ideapad is only supported on Linux systems due to its aforementioned dependency on the acpi_call kernel module.

After a few minutes of research, it seems like Windows does not support calling arbitrary ACPI methods in userspace. In order to get around this, it seems a driver is needed to call the ACPI methods.

Application

If you want to see this library being used in an application, see the tuxvantage project.

You might also like...
Simple OpenAI CLI wrapper written in Rust, feat. configurable prompts and models

Quick Start git clone https://github.com/ryantinder/ask-rs cd ask cargo install --path . Example ask tell me about the Lockheed Martin SR71 The Loc

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!
Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!

Oatmeal Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors! Overview In

auto-rust is an experimental project that aims to automatically generate Rust code with LLM (Large Language Models) during compilation, utilizing procedural macros.
auto-rust is an experimental project that aims to automatically generate Rust code with LLM (Large Language Models) during compilation, utilizing procedural macros.

Auto Rust auto-rust is an experimental project that aims to automatically generate Rust code with LLM (Large Language Models) during compilation, util

Solving context limits when working with AI LLM models by implementing a "chunkable" attribute on your prompt structs.

Promptize Promptize attempts to solve the issues with context limits when working with AI systems. It allows a user to add an attribute to their struc

Putting a brain behind `cat`🐈‍⬛ Integrating language models in the Unix commands ecosystem through text streams.
Putting a brain behind `cat`🐈‍⬛ Integrating language models in the Unix commands ecosystem through text streams.

smartcat (sc) Puts a brain behind cat! CLI interface to bring language models in the Unix ecosystem and allow power users to make the most out of llms

A lightweight but incredibly powerful and feature-rich BitTorrent tracker. Supports UDP + HTTP(S) and a private tracker mode.

Torrust Tracker Project Description Torrust Tracker is a lightweight but incredibly powerful and feature-rich BitTorrent tracker made using Rust. Feat

Detects whether a terminal supports color, and gives details about that support

Detects whether a terminal supports color, and gives details about that support. It takes into account the NO_COLOR environment variable. This crate i

RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions
RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions

RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions. Features Batch rename files and direct

A clock app in terminal written in Rust, supports local clock, timer and stopwatch.
A clock app in terminal written in Rust, supports local clock, timer and stopwatch.

clock-tui (tclock) A clock app in terminal. It support the following modes: Clock Timer Stopwatch Countdown Usage Install Install excutable by cargo:

Owner
ALinuxPerson
I like programming.
ALinuxPerson
An Intel HAXM powered, protected mode, 32 bit, hypervisor addition calculator, written in Rust.

HyperCalc An Intel HAXM powered, protected mode, 32 bit, hypervisor addition calculator, written in Rust. Purpose None ?? . Mostly just to learn Rust

Michael B. 2 Mar 29, 2022
A CLI utility installed as "ansi" to quickly get ANSI escape sequences. Supports the most basic ones, like colors and styles as bold or italic.

'ansi' - a CLI utility to quickly get ANSI escape codes This Rust project called ansi-escape-sequences-cli provides an executable called ansi which ca

Philipp Schuster 5 Jul 28, 2022
A lightweight command line utility with some small functions for CTFs.

Ice Ice is a lightweight command line utility to help with simple problems encountered while playing CTFs. Extracted from graveyard NOTE: Most of the

Aquib 12 Dec 19, 2022
A Rust curses library, supports Unix platforms and Windows

pancurses pancurses is a curses library for Rust that supports both Linux and Windows by abstracting away the backend that it uses (ncurses-rs and pdc

Ilkka Halila 360 Jan 7, 2023
Universal Windows library for discovering common render engines functions. Supports DirectX9 (D3D9), DirectX10 (D3D10), DirectX11 (D3D11), DirectX12 (D3D12).

Shroud Universal library for discovering common render engines functions. Supports DirectX9 (D3D9), DirectX10 (D3D10), DirectX11 (D3D11), DirectX12 (D

Chase 6 Dec 10, 2022
command line tools for coprolite research (paleontology and archaeology): estimate the producer's body mass based on coprolite diameter by the use of regression models

OVERVIEW OF COPROSIZE coprosize employs power, exponential and cubic regression models allowing to estimate the producer's body mass based on coprolit

Piotr Bajdek 7 Nov 25, 2022
Core Fiberplane data models and methods for transforming them (templates, providers, markdown conversion)

fiberplane This repository is a monorepo for Rust code that is used throughout Fiberplane's product. Overview base64uuid - A utility for working with

Fiberplane 18 Feb 22, 2023
Striving to create a great Application with full functions of learning languages by ChatGPT, TTS, STT and other awesome AI models

Striving to create a great Application with full functions of learning languages by ChatGPT, TTS, STT and other awesome AI models, supports talking, speaking assessment, memorizing words with contexts, Listening test, so on.

null 155 Apr 20, 2023
Build Abstract Syntax Trees and tree-walking models quickly in Rust.

astmaker Build Abstract Syntax Trees and tree-walking models quickly in Rust. Example This example creates an AST for simple math expressions, and an

David Delassus 100 Jun 5, 2023
🦀Rust + Large Language Models - Make AI Services Freely and Easily. Inspired by LangChain

llmchain: Modern Data Transformations with LLM ?? + Large Language Models, inspired by LangChain. Features Models: LLMs & Chat Models & Embedding Mode

Shafish Labs 63 Jun 22, 2023