=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/usbhidctl/usbhid.c,v retrieving revision 1.16 retrieving revision 1.17 diff -c -r1.16 -r1.17 *** src/usr.bin/usbhidctl/usbhid.c 2021/02/04 06:57:19 1.16 --- src/usr.bin/usbhidctl/usbhid.c 2021/05/31 18:30:11 1.17 *************** *** 1,4 **** ! /* $OpenBSD: usbhid.c,v 1.16 2021/02/04 06:57:19 anton Exp $ */ /* $NetBSD: usbhid.c,v 1.22 2002/02/20 20:30:42 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: usbhid.c,v 1.17 2021/05/31 18:30:11 jcs Exp $ */ /* $NetBSD: usbhid.c,v 1.22 2002/02/20 20:30:42 christos Exp $ */ /* *************** *** 755,760 **** --- 755,761 ---- fprintf(stderr, " %s -f device [-t table] -w name=value ...\n", __progname); + fprintf(stderr, " %s -f device -R\n", __progname); exit(1); } *************** *** 764,779 **** char const *dev; char const *table; size_t varnum; ! int aflag, lflag, nflag, rflag, wflag; ! int ch, hidfd; report_desc_t repdesc; char devnamebuf[PATH_MAX]; struct Susbvar variables[128]; ! wflag = aflag = nflag = verbose = rflag = lflag = 0; dev = NULL; table = NULL; ! while ((ch = getopt(argc, argv, "?af:lnrt:vw")) != -1) { switch (ch) { case 'a': aflag = 1; --- 765,782 ---- char const *dev; char const *table; size_t varnum; ! uint32_t repsize; ! int aflag, lflag, nflag, rflag, Rflag, wflag; ! int ch, hidfd, x; ! uint8_t *repdata; report_desc_t repdesc; char devnamebuf[PATH_MAX]; struct Susbvar variables[128]; ! wflag = aflag = nflag = verbose = rflag = Rflag = lflag = 0; dev = NULL; table = NULL; ! while ((ch = getopt(argc, argv, "?af:lnRrt:vw")) != -1) { switch (ch) { case 'a': aflag = 1; *************** *** 790,795 **** --- 793,801 ---- case 'r': rflag = 1; break; + case 'R': + Rflag = 1; + break; case 't': table = optarg; break; *************** *** 807,813 **** } argc -= optind; argv += optind; ! if (dev == NULL || (lflag && (wflag || rflag))) { /* * No device specified, or attempting to loop and set * or dump report at the same time --- 813,820 ---- } argc -= optind; argv += optind; ! if (dev == NULL || (lflag && (wflag || rflag || Rflag)) || ! (rflag && Rflag)) { /* * No device specified, or attempting to loop and set * or dump report at the same time *************** *** 942,947 **** --- 949,962 ---- if (repdesc == 0) errx(1, "USB_GET_REPORT_DESC"); + if (Rflag) { + hid_get_report_desc_data(repdesc, &repdata, &repsize); + + for (x = 0; x < repsize; x++) + printf("%s0x%02x", x > 0 ? " " : "", repdata[x]); + printf("\n"); + } + if (lflag) { devloop(hidfd, repdesc, variables, varnum); /* NOTREACHED */ *************** *** 951,960 **** /* Report mode header */ printf("Report descriptor:\n"); ! devshow(hidfd, repdesc, variables, varnum, ! 1 << hid_input | ! 1 << hid_output | ! 1 << hid_feature); if (rflag) { /* Report mode trailer */ --- 966,976 ---- /* Report mode header */ printf("Report descriptor:\n"); ! if (!Rflag) ! devshow(hidfd, repdesc, variables, varnum, ! 1 << hid_input | ! 1 << hid_output | ! 1 << hid_feature); if (rflag) { /* Report mode trailer */