HID example description*
1. Overview*
The vsp project supports the use of HID. This article describes how to use HID in vsp; the HID communication in this example is bare data communication, and users can choose different HID protocols according to their needs;
2. HID host computer*
The program used to test the HID up and down communication between GX8008C and PC, the host computer program is based on the linux platform; the code path is in "vsp/tools/hid_host_compter/hid-example.c"
hid-example.c | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
3. Lower computer test program*
The lower computer is GX8008C; the following is the GX8008C test code that has been included in vsp_sdk, and the path is "vsp/mcu/vsp/hook/vsp_hook_hid_demo.c"
vsp_hook_hid_demo.c | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
4. Test example steps*
4.1 Lower computer GX8008C preparation*
- a. Download vsp_sdk, open the terminal, and enter the sdk directory.
- b. Copy "configs/nationalchip_public_version/8008c_wukong_prime_1v4_hid_demo.config" to
.config
. - c. Execute
make menuconfig
, then exit and save. - d. Execute
make clean; make
. - e. After compiling, burn the firmware into GX8008C, and then power on.
- d. After power on, you can view the specific device number of the device through
ls /dev/hidraw*
.
Attention
Please refer to Environment Construction and Compilation and Burning for the specific operations of downloading SDK, compiling, and burning mentioned above.
4.2 Preparation on the PC End of the Host Computer*
- a. Open the terminal and navigate to the vsp_sdk directory: "vsp/tools/hid_host_compter".
- b. Run the command
make
to generate thehid_example
executable. By default, it tests sending and receiving functionality, but you can modify the test mode according to your needs before runningmake
again. - c. Execute
./hid-example /dev/hidraw*
with the specific device number referred to in section 4.1. - d. After the execution is successful, you can receive the data sent by hid.