#hid #devices #daemon #hid-io #keyboard #advanced #client

nightly bin+lib hid-io-core

HID-IO是一个用于高级HID设备的宿主端守护进程

5个版本

0.1.4 2023年9月7日
0.1.3 2023年6月5日
0.1.2 2022年11月29日
0.1.1 2022年11月17日
0.1.0 2022年5月22日

#1774 in 硬件支持

每月48次下载
用于hid-io-client

GPL-3.0或更高

780KB
11K SLoC

hid-io-core

Linux Status macOS Status Windows Status Doc Status Total alerts Language grade: Python

docs.rs Crates.io Crates.io Crates.io

HID-IO客户端库和守护进程

概述

Overview

API文档

获取

目前您必须自己构建HID-IO守护进程。但一旦我们准备好公开测试版,它将以二进制形式提供。

用法

hid-io
hid-io --help

RPC终端示例

首先在一个终端中启动hid-io-core

RUST_BACKTRACE=full RUST_LOG="info,tokio=info,tokio_core::reactor=info" cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/hid-io-core`
INFO [hid_io_core] -------------------------- HID-IO Core starting! --------------------------
INFO [hid_io_core] Log location -> "/tmp"
Press Ctrl-C to exit...
INFO [hid_io_core] Version: 0.1.0-beta3 (git v0.1.0-beta3-9-g29548e1) - debug
INFO [hid_io_core] Build: rustc 1.44.0-nightly (f509b26a7 2020-03-18) (x86_64-unknown-linux-gnu) -> x86_64-unknown-linux-gnu (Sun, 29 Mar 2020 21:40:53 GMT)
INFO [hid_io_core] Initializing HID-IO daemon...
INFO [hid_io_core::module] Initializing modules...
INFO [hid_io_core::device] Initializing devices...
INFO [hid_io_core::device::hidusb] Initializing device/hidusb...
INFO [hid_io_core::device::debug] Initializing device/debug...
INFO [hid_io_core::api] Initializing api...
INFO [hid_io_core::device::hidusb] Spawning hidusb spawning thread...
INFO [hid_io_core::device::debug] Spawning device/debug spawning thread...
INFO [hid_io_core::module] Current layout: us
API: Listening on [::1]:7185
INFO [hid_io_core::device::hidusb] Connecting to id:1 Device: "/dev/hidraw12"
    [308f:0013-ff1c:1100] I:4 Input Club Keyboard - Kira PixelMap USB (5337310036384B323430313035353031 - sam4s8) R:1222
Connected to id:1 USB [308f:0013-ff1c:1100] [Input Club] Keyboard - Kira PixelMap USB 5337310036384B323430313035353031 - sam4s8
INFO [hid_io_core::device] Registering device: 1
INFO [hid_io_core::api] Node list update detected, pushing list to subscribers -> 0

然后在另一个终端窗口中,启动RPC示例程序。这将连接到设备串行端口。一旦连接,您就可以开始输入命令。

cargo run --example rpc
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/examples/rpc`
Connecting to [::1]:7185
Version:    0.1.0-beta3 (git v0.1.0-beta3-9-g29548e1)
Buildtime:  Sun, 29 Mar 2020 21:40:53 GMT
Serverarch: x86_64-unknown-linux-gnu
Compiler:   rustc 1.44.0-nightly (f509b26a7 2020-03-18)
Key Path:   /tmp/.tmpGET4P5
Key:        otrbfPWsyZKa6VrWFTXHL
Id:         2
Registering to UsbKeyboard: [308f:0013-ff1c:1100] [Input Club] Keyboard - Kira PixelMap USB (5337310036384B323430313035353031 - sam4s8)
READY


:

:

: version
version
 Revision:      e1a1d816199bf54f42432f6d9097171a1614b6a0
 Revision #:    1222
 Version:       v0.5.7 (+0:1222)
 Branch:        HEAD
 Tree Status:   Clean
	
 Repo Origin:   https://github.com/kiibohd/controller.git
 Commit Date:   2020-03-20 20:19:26 -0700
 Commit Author: Jacob Alexander <haata@kiibohd.com>
 Build Date:    2020-03-23 22:49:38 +0000
 Build OS:      Ubuntu 18.04.1 LTS bionic
 Compiler:      /usr/lib/ccache/arm-none-eabi-gcc 6.3.1
 Architecture:  arm
 Chip Compiled: sam4s8 (sam4s8b)
 CPU:           cortex-m4
 Device:        Keyboard
 Modules:       Scan(Kira) Macro(PixelMap) Output(USB) Debug(full)

 CPU Detected:  SAM4S8C (Rev B)
 CPU Id:        0x410FC241
  (Implementor:ARM:0x41)(Variant:0x0)(Arch:0xF)(PartNo:Cortex-M4:0xC24)(Revision:0x1)
 Chip Id:       0x28AC0AE1
  (Version:0x1)(Proc:CM4:0x7)(NVM1:512kB:0xA)(NVM2:0kB:0x0)(SRAM:128kB:0xC)(Arch:SAM4SxC:0x8A)(NVMType:FLASH:0x2)(ExtId:0x0)
 Chip Ext:      0x0
 Unique Id:     5337310036384B323430313035353031
:

依赖项

  • Rust nightly(可能随时间放松)
  • capnproto >= 0.7.0

i686-pc-windows-gnu依赖项

  • make必须是路径

构建

cargo build

测试

RUST_LOG=hid_io=info RUST_BACKTRACE=1 cargo run

检查rawhid流量

sudo usbhid-dump -m 308f:0013 -es
sudo usbhid-dump -m 1c11:b04d -es -t 0 -i 5

运行单元测试

cargo test

支持的键盘固件

贡献

  • 在提交拉取请求之前,请运行cargo test
  • Travis将失败任何未通过所有测试的提交

调试

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
rust-gdb target/debug/hid-io -p $(pidof hid-io)

打包

cargo build --release --target "x86_64-pc-windows-gnu"

Linux systemd服务

cp hid-io.service /etc/systemd/system
systemctl daemon-reload
systemctl enable --now hid-io

Windows服务

install_service.exe
sc start hid-io
sc stop hid-io
sc query hid-io

OSX服务

cp hidio.plist ~/Library/LaunchAgents
launchctl -w  ~/Library/LaunchAgents/hidio.plist

依赖项

~8–28MB
~391K SLoC