/* we use a temporary buffer to write the captured data. since the length of written data is determined by host, we cannot write onto the pcm buffer directly... the data is thus copied later at complete callback to the global buffer.  */
static int prepare_capture_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb)
/* we use a temporary buffer to write the captured data. since the length of written data is determined by host, we cannot write onto the pcm buffer directly... the data is thus copied later at complete callback to the global buffer.  */
static int prepare_capture_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb)
{
	int i, offs;
	struct snd_urb_ctx *ctx = urb->context;
	offs = 0;
	urb->dev = ctx->subs->dev;
	for (i = 0; i < ctx->packets; i++) {
		urb->iso_frame_desc[i].offset = offs;
		urb->iso_frame_desc[i].length = subs->curpacksize;
		offs += subs->curpacksize;
	}
	urb->transfer_buffer_length = offs;
	urb->number_of_packets = ctx->packets;
	return 0;
}