mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
cleaning up
This commit is contained in:
parent
63485527ad
commit
f60977695a
4 changed files with 8 additions and 15 deletions
|
@ -1641,7 +1641,8 @@ void __attribute__((noreturn)) AppMain(void) {
|
||||||
if (ret == PM3_SUCCESS) {
|
if (ret == PM3_SUCCESS) {
|
||||||
PacketReceived(&rx);
|
PacketReceived(&rx);
|
||||||
} else if (ret != PM3_ENODATA) {
|
} 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 ?
|
// TODO if error, shall we resync ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -529,13 +529,13 @@ void Flashmem_print_status(void) {
|
||||||
uint8_t dev_id = Flash_ReadID();
|
uint8_t dev_id = Flash_ReadID();
|
||||||
switch (dev_id) {
|
switch (dev_id) {
|
||||||
case 0x11 :
|
case 0x11 :
|
||||||
DbpString(" Memory size.............2 mbits / 256kb");
|
DbpString(" Memory size............." _YELLOW_("2 mbits / 256kb"));
|
||||||
break;
|
break;
|
||||||
case 0x10 :
|
case 0x10 :
|
||||||
DbpString(" Memory size..... .......1 mbits / 128kb");
|
DbpString(" Memory size..... ......." _YELLOW_("1 mbits / 128kb"));
|
||||||
break;
|
break;
|
||||||
case 0x05 :
|
case 0x05 :
|
||||||
DbpString(" Memory size.............512 kbits / 64kb");
|
DbpString(" Memory size............." _YELLOW_("512 kbits / 64kb"));
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
DbpString(" Device ID..............." _YELLOW_(" --> Unknown <--"));
|
DbpString(" Device ID..............." _YELLOW_(" --> Unknown <--"));
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
|
|
||||||
// Serial port that we are communicating with the PM3 on.
|
// Serial port that we are communicating with the PM3 on.
|
||||||
static serial_port sp = NULL;
|
static serial_port sp = NULL;
|
||||||
static char *serial_port_name = NULL;
|
|
||||||
static uint32_t _speed = 0;
|
|
||||||
|
|
||||||
communication_arg_t conn;
|
communication_arg_t conn;
|
||||||
capabilities_t pm3_capabilities;
|
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);
|
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 ) {
|
void GetSavedSerialPortName( char **dest ) {
|
||||||
*dest = serial_port_name;
|
*dest = conn.serial_port_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendCommand(PacketCommandOLD *c) {
|
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) {
|
if (sp == INVALID_SERIAL_PORT) {
|
||||||
PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "invalid serial port " _YELLOW_("%s"), portname);
|
PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "invalid serial port " _YELLOW_("%s"), portname);
|
||||||
sp = NULL;
|
sp = NULL;
|
||||||
//serial_port_name = NULL;
|
|
||||||
return false;
|
return false;
|
||||||
} else if (sp == CLAIMED_SERIAL_PORT) {
|
} else if (sp == CLAIMED_SERIAL_PORT) {
|
||||||
PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "serial port " _YELLOW_("%s") " is claimed by another process", portname);
|
PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "serial port " _YELLOW_("%s") " is claimed by another process", portname);
|
||||||
sp = NULL;
|
sp = NULL;
|
||||||
//serial_port_name = NULL;
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// start the communication thread
|
// start the communication thread
|
||||||
serial_port_name = portname;
|
conn.serial_port_name = portname;
|
||||||
_speed = speed;
|
|
||||||
conn.run = true;
|
conn.run = true;
|
||||||
conn.block_after_ACK = flash_mode;
|
conn.block_after_ACK = flash_mode;
|
||||||
// Flags to tell where to add CRC on sent replies
|
// 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/*
|
// 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).
|
// 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
|
#endif
|
||||||
|
|
||||||
// Clean up our state
|
// Clean up our state
|
||||||
sp = NULL;
|
sp = NULL;
|
||||||
serial_port_name = NULL;
|
|
||||||
memset(&communication_thread, 0, sizeof(pthread_t));
|
memset(&communication_thread, 0, sizeof(pthread_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ typedef struct {
|
||||||
// To memorise baudrate
|
// To memorise baudrate
|
||||||
uint32_t uart_speed;
|
uint32_t uart_speed;
|
||||||
uint16_t last_command;
|
uint16_t last_command;
|
||||||
|
uint8_t *serial_port_name;
|
||||||
} communication_arg_t;
|
} communication_arg_t;
|
||||||
|
|
||||||
extern communication_arg_t conn;
|
extern communication_arg_t conn;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue