'Ruby: Libusb, one USB Device, two input endpoints = difficulties

I'd like to read out an USB Device in Ruby with libusb, which has two endpoints for input, once 0x81, which is in fact a Midi input Connector, and 0x82, which is the HID of this particular device (where the midi input is built in).

The problem is: Libusb responds with an Timeout, if the Endpoint 0x81 (Midi) is not being fed with data through the Midi input. So in order to fetch data simultaneously also from Endpoint 0x82 (HID), i need a construction like

begin  
  data = @handle.bulk_transfer(:endpoint=>0x81, :dataIn=>512, :timeout=>20) 

 rescue  
  data2 = @handle.bulk_transfer(:endpoint=>0x82, :dataIn=>512, :timeout=>20)
end

But this doesn't work at all, because i won't get any updated data from the HID-Endpoint (0x82), unless the Midi-Endpoint also receives data .

Endpoint 0x82 doesn't generate an timeout when asking for data, but the transmitted Data doesn't change by any action on the HID. Without previously calling Endpoint 0x81 at least the HID works fine.

Is there anything additional that i should tell libusb before accessing another endpoint, after a timeout occurs? According to Lsusb the device itself only accepts bulk transfers on those endpoints.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source