[BACK]Return to usbhid.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / usbhidctl

Diff for /src/usr.bin/usbhidctl/usbhid.c between version 1.16 and 1.17

version 1.16, 2021/02/04 06:57:19 version 1.17, 2021/05/31 18:30:11
Line 755 
Line 755 
         fprintf(stderr,          fprintf(stderr,
             "       %s -f device [-t table] -w name=value ...\n",              "       %s -f device [-t table] -w name=value ...\n",
             __progname);              __progname);
           fprintf(stderr, "       %s -f device -R\n", __progname);
         exit(1);          exit(1);
 }  }
   
Line 764 
Line 765 
         char const *dev;          char const *dev;
         char const *table;          char const *table;
         size_t varnum;          size_t varnum;
         int aflag, lflag, nflag, rflag, wflag;          uint32_t repsize;
         int ch, hidfd;          int aflag, lflag, nflag, rflag, Rflag, wflag;
           int ch, hidfd, x;
           uint8_t *repdata;
         report_desc_t repdesc;          report_desc_t repdesc;
         char devnamebuf[PATH_MAX];          char devnamebuf[PATH_MAX];
         struct Susbvar variables[128];          struct Susbvar variables[128];
   
         wflag = aflag = nflag = verbose = rflag = lflag = 0;          wflag = aflag = nflag = verbose = rflag = Rflag = lflag = 0;
         dev = NULL;          dev = NULL;
         table = NULL;          table = NULL;
         while ((ch = getopt(argc, argv, "?af:lnrt:vw")) != -1) {          while ((ch = getopt(argc, argv, "?af:lnRrt:vw")) != -1) {
                 switch (ch) {                  switch (ch) {
                 case 'a':                  case 'a':
                         aflag = 1;                          aflag = 1;
Line 790 
Line 793 
                 case 'r':                  case 'r':
                         rflag = 1;                          rflag = 1;
                         break;                          break;
                   case 'R':
                           Rflag = 1;
                           break;
                 case 't':                  case 't':
                         table = optarg;                          table = optarg;
                         break;                          break;
Line 807 
Line 813 
         }          }
         argc -= optind;          argc -= optind;
         argv += optind;          argv += optind;
         if (dev == NULL || (lflag && (wflag || rflag))) {          if (dev == NULL || (lflag && (wflag || rflag || Rflag)) ||
               (rflag && Rflag)) {
                 /*                  /*
                  * No device specified, or attempting to loop and set                   * No device specified, or attempting to loop and set
                  * or dump report at the same time                   * or dump report at the same time
Line 942 
Line 949 
         if (repdesc == 0)          if (repdesc == 0)
                 errx(1, "USB_GET_REPORT_DESC");                  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) {          if (lflag) {
                 devloop(hidfd, repdesc, variables, varnum);                  devloop(hidfd, repdesc, variables, varnum);
                 /* NOTREACHED */                  /* NOTREACHED */
Line 951 
Line 966 
                 /* Report mode header */                  /* Report mode header */
                 printf("Report descriptor:\n");                  printf("Report descriptor:\n");
   
         devshow(hidfd, repdesc, variables, varnum,          if (!Rflag)
                 1 << hid_input |                  devshow(hidfd, repdesc, variables, varnum,
                 1 << hid_output |                          1 << hid_input |
                 1 << hid_feature);                          1 << hid_output |
                           1 << hid_feature);
   
         if (rflag) {          if (rflag) {
                 /* Report mode trailer */                  /* Report mode trailer */

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17