I've have written a driver for Creative's extigy usb sound card, based on 
the generic audio.c driver. The card uses usb interrupts to signal events 
such as button presses on the unit and MIDI messages.

When the host driver gets the interrupt, the event code can be read by
using the GET_MEM request. This works fine for a time, but then the driver
only gets every other interrupt. About half of the events go undetected.  
In particular, this begins to happen while playing or recording an audio
stream.

I am quite sure that the completion handler is not being called in these
cases. Below I have some code snippets. I ask for help answering two
questions:

1. Is there something wrong with the way I request the interrupt?

2. If not, is there some known issue handling usb interrupts in the usb 
core? (I've tried both usb-uhci and uhci under kernel 2.4.20).

In the probe function, I call:

void setup_interrupt(struct extigy* exy,struct usb_device *dev)
{
  int err;
  unsigned int pipe;
  pipe = usb_rcvintpipe(dev,1);
  FILL_INT_URB(&exy->irurb,dev,pipe,exy->irbuf,8,handle_interrupt,exy,1);
  err = usb_submit_urb(&exy->irurb);
  if (err) {
    err("cannot submit interrupt urb");
  }
}

The interrupt handler simply calls ctlmsg(), a convenience function that 
submits the control request:

static void handle_interrupt(struct urb* u)
{
  struct extigy* exy = (struct extigy*)u->context;
  if (u->status < 0) {
    err("interrupt with bad status=%d",u->status);
    return;
  }
  if (exy->irbuf[1]) { /* A jack (un)plugged event. */
    return;
  }
  /* Fetch the code from memory. */
  if (ctlmsg(exy->usbdev,GET_MEM,0xA1,0,0,NULL,2,fetch_ir_code,exy)) {
    err("cannot send control message to get IR code");
  }
}

Thanks,

Richard








-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to