Lines Matching refs:itransfer
1265 static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
1266 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1296 transfer->length, darwin_async_io_callback, itransfer);
1299 transfer->length, darwin_async_io_callback, itransfer);
1301 itransfer->flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
1306 darwin_async_io_callback, (void *)itransfer);
1310 darwin_async_io_callback, (void *)itransfer);
1320 static int submit_iso_transfer(struct usbi_transfer *itransfer) {
1321 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1322 struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
1379 itransfer);
1383 itransfer);
1397 static int submit_control_transfer(struct usbi_transfer *itransfer) {
1398 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1402 struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
1420 itransfer->flags |= USBI_TRANSFER_OS_HANDLES_TIMEOUT;
1436 kresult = (*(cInterface->interface))->ControlRequestAsyncTO (cInterface->interface, pipeRef, &(tpriv->req), darwin_async_io_callback, itransfer);
1439 kresult = (*(dpriv->device))->DeviceRequestAsyncTO(dpriv->device, &(tpriv->req), darwin_async_io_callback, itransfer);
1447 static int darwin_submit_transfer(struct usbi_transfer *itransfer) {
1448 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1452 return submit_control_transfer(itransfer);
1455 return submit_bulk_transfer(itransfer);
1457 return submit_iso_transfer(itransfer);
1464 static int cancel_control_transfer(struct usbi_transfer *itransfer) {
1465 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1469 usbi_info (ITRANSFER_CTX (itransfer), "WARNING: aborting all transactions control pipe");
1479 static int darwin_abort_transfers (struct usbi_transfer *itransfer) {
1480 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1498 usbi_info (ITRANSFER_CTX (itransfer), "WARNING: aborting all transactions on interface %d pipe %d", iface, pipeRef);
1503 usbi_info (ITRANSFER_CTX (itransfer), "calling clear pipe stall to clear the data toggle bit");
1516 static int darwin_cancel_transfer(struct usbi_transfer *itransfer) {
1517 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1521 return cancel_control_transfer(itransfer);
1525 return darwin_abort_transfers (itransfer);
1532 static void darwin_clear_transfer_priv (struct usbi_transfer *itransfer) {
1533 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1534 struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
1543 struct usbi_transfer *itransfer = (struct usbi_transfer *)refcon;
1544 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1548 usbi_info (ITRANSFER_CTX (itransfer), "an async io operation has completed");
1555 write (priv->fds[1], &itransfer, sizeof (itransfer));
1560 static int darwin_transfer_status (struct usbi_transfer *itransfer, kern_return_t result) {
1561 if (itransfer->flags & USBI_TRANSFER_TIMED_OUT)
1571 usbi_warn (ITRANSFER_CTX (itransfer), "transfer error: pipe is stalled");
1574 usbi_err (ITRANSFER_CTX (itransfer), "transfer error: data overrun");
1577 usbi_err (ITRANSFER_CTX (itransfer), "transfer error: timed out");
1578 itransfer->flags |= USBI_TRANSFER_TIMED_OUT;
1581 usbi_err (ITRANSFER_CTX (itransfer), "transfer error: %s (value = 0x%08x)", darwin_error_str (result), result);
1586 static void darwin_handle_callback (struct usbi_transfer *itransfer, kern_return_t result, UInt32 io_size) {
1587 struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
1588 struct darwin_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer);
1600 usbi_info (ITRANSFER_CTX (itransfer), "handling %s completion with kernel status %d",
1613 itransfer->transferred += io_size;
1617 usbi_handle_transfer_completion (itransfer, darwin_transfer_status (itransfer, result));
1621 struct usbi_transfer *itransfer;
1670 read (hpriv->fds[0], &itransfer, sizeof (itransfer));
1674 darwin_handle_callback (itransfer, kresult, io_size);