Part 1
요약·해설
Reel Board build, journalctl 탐지와 VID/PID 기반 dump를 설명합니다.
Raw HID
hidraw0
usbhid-dump
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
462156031D2C47FD4F9AD51EF0CCF6F00D4B1C63276A09ABFE3016073850CB59
.. zephyr:code-sample:: usb-hid
:name: USB HID (Human Interface Device)
:relevant-api: _usb_device_core_api usb_hid_device_api
Use USB HID driver to enumerate as a raw HID device.
Overview
********
This sample app demonstrates use of a USB Human Interface Device (HID) driver
by the Zephyr project. This very simple driver is enumerated as a raw HID
device. This sample can be found under :zephyr_file:`samples/subsys/usb/hid` in the
Zephyr project tree.
Requirements
************
This project requires a USB device driver.
Building and Running
********************
This sample can be built for multiple boards, in this example we will build it
for the reel_board board:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/usb/hid
:board: reel_board
:goals: build
:compact:
After you have built and flashed the sample app image to your board, plug the
board into a host device, for example, a PC running Linux.
The board will be detected as shown by the Linux journalctl command:
.. code-block:: console
$ journalctl -k -n 10
usb 7-1: New USB device found, idVendor=2fe3, idProduct=0006, bcdDevice= 2.03
usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 7-1: Product: Zephyr HID sample
usb 7-1: Manufacturer: ZEPHYR
usb 7-1: SerialNumber: 86FE679A598AC47A
input: ZEPHYR Zephyr HID sample as /devices/platform/vhci_hcd.0/usb7/7-1/7-1:1.0/0003:2FE3:0100.0046/input/input81
hid-generic 0003:2FE3:0100.0046: input,hidraw0: USB HID v1.10 Device [ZEPHYR Zephyr HID sample] on usb-vhci_hcd.0-1/input0
You can monitor report sending using standard Linux ``usbhid-dump`` command.
.. code-block:: console
$ sudo usbhid-dump -d 2fe3:0006 -es
Starting dumping interrupt transfer stream
with 1 minute timeout.
007:012:000:STREAM 1537362690.341208
01 02
Part 3
한국어 전문 번역
개요
Zephyr project가 제공하는 USB Human Interface Device(HID) driver 사용법을 보여 주는 sample입니다. Board는 특정 keyboard나 mouse가 아닌 raw HID device로 enumerate됩니다. Source는 samples/subsys/usb/hid에 있습니다.
요구 사항
이 project에는 USB device driver가 필요합니다.
빌드 및 실행
여러 board용으로 build할 수 있습니다. 다음 example은 reel_board용 image를 build합니다.
west build -b reel_board samples/subsys/usb/hid
Image를 build하고 board에 flash한 뒤 Linux PC 같은 host에 연결합니다. Linux journalctl에는 raw HID device와 hidraw0가 다음과 같이 감지됩니다.
$ journalctl -k -n 10
usb 7-1: New USB device found, idVendor=2fe3, idProduct=0006, bcdDevice= 2.03
usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 7-1: Product: Zephyr HID sample
usb 7-1: Manufacturer: ZEPHYR
usb 7-1: SerialNumber: 86FE679A598AC47A
input: ZEPHYR Zephyr HID sample as /devices/platform/vhci_hcd.0/usb7/7-1/7-1:1.0/0003:2FE3:0100.0046/input/input81
hid-generic 0003:2FE3:0100.0046: input,hidraw0: USB HID v1.10 Device [ZEPHYR Zephyr HID sample] on usb-vhci_hcd.0-1/input0
표준 Linux usbhid-dump command로 report 전송을 감시할 수 있습니다. Vendor ID 2fe3, product ID 0006을 선택하면 interrupt transfer stream과 report byte가 표시됩니다.
$ sudo usbhid-dump -d 2fe3:0006 -es
Starting dumping interrupt transfer stream
with 1 minute timeout.
007:012:000:STREAM 1537362690.341208
01 02
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.