]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
detect usb or no usb for standalone mode [ryan]
[proxmark3-svn] / armsrc / appmain.c
index 7dba687fc80ca37270ffb48ba70cba2d83a20fab..33df93c47e1708758351da7d55223c3e917e682e 100644 (file)
@@ -13,7 +13,6 @@
 #include "LCD.h"
 #endif
 
-int usbattached = 0;
 
 //=============================================================================
 // A buffer where we can queue things up to be sent through the FPGA, for
@@ -64,8 +63,8 @@ void ToSendStuffBit(int b)
 void DbpString(char *str)
 {
        /* this holds up stuff unless we're connected to usb */
-//     if (!usbattached)
-//             return;
+       if (!UsbConnected())
+               return;
 
        UsbCommand c;
        c.cmd = CMD_DEBUG_PRINT_STRING;
@@ -80,8 +79,8 @@ void DbpString(char *str)
 void DbpIntegers(int x1, int x2, int x3)
 {
        /* this holds up stuff unless we're connected to usb */
-//     if (!usbattached)
-//             return;
+       if (!UsbConnected())
+               return;
 
        UsbCommand c;
        c.cmd = CMD_DEBUG_PRINT_INTEGERS;
@@ -266,7 +265,7 @@ void SamyRun()
 
        for (;;)
        {
-               usbattached = UsbPoll(FALSE);
+               UsbPoll(FALSE);
                WDT_HIT();
 
                // Was our button held down or pressed?
@@ -597,10 +596,6 @@ void UsbPacketReceived(BYTE *packet, int len)
                        LED_D_OFF(); // LED D indicates field ON or OFF
                        break;
 
-               case CMD_ACQUIRE_RAW_BITS_TI_TYPE:
-                       AcquireRawBitsTI();
-                       break;
-
                case CMD_READ_TI_TYPE:
                        ReadTItag();
                        break;
@@ -609,8 +604,7 @@ void UsbPacketReceived(BYTE *packet, int len)
                        WriteTItag(c->ext1,c->ext2,c->ext3);
                        break;
 
-               case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K:
-               case CMD_DOWNLOAD_RAW_BITS_TI_TYPE: {
+               case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K: {
                        UsbCommand n;
                        if(c->cmd == CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K) {
                                n.cmd = CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K;
@@ -632,11 +626,6 @@ void UsbPacketReceived(BYTE *packet, int len)
                        SimulateTagLowFrequency(c->ext1, 1);
                        LED_A_OFF();
                        break;
-#ifdef WITH_LCD
-               case CMD_LCD_RESET:
-                       LCDReset();
-                       break;
-#endif
                case CMD_READ_MEM:
                        ReadMem(c->ext1);
                        break;
@@ -644,6 +633,9 @@ void UsbPacketReceived(BYTE *packet, int len)
                        FpgaSendCommand(FPGA_CMD_SET_DIVISOR, c->ext1);
                        break;
 #ifdef WITH_LCD
+               case CMD_LCD_RESET:
+                       LCDReset();
+                       break;
                case CMD_LCD:
                        LCDSend(c->ext1);
                        break;
@@ -660,7 +652,6 @@ void UsbPacketReceived(BYTE *packet, int len)
                        }
                        break;
 
-
                default:
                        DbpString("unknown command");
                        break;
@@ -723,7 +714,7 @@ void AppMain(void)
 #endif
 
        for(;;) {
-               usbattached = UsbPoll(FALSE);
+               UsbPoll(FALSE);
                WDT_HIT();
 
                if (BUTTON_HELD(1000) > 0)
Impressum, Datenschutz