[haiku-development] Am I misunderstanding USB queue_bulk?

  • From: pete.goodeve@xxxxxxxxxxxx
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 6 Sep 2009 20:41:04 -0700

Hi,
   First, I'd like to note that I have usb_midi pretty much working
(read AND write).  There were some unexpected hacks needed, though.

The main one was in getting the write function to work.  The midi driver
seems to cleanly pass an event at a time, which nicely fits in a USB
midi packet -- *unless* it is a SysEx sequence, which can take many
packets to transmit.  So I thought I'd be efficient, and set up a
rotating pool of packet-sized buffers that I'd fill and pass on to
the USB driver with queue_bulk(...) as fast as they were filled.
(A semaphore primed with the number of buffers is used to prevent
overflow.)

It doesn't work.  dprintf's in the write function and the callback
show that I'm filling the packets with the correct data, and I get
a callback corresponding to each packet queued, but only the first
packet of the group actually seems to get sent!

I've made it work by changing the semaphore to only allow one packet
to get sent until the callback is invoked, but this seems wrong from
the concept of a 'queue'. [And SLOW!]  Or, as I say, am I misunderstanding?

Cheers,
                -- Pete --


Other related posts: