10 #include <sys/types.h>
12 #include <linux/types.h>
18 int main(int argc, char **argv) {
21 r= ioctl(0, HIDIOCGRDESCSIZE, &descsz);
23 perror("HIDIOCGRDESCSIZE");
25 printf("%d\n",descsz);
27 struct hidraw_report_descriptor d;
28 unsigned char buf[descsz];
31 r= ioctl(0, HIDIOCGRDESC, &d);
32 if (r) perror("HIDIOCGRDESC");
33 else { dump(d.d.value, d.d.size); putchar('\n'); }
36 struct hidraw_devinfo di;
37 r= ioctl(0, HIDIOCGRAWINFO, &di);
38 if (r) perror("HIDIOCGRAWINFO");
40 printf("%08"PRIx32" %04"PRIx16" %04"PRIx16"\n",
41 di.bustype, di.vendor, di.product);
44 unsigned char buf[PATH_MAX];
46 r= ioctl(0, HIDIOCGRAWNAME(PATH_MAX), buf);
47 if (r<0) perror("HIDIOCGRAWNAME");
48 else printf("%d %.*s\n", r, r,buf);
50 r= ioctl(0, HIDIOCGRAWPHYS(PATH_MAX), buf);
51 if (r<0) perror("HIDIOCGRAWPHYS");
52 else printf("%d %.*s\n", r, r,buf);