From 61f264f97ab47bb2438b3139a70c1164f4ed0e74 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 19 May 2021 07:28:40 +0200 Subject: [PATCH] Linux port: VFS to init termux, W-no-format for linux only --- esp_modem/CMakeLists.txt | 5 ++++- esp_modem/examples/linux_modem/main/modem_main.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/esp_modem/CMakeLists.txt b/esp_modem/CMakeLists.txt index bbff14a50..a1b031ff3 100644 --- a/esp_modem/CMakeLists.txt +++ b/esp_modem/CMakeLists.txt @@ -33,4 +33,7 @@ idf_component_register(SRCS "${srcs}" target_compile_features(${COMPONENT_LIB} PRIVATE cxx_std_17) -set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_FLAGS -Wno-format) +if(${target} STREQUAL "linux") + # This is needed for ESP_LOGx() macros, as integer formats differ on ESP32(..) and x64 + set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_FLAGS -Wno-format) +endif() diff --git a/esp_modem/examples/linux_modem/main/modem_main.cpp b/esp_modem/examples/linux_modem/main/modem_main.cpp index 456bb6469..68b28188f 100644 --- a/esp_modem/examples/linux_modem/main/modem_main.cpp +++ b/esp_modem/examples/linux_modem/main/modem_main.cpp @@ -8,11 +8,14 @@ #include "esp_modem_config.h" #include "esp_netif.h" + +#define CONFIG_EXAMPLE_SIM_PIN "1234" + using namespace esp_modem; [[maybe_unused]] static const char *TAG = "linux_modem_main"; -#define CONFIG_EXAMPLE_SIM_PIN "1234" + int main() { @@ -25,6 +28,7 @@ int main() .vfs_config = { } }; dte_config.vfs_config.dev_name = "/dev/ttyUSB0"; + dte_config.vfs_config.resource = ESP_MODEM_VFS_IS_UART; // This tells the VFS to init the UART (use termux to setup baudrate, etc.) esp_netif_config_t netif_config = { .dev_name = "/dev/net/tun",