diff --git a/boards/matek/gnss-m9n-f4/nuttx-config/Kconfig b/boards/matek/gnss-m9n-f4/nuttx-config/Kconfig deleted file mode 100644 index e991f5a766..0000000000 --- a/boards/matek/gnss-m9n-f4/nuttx-config/Kconfig +++ /dev/null @@ -1,23 +0,0 @@ -menu "SERIAL_PASSTHRU Configuration" -config SERIAL_PASSTHRU_UBLOX - bool "Detect and Auto Connect on U-Center messages" - default n - ---help--- - This option will enable the cdc_acm_check to launch - The passthru driver. - -config SERIAL_PASSTHRU_UBLOX_DEV - string "Device path of the GPS" - depends on SERIAL_PASSTHRU_UBLOX - default "/dev/ttyS2" - ---help--- - This is the path of the device used as the right side - of the passthru. - -config SERIAL_PASSTHRU_UBLOX_BAUDRATE - string "baudrate" - depends on SERIAL_PASSTHRU_UBLOX - default "115200" - ---help--- - This option sets the baudrate for the passthru. -endmenu diff --git a/platforms/nuttx/src/px4/common/cdc_acm_check.cpp b/platforms/nuttx/src/px4/common/cdc_acm_check.cpp index a2756a4d3c..ac5a24d7ff 100644 --- a/platforms/nuttx/src/px4/common/cdc_acm_check.cpp +++ b/platforms/nuttx/src/px4/common/cdc_acm_check.cpp @@ -50,6 +50,24 @@ __END_DECLS #define USB_DEVICE_PATH "/dev/ttyACM0" +#if defined(CONFIG_SERIAL_PASSTHRU_UBLOX) +# undef SERIAL_PASSTHRU_UBLOX_DEV +# if defined(CONFIG_SERIAL_PASSTHRU_GPS1) && defined(CONFIG_BOARD_SERIAL_GPS1) +# define SERIAL_PASSTHRU_UBLOX_DEV CONFIG_BOARD_SERIAL_GPS1 +# elif defined(CONFIG_SERIAL_PASSTHRU_GPS2)&& defined(CONFIG_BOARD_SERIAL_GPS2) +# define SERIAL_PASSTHRU_UBLOX_DEV CONFIG_BOARD_SERIAL_GPS2 +# elif defined(CONFIG_SERIAL_PASSTHRU_GPS3)&& defined(CONFIG_BOARD_SERIAL_GPS3) +# define SERIAL_PASSTHRU_UBLOX_DEV CONFIG_BOARD_SERIAL_GPS3 +# elif defined(CONFIG_SERIAL_PASSTHRU_GPS4)&& defined(CONFIG_BOARD_SERIAL_GPS4) +# define SERIAL_PASSTHRU_UBLOX_DEV CONFIG_BOARD_SERIAL_GPS4 +# elif defined(CONFIG_SERIAL_PASSTHRU_GPS5) && defined(CONFIG_BOARD_SERIAL_GPS5) +# define SERIAL_PASSTHRU_UBLOX_DEV CONFIG_BOARD_SERIAL_GPS5 +# endif +# if !defined(SERIAL_PASSTHRU_UBLOX_DEV) +# error "CONFIG_SERIAL_PASSTHRU_GPSn and CONFIG_BOARD_SERIAL_GPSn must be defined" +# endif +#endif + static struct work_s usb_serial_work; static bool vbus_present_prev = false; static int ttyacm_fd = -1; @@ -204,7 +222,7 @@ static void mavlink_usb_check(void *arg) snprintf(baudstring, sizeof(baudstring), "%d", baudrate); static const char *gps_argv[] {"gps", "stop", nullptr}; - static const char *passthru_argv[] {"serial_passthru", "start", "-t", "-b", baudstring, "-e", USB_DEVICE_PATH, "-d", CONFIG_SERIAL_PASSTHRU_UBLOX_DEV, nullptr}; + static const char *passthru_argv[] {"serial_passthru", "start", "-t", "-b", baudstring, "-e", USB_DEVICE_PATH, "-d", SERIAL_PASSTHRU_UBLOX_DEV, nullptr}; #endif char **exec_argv = nullptr; diff --git a/src/systemcmds/serial_passthru/Kconfig b/src/systemcmds/serial_passthru/Kconfig index b91415a6f5..cfbbf9933d 100644 --- a/src/systemcmds/serial_passthru/Kconfig +++ b/src/systemcmds/serial_passthru/Kconfig @@ -4,3 +4,54 @@ menuconfig SYSTEMCMDS_SERIAL_PASSTHRU ---help--- Enable support for passing one sevice to another i.e ttyACM to ttyS5 + +if SYSTEMCMDS_SERIAL_PASSTHRU + +config SERIAL_PASSTHRU_UBLOX + bool "Detect and Auto Connect on U-Center messages" + default n + ---help--- + This option will enable the cdc_acm_check to launch + The passthru driver. + +# +# GPS Passthru device selection +# + +choice + prompt "Passthru device" + default SERIAL_PASSTHRU_GPS1 if BOARD_SERIAL_GPS1 != "" + depends on SERIAL_PASSTHRU_UBLOX + ---help--- + This is the GPS device used as the right side of the passthru. + the path is provided by BOARD_SERIAL_GPSn + +config SERIAL_PASSTHRU_GPS1 + bool "GPS1" + depends on BOARD_SERIAL_GPS1 !="" + +config SERIAL_PASSTHRU_GPS2 + bool "GPS2" + depends on BOARD_SERIAL_GPS2 !="" + +config SERIAL_PASSTHRU_GPS3 + bool "GPS3" + depends on BOARD_SERIAL_GPS3 !="" + +config SERIAL_PASSTHRU_GPS4 + bool "GPS4" + depends on BOARD_SERIAL_GPS4 !="" + +config SERIAL_PASSTHRU_GPS5 + bool "GPS5" + depends on BOARD_SERIAL_GPS5 !="" +endchoice + +config SERIAL_PASSTHRU_UBLOX_BAUDRATE + string "baudrate" + depends on SERIAL_PASSTHRU_UBLOX + default "115200" + ---help--- + This option sets the baudrate for the passthru. + +endif #SYSTEMCMDS_SERIAL_PASSTHRU \ No newline at end of file