Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
mouse-sdk

mouse-sdk

> 数据库
Free

Cross-platform USB HID/BLE smart mouse SDK with a C ABI for device events and audio. Windows x64/mac

1.5K stars0 likes2 views
WebsiteGitHub

About

Cross-platform USB HID/BLE smart mouse SDK with a C ABI for device events and audio. Windows x64/mac

uMouse SDK - USB HID/BLE Smart Mouse Access

资源 入口
Windows 10 / 11 x64 · SDK 0.4.20 下载 Windows ZIP
macOS 11+ ARM64 · SDK 0.4.20 下载 Apple Silicon ZIP
版本说明与全部发布 GitHub Releases
完整接入文档 v2.2 中文指南 · English guide
C 示例与公共接口 按场景选示例 · umouse_sdk.h
Linux / UOS / 麒麟 / 方德等平台包、兼容硬件与样机 获取方式与技术支持

快速开始

  1. 获取本仓库的示例源码:
bash
   git clone https://github.com/SonicloudTech/mouse-sdk.git
   cd mouse-sdk
  1. 下载上表中对应系统和架构的 ZIP,解压到仓库根目录,确认存在 uMouseSdk/include/umouse_sdk.h,且 SDK 动态库位于 uMouseSdk/ 下。仓库 packages/ 也保留这两个平台包。
  2. 连接兼容设备,在仓库根目录编译运行最小示例。Windows 使用 x64 MSVC 开发者命令提示符;macOS 需要 Xcode Command Line Tools。

Windows x64: bat cl /I uMouseSdk\include demo\demo.c /Fe:umouse-demo.exe /link /LIBPATH:uMouseSdk uMouseSdk.lib set "PATH=%CD%\\\uMouseSdk;%PATH%" umouse-demo.exe macOS ARM64: sh cc -IuMouseSdk/include demo/demo.c -LuMouseSdk -luMouseSdk -Wl,-rpath,@executable_path/uMouseSdk -o umouse-demo ./umouse-demo Keep the relative location of the runtime library and the SDK main library. For Windows, see the README in the package for instructions on loading the DLL/VC runtime library. For macOS, Bluetooth access is required when using BLE for the first time, and the FFmpeg dynamic library is included in the package, so no additional installation is required. The example prints the SDK version; after the device is connected, the message [connected] is displayed, followed by output of device events and audio length, and the received PCM is saved as out.pcm. Press Enter to exit. The ability to read the version number only indicates that the library has been loaded; device connection and callback data are used to confirm the hardware link. The core call sequence is: **register callback → um_sdk_init() → business processing → um_sdk_close(). The SDK provides buttons, device events, and audio data; voice recognition and button business mapping are implemented by the application. For more steps and troubleshooting, see the complete access guide.

场景 示例
声云设备基础接入:按键、设备信息与 PCM 音频 demo.c — FULL 模式最小示例
声云设备原始帧透传,自行解析协议 demo2.c — RAW 模式、握手与通道切换
声云设备与自定义设备同时在线 demo3.c — 多规则、多设备,FULL / RAW 共存
用自定义标识、握手和解析逻辑接入外部硬件 demo4.c — 替换默认规则的完整示例

demo4.c 当前用声云设备的实际标识和协议演示接入流程;接入自有硬件时,需要替换 HW_* 配置、握手和解析逻辑。USB 自定义硬件的数据通道须位于所选接口的首个 HID 顶层集合或独占接口,并支持 Output Report 或 Feature Report 写入。完整前提与示例选择见示例说明;此路径不代表任意 USB / BLE 设备无需适配即可使用。

能做什么

  • 设备扫描与连接:USB 2.4G 接收器即插即用;BLE 扫描与自动接管;USB 优先的通道偏好及运行时切换,同一设备的身份(SN)跨通道连续。
  • 多设备并发:同型号多台可共用规则,默认每规则 4 台、全局 8 台,可配置;每台设备独立解析。
  • 按键事件:语音 / 翻译 / M / AI / 截图键的按下、抬起、长按、单击;未接入键型以原始 code 透传,不做业务映射。
  • JSON 设备事件:SN、电量、会议状态、DPI 广播、会议生命周期与独占调度,以及配对异常、设备数量、BLE 链路数量等告警。
  • 音频输出:内置 SBC / ADPCM 等解码,输出 PCM(16 kHz / 16 bit / 单声道),或透传原始编码块供应用自行解码。
  • RAW 模式:自定义握手、设备匹配、SN 提取和协议解析,使用 um_write_raw 双向传输。
  • 诊断:进程级崩溃记录(不含业务数据)、内部日志开关与队列健康上报。

平台与架构

系统 架构 USB BLE 交付方式
Windows 10 / 11 x64 ✅ ✅ 公开下载
macOS 11+ ARM64(Apple Silicon) ✅ ✅ 公开下载
统信 UOS x86_64 / ARM64 ✅ ✅ 联系获取
麒麟 Kylin x86_64 / ARM64 ✅ ✅ 联系获取
方德 FangDe x86_64 / ARM64 ✅ ✅ 联系获取
通用 Linux x86_64 ✅ ✅ 联系获取
macOS(Intel) x86_64 ✅ ✅ 联系获取

SDK 内部源码以 CMake 工程跨系统、跨架构构建,公开接口使用统一的 C ABI 与 JSON 事件协议。本仓库公开的是交付包和接入资源,不含 SDK 完整源码;当前可直接下载 Windows x64 与 macOS ARM64 包,其余组合按上表联系获取。二进制按系统和架构分别构建,不能互换;Linux 各发行版也需选用匹配的包。

语言集成

For hardware specifications, sample machines, complete protocols, Linux/WinRT and other architecture packages, commercial licenses, and technical support, please contact Anhui SoniCloud Intelligent Technology Co., Ltd. Please specify the target system and architecture, device model, expected quantity, and application scenario.

Is this a universal driver that supports any USB or Bluetooth mouse?

不是。FULL 模式处理兼容的声云设备;自有硬件需要通过 RAW 模式适配设备匹配、握手和帧解析。可从示例选择说明及 demo4.c 开始,具有 USB 或 BLE 连接本身并不足以接入。

Python、Electron 和 C# 可以调用吗?

可以通过公开 C ABI 调用:Python 使用 ctypes,Electron / Node.js 可使用 koffi 等 FFI 库,C# 使用 P/Invoke。应用进程架构必须匹配原生包;保持回调对象存活,如需保留回调缓冲区,应在回调返回前复制,并遵守接入指南的生命周期约定。仓库提供的独立可编译示例是 C 程序,并非每种语言都有打包应用。

明明有 uMouseSdk.dll,为什么仍然加载失败?

检查进程架构、动态库搜索路径和下载包内的全部运行依赖。保留 SDK 随附的 FFmpeg 与 VC 运行库 DLL,并按包内 README 配置加载方式,不要只复制主 DLL。macOS 同样需要保留配套 dylib,使用 BLE 时允许蓝牙访问。

Linux 和 ARM64 的包在哪里下载?

当前公开的 v0.4.20 发布包含 Windows x64 与 macOS ARM64 包。平台矩阵中的 Linux、UOS、麒麟、方德及其他组合通过技术支持获取。申请时说明准确的系统和架构;不同平台二进制不能互换。

SDK 自带语音识别或 MCP 服务器吗?

SDK 提供设备事件和音频,应用负责语音识别与业务动作。需要 AI 智能体控制硬件鼠标时,使用独立的 mouse-mcp 服务器;它的公开发布包面向 Windows x64,并需要兼容硬件。SDK 二进制许可与 MIT 示例代码许可分别适用。

反馈问题

请通过 GitHub Issues 反馈,并附上目标系统与架构、设备型号、SDK 版本(um_sdk_version())、复现步骤及 um_sdk_init(1) 开启的相关日志。

鸣谢

AtomGit:荣获AtomGit 官方 G-Star 优质开源项目认证。

> Tags

sdkblehid

No comments yet. Be the first to share.

> Details

PublishedNov 30, 2026
UpdatedDec 1, 2026
Category数据库
PricingFree

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库