Skip to content

starboykm/flydigi-bs3-linux

Repository files navigation

FlyDigi BS3 Pro Linux 控制台

这是一个给飞智 BS3 Pro 笔记本散热器用的 Linux 控制程序。它通过 BlueZ 的 D-Bus 接口直接与散热器通信,提供网页看板、风扇控制、温度曲线和 RGB 灯效设置。

项目目前在 Fedora 44 和 BS3 Pro 37D7:1004 上开发、测试。它不是飞智官方软件,也没有覆盖其他批次或型号。

BS3 Pro 实时状态与自动曲线

BS3 Pro RGB 灯效控制

现在能做什么

  • 查看散热器的当前转速、目标转速和工作模式
  • 切换静音、标准、强劲、超频四个固定档位
  • 在 1000-4000 RPM 范围内设置实时目标转速
  • 根据 Linux CPU 封装温度运行自定义风扇曲线
  • 编辑 2-8 个温度与转速控制点
  • 使用温度平滑、100 RPM 死区和 90°C 满速保护
  • 设置单色、多色、旋转、流光、呼吸和温控灯效
  • 使用六组颜色、五套预设色板、亮度和速度设置
  • 在桌面和手机浏览器中使用同一套看板

使用前准备

需要:

  • Linux 和正在运行的 BlueZ
  • Python 3.11 或更高版本
  • 已通过系统蓝牙配对的 FlyDigi BS3 Pro
  • 可读取的 /sys/class/thermal CPU 温度源

先确认系统能看到设备:

bluetoothctl devices | grep 'FlyDigi BS3PRO'

设备地址可能与示例不同。重新配对后,随机地址也可能变化。

直接运行

git clone https://github.com/starboykm/flydigi-bs3-linux.git
cd flydigi-bs3-linux

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

./bs3_dashboard.py

程序默认按设备名 FlyDigi BS3PRO 自动发现。如果系统里有多个同名设备,可以显式指定:

./bs3_dashboard.py --address AA:BB:CC:DD:EE:FF

浏览器打开:

http://127.0.0.1:8765

看板默认只监听本机地址,不会暴露到局域网。

命令行控制

./bs3ctl.py status
./bs3ctl.py gear quiet
./bs3ctl.py gear standard
./bs3ctl.py gear performance
./bs3ctl.py gear extreme
./bs3ctl.py rpm 2400
./bs3ctl.py rgb off
./bs3ctl.py rgb on

Docker / Podman

蓝牙控制不是一个完全隔离的容器工作负载。容器需要访问宿主机的 BlueZ D-Bus socket,并只读访问温度目录。仓库里的 Compose 配置已经声明这些挂载。

Docker Compose:

docker compose up -d --build

Podman Compose:

podman compose up -d --build

在 Fedora、Silverblue 等启用 SELinux 的系统上,compose.yaml 使用 label=disable,避免容器运行时尝试重新标记系统 D-Bus socket。这个设置只应用于该容器。

容器仍然只监听宿主机的 127.0.0.1:8765。自动曲线配置保存在 ./data/bs3-dashboard-config.json

如果不使用 Compose,可以手动运行:

docker build -t flydigi-bs3-linux .

docker run --rm \
  --name flydigi-bs3-linux \
  -p 127.0.0.1:8765:8765 \
  -e DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket \
  -v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket \
  -v /sys/class/thermal:/sys/class/thermal:ro \
  -v "$PWD/data:/data" \
  flydigi-bs3-linux

Fedora 使用 Podman 手动运行时,通常还需要追加:

--security-opt label=disable

自动曲线如何工作

后台控制器每四秒读取一次 CPU 封装温度,优先使用:

  1. x86_pkg_temp
  2. TCPU
  3. TCPU_PCI

温度会经过指数平滑,再根据相邻控制点线性插值到目标 RPM。目标变化不足 100 RPM 时不会重复写入,减少风扇来回调整。自动模式启用时,如果实时温度达到 90°C,会请求 4000 RPM。

手动选择档位或设置 RPM 会停用自动曲线,避免后台马上覆盖手动操作。

默认曲线:

温度 目标转速
35°C 1000 RPM
45°C 1400 RPM
55°C 2000 RPM
65°C 2700 RPM
75°C 3400 RPM
85°C 4000 RPM

RGB 灯效

灯效配置通过 FFF0 私有 GATT 服务上传。静态、多色、旋转、流光和呼吸模式会发送一组 30 帧灯带数据。不同模式使用的颜色数量不同:

  • 单色:第一个颜色
  • 多色:前三个颜色
  • 旋转:最多六个颜色
  • 呼吸:最多五个颜色
  • 流光和温控:使用设备协议内置行为

网页会保存上次选择的灯效参数,但设备断电后是否保留由散热器固件决定。

测试

python -m unittest discover -s tests -v
python -m py_compile bs3ctl.py bs3_dashboard.py
node --check bs3-dashboard/app.js

容器构建:

podman build -t flydigi-bs3-linux .

已知限制

  • 目前只在 BS3 Pro 37D7:1004 上实机测试
  • 默认按 FlyDigi BS3PRO 设备名自动发现;多个同名设备需要用 --address 区分
  • 当前自动曲线只读取 CPU 温度,没有读取独显温度
  • RGB 状态不能完整反查,网页显示的是本次会话最后应用的设置
  • 设备固件升级可能改变私有协议
  • Web 服务没有用户认证,请保持监听在 127.0.0.1

协议来源

风扇与灯效帧格式参考了 TIANLI0/THRM 的公开实现和协议文档。本项目在 Linux BlueZ D-Bus 上重新实现传输层,并针对 BS3 Pro 做了实机验证。

English

This project controls the FlyDigi BS3 Pro laptop cooler on Linux through the BlueZ D-Bus API. It provides a local web dashboard, fixed fan gears, direct RPM control, a CPU-temperature fan curve, and RGB lighting modes.

It is currently developed and tested on Fedora 44 with a BS3 Pro reporting USB/Bluetooth product ID 37D7:1004. This is an unofficial community project and has not been validated with other models or hardware revisions.

Quick start

git clone https://github.com/starboykm/flydigi-bs3-linux.git
cd flydigi-bs3-linux

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

./bs3_dashboard.py

Open http://127.0.0.1:8765.

Container

docker compose up -d --build

The container needs the host BlueZ system D-Bus socket and read-only access to /sys/class/thermal. The included Compose file provides both mounts and keeps the dashboard bound to localhost. On SELinux hosts it disables label separation for this container so the system D-Bus socket remains accessible.

Safety and limitations

  • RPM input is limited to 1000-4000 RPM.
  • Automatic mode requests 4000 RPM at 90°C.
  • A manual gear or RPM command disables automatic control.
  • Only CPU package temperature is currently used.
  • Keep the HTTP server on localhost because it has no authentication.
  • Firmware updates may change the private protocol.

License

MIT. See LICENSE.

About

Linux controller and dashboard for the FlyDigi BS3 Pro laptop cooler

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages