Lines Matching defs:pUrb
1000 * @param pUrb The URB to insert.
1002 DECLINLINE(void) usbHidQueueAddTail(PUSBHIDURBQUEUE pQueue, PVUSBURB pUrb)
1004 pUrb->Dev.pNext = NULL;
1005 *pQueue->ppTail = pUrb;
1006 pQueue->ppTail = &pUrb->Dev.pNext;
1018 PVUSBURB pUrb = pQueue->pHead;
1019 if (pUrb)
1021 PVUSBURB pNext = pUrb->Dev.pNext;
1026 pUrb->Dev.pNext = NULL;
1028 return pUrb;
1037 * @param pUrb The URB to remove.
1039 DECLINLINE(bool) usbHidQueueRemove(PUSBHIDURBQUEUE pQueue, PVUSBURB pUrb)
1042 if (pCur == pUrb)
1044 pQueue->pHead = pUrb->Dev.pNext;
1045 if (!pUrb->Dev.pNext)
1052 if (pCur->Dev.pNext == pUrb)
1054 pCur->Dev.pNext = pUrb->Dev.pNext;
1061 if (!pUrb->Dev.pNext)
1064 pUrb->Dev.pNext = NULL;
1085 * @param pUrb The URB.
1087 static void usbHidLinkDone(PUSBHID pThis, PVUSBURB pUrb)
1089 usbHidQueueAddTail(&pThis->DoneQueue, pUrb);
1103 static int usbHidCompleteStall(PUSBHID pThis, PUSBHIDEP pEp, PVUSBURB pUrb, const char *pszWhy)
1105 LogRelFlow(("usbHidCompleteStall/#%u: pUrb=%p:%s: %s\n",
1106 pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, pszWhy));
1108 pUrb->enmStatus = VUSBSTATUS_STALL;
1119 usbHidLinkDone(pThis, pUrb);
1127 static int usbHidCompleteOk(PUSBHID pThis, PVUSBURB pUrb, size_t cbData)
1129 LogRelFlow(("usbHidCompleteOk/#%u: pUrb=%p:%s cbData=%#zx\n",
1130 pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, cbData));
1132 pUrb->enmStatus = VUSBSTATUS_OK;
1133 pUrb->cbData = (uint32_t)cbData;
1135 usbHidLinkDone(pThis, pUrb);
1146 * @param pUrb Set when usbHidHandleDefaultPipe is the
1151 static int usbHidResetWorker(PUSBHID pThis, PVUSBURB pUrb, bool fSetConfig)
1169 if (!pUrb && !fSetConfig) /* (only device reset) */
1182 if (pUrb)
1183 return usbHidCompleteOk(pThis, pUrb, 0);
1258 static int usbHidSendMultiTouchReport(PUSBHID pThis, PVUSBURB pUrb)
1331 USBHIDMT_REPORT *p = (USBHIDMT_REPORT *)&pUrb->abData[0];
1389 return usbHidCompleteOk(pThis, pUrb, sizeof(USBHIDMT_REPORT));
1397 PVUSBURB pUrb = usbHidQueueRemoveHead(&pThis->ToHostQueue);
1402 if (pUrb)
1403 return usbHidSendMultiTouchReport(pThis, pUrb);
1407 if (pUrb)
1409 PUSBHIDTM_REPORT pReport = (PUSBHIDTM_REPORT)&pUrb->abData[0];
1414 return usbHidCompleteOk(pThis, pUrb, cbCopy);
1675 PVUSBURB pUrb = usbHidQueueRemoveHead(&pThis->DoneQueue);
1676 if (!pUrb && cMillies)
1687 pUrb = usbHidQueueRemoveHead(&pThis->DoneQueue);
1692 if (pUrb)
1693 LogRelFlow(("usbHidUrbReap/#%u: pUrb=%p:%s\n", pUsbIns->iInstance, pUrb,
1694 pUrb->pszDesc));
1695 return pUrb;
1711 static DECLCALLBACK(int) usbHidUrbCancel(PPDMUSBINS pUsbIns, PVUSBURB pUrb)
1714 LogRelFlow(("usbHidUrbCancel/#%u: pUrb=%p:%s\n", pUsbIns->iInstance, pUrb,
1715 pUrb->pszDesc));
1721 if (usbHidQueueRemove(&pThis->ToHostQueue, pUrb))
1722 usbHidLinkDone(pThis, pUrb);
1734 static int usbHidHandleIntrDevToHost(PUSBHID pThis, PUSBHIDEP pEp, PVUSBURB pUrb)
1740 return usbHidCompleteStall(pThis, NULL, pUrb, "Halted pipe");
1754 return usbHidCompleteOk(pThis, pUrb, 0);
1765 return usbHidCompleteOk(pThis, pUrb, 0);
1769 usbHidQueueAddTail(&pThis->ToHostQueue, pUrb);
1771 pUrb, pUrb->pszDesc));
1782 pThis->enmState, pUrb->cbData));
1783 return usbHidCompleteStall(pThis, NULL, pUrb, "Really bad state (D2H)!");
1830 static int usbHidRequestClass(PUSBHID pThis, PUSBHIDEP pEp, PVUSBURB pUrb)
1832 PVUSBSETUP pSetup = (PVUSBSETUP)&pUrb->abData[0];
1839 return usbHidCompleteStall(pThis, pEp, pUrb, "Unsupported class req");
1854 pUrb->cbData - sizeof(VUSBSETUP), &pUrb->abData[sizeof(VUSBSETUP)]));
1861 USBHIDMT_REPORT_POINTER *p = (USBHIDMT_REPORT_POINTER *)&pUrb->abData[sizeof(VUSBSETUP)];
1871 USBHIDMT_REPORT *p = (USBHIDMT_REPORT *)&pUrb->abData[sizeof(VUSBSETUP)];
1879 pUrb->abData[sizeof(VUSBSETUP) + 0] = REPORTID_TOUCH_MAX_COUNT;
1880 pUrb->abData[sizeof(VUSBSETUP) + 1] = MT_CONTACT_MAX_COUNT; /* Contact count maximum. */
1881 pUrb->abData[sizeof(VUSBSETUP) + 2] = 0; /* Device identifier */
1886 uint32_t cbLeft = pUrb->cbData;
1887 pUrb->abData[sizeof(VUSBSETUP) + 0] = REPORTID_TOUCH_QABLOB; /* Report Id. */
1888 memcpy(&pUrb->abData[sizeof(VUSBSETUP) + 1],
1894 pUrb->abData[sizeof(VUSBSETUP) + 0] = REPORTID_TOUCH_DEVCONFIG;
1895 pUrb->abData[sizeof(VUSBSETUP) + 1] = 2; /* Device mode:
1899 pUrb->abData[sizeof(VUSBSETUP) + 2] = 0; /* Device identifier */
1905 rc = usbHidCompleteOk(pThis, pUrb, sizeof(VUSBSETUP) + cbData);
1909 rc = usbHidCompleteStall(pThis, pEp, pUrb, "Unsupported GET_REPORT MT");
1915 rc = usbHidCompleteOk(pThis, pUrb, pUrb->cbData);
1923 rc = usbHidCompleteStall(pThis, pEp, pUrb, "Unsupported class req MT");
1933 static int usbHidHandleDefaultPipe(PUSBHID pThis, PUSBHIDEP pEp, PVUSBURB pUrb)
1935 PVUSBSETUP pSetup = (PVUSBSETUP)&pUrb->abData[0];
1936 AssertReturn(pUrb->cbData >= sizeof(*pSetup), VERR_VUSB_FAILED_TO_QUEUE_URB);
1992 cbCopy = pUrb->cbData - sizeof(*pSetup);
1997 memcpy(&pUrb->abData[sizeof(*pSetup)], pDesc, cbCopy);
1998 return usbHidCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
2023 cbCopy = pUrb->cbData - sizeof(*pSetup);
2028 memcpy(&pUrb->abData[sizeof(*pSetup)], pDesc, cbCopy);
2029 return usbHidCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
2043 return usbHidCompleteStall(pThis, pEp, pUrb, "Bad GET_DESCRIPTOR");
2066 memcpy(&pUrb->abData[sizeof(*pSetup)], &wRet, sizeof(wRet));
2067 return usbHidCompleteOk(pThis, pUrb, sizeof(wRet) + sizeof(*pSetup));
2074 memcpy(&pUrb->abData[sizeof(*pSetup)], &wRet, sizeof(wRet));
2075 return usbHidCompleteOk(pThis, pUrb, sizeof(wRet) + sizeof(*pSetup));
2090 memcpy(&pUrb->abData[sizeof(*pSetup)], &wRet, sizeof(wRet));
2091 return usbHidCompleteOk(pThis, pUrb, sizeof(wRet) + sizeof(*pSetup));
2104 return usbHidCompleteStall(pThis, pEp, pUrb, "Bad GET_STATUS");
2118 usbHidCompleteStall(pThis, pEp, pUrb, "TODO: standard request stuff");
2125 return usbHidRequestClass(pThis, pEp, pUrb);
2131 return usbHidCompleteStall(pThis, pEp, pUrb, "Invalid recip");
2138 return usbHidCompleteStall(pThis, pEp, pUrb, "Unknown control msg");
2148 static DECLCALLBACK(int) usbHidQueue(PPDMUSBINS pUsbIns, PVUSBURB pUrb)
2151 LogRelFlow(("usbHidQueue/#%u: pUrb=%p:%s EndPt=%#x\n", pUsbIns->iInstance,
2152 pUrb, pUrb->pszDesc, pUrb->EndPt));
2159 switch (pUrb->EndPt)
2162 rc = usbHidHandleDefaultPipe(pThis, &pThis->aEps[0], pUrb);
2168 rc = usbHidHandleIntrDevToHost(pThis, &pThis->aEps[1], pUrb);
2172 AssertMsgFailed(("EndPt=%d\n", pUrb->EndPt));