[libhid-discuss] retrieving large HID descriptor bytes

mike stone vrspace1987 at yahoo.com.tw
Fri Jun 18 06:07:06 UTC 2010


Peter Stuge <peter <at> stuge.se> writes:


> 
> Hm, can you clarify how you use the device on Windows?
> 
  I use the usbhidio VC6 on http://www.lvr.com/hidpage.htm to test the device
under Windows.

  May be it is better to solve libhid problem later. I tried using libusb to 
read data from the device and send data to it.   usb_interrupt_read worked. 
usb_control_msg failed. (the device do not have output endpoint, it use ep0
instead)   

    dev_handle = usb_open(dev);

    if (dev_handle == NULL) {
	printf("USB IO open failed.\n");
	return;
    }
    if(usb_set_configuration(dev_handle, 1) < 0)
    {
      printf("error: setting config 1 failed\n");
      usb_close(dev_handle);
      return;
    }

    if(usb_claim_interface(dev_handle, 0) < 0)
    {
      printf("error: claiming interface 0 failed\n");
      usb_close(dev_handle);
      return;
    } 

/* if usb_control_msg success then usb_interrupt_read will read different type
   of data */

    tmp[0] = 'S'; tmp[1] = 'c'; tmp[2] = 0x0; tmp[1] = 0x0; tmp[4] = '\n';
    if(usb_control_msg(dev_handle, 0x22, 0x9, 0x200, 0x0, &tmp[0], 24, 1000) <
       0)
             printf("usb_control_msg failed***\n");


    for(i = 0; i < 100; i++)
    {
       ret = usb_interrupt_read(dev_handle, 0x1, tmp, 24, 10);
       
       for(j = 0; j < 23;j++) 
       {
          ui = tmp[j];
          printf("%x ", ui); 
       }
       ui = tmp[23];
       printf("%x \n", ui); 





More information about the libhid-discuss mailing list