From 362d7b69566ad21234921e3936c3e5f990d22291 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 16 May 2019 13:16:23 +0200 Subject: [PATCH] Fix win32 uart_receive disconnected device error code (@iceman) --- uart/uart_win32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uart/uart_win32.c b/uart/uart_win32.c index ba1d0de89..a797a7cd6 100644 --- a/uart/uart_win32.c +++ b/uart/uart_win32.c @@ -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) { @@ -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; }