mirror of
https://github.com/Steve-Tech/YAFI.git
synced 2026-04-19 16:50:36 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8810aa01e5 | ||
|
|
1fc4b94237 | ||
|
|
90a994a685 | ||
|
|
7b123da001 | ||
|
|
c8fd626446 | ||
|
|
0f6fee40ae | ||
|
|
4a788c2395 | ||
|
|
d2f34c9b5a | ||
|
|
4958722edd | ||
|
|
23b54ee397 |
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github: [Steve-Tech]
|
||||
thanks_dev: u/gh/steve-tech
|
||||
@@ -1,7 +0,0 @@
|
||||
# CrOS_EC_Python udev rules
|
||||
|
||||
# LPC Access
|
||||
KERNEL=="port", TAG+="uaccess"
|
||||
|
||||
# /dev/cros_ec Access
|
||||
KERNEL=="cros_ec", TAG+="uaccess"
|
||||
16
README.md
16
README.md
@@ -11,9 +11,13 @@ You can download the latest release from the [Releases page](https://github.com/
|
||||
|
||||
There are builds for Flatpak, and PyInstaller for portable execution on Linux or Windows.
|
||||
|
||||
YAFI is also available on [Flathub](https://flathub.org/en/apps/au.stevetech.yafi): `flatpak install flathub au.stevetech.yafi`.
|
||||
|
||||
### Linux
|
||||
|
||||
To allow YAFI to communicate with the EC, you need to copy the [`60-cros_ec_python.rules`](60-cros_ec_python.rules) file to `/etc/udev/rules.d/` and reload the rules with `sudo udevadm control --reload-rules && sudo udevadm trigger`.
|
||||
To allow YAFI to communicate with the EC, you will need to enable user access to the `/dev/cros_ec` device. You can do this by running `echo KERNEL=="cros_ec", TAG+="uaccess" | sudo tee /etc/udev/rules.d/60-yafi.rules`, and then reload the rules with `sudo udevadm control --reload-rules && sudo udevadm trigger`.
|
||||
|
||||
You can also do this by running `curl -fL yafi.stevetech.au/udev.sh | sudo sh` which will run the [`add-udev-rules.sh`](add-udev-rules.sh) script.
|
||||
|
||||
### Windows
|
||||
|
||||
@@ -21,6 +25,8 @@ If your Laptop's BIOS supports Framework's EC driver, there is no need to instal
|
||||
|
||||
Otherwise, YAFI supports the [PawnIO](https://pawnio.eu/) driver, and will be automatically used if installed and there is no Framework driver available. YAFI will need to be run as administrator to communicate with the driver.
|
||||
|
||||
Currently the PawnIO driver does not support Framework 13 mainboards with 11th, 12th, or 13th Gen Intel CPUs.
|
||||
|
||||
## Building
|
||||
|
||||
### Flatpak
|
||||
@@ -80,7 +86,7 @@ It is possible to run YAFI on Windows using [gvsbuild](https://github.com/wingtk
|
||||
|
||||
### `[Errno 13] Permission denied: '/dev/cros_ec'`
|
||||
|
||||
This error occurs when the udev rules are not installed or not working. Make sure you have copied the `60-cros_ec_python.rules` file to `/etc/udev/rules.d/` and reloaded the rules with `sudo udevadm control --reload-rules && sudo udevadm trigger`.
|
||||
This error occurs when the udev rules are not installed or not working. Make sure you have installed the udev rules as described in the [Linux Installation](#linux) section.
|
||||
|
||||
### `Could not auto detect device, check you have the required permissions, or specify manually.`
|
||||
|
||||
@@ -88,3 +94,9 @@ This error occurs when `/dev/cros_ec` is not found, and the `CrOS_EC_Python` lib
|
||||
You can either update your kernel to have a working `cros_ec_dev` driver, or run YAFI as root.
|
||||
|
||||
It can also occur if you do not have a CrOS EC, like on non Framework laptops.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
YAFI is not affiliated with Framework Computer Inc. in any way.
|
||||
|
||||
YAFI is licensed under the [GPL-2.0-or-later license](COPYING), and comes with no warranty or guarantee of any kind. Use at your own risk.
|
||||
|
||||
7
add-udev-rules.sh
Executable file
7
add-udev-rules.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
echo Installing udev rules for YAFI to /etc/udev/rules.d/60-yafi.rules
|
||||
echo KERNEL=="cros_ec", TAG+="uaccess" > /etc/udev/rules.d/60-yafi.rules
|
||||
udevadm control --reload-rules
|
||||
udevadm trigger
|
||||
echo udev rules installed successfully.
|
||||
@@ -7,7 +7,21 @@
|
||||
<name>Yet Another Framework Interface</name>
|
||||
<summary>YAFI is another GUI for the Framework Laptop Embedded Controller</summary>
|
||||
<description>
|
||||
<p>It is written in Python with a GTK4 Adwaita theme, and uses the `CrOS_EC_Python` library to communicate with the EC.</p>
|
||||
<p>It is written in Python with a GTK4 Adwaita theme, and uses the CrOS_EC_Python library to communicate with the EC.</p>
|
||||
<p>YAFI has the capability for the following features:</p>
|
||||
<ul>
|
||||
<li>Fan control and temperature monitoring</li>
|
||||
<li>LED control</li>
|
||||
<li>Battery statistics</li>
|
||||
<li>Battery limiting</li>
|
||||
<li>Hardware information</li>
|
||||
</ul>
|
||||
|
||||
<p>You will need to install the udev rules to allow non-root access to the EC device. See the README for more information.</p>
|
||||
|
||||
<p>Alternatively, you can run <code>curl -fL yafi.stevetech.au/udev.sh | sudo sh</code> to install the udev rules.</p>
|
||||
|
||||
<p>YAFI is not affiliated with Framework Computer Inc. in any way.</p>
|
||||
</description>
|
||||
|
||||
<developer id="au.stevetech">
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"only-arches": ["x86_64"]
|
||||
}
|
||||
}
|
||||
|
||||
65
yafi/leds.py
65
yafi/leds.py
@@ -28,9 +28,11 @@ class LedsPage(Gtk.Box):
|
||||
__gtype_name__ = 'LedsPage'
|
||||
|
||||
first_run = True
|
||||
fp_led_version = 1
|
||||
|
||||
led_pwr = Gtk.Template.Child()
|
||||
led_pwr_scale = Gtk.Template.Child()
|
||||
led_pwr_scale_adj = Gtk.Template.Child()
|
||||
|
||||
led_kbd = Gtk.Template.Child()
|
||||
led_kbd_scale = Gtk.Template.Child()
|
||||
@@ -42,17 +44,61 @@ class LedsPage(Gtk.Box):
|
||||
|
||||
def setup(self, app):
|
||||
# Power LED
|
||||
fp_led_level_text = ["High", "Medium", "Low", "Ultra Low"]
|
||||
try:
|
||||
def handle_led_pwr(scale):
|
||||
value = int(abs(scale.get_value() - 2))
|
||||
ec_commands.framework_laptop.set_fp_led_level(app.cros_ec, value)
|
||||
self.led_pwr.set_subtitle(["High", "Medium", "Low"][value])
|
||||
match self.fp_led_version:
|
||||
case 0:
|
||||
value = int(abs(scale.get_value() - 2))
|
||||
ec_commands.framework_laptop.set_fp_led_level(
|
||||
app.cros_ec, value
|
||||
)
|
||||
self.led_pwr.set_subtitle(fp_led_level_text[value])
|
||||
case 1:
|
||||
value = int(scale.get_value())
|
||||
ec_commands.framework_laptop.set_fp_led_percent(
|
||||
app.cros_ec, value
|
||||
)
|
||||
self.led_pwr.set_subtitle(f"{value}%")
|
||||
|
||||
if self.fp_led_version == 1:
|
||||
try:
|
||||
current_fp_levels = (
|
||||
ec_commands.framework_laptop.get_fp_led_levels_v1(
|
||||
app.cros_ec
|
||||
).value
|
||||
)
|
||||
self.led_pwr_scale.set_value(current_fp_levels["percentage"])
|
||||
if current_fp_levels["level"] < len(fp_led_level_text):
|
||||
self.led_pwr.set_subtitle(
|
||||
f"{fp_led_level_text[current_fp_levels['level']]} ({current_fp_levels['percentage']}%)"
|
||||
)
|
||||
else:
|
||||
self.led_pwr.set_subtitle(f"{current_fp_levels['percentage']}%")
|
||||
|
||||
except ec_exceptions.ECError as e:
|
||||
if e.ec_status == ec_exceptions.EcStatus.EC_RES_INVALID_VERSION:
|
||||
self.fp_led_version = 0
|
||||
else:
|
||||
raise e
|
||||
|
||||
if self.fp_led_version == 0:
|
||||
current_fp_level = ec_commands.framework_laptop.get_fp_led_level(
|
||||
app.cros_ec
|
||||
).value
|
||||
if current_fp_level < len(fp_led_level_text):
|
||||
self.led_pwr_scale_adj.set_upper(2)
|
||||
self.led_pwr_scale.set_value(abs(current_fp_level - 2))
|
||||
self.led_pwr.set_subtitle(f"{fp_led_level_text[current_fp_level]}")
|
||||
else:
|
||||
# Disable if an unsupported level is set
|
||||
self.led_pwr_scale.set_sensitive(False)
|
||||
current_fp_percent = (
|
||||
ec_commands.framework_laptop.get_fp_led_percent(app.cros_ec)
|
||||
)
|
||||
self.led_pwr_scale.set_value(current_fp_percent)
|
||||
self.led_pwr.set_subtitle(f"Custom {current_fp_percent}%")
|
||||
|
||||
current_fp_level = ec_commands.framework_laptop.get_fp_led_level(
|
||||
app.cros_ec
|
||||
).value
|
||||
self.led_pwr_scale.set_value(abs(current_fp_level - 2))
|
||||
self.led_pwr.set_subtitle(["High", "Medium", "Low"][current_fp_level])
|
||||
self.led_pwr_scale.connect("value-changed", handle_led_pwr)
|
||||
except ec_exceptions.ECError as e:
|
||||
if e.ec_status == ec_exceptions.EcStatus.EC_RES_INVALID_COMMAND:
|
||||
@@ -110,6 +156,9 @@ class LedsPage(Gtk.Box):
|
||||
continue
|
||||
else:
|
||||
raise e
|
||||
|
||||
# Power LED does not support Blue, even though Intel models think they do
|
||||
leds[ec_commands.leds.EcLedId.EC_LED_ID_POWER_LED][2] = 0
|
||||
|
||||
def handle_led_colour(combobox, led_id):
|
||||
colour = combobox.get_selected() - 2
|
||||
|
||||
@@ -135,8 +135,9 @@ class YafiApplication(Adw.Application):
|
||||
about = Adw.AboutDialog(
|
||||
application_icon="au.stevetech.yafi",
|
||||
application_name="Yet Another Framework Interface",
|
||||
comments="YAFI is another GUI for the Framework Laptop Embedded Controller.\n"
|
||||
+ "It is written in Python with a GTK3 theme, and uses the `CrOS_EC_Python` library to communicate with the EC.",
|
||||
comments="YAFI is another GUI for the Framework Laptop Embedded Controller.\n\n"
|
||||
+ "It is written in Python with a GTK4 Adwaita theme, and uses the CrOS_EC_Python library to communicate with the EC.\n\n"
|
||||
+ "YAFI is not affiliated with Framework Computer Inc. in any way.",
|
||||
copyright="© 2025 Stephen Horvath",
|
||||
developer_name="Stephen Horvath",
|
||||
developers=["Stephen Horvath https://github.com/Steve-Tech"],
|
||||
|
||||
6
yafi/ui/leds.cmb
Normal file
6
yafi/ui/leds.cmb
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||
<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd">
|
||||
<!-- Created with Cambalache 0.96.1 -->
|
||||
<cambalache-project version="0.96.0" target_tk="gtk-4.0">
|
||||
<ui template-class="LedsPage" filename="leds.ui" sha256="a52e82a54a64ff7e5ca5a83af2ee096c1be44c379cc286c65fbee8eaf2400324"/>
|
||||
</cambalache-project>
|
||||
@@ -26,11 +26,10 @@
|
||||
<child>
|
||||
<object class="GtkScale" id="led_pwr_scale">
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment">
|
||||
<object class="GtkAdjustment" id="led_pwr_scale_adj">
|
||||
<property name="page-increment">1.0</property>
|
||||
<property name="step-increment">1.0</property>
|
||||
<property name="upper">2.0</property>
|
||||
<property name="value">2.0</property>
|
||||
<property name="upper">100.0</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="hexpand">True</property>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user