Skip to content

Commit

Permalink
Fix win32 uart_receive disconnected device error code (@iceman)
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed May 16, 2019
1 parent b5e4a60 commit 362d7b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions uart/uart_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin

int errorcode = GetLastError();

// disconnected device
if (res == 0 && errorcode == 2) {
return PM3_EIO;
}

// printf("[!]res %d | rx errorcode == %d \n", res, errorcode);
return res;
// disconnected device
return PM3_ENOTTY;
}

int uart_send(const serial_port sp, const uint8_t *p_tx, const uint32_t len) {
Expand All @@ -202,6 +202,7 @@ int uart_send(const serial_port sp, const uint8_t *p_tx, const uint32_t len) {
}

// printf("[!!]res %d | send errorcode == %d \n", res, errorcode);
// disconnected device
return PM3_ENOTTY;
}

Expand Down

0 comments on commit 362d7b6

Please sign in to comment.