mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
chg: add some error messages in order to debug better.
This commit is contained in:
parent
141cde93dd
commit
57337fe941
1 changed files with 6 additions and 2 deletions
|
@ -62,9 +62,10 @@ serial_port uart_open(const char* pcPortName) {
|
||||||
char acPortName[255];
|
char acPortName[255];
|
||||||
serial_port_windows* sp = malloc(sizeof(serial_port_windows));
|
serial_port_windows* sp = malloc(sizeof(serial_port_windows));
|
||||||
|
|
||||||
if (sp == 0)
|
if (sp == 0) {
|
||||||
|
printf("[!] UART failed to allocate memory\n");
|
||||||
return INVALID_SERIAL_PORT;
|
return INVALID_SERIAL_PORT;
|
||||||
|
}
|
||||||
// Copy the input "com?" to "\\.\COM?" format
|
// Copy the input "com?" to "\\.\COM?" format
|
||||||
sprintf(acPortName,"\\\\.\\%s", pcPortName);
|
sprintf(acPortName,"\\\\.\\%s", pcPortName);
|
||||||
_strupr(acPortName);
|
_strupr(acPortName);
|
||||||
|
@ -83,12 +84,14 @@ serial_port uart_open(const char* pcPortName) {
|
||||||
sp->dcb.DCBlength = sizeof(DCB);
|
sp->dcb.DCBlength = sizeof(DCB);
|
||||||
if (!BuildCommDCBA("baud=115200 parity=N data=8 stop=1", &sp->dcb)) {
|
if (!BuildCommDCBA("baud=115200 parity=N data=8 stop=1", &sp->dcb)) {
|
||||||
uart_close(sp);
|
uart_close(sp);
|
||||||
|
printf("[!] UART error cdc setup\n");
|
||||||
return INVALID_SERIAL_PORT;
|
return INVALID_SERIAL_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the active serial port
|
// Update the active serial port
|
||||||
if (!SetCommState(sp->hPort, &sp->dcb)) {
|
if (!SetCommState(sp->hPort, &sp->dcb)) {
|
||||||
uart_close(sp);
|
uart_close(sp);
|
||||||
|
printf("[!] UART error while setting com state\n");
|
||||||
return INVALID_SERIAL_PORT;
|
return INVALID_SERIAL_PORT;
|
||||||
}
|
}
|
||||||
// all zero's configure: no timeout for read/write used.
|
// all zero's configure: no timeout for read/write used.
|
||||||
|
@ -101,6 +104,7 @@ serial_port uart_open(const char* pcPortName) {
|
||||||
|
|
||||||
if (!SetCommTimeouts(sp->hPort, &sp->ct)) {
|
if (!SetCommTimeouts(sp->hPort, &sp->ct)) {
|
||||||
uart_close(sp);
|
uart_close(sp);
|
||||||
|
printf("[!] UART error while setting comm time outs\n");
|
||||||
return INVALID_SERIAL_PORT;
|
return INVALID_SERIAL_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue