13 #include <linux/types.h> 14 #include <linux/input.h> 15 #include <linux/hidraw.h> 29 #include <sys/ioctl.h> 30 #include <sys/types.h> 31 #include <sys/stat.h> 32 #include <fcntl.h> 33 #include <unistd.h>
接下来继续修改
vi /usr/include/linux/input.h
定位到647行
#define BUS_PCI 0x01
#define BUS_ISAPNP 0x02
#define BUS_USB 0x03
#define BUS_HIL 0x04
#define BUS_BLUETOOTH 0x05
/*新增以下这一行*/
#define BUS_VIRTUAL 0x06
#define BUS_ISA 0x10
#define BUS_I8042 0x11
#define BUS_XTKBD 0x12
#define BUS_RS232 0x13
#define BUS_GAMEPORT 0x14
#define BUS_PARPORT 0x15
#define BUS_AMIGA 0x16
#define BUS_ADB 0x17
#define BUS_I2C 0x18
#define BUS_HOST 0x19
#define BUS_GSC 0x1A
/*再新增两行---声明*/
#define BUS_ATARI 0x1B #define BUS_SPI 0x1C
或者进入设置菜单
make menuconfig
进入选项"kernel hacking"
取消勾选:"sameple kernel code"
因为它默认引用了include的头文件,不编译即可!
错误二:
错误提示:编译错误,未知存储大小
解决办法:这两个头文件可以把错误与警告消除
vi samples/hidraw/hid-example.c
新增
#include <arpa/inet.h> #include <netinet/in.h>
错误三: