sys/dev/sound/usb/uaudio.c
static usbd_status
uaudio_chan_open(struct uaudio_softc *sc, struct chan *ch)
{
	struct as_info *as;
	int endpt;
	usbd_status err;

	if (sc->sc_dying)
		return EIO;

	as = &sc->sc_alts[ch->altidx];
	endpt = as->edesc->bEndpointAddress;
	DPRINTF(("uaudio_chan_open: endpt=0x%02x, speed=%d, alt=%d\n",
		 endpt, ch->sample_rate, as->alt));

	/* Set alternate interface corresponding to the mode. */
	err = usbd_set_interface(as->ifaceh, as->alt);
	if (err)
		return err;

	/*
	 * If just one sampling rate is supported,
	 * no need to call uaudio_set_speed().
	 * Roland SD-90 freezes by a SAMPLING_FREQ_CONTROL request.
	 */
	if (as->asf1desc->bSamFreqType != 1) {
		err = uaudio_set_speed(sc, endpt, ch->sample_rate);
		if (err)
			DPRINTF(("uaudio_chan_open: set_speed failed err=%s\n",
				 usbd_errstr(err)));
	}

	ch->pipe = 0;
	ch->sync_pipe = 0;
	DPRINTF(("uaudio_chan_open: create pipe to 0x%02x\n", endpt));
	err = usbd_open_pipe(as->ifaceh, endpt, 0, &ch->pipe);
	if (err)
		return err;
	if (as->edesc1 != NULL) {
		endpt = as->edesc1->bEndpointAddress;
		DPRINTF(("uaudio_chan_open: create sync-pipe to 0x%02x\n", endpt));
		err = usbd_open_pipe(as->ifaceh, endpt, 0, &ch->sync_pipe);
	}
	return err;
}
/* Set up a pipe for a channel. */
Set up a pipe for a channel.
Set up a pipe for a channel .
static usbd_status
uaudio_chan_open(struct uaudio_softc *sc, struct chan *ch)
{
	struct as_info *as;
	int endpt;
	usbd_status err;
	if (sc->sc_dying)
		return EIO;
	as = &sc->sc_alts[ch->altidx];
	endpt = as->edesc->bEndpointAddress;
	DPRINTF(("uaudio_chan_open: endpt=0x%02x, speed=%d, alt=%d\n",
		 endpt, ch->sample_rate, as->alt));
	err = usbd_set_interface(as->ifaceh, as->alt);
	if (err)
		return err;
	if (as->asf1desc->bSamFreqType != 1) {
		err = uaudio_set_speed(sc, endpt, ch->sample_rate);
		if (err)
			DPRINTF(("uaudio_chan_open: set_speed failed err=%s\n",
				 usbd_errstr(err)));
	}
	ch->pipe = 0;
	ch->sync_pipe = 0;
	DPRINTF(("uaudio_chan_open: create pipe to 0x%02x\n", endpt));
	err = usbd_open_pipe(as->ifaceh, endpt, 0, &ch->pipe);
	if (err)
		return err;
	if (as->edesc1 != NULL) {
		endpt = as->edesc1->bEndpointAddress;
		DPRINTF(("uaudio_chan_open: create sync-pipe to 0x%02x\n", endpt));
		err = usbd_open_pipe(as->ifaceh, endpt, 0, &ch->sync_pipe);
	}
	return err;
}
static usbd_status uaudio_chan_open ( struct uaudio_softc * sc , struct chan * ch ) { struct as_info * as ; int endpt ; usbd_status err ; if ( sc -> sc_dying ) return EIO ; as = & sc -> sc_alts [ ch -> altidx ] ; endpt = as -> edesc -> bEndpointAddress ; DPRINTF ( ( " \n " , endpt , ch -> sample_rate , as -> alt ) ) ; err = usbd_set_interface ( as -> ifaceh , as -> alt ) ; if ( err ) return err ; if ( as -> asf1desc -> bSamFreqType != 1 ) { err = uaudio_set_speed ( sc , endpt , ch -> sample_rate ) ; if ( err ) DPRINTF ( ( " \n " , usbd_errstr ( err ) ) ) ; } ch -> pipe = 0 ; ch -> sync_pipe = 0 ; DPRINTF ( ( " \n " , endpt ) ) ; err = usbd_open_pipe ( as -> ifaceh , endpt , 0 , & ch -> pipe ) ; if ( err ) return err ; if ( as -> edesc1 != NULL ) { endpt = as -> edesc1 -> bEndpointAddress ; DPRINTF ( ( " \n " , endpt ) ) ; err = usbd_open_pipe ( as -> ifaceh , endpt , 0 , & ch -> sync_pipe ) ; } return err ; }
Set up a pipe for a channel.
Set up a pipe for a channel .
/* Set alternate interface corresponding to the mode. */ /*
	 * If just one sampling rate is supported,
	 * no need to call uaudio_set_speed().
	 * Roland SD-90 freezes by a SAMPLING_FREQ_CONTROL request.
	 */