This commit is contained in:
Philippe Teuwen
2019-05-08 01:35:51 +02:00
parent f49d7e6d39
commit 68e5b3c355
21 changed files with 106 additions and 106 deletions

View File

@@ -323,7 +323,7 @@ int uart_send(const serial_port sp, const uint8_t *pbtTx, const uint32_t len) {
res = write(((serial_port_unix *)sp)->fd, pbtTx + pos, len - pos);
// Stop if the OS has some troubles sending the data
if (res <= 0)
if (res <= 0)
return PM3_EIO;
pos += res;

View File

@@ -160,8 +160,8 @@ uint32_t uart_get_speed(const serial_port sp) {
}
int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uint32_t *pszRxLen) {
int res = ReadFile(((serial_port_windows *)sp)->hPort, pbtRx, pszMaxRxLen, (LPDWORD)pszRxLen, NULL);
if ( res )
int res = ReadFile(((serial_port_windows *)sp)->hPort, pbtRx, pszMaxRxLen, (LPDWORD)pszRxLen, NULL);
if (res)
return PM3_SUCCESS;
int errorcode = GetLastError();
@@ -171,22 +171,22 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
return PM3_EIO;
}
printf("[!]res %d | rx errorcode == %d \n",res, errorcode);
return res;
printf("[!]res %d | rx errorcode == %d \n", res, errorcode);
return res;
}
int uart_send(const serial_port sp, const uint8_t *p_tx, const uint32_t len) {
DWORD txlen = 0;
int res = WriteFile(((serial_port_windows *)sp)->hPort, p_tx, len, &txlen, NULL);
if ( res )
if (res)
return PM3_SUCCESS;
int errorcode = GetLastError();
if (res == 0 && errorcode == 2) {
return PM3_EIO;
}
printf("[!!]res %d | send errorcode == %d \n",res, errorcode);
printf("[!!]res %d | send errorcode == %d \n", res, errorcode);
return PM3_ENOTTY;
}