X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6658905f18a1eebc148836f26c731dea9c1377dc..83288efc7d1b673d30edee6ce732d1de8c505da3:/common/usb.c diff --git a/common/usb.c b/common/usb.c index f0b95291..bef4d7e0 100644 --- a/common/usb.c +++ b/common/usb.c @@ -259,6 +259,19 @@ static void UsbSendZeroLength(void) ; } +static void UsbSendStall(void) +{ + UDP_ENDPOINT_CSR(0) |= UDP_CSR_FORCE_STALL; + + while(!(UDP_ENDPOINT_CSR(0) & UDP_CSR_STALL_SENT)) + ; + + UDP_ENDPOINT_CSR(0) &= ~UDP_CSR_STALL_SENT; + + while(UDP_ENDPOINT_CSR(0) & UDP_CSR_STALL_SENT) + ; +} + static void HandleRxdSetupData(void) { int i; @@ -346,6 +359,8 @@ static void HandleRxdSetupData(void) case USB_REQUEST_CLEAR_FEATURE: case USB_REQUEST_SET_FEATURE: + UsbSendStall(); + break; case USB_REQUEST_SET_DESCRIPTOR: case USB_REQUEST_SYNC_FRAME: default: @@ -436,6 +451,14 @@ void UsbStart(void) } } +BOOL UsbConnected() +{ + if (UDP_GLOBAL_STATE & UDP_GLOBAL_STATE_CONFIGURED) + return TRUE; + else + return FALSE; +} + BOOL UsbPoll(BOOL blinkLeds) { BOOL ret = FALSE;