]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - common/usb.c
Fix data segement. You may now use stuff like int foo = 1; in global context (as...
[proxmark3-svn] / common / usb.c
index f0b9529175ad664e39d848f71c399a5008355717..bef4d7e057eb3fc6769892ebe89e3fea1a1f3122 100644 (file)
@@ -259,6 +259,19 @@ static void UsbSendZeroLength(void)
                ;\r
 }\r
 \r
+static void UsbSendStall(void)\r
+{\r
+       UDP_ENDPOINT_CSR(0) |= UDP_CSR_FORCE_STALL;\r
+\r
+       while(!(UDP_ENDPOINT_CSR(0) & UDP_CSR_STALL_SENT))\r
+               ;\r
+\r
+       UDP_ENDPOINT_CSR(0) &= ~UDP_CSR_STALL_SENT;\r
+\r
+       while(UDP_ENDPOINT_CSR(0) & UDP_CSR_STALL_SENT)\r
+               ;\r
+}\r
+\r
 static void HandleRxdSetupData(void)\r
 {\r
        int i;\r
@@ -346,6 +359,8 @@ static void HandleRxdSetupData(void)
 \r
                case USB_REQUEST_CLEAR_FEATURE:\r
                case USB_REQUEST_SET_FEATURE:\r
+                       UsbSendStall();\r
+                       break;\r
                case USB_REQUEST_SET_DESCRIPTOR:\r
                case USB_REQUEST_SYNC_FRAME:\r
                default:\r
@@ -436,6 +451,14 @@ void UsbStart(void)
        }\r
 }\r
 \r
+BOOL UsbConnected()\r
+{\r
+       if (UDP_GLOBAL_STATE & UDP_GLOBAL_STATE_CONFIGURED)\r
+               return TRUE;\r
+       else\r
+               return FALSE;\r
+}\r
+\r
 BOOL UsbPoll(BOOL blinkLeds)\r
 {\r
        BOOL ret = FALSE;\r
Impressum, Datenschutz