From 5bc9118a19dc4839bb276429ad949f1e63013922 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 28 Apr 2019 22:51:40 +0200 Subject: [PATCH] baudrate only for physical uart --- client/proxmark3.c | 10 ++-------- common/usb_cdc.c | 16 ++++++++-------- common/usb_cdc.h | 1 + 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/client/proxmark3.c b/client/proxmark3.c index 5cf045170..35db95975 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -259,7 +259,7 @@ static void show_help(bool showFullHelp, char *exec_name) { PrintAndLogEx(NORMAL, " -t/--text dump all interactive command's help at once"); PrintAndLogEx(NORMAL, " -m/--markdown dump all interactive help at once in markdown syntax"); PrintAndLogEx(NORMAL, " -p/--port serial port to connect to"); - PrintAndLogEx(NORMAL, " -b/--baud serial port speed"); + PrintAndLogEx(NORMAL, " -b/--baud serial port speed (only needed for physical UART, not for USB-CDC or BT)"); PrintAndLogEx(NORMAL, " -w/--wait 20sec waiting the serial port to appear in the OS"); PrintAndLogEx(NORMAL, " -f/--flush output will be flushed after every print"); PrintAndLogEx(NORMAL, " -c/--command execute one proxmark3 command (or several separated by ';')."); @@ -433,15 +433,9 @@ int main(int argc, char *argv[]) { if (!script_cmds_file && !stdinOnPipe) showBanner(); - - // default speed for USB 460800, USART(FPC serial) 115200 baud + // Let's take a baudrate ok for real UART, USB-CDC & BT don't use that info anyway if (speed == 0) -#ifdef WITH_FPC_HOST - // Let's assume we're talking by default to pm3 over usart in this mode speed = USART_BAUD_RATE; -#else - speed = 460800; -#endif if (script_cmd) { while (script_cmd[strlen(script_cmd) - 1] == ' ') diff --git a/common/usb_cdc.c b/common/usb_cdc.c index 04f86ad71..63d5c66d0 100644 --- a/common/usb_cdc.c +++ b/common/usb_cdc.c @@ -420,7 +420,7 @@ const char *getStringDescriptor(uint8_t idx) { reg |= REG_NO_EFFECT_1_ALL; \ reg &= ~(flags); \ pUdp->UDP_CSR[(endpoint)] = reg; \ - } \ + } // reset flags in the UDP_CSR register and waits for synchronization #define UDP_SET_EP_FLAGS(endpoint, flags) { \ @@ -429,7 +429,7 @@ const char *getStringDescriptor(uint8_t idx) { reg |= REG_NO_EFFECT_1_ALL; \ reg |= (flags); \ pUdp->UDP_CSR[(endpoint)] = reg; \ - } \ + } typedef struct { @@ -439,12 +439,12 @@ typedef struct { uint8_t DataBits; } AT91S_CDC_LINE_CODING, *AT91PS_CDC_LINE_CODING; -AT91S_CDC_LINE_CODING line = { - 115200, // baudrate - 0, // 1 Stop Bit - 0, // None Parity - 8 -}; // 8 Data bits +AT91S_CDC_LINE_CODING line = { // purely informative, actual values don't matter + USART_BAUD_RATE, // baudrate + 0, // 1 Stop Bit + 0, // None Parity + 8 // 8 Data bits +}; static void SpinDelay(int ms) { int us = ms * 1000; diff --git a/common/usb_cdc.h b/common/usb_cdc.h index 3dbe9df5f..64dfbcd4d 100644 --- a/common/usb_cdc.h +++ b/common/usb_cdc.h @@ -37,6 +37,7 @@ #include #include "at91sam7s512.h" +#include "usart.h" #include "config_gpio.h" #include "proxmark3.h" // USB_CONNECT() #include "common.h"