Merge pull request #2022 from wh201906/tcp_timeout

Fix the timeout of TCP connections
This commit is contained in:
Iceman 2023-07-05 13:36:34 +02:00 committed by GitHub
commit 9c947eddcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased] ## [unreleased][unreleased]
- Fixed timeout of TCP connections (@wh201906)
## [Seven.4.16717][2023-06-25] ## [Seven.4.16717][2023-06-25]
- Change `hf 14a info` - now identifes QL88 tags (@iceman1001) - Change `hf 14a info` - now identifes QL88 tags (@iceman1001)

View file

@ -623,6 +623,7 @@ int TestProxmark(pm3_device_t *dev) {
PacketResponseNG resp; PacketResponseNG resp;
uint16_t len = 32; uint16_t len = 32;
bool is_tcp_conn = false;
uint8_t data[len]; uint8_t data[len];
for (uint16_t i = 0; i < len; i++) for (uint16_t i = 0; i < len; i++)
data[i] = i & 0xFF; data[i] = i & 0xFF;
@ -665,16 +666,17 @@ int TestProxmark(pm3_device_t *dev) {
memcpy(&g_pm3_capabilities, resp.data.asBytes, MIN(sizeof(capabilities_t), resp.length)); memcpy(&g_pm3_capabilities, resp.data.asBytes, MIN(sizeof(capabilities_t), resp.length));
g_conn.send_via_fpc_usart = g_pm3_capabilities.via_fpc; g_conn.send_via_fpc_usart = g_pm3_capabilities.via_fpc;
g_conn.uart_speed = g_pm3_capabilities.baudrate; g_conn.uart_speed = g_pm3_capabilities.baudrate;
is_tcp_conn = memcmp(g_conn.serial_port_name, "tcp:", 4) == 0;
PrintAndLogEx(INFO, "Communicating with PM3 over %s%s%s", PrintAndLogEx(INFO, "Communicating with PM3 over %s%s%s",
g_conn.send_via_fpc_usart ? _YELLOW_("FPC UART") : _YELLOW_("USB-CDC"), g_conn.send_via_fpc_usart ? _YELLOW_("FPC UART") : _YELLOW_("USB-CDC"),
memcmp(g_conn.serial_port_name, "tcp:", 4) == 0 ? " over " _YELLOW_("TCP") : "", is_tcp_conn ? " over " _YELLOW_("TCP") : "",
memcmp(g_conn.serial_port_name, "bt:", 3) == 0 ? " over " _YELLOW_("BT") : ""); memcmp(g_conn.serial_port_name, "bt:", 3) == 0 ? " over " _YELLOW_("BT") : "");
if (g_conn.send_via_fpc_usart) { if (g_conn.send_via_fpc_usart) {
PrintAndLogEx(INFO, "PM3 UART serial baudrate: " _YELLOW_("%u") "\n", g_conn.uart_speed); PrintAndLogEx(INFO, "PM3 UART serial baudrate: " _YELLOW_("%u") "\n", g_conn.uart_speed);
} else { } else {
int res = uart_reconfigure_timeouts(UART_USB_CLIENT_RX_TIMEOUT_MS); int res = uart_reconfigure_timeouts(is_tcp_conn ? UART_TCP_CLIENT_RX_TIMEOUT_MS : UART_USB_CLIENT_RX_TIMEOUT_MS);
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
return res; return res;
} }