Re: Setting a HID report via an interrupt transfer.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[quoted lines by Alan Stern on 2012/04/06 at 10:22 -0400]

>There's nothing special about setting reports; all you do is a normal 
>interrupt-OUT transfer.

Thanks. Where does the report number and/or any other required information go? 
Should it just be put in a byte which is prepended to the data? For example, to 
set report 3 to the three characters "abc", should we actually write {0X03, 
0X61, 0X62, 0X63}?

>With usbfs, you can send an interrupt transfer the same way you would
>send a bulk transfer: the USBDEVFS_BULK ioctl.  Or if you prefer, you
>can use the async interface with USBDEVFS_SUBMITURB, where urb->type is
>set to either USBDEVFS_URB_TYPE_INTERRUPT or USBDEVFS_URB_TYPE_BULK
>(the kernel will accept either one when urb->endpoint refers to an
>interrupt endpoint).

Our code looks like this:

    case UsbEndpointTransfer_Interrupt:
    case UsbEndpointTransfer_Bulk:
      return usbBulkTransfer(endpoint, (void *)buffer, length, timeout);
  /*
    case UsbEndpointTransfer_Interrupt: {
      struct usbdevfs_urb *urb = usbInterruptTransfer(endpoint, (void *)buffer, length, timeout);

      if (urb) {
        ssize_t count = urb->actual_length;
        free(urb);
        return count;
      }
      break;
    }
  */

So we actually do it the easier way, but also keep the harder way hanging 
around in a comment.

>Of course, if you're using usbfs then you have to detach the normal 
>usbhid kernel driver from the interface first.  Presumably you're 
>already aware of what that entails.

Yes. We have code for that as well since it also has to be done for a number of 
non-HID USB to serial adapters. We do, in fact, already support other HID-based 
braille devices - it's just that this is the first one which requires an 
interrupt transfer to set a report.

Even though we already do most of what's necessary, I still do very much 
appreciate your complete answer just in case we weren't.

I think we now just need to know where to put the report number, and whatever 
other information may also need to be added to the data.

-- 
Dave Mielke           | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario   | 2011 May 21 is the End of Salvation.
EMail: dave@xxxxxxxxx | Canada  K2A 1H7   | http://Mielke.cc/now.html
http://FamilyRadio.com/                   | http://Mielke.cc/bible/
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux