Louisreed/alienware-m15-rgb
GitHub: Louisreed/alienware-m15-rgb
通过逆向工程 hidraw 协议,为 Linux 上无法被 OpenRGB 等工具控制的 Alienware m15 R2 逐键键盘提供原生 RGB 灯效控制。
Stars: 0 | Forks: 0
# alienware-m15-rgb
**用于 Alienware m15 R2 键盘的原生 Linux 逐键 RGB 控制** — 无需
Windows,无需 Alienware Command Center,无需专有 daemon。
m15 R2 的逐键键盘由 Darfon controller (`0d62:0a1c`) 驱动,
**OpenRGB、AlienFX 和 AKBL 均无法对其进行控制** — OpenRGB 只能识别到
独立的机箱控制器 (`187c:0550`)。本项目通过 `hidraw` 直接与键盘的
实际协议进行通信,因此你终于可以在
Linux 上设置其颜色了。
## 功能
- 将整个键盘设置为纯色
- 在键盘上分布调色板(色带)
- 自动**匹配你的桌面壁纸**
- 固件特效(波浪、呼吸、脉冲等)
- 亮度缩放
- 可选的 **GNOME 顶栏菜单** 来控制一切
- 纯 stdlib Python + `hidraw` ioctls — 无需 C,无需 daemon,无需外部库
## 支持的硬件
| 设备 | USB ID | 状态 |
|---|---|
| Alienware m15 R2 逐键键盘 (Darfon) | `0d62:0a1c` | ✅ 已测试 |
其他使用相同 Darfon "API_V5" 键盘(厂商 HID
Usage `0xCC`,Report ID `0xCC`)的 Alienware 笔记本可能兼容 — 如果你尝试了某款设备,请带上 `alienware-m15-rgb detect` 和 `lsusb` 的输出提交一个 issue。
## 安装
### 从 PyPI
```
pip install --user alienware-m15-rgb
# 然后安装 udev 规则以进行非 root 访问(见下文)
```
### 从源码 / git
```
git clone https://github.com/Louisreed/alienware-m15-rgb
cd alienware-m15-rgb
./install.sh
```
### udev 规则(用于非 root 访问)
```
sudo cp udev/99-alienware-m15-rgb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger
# 注销并重新登录一次,以便 uaccess ACL 生效
```
`wallpaper` 匹配需要 **ImageMagick** (`magick`/`convert`) 来进行图像
解码(支持 JPEG-XL、PNG、JPG 等)。
## 用法
```
alienware-m15-rgb solid 00AEEF # whole keyboard Alienware-blue
alienware-m15-rgb grid FF0000,00FF00,0000FF,FFFF00
alienware-m15-rgb wallpaper # match the desktop wallpaper (gradient)
alienware-m15-rgb wallpaper --mode dominant
alienware-m15-rgb effect wave # firmware wave animation
alienware-m15-rgb brightness 40 # dim the current colours to 40%
alienware-m15-rgb off
alienware-m15-rgb detect # print the keyboard's hidraw node
```
作为库使用:
```
from alienware_m15_rgb import Keyboard
with Keyboard() as kb:
kb.set_solid(0xFF, 0x14, 0x14)
```
## GNOME 顶栏菜单(可选)
```
cp -r gnome-extension/alienware-m15-rgb@local \
~/.local/share/gnome-shell/extensions/
gnome-extensions enable alienware-m15-rgb@local # then log out/in
```
## 工作原理(简述)
键盘暴露了一个厂商 HID 集合(Usage Page `0xFF89`,Usage `0xCC`)
以及一个 63 字节的 **feature** 报告(Report ID `0xCC`)。颜色通过发出
一系列 `HIDIOCSFEATURE` 报告来设置:
```
Reset cc 94
Custom mode cc 80 01 fe 00 00 01 01 01 ← required, or colours are ignored
ColorSet cc 8c 02 00 [keyID+1, R, G, B] × up to 15
Loop cc 8c 13
Update cc 8b 01 ff
```
完整的逆向工程细节请参阅 [`docs/PROTOCOL.md`](docs/PROTOCOL.md)。
## 许可证
[GPL-3.0-or-later](LICENSE)。这是一个独立的互操作性
实现;不包含任何专有代码。
## 免责声明
本项目不附属于 Dell/Alienware,也未获得其认可。使用风险自负。
标签:Alienware, HID, Python, RGB灯效, 云资产清单, 无后门, 硬件控制, 逆向工具, 逆向工程