1.. zephyr:code-sample:: usb-hid
2   :name: USB HID (Human Interface Device)
3   :relevant-api: usbd_api usb_hid_device_api
4
5   Use USB HID driver to enumerate as a raw HID device.
6
7Overview
8********
9
10This sample app demonstrates use of a USB Human Interface Device (HID) driver
11by the Zephyr project.  This very simple driver is enumerated as a raw HID
12device. This sample can be found under :zephyr_file:`samples/subsys/usb/hid` in the
13Zephyr project tree.
14
15Requirements
16************
17
18This project requires a USB device driver.
19
20Building and Running
21********************
22
23This sample can be built for multiple boards, in this example we will build it
24for the reel_board board:
25
26.. zephyr-app-commands::
27   :zephyr-app: samples/subsys/usb/hid
28   :board: reel_board
29   :goals: build
30   :compact:
31
32After you have built and flashed the sample app image to your board, plug the
33board into a host device, for example, a PC running Linux.
34The board will be detected as shown by the Linux journalctl command:
35
36.. code-block:: console
37
38    $ journalctl -k -n 10
39    usb 7-1: New USB device found, idVendor=2fe3, idProduct=0006, bcdDevice= 2.03
40    usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
41    usb 7-1: Product: Zephyr HID sample
42    usb 7-1: Manufacturer: ZEPHYR
43    usb 7-1: SerialNumber: 86FE679A598AC47A
44    input: ZEPHYR Zephyr HID sample as /devices/platform/vhci_hcd.0/usb7/7-1/7-1:1.0/0003:2FE3:0100.0046/input/input81
45    hid-generic 0003:2FE3:0100.0046: input,hidraw0: USB HID v1.10 Device [ZEPHYR Zephyr HID sample] on usb-vhci_hcd.0-1/input0
46
47You can monitor report sending using standard Linux ``usbhid-dump`` command.
48
49.. code-block:: console
50
51    $ sudo usbhid-dump -d 2fe3:0006 -es
52    Starting dumping interrupt transfer stream
53    with 1 minute timeout.
54
55    007:012:000:STREAM             1537362690.341208
56     01 02
57