or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
cgo 與 channel 的陷阱如何造成讀取 usb message 失敗 - lschyi
tags:
COSCUP2020
中階
TR214
歡迎來到 https://hackmd.io/@coscup/2020 共筆
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →點擊本頁上方的 開始用 Markdown 一起寫筆記!
手機版請點選上方 按鈕展開議程列表。
講者使用很酷的人體工學鍵盤: ErgodoxTW
為了找到最適合自己的鍵盤按鍵自定義設定,需要從韌體去紀錄實際上按下了哪一個位置按鍵,而不是
ctrl
,shift
的訊號講者使用 QMK firmware,去接受到 usb keyboard 的 debug log ?
Log format
listener
使用
golang
實作一個 HID listenerv1
用 for loop 一直去讀 log,一個一個字元?
結果怪怪 der
cgo call 成本很高,講者做了一個 benchmark 差了幾乎將至 100 倍
解法:在
C
裡面多讀一點再丟到golang
listenerv2
跑起來卡住了?但每個 unit test 都過了
因為讀 HID 要一直 pulling ,其 timing 是很重要的
但 go channel 是有 lock 的,即便是 buffered channel
還是需要拿到 lock 才能寫入
因此整個程式 sequential 執行被影響到
結論
C
工商
phoenix keyboard