diff --git a/armsrc/appmain.c b/armsrc/appmain.c index f7fc81b57..89b5d1cf1 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1641,7 +1641,8 @@ void __attribute__((noreturn)) AppMain(void) { if (ret == PM3_SUCCESS) { PacketReceived(&rx); } else if (ret != PM3_ENODATA) { - Dbprintf("Error in frame reception: %d", ret); + + Dbprintf("Error in frame reception: %d %s", ret, (ret == PM3_EIO)?"PM3_EIO":""); // TODO if error, shall we resync ? } diff --git a/armsrc/flashmem.c b/armsrc/flashmem.c index 3ec746074..a134ebbd0 100644 --- a/armsrc/flashmem.c +++ b/armsrc/flashmem.c @@ -529,13 +529,13 @@ void Flashmem_print_status(void) { uint8_t dev_id = Flash_ReadID(); switch (dev_id) { case 0x11 : - DbpString(" Memory size.............2 mbits / 256kb"); + DbpString(" Memory size............." _YELLOW_("2 mbits / 256kb")); break; case 0x10 : - DbpString(" Memory size..... .......1 mbits / 128kb"); + DbpString(" Memory size..... ......." _YELLOW_("1 mbits / 128kb")); break; case 0x05 : - DbpString(" Memory size.............512 kbits / 64kb"); + DbpString(" Memory size............." _YELLOW_("512 kbits / 64kb")); break; default : DbpString(" Device ID..............." _YELLOW_(" --> Unknown <--")); diff --git a/client/comms.c b/client/comms.c index 8f143d5e3..7f6691390 100644 --- a/client/comms.c +++ b/client/comms.c @@ -21,8 +21,6 @@ // Serial port that we are communicating with the PM3 on. static serial_port sp = NULL; -static char *serial_port_name = NULL; -static uint32_t _speed = 0; communication_arg_t conn; capabilities_t pm3_capabilities; @@ -60,7 +58,7 @@ static uint64_t timeout_start_time; static bool dl_it(uint8_t *dest, uint32_t bytes, uint32_t start_index, PacketResponseNG *response, size_t ms_timeout, bool show_warning, uint32_t rec_cmd); void GetSavedSerialPortName( char **dest ) { - *dest = serial_port_name; + *dest = conn.serial_port_name; } void SendCommand(PacketCommandOLD *c) { @@ -555,17 +553,14 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, if (sp == INVALID_SERIAL_PORT) { PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "invalid serial port " _YELLOW_("%s"), portname); sp = NULL; - //serial_port_name = NULL; return false; } else if (sp == CLAIMED_SERIAL_PORT) { PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "serial port " _YELLOW_("%s") " is claimed by another process", portname); sp = NULL; - //serial_port_name = NULL; return false; } else { // start the communication thread - serial_port_name = portname; - _speed = speed; + conn.serial_port_name = portname; conn.run = true; conn.block_after_ACK = flash_mode; // Flags to tell where to add CRC on sent replies @@ -664,14 +659,10 @@ void CloseProxmark(void) { // Fix for linux, it seems that it is extremely slow to release the serial port file descriptor /dev/* // // This may be disabled at compile-time with -DNO_UNLINK (used for a JNI-based serial port on Android). - if (serial_port_name) { - unlink(serial_port_name); - } #endif // Clean up our state sp = NULL; - serial_port_name = NULL; memset(&communication_thread, 0, sizeof(pthread_t)); } diff --git a/client/comms.h b/client/comms.h index 501ee18e7..58387fc66 100644 --- a/client/comms.h +++ b/client/comms.h @@ -50,6 +50,7 @@ typedef struct { // To memorise baudrate uint32_t uart_speed; uint16_t last_command; + uint8_t *serial_port_name; } communication_arg_t; extern communication_arg_t conn;