10 #include <sys/types.h>
12 #include <linux/types.h>
18 static void dump(const void *pu, int l) {
27 int main(int argc, char **argv) {
30 r= ioctl(0, HIDIOCGRDESCSIZE, &descsz);
32 perror("HIDIOCGRDESCSIZE");
34 printf("%d\n",descsz);
36 struct hidraw_report_descriptor d;
37 unsigned char buf[descsz];
40 r= ioctl(0, HIDIOCGRDESC, &d);
41 if (r) perror("HIDIOCGRDESC");
42 else { dump(d.d.value, d.d.size); putchar('\n'); }
45 struct hidraw_devinfo di;
46 r= ioctl(0, HIDIOCGRAWINFO, &di);
47 if (r) perror("HIDIOCGRAWINFO");
49 printf("%08"PRIx32" %04"PRIx16" %04"PRIx16"\n",
50 di.bustype, di.vendor, di.product);
53 unsigned char buf[PATH_MAX];
55 r= ioctl(0, HIDIOCGRAWNAME(PATH_MAX), buf);
56 if (r<0) perror("HIDIOCGRAWNAME");
57 else printf("%d %.*s\n", r, r,buf);
59 r= ioctl(0, HIDIOCGRAWPHYS(PATH_MAX), buf);
60 if (r<0) perror("HIDIOCGRAWPHYS");
61 else printf("%d %.*s\n", r, r,buf);