Go to the documentation of this file.
13 #include <linux/types.h>
14 #include <linux/input.h>
15 #include <linux/hidraw.h>
23 #ifndef HIDIOCSFEATURE
24 #define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
25 #define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
29 #include <sys/ioctl.h>
30 #include <sys/types.h>
46 int i,
res, desc_size = 0;
56 perror(
"Unable to open device");
60 memset(&rpt_desc, 0x0,
sizeof(rpt_desc));
61 memset(&info, 0x0,
sizeof(info));
62 memset(buf, 0x0,
sizeof(buf));
67 perror(
"HIDIOCGRDESCSIZE");
69 printf(
"Report Descriptor Size: %d\n", desc_size);
72 rpt_desc.
size = desc_size;
75 perror(
"HIDIOCGRDESC");
77 printf(
"Report Descriptor:\n");
78 for (i = 0; i < rpt_desc.
size; i++)
86 perror(
"HIDIOCGRAWNAME");
88 printf(
"Raw Name: %s\n", buf);
93 perror(
"HIDIOCGRAWPHYS");
95 printf(
"Raw Phys: %s\n", buf);
100 perror(
"HIDIOCGRAWINFO");
103 printf(
"\tbustype: %d (%s)\n",
116 perror(
"HIDIOCSFEATURE");
118 printf(
"ioctl HIDIOCGFEATURE returned: %d\n", res);
124 perror(
"HIDIOCGFEATURE");
126 printf(
"ioctl HIDIOCGFEATURE returned: %d\n", res);
127 printf(
"Report data (not containing the report number):\n\t");
128 for (i = 0; i <
res; i++)
136 res =
write(fd, buf, 2);
141 printf(
"write() wrote %d bytes\n", res);
145 res =
read(fd, buf, 16);
149 printf(
"read() read %d bytes:\n\t", res);
150 for (i = 0; i <
res; i++)