HIDAPI on linux doesn't seem to recognize descriptors





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















Got a device reported in dmesg as:



[ 7679.312788] hid-generic 0003:16D0:0E70.0012: hiddev0,hidraw0: USB HID v1.01 Device [.de.nonchip TinyStick HIDSTM1640] on usb-0000:00:13.0-3/input0


the actual HID descriptor (as I put it into the device's firmware, not sniffed+decoded) is as follows:



PROGMEM const char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = {    /* USB report descriptor */
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x08, // REPORT_COUNT (8)
0x09, 0x00, // USAGE (Undefined)
0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
0x95, 32, // REPORT_COUNT (32)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};


the string descriptors are defined as:



#define USB_CFG_VENDOR_NAME     '.','d','e','.','n','o','n','c','h','i','p'
#define USB_CFG_VENDOR_NAME_LEN 11
#define USB_CFG_DEVICE_NAME 'T','i','n','y','S','t','i','c','k',' ','H','I','D','S','T','M','1','6','4','0'
#define USB_CFG_DEVICE_NAME_LEN 20


i'm using the following code in hidapi to (try to) find it:



#define HIDSERIAL_VENDOR_ID 0x16d0
#define HIDSERIAL_PRODUCT_ID 0x0E70
#define HIDSERIAL_MANUFACTURER_STRING L".de.nonchip"
#define HIDSERIAL_PRODUCT_STRING L"TinyStick HIDSTM1640"

hid_device* hidserial_find_device(void){
hid_device *handle = NULL;

hid_init();
// Enumerate and print the HID devices on the system
struct hid_device_info *devs, *cur_dev;

devs = hid_enumerate(HIDSERIAL_VENDOR_ID, HIDSERIAL_PRODUCT_ID);
cur_dev = devs;
while (cur_dev) {
wprintf(L"%ls %lsn", cur_dev->manufacturer_string, cur_dev->product_string); // <------ DEBUG
if( cur_dev->manufacturer_string!=NULL && cur_dev->product_string!=NULL &&
0==wcscmp(HIDSERIAL_MANUFACTURER_STRING,cur_dev->manufacturer_string) &&
0==wcscmp(HIDSERIAL_PRODUCT_STRING,cur_dev->product_string)){
handle = hid_open_path(cur_dev->path);
break;
}
cur_dev = cur_dev->next;
}
hid_free_enumeration(devs);

return handle;
}


my problem is, the device, while reported correctly by the kernel, is not found. the debug output shows a single line of (null) (null), which indicates the device was enumerated by its VID:PID pair, but the strings are empty all of a sudden. I don't get any errors (one might expect something like "permission denied" but nothing is reported and even running it as root doesn't seem to help)...










share|improve this question





























    1















    Got a device reported in dmesg as:



    [ 7679.312788] hid-generic 0003:16D0:0E70.0012: hiddev0,hidraw0: USB HID v1.01 Device [.de.nonchip TinyStick HIDSTM1640] on usb-0000:00:13.0-3/input0


    the actual HID descriptor (as I put it into the device's firmware, not sniffed+decoded) is as follows:



    PROGMEM const char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = {    /* USB report descriptor */
    0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
    0x09, 0x01, // USAGE (Vendor Usage 1)
    0xa1, 0x01, // COLLECTION (Application)
    0x15, 0x00, // LOGICAL_MINIMUM (0)
    0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
    0x75, 0x08, // REPORT_SIZE (8)
    0x95, 0x08, // REPORT_COUNT (8)
    0x09, 0x00, // USAGE (Undefined)
    0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
    0x95, 32, // REPORT_COUNT (32)
    0x09, 0x00, // USAGE (Undefined)
    0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
    0xc0 // END_COLLECTION
    };


    the string descriptors are defined as:



    #define USB_CFG_VENDOR_NAME     '.','d','e','.','n','o','n','c','h','i','p'
    #define USB_CFG_VENDOR_NAME_LEN 11
    #define USB_CFG_DEVICE_NAME 'T','i','n','y','S','t','i','c','k',' ','H','I','D','S','T','M','1','6','4','0'
    #define USB_CFG_DEVICE_NAME_LEN 20


    i'm using the following code in hidapi to (try to) find it:



    #define HIDSERIAL_VENDOR_ID 0x16d0
    #define HIDSERIAL_PRODUCT_ID 0x0E70
    #define HIDSERIAL_MANUFACTURER_STRING L".de.nonchip"
    #define HIDSERIAL_PRODUCT_STRING L"TinyStick HIDSTM1640"

    hid_device* hidserial_find_device(void){
    hid_device *handle = NULL;

    hid_init();
    // Enumerate and print the HID devices on the system
    struct hid_device_info *devs, *cur_dev;

    devs = hid_enumerate(HIDSERIAL_VENDOR_ID, HIDSERIAL_PRODUCT_ID);
    cur_dev = devs;
    while (cur_dev) {
    wprintf(L"%ls %lsn", cur_dev->manufacturer_string, cur_dev->product_string); // <------ DEBUG
    if( cur_dev->manufacturer_string!=NULL && cur_dev->product_string!=NULL &&
    0==wcscmp(HIDSERIAL_MANUFACTURER_STRING,cur_dev->manufacturer_string) &&
    0==wcscmp(HIDSERIAL_PRODUCT_STRING,cur_dev->product_string)){
    handle = hid_open_path(cur_dev->path);
    break;
    }
    cur_dev = cur_dev->next;
    }
    hid_free_enumeration(devs);

    return handle;
    }


    my problem is, the device, while reported correctly by the kernel, is not found. the debug output shows a single line of (null) (null), which indicates the device was enumerated by its VID:PID pair, but the strings are empty all of a sudden. I don't get any errors (one might expect something like "permission denied" but nothing is reported and even running it as root doesn't seem to help)...










    share|improve this question

























      1












      1








      1








      Got a device reported in dmesg as:



      [ 7679.312788] hid-generic 0003:16D0:0E70.0012: hiddev0,hidraw0: USB HID v1.01 Device [.de.nonchip TinyStick HIDSTM1640] on usb-0000:00:13.0-3/input0


      the actual HID descriptor (as I put it into the device's firmware, not sniffed+decoded) is as follows:



      PROGMEM const char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = {    /* USB report descriptor */
      0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
      0x09, 0x01, // USAGE (Vendor Usage 1)
      0xa1, 0x01, // COLLECTION (Application)
      0x15, 0x00, // LOGICAL_MINIMUM (0)
      0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
      0x75, 0x08, // REPORT_SIZE (8)
      0x95, 0x08, // REPORT_COUNT (8)
      0x09, 0x00, // USAGE (Undefined)
      0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
      0x95, 32, // REPORT_COUNT (32)
      0x09, 0x00, // USAGE (Undefined)
      0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
      0xc0 // END_COLLECTION
      };


      the string descriptors are defined as:



      #define USB_CFG_VENDOR_NAME     '.','d','e','.','n','o','n','c','h','i','p'
      #define USB_CFG_VENDOR_NAME_LEN 11
      #define USB_CFG_DEVICE_NAME 'T','i','n','y','S','t','i','c','k',' ','H','I','D','S','T','M','1','6','4','0'
      #define USB_CFG_DEVICE_NAME_LEN 20


      i'm using the following code in hidapi to (try to) find it:



      #define HIDSERIAL_VENDOR_ID 0x16d0
      #define HIDSERIAL_PRODUCT_ID 0x0E70
      #define HIDSERIAL_MANUFACTURER_STRING L".de.nonchip"
      #define HIDSERIAL_PRODUCT_STRING L"TinyStick HIDSTM1640"

      hid_device* hidserial_find_device(void){
      hid_device *handle = NULL;

      hid_init();
      // Enumerate and print the HID devices on the system
      struct hid_device_info *devs, *cur_dev;

      devs = hid_enumerate(HIDSERIAL_VENDOR_ID, HIDSERIAL_PRODUCT_ID);
      cur_dev = devs;
      while (cur_dev) {
      wprintf(L"%ls %lsn", cur_dev->manufacturer_string, cur_dev->product_string); // <------ DEBUG
      if( cur_dev->manufacturer_string!=NULL && cur_dev->product_string!=NULL &&
      0==wcscmp(HIDSERIAL_MANUFACTURER_STRING,cur_dev->manufacturer_string) &&
      0==wcscmp(HIDSERIAL_PRODUCT_STRING,cur_dev->product_string)){
      handle = hid_open_path(cur_dev->path);
      break;
      }
      cur_dev = cur_dev->next;
      }
      hid_free_enumeration(devs);

      return handle;
      }


      my problem is, the device, while reported correctly by the kernel, is not found. the debug output shows a single line of (null) (null), which indicates the device was enumerated by its VID:PID pair, but the strings are empty all of a sudden. I don't get any errors (one might expect something like "permission denied" but nothing is reported and even running it as root doesn't seem to help)...










      share|improve this question














      Got a device reported in dmesg as:



      [ 7679.312788] hid-generic 0003:16D0:0E70.0012: hiddev0,hidraw0: USB HID v1.01 Device [.de.nonchip TinyStick HIDSTM1640] on usb-0000:00:13.0-3/input0


      the actual HID descriptor (as I put it into the device's firmware, not sniffed+decoded) is as follows:



      PROGMEM const char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = {    /* USB report descriptor */
      0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
      0x09, 0x01, // USAGE (Vendor Usage 1)
      0xa1, 0x01, // COLLECTION (Application)
      0x15, 0x00, // LOGICAL_MINIMUM (0)
      0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
      0x75, 0x08, // REPORT_SIZE (8)
      0x95, 0x08, // REPORT_COUNT (8)
      0x09, 0x00, // USAGE (Undefined)
      0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
      0x95, 32, // REPORT_COUNT (32)
      0x09, 0x00, // USAGE (Undefined)
      0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
      0xc0 // END_COLLECTION
      };


      the string descriptors are defined as:



      #define USB_CFG_VENDOR_NAME     '.','d','e','.','n','o','n','c','h','i','p'
      #define USB_CFG_VENDOR_NAME_LEN 11
      #define USB_CFG_DEVICE_NAME 'T','i','n','y','S','t','i','c','k',' ','H','I','D','S','T','M','1','6','4','0'
      #define USB_CFG_DEVICE_NAME_LEN 20


      i'm using the following code in hidapi to (try to) find it:



      #define HIDSERIAL_VENDOR_ID 0x16d0
      #define HIDSERIAL_PRODUCT_ID 0x0E70
      #define HIDSERIAL_MANUFACTURER_STRING L".de.nonchip"
      #define HIDSERIAL_PRODUCT_STRING L"TinyStick HIDSTM1640"

      hid_device* hidserial_find_device(void){
      hid_device *handle = NULL;

      hid_init();
      // Enumerate and print the HID devices on the system
      struct hid_device_info *devs, *cur_dev;

      devs = hid_enumerate(HIDSERIAL_VENDOR_ID, HIDSERIAL_PRODUCT_ID);
      cur_dev = devs;
      while (cur_dev) {
      wprintf(L"%ls %lsn", cur_dev->manufacturer_string, cur_dev->product_string); // <------ DEBUG
      if( cur_dev->manufacturer_string!=NULL && cur_dev->product_string!=NULL &&
      0==wcscmp(HIDSERIAL_MANUFACTURER_STRING,cur_dev->manufacturer_string) &&
      0==wcscmp(HIDSERIAL_PRODUCT_STRING,cur_dev->product_string)){
      handle = hid_open_path(cur_dev->path);
      break;
      }
      cur_dev = cur_dev->next;
      }
      hid_free_enumeration(devs);

      return handle;
      }


      my problem is, the device, while reported correctly by the kernel, is not found. the debug output shows a single line of (null) (null), which indicates the device was enumerated by its VID:PID pair, but the strings are empty all of a sudden. I don't get any errors (one might expect something like "permission denied" but nothing is reported and even running it as root doesn't seem to help)...







      c linux usb hid hidapi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 16:55









      nonchipnonchip

      61911233




      61911233
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460397%2fhidapi-on-linux-doesnt-seem-to-recognize-descriptors%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460397%2fhidapi-on-linux-doesnt-seem-to-recognize-descriptors%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()