mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-11 01:55:38 +08:00
added debug output for usart comms
This commit is contained in:
parent
6d22b606c2
commit
2b90683aff
2 changed files with 6 additions and 0 deletions
|
@ -263,6 +263,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
|||
|
||||
sp->fd = open(pcPortName, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
|
||||
if (sp->fd == -1) {
|
||||
PrintAndLogEx(ERR, "error: UART file descriptor");
|
||||
uart_close(sp);
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
@ -285,6 +286,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
|||
|
||||
// Try to retrieve the old (current) terminal info struct
|
||||
if (tcgetattr(sp->fd, &sp->tiOld) == -1) {
|
||||
PrintAndLogEx(ERR, "error: UART get terminal info attribute");
|
||||
uart_close(sp);
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
@ -305,6 +307,8 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
|||
|
||||
// Try to set the new terminal info struct
|
||||
if (tcsetattr(sp->fd, TCSANOW, &sp->tiNew) == -1) {
|
||||
PrintAndLogEx(ERR, "error: UART set terminal info attribute");
|
||||
perror("tcsetattr() error");
|
||||
uart_close(sp);
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
|||
free(prefix);
|
||||
|
||||
if (strlen(pcPortName) <= 4) {
|
||||
PrintAndLogEx(ERR, "error: tcp port name length too short");
|
||||
free(sp);
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
@ -193,6 +194,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
|||
sp->hPort = CreateFileA(acPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (sp->hPort == INVALID_HANDLE_VALUE) {
|
||||
uart_close(sp);
|
||||
PrintAndLogEx(ERR, "error: invalid handle");
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue