ffexis/aukey-km-g15-rgb
GitHub: ffexis/aukey-km-g15-rgb
通过逆向工程 USB HID 协议,提供跨平台的 AUKEY KM-G15 机械键盘 RGB 灯效与配置 CLI 控制工具。
Stars: 0 | Forks: 0
# AUKEY KM-G15 RGB 控制
[中文版](README_CN.md)
一款通过 USB HID 控制 AUKEY KM-G15 机械键盘 RGB 灯效的 CLI 工具。
## 功能
- 在 3 个配置档位之间切换
- 设置灯效模式(19 种效果)
- 调节亮度、速度、方向
- 切换彩色模式(多色循环)
- 配置 USB 轮询率(125-1000 Hz)
- 自动检测当前配置档
- 读取当前设备状态
## 支持的键盘
- **AUKEY KM-G15**(Sonix MCU)
- VID:`0x0C45`,PID:`0x7666`
## 安装
### 下载 Release
从 [Releases](https://github.com/ffexis/aukey-km-g15-rgb/releases) 下载适合您平台的最新二进制文件。
### 从源码构建
需要 Go 1.21+ 和 C 编译器(用于 CGO/hidapi)。
```
cd go
make build
```
生成的二进制文件将输出为 `km-g15-rgb.exe`(Windows)或 `km-g15-rgb`(Linux/macOS)。
## 用法
```
km-g15-rgb [flags]
Global Flags:
--device Specific device path (if multiple keyboards)
-p, --profile Target profile slot (0-2, default: auto-detect)
```
### 命令
| 命令 | 描述 |
|---------|-------------|
| `info` | 显示已连接的设备信息 |
| `status` | 读取当前设备配置 |
| `mode ` | 设置灯效模式(0-18, 20) |
| `brightness <0-4>` | 设置亮度级别 |
| `speed <0-4>` | 设置动画速度(0=最慢,4=最快) |
| `rate ` | 设置 USB 轮询率(125, 250, 500, 1000) |
| `profile <0-2>` | 切换活动的配置档位 |
| `colorful ` | 启用/禁用彩色模式 |
| `list-modes` | 列出可用的灯效模式 |
### 示例
```
# 显示设备信息
km-g15-rgb info
# 读取当前状态
km-g15-rgb status
# 在当前 profile 上设置 static mode
km-g15-rgb mode 6
# 在 profile 1 上设置 breathing mode
km-g15-rgb mode 5 -p 1
# 设置最大亮度
km-g15-rgb brightness 4
# 设置最快速度
km-g15-rgb speed 4
# 设置 1000Hz polling rate
km-g15-rgb rate 1000
# 启用 Colorful mode
km-g15-rgb colorful on
# 切换到 profile 2
km-g15-rgb profile 2
```
## 灯效模式
| ID | 名称 (CN) | 名称 (EN) |
|----|-----------|-----------|
| 1 | 随波逐流 | Go with the stream |
| 2 | 彩云纷飞 | Clouds fly |
| 3 | 峰回路转 | Winding paths |
| 4 | 光之审判 | The trial of light |
| 5 | 呼吸 | Breathing |
| 6 | 常亮 | Normally on |
| 7 | 踏雪无痕 | Pass without trace |
| 8 | 泛起涟漪 | Ripple graff |
| 9 | 奔逸绝尘 | Fast run without trace |
| 10 | 繁星点点 | Snow winter jasmine |
| 11 | 百花争艳 | Flowers blooming |
| 12 | 流星赶月 | Swift action |
| 13 | 大鹏展翅 | Hurricane |
| 14 | 厚积薄发 | Accumulate |
| 15 | 落雨纷纷 | Digital Times |
| 16 | 左右逢缘 | Both ways |
| 17 | 众志成城 | Surmount |
| 18 | 速度激情 | Fast and the Furious |
| 20 | 指点江山 | Coastal |
## 参数范围
| 参数 | 范围 | 描述 |
|-----------|-------|-------------|
| 亮度 | 0-4 | 0=最小,4=最大 |
| 速度 | 0-4 | 0=最慢,4=最快 |
| USB 速率 | 125/250/500/1000 | Hz |
## 协议文档
请查看 [docs/PROTOCOL.md](docs/PROTOCOL.md) 获取详细的协议文档。
## 许可证
MIT 许可证
## 致谢
本项目使用了以下开源项目:
- [go-hid](https://github.com/sstallion/go-hid) — libhidapi 的 Go 绑定(USB HID 通信)
- [cobra](https://github.com/spf13/cobra) — Go 的 CLI 框架
- [libhidapi](https://github.com/libusb/hidapi) — 跨平台的 HID API 库
通过使用 [Wireshark](https://www.wireshark.org/) 和 [USBPcap](https://usbpcap.org/) 进行 USB 数据包捕获分析,对协议进行了逆向工程。
标签:EVTX分析, Go, Ruby工具, SOC Prime, USB HID, 云资产清单, 外设驱动, 开发工具, 日志审计, 硬件控制, 逆向工程