Пример #1
0
usbd_status
usbd_intr_transfer(usbd_xfer_handle xfer, usbd_pipe_handle pipe,
		   u_int16_t flags, u_int32_t timeout, void *buf,
		   u_int32_t *size, const char *lbl)
{
	usbd_status err;

	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);

	usbd_setup_xfer(xfer, pipe, 0, buf, *size, flags, timeout, NULL);

	DPRINTFN(1, ("usbd_intr_transfer: start transfer %d bytes\n", *size));
	err = usbd_sync_transfer_sig(xfer);

	usbd_get_xfer_status(xfer, NULL, NULL, size, NULL);

	DPRINTFN(1,("usbd_intr_transfer: transferred %d\n", *size));
	if (err) {
		DPRINTF(("usbd_intr_transfer: error=%d\n", err));
		usbd_clear_endpoint_stall(pipe);
	}
	USBHIST_LOG(usbdebug, "<- done err %d", xfer, err, 0, 0);

	return (err);
}
Пример #2
0
usbd_status
usbd_bulk_transfer(struct usbd_xfer *xfer, struct usbd_pipe *pipe,
    uint16_t flags, uint32_t timeout, void *buf, uint32_t *size)
{
	usbd_status err;

	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);

	usbd_setup_xfer(xfer, 0, buf, *size, flags, timeout, NULL);
	DPRINTFN(1, "start transfer %d bytes", *size, 0, 0, 0);
	err = usbd_sync_transfer_sig(xfer);

	usbd_get_xfer_status(xfer, NULL, NULL, size, NULL);
	DPRINTFN(1, "transferred %d", *size, 0, 0, 0);
	if (err) {
		usbd_clear_endpoint_stall(pipe);
	}
	USBHIST_LOG(usbdebug, "<- done xfer %p err %d", xfer, err, 0, 0);

	return err;
}