Fix win32 uart_receive disconnected device error code (@iceman)

This commit is contained in:
Philippe Teuwen 2019-05-16 13:16:23 +02:00
parent b5e4a60a15
commit 362d7b6956

View file

@ -181,13 +181,13 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
int errorcode = GetLastError(); int errorcode = GetLastError();
// disconnected device
if (res == 0 && errorcode == 2) { if (res == 0 && errorcode == 2) {
return PM3_EIO; return PM3_EIO;
} }
// printf("[!]res %d | rx errorcode == %d \n", res, errorcode); // 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) { 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); // printf("[!!]res %d | send errorcode == %d \n", res, errorcode);
// disconnected device
return PM3_ENOTTY; return PM3_ENOTTY;
} }