From 8dc5869e359560d351ccd921a1aaf06683f810cf Mon Sep 17 00:00:00 2001 From: Jacques Gagnon Date: Sun, 19 Jan 2025 22:25:21 -0500 Subject: [PATCH] [ADAPTER] Dump output to BT mon in verbose build --- main/Kconfig.projbuild | 5 +++++ main/adapter/wired/cdi.c | 5 ++++- main/adapter/wired/dc.c | 6 +++++- main/adapter/wired/gc.c | 4 ++++ main/adapter/wired/genesis.c | 6 +++++- main/adapter/wired/jag.c | 7 ++++++- main/adapter/wired/jvs.c | 6 +++++- main/adapter/wired/n64.c | 5 ++++- main/adapter/wired/npiso.c | 4 +++- main/adapter/wired/parallel_1p.c | 5 ++++- main/adapter/wired/parallel_2p.c | 5 ++++- main/adapter/wired/pce.c | 5 ++++- main/adapter/wired/pcfx.c | 4 +++- main/adapter/wired/ps.c | 7 ++++++- main/adapter/wired/real.c | 4 +++- main/adapter/wired/saturn.c | 6 +++++- main/adapter/wired/sea.c | 7 +++++-- main/adapter/wired/wii.c | 8 ++++++-- main/bluetooth/mon.h | 6 ++++++ 19 files changed, 87 insertions(+), 18 deletions(-) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index a9c1af45..09e759e0 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -245,6 +245,11 @@ menu "BlueRetro" endchoice + config BLUERETRO_BTMON_VERBOSE + bool "Enable verbose loggin into BT monitor" + help + Seclect this to enable verbose loggin into BT monitor. + endmenu endmenu diff --git a/main/adapter/wired/cdi.c b/main/adapter/wired/cdi.c index b0850ac8..4e8a2881 100644 --- a/main/adapter/wired/cdi.c +++ b/main/adapter/wired/cdi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -9,6 +9,7 @@ #include "adapter/config.h" #include "adapter/kb_monitor.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "cdi.h" #define CDI_KB_SHIFT 0x01 @@ -378,6 +379,8 @@ void cdi_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wire TESTS_CMDS_LOG("\"wired_output\": {\"axes\": [%ld, %ld], \"btns\": %d},\n", raw_axes[cdi_axes_idx[0]], raw_axes[cdi_axes_idx[1]], map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"axes\": [%08lX, %08lX], \"btns\": %02X},\n", + raw_axes[cdi_axes_idx[0]], raw_axes[cdi_axes_idx[1]], map_tmp.buttons); } static void cdi_mouse_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/dc.c b/main/adapter/wired/dc.c index adf0bb90..37d7d3df 100644 --- a/main/adapter/wired/dc.c +++ b/main/adapter/wired/dc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "adapter/wired/wired.h" #include "system/manager.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "dc.h" #define DC_TIMEOUT_TO_US 250000 @@ -316,6 +317,9 @@ static void dc_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data TESTS_CMDS_LOG("\"wired_output\": {\"axes\": [%d, %d, %d, %d, %d, %d], \"btns\": %d},\n", map_tmp.axes[dc_axes_idx[0]], map_tmp.axes[dc_axes_idx[1]], map_tmp.axes[dc_axes_idx[2]], map_tmp.axes[dc_axes_idx[3]], map_tmp.axes[dc_axes_idx[4]], map_tmp.axes[dc_axes_idx[5]], map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"axes\": [%02X, %02X, %02X, %02X, %02X, %02X], \"btns\": %04X},\n", + map_tmp.axes[dc_axes_idx[0]], map_tmp.axes[dc_axes_idx[1]], map_tmp.axes[dc_axes_idx[2]], + map_tmp.axes[dc_axes_idx[3]], map_tmp.axes[dc_axes_idx[4]], map_tmp.axes[dc_axes_idx[5]], map_tmp.buttons); } static void dc_mouse_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/gc.c b/main/adapter/wired/gc.c index 55d2bd19..ddb0c5eb 100644 --- a/main/adapter/wired/gc.c +++ b/main/adapter/wired/gc.c @@ -10,6 +10,7 @@ #include "adapter/config.h" #include "adapter/wired/wired.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "gc.h" enum { @@ -229,6 +230,9 @@ static void gc_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data TESTS_CMDS_LOG("\"wired_output\": {\"axes\": [%d, %d, %d, %d, %d, %d], \"btns\": %d},\n", map_tmp.axes[gc_axes_idx[0]], map_tmp.axes[gc_axes_idx[1]], map_tmp.axes[gc_axes_idx[2]], map_tmp.axes[gc_axes_idx[3]], map_tmp.axes[gc_axes_idx[4]], map_tmp.axes[gc_axes_idx[5]], map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"axes\": [%02X, %02X, %02X, %02X, %02X, %02X], \"btns\": %04X},\n", + map_tmp.axes[gc_axes_idx[0]], map_tmp.axes[gc_axes_idx[1]], map_tmp.axes[gc_axes_idx[2]], + map_tmp.axes[gc_axes_idx[3]], map_tmp.axes[gc_axes_idx[4]], map_tmp.axes[gc_axes_idx[5]], map_tmp.buttons); } static void gc_kb_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/genesis.c b/main/adapter/wired/genesis.c index ff510900..1d94ea57 100644 --- a/main/adapter/wired/genesis.c +++ b/main/adapter/wired/genesis.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2024, Jacques Gagnon + * Copyright (c) 2020-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "zephyr/types.h" #include "tools/util.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "genesis.h" #include "driver/gpio.h" @@ -312,6 +313,9 @@ static void genesis_std_from_generic(struct wired_ctrl *ctrl_data, struct wired_ TESTS_CMDS_LOG("\"wired_output\": {\"btns\": [%ld, %ld, %ld, %ld, %ld, %ld]},\n", map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons_high[0], map_tmp.buttons_high[1], map_tmp.buttons_high[2]); + BT_MON_LOG("\"wired_output\": {\"btns\": [%08lX, %08lX, %08lX, %08lX, %08lX, %08lX]},\n", + map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], + map_tmp.buttons_high[0], map_tmp.buttons_high[1], map_tmp.buttons_high[2]); } static void genesis_twh_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/jag.c b/main/adapter/wired/jag.c index ddd31309..c2f27932 100644 --- a/main/adapter/wired/jag.c +++ b/main/adapter/wired/jag.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024, Jacques Gagnon + * Copyright (c) 2021-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -9,6 +9,7 @@ #include "zephyr/types.h" #include "tools/util.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "jag.h" #include "driver/gpio.h" #include "wired/jag_io.h" @@ -272,6 +273,8 @@ static void jag_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_dat TESTS_CMDS_LOG("\"wired_output\": {\"btns\": [%ld, %ld, %ld, %ld]},\n", map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3]); + BT_MON_LOG("\"wired_output\": {\"btns\": [%08lX, %08lX, %08lX, %08lX]},\n", + map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3]); } static void jag_6d_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { @@ -332,6 +335,8 @@ static void jag_6d_from_generic(struct wired_ctrl *ctrl_data, struct wired_data TESTS_CMDS_LOG("\"wired_output\": {\"btns\": [%ld, %ld, %ld, %ld]},\n", map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3]); + BT_MON_LOG("\"wired_output\": {\"btns\": [%08lX, %08lX, %08lX, %08lX]},\n", + map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3]); } void jag_from_generic(int32_t dev_mode, struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/jvs.c b/main/adapter/wired/jvs.c index 7338a436..cd80ff3d 100644 --- a/main/adapter/wired/jvs.c +++ b/main/adapter/wired/jvs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -9,6 +9,7 @@ #include "tools/util.h" #include "adapter/wired/wired.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "jvs.h" #define JVS_AXES_MAX 2 @@ -158,6 +159,9 @@ void jvs_from_generic(int32_t dev_mode, struct wired_ctrl *ctrl_data, struct wir TESTS_CMDS_LOG("\"wired_output\": {\"axes\": [%d, %d], \"btns\": %d, \"COINS\": %d, \"TEST\": %d},\n", map_tmp.axes[jvs_axes_idx[0]], map_tmp.axes[jvs_axes_idx[1]], map_tmp.buttons, map_tmp.coins, map_tmp.test); + BT_MON_LOG("\"wired_output\": {\"axes\": [%04X, %04X], \"btns\": %04X, \"COINS\": %04X, \"TEST\": %02X},\n", + map_tmp.axes[jvs_axes_idx[0]], map_tmp.axes[jvs_axes_idx[1]], + map_tmp.buttons, map_tmp.coins, map_tmp.test); } void IRAM_ATTR jvs_gen_turbo_mask(struct wired_data *wired_data) { diff --git a/main/adapter/wired/n64.c b/main/adapter/wired/n64.c index 084847ab..9a19fafa 100644 --- a/main/adapter/wired/n64.c +++ b/main/adapter/wired/n64.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -11,6 +11,7 @@ #include "adapter/wired/wired.h" #include "adapter/wireless/wireless.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "n64.h" #define N64_AXES_MAX 2 @@ -273,6 +274,8 @@ static void n64_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_dat TESTS_CMDS_LOG("\"wired_output\": {\"axes\": [%d, %d], \"btns\": %d},\n", map_tmp.axes[n64_axes_idx[0]], map_tmp.axes[n64_axes_idx[1]], map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"axes\": [%02X, %02X], \"btns\": %04X},\n", + map_tmp.axes[n64_axes_idx[0]], map_tmp.axes[n64_axes_idx[1]], map_tmp.buttons); } static void n64_mouse_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/npiso.c b/main/adapter/wired/npiso.c index 4a76630d..9207e96e 100644 --- a/main/adapter/wired/npiso.c +++ b/main/adapter/wired/npiso.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "adapter/config.h" #include "adapter/wired/wired.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "npiso.h" #include "soc/gpio_struct.h" #include "driver/gpio.h" @@ -330,6 +331,7 @@ static void npiso_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_d memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp)); TESTS_CMDS_LOG("\"wired_output\": {\"btns\": %d},\n", map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"btns\": %04X},\n", map_tmp.buttons); } static void npiso_mouse_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/parallel_1p.c b/main/adapter/wired/parallel_1p.c index ec40d540..c232440f 100644 --- a/main/adapter/wired/parallel_1p.c +++ b/main/adapter/wired/parallel_1p.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "parallel_1p.h" #include "soc/gpio_struct.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "driver/gpio.h" #define P1_LD_UP 3 @@ -103,6 +104,8 @@ void para_1p_from_generic(int32_t dev_mode, struct wired_ctrl *ctrl_data, struct TESTS_CMDS_LOG("\"wired_output\": {\"btns\": [%ld, %ld]},\n", map_tmp.buttons, map_tmp.buttons_high); + BT_MON_LOG("\"wired_output\": {\"btns\": [%08lX, %08lX]},\n", + map_tmp.buttons, map_tmp.buttons_high); } } diff --git a/main/adapter/wired/parallel_2p.c b/main/adapter/wired/parallel_2p.c index c4f4179d..a956b68c 100644 --- a/main/adapter/wired/parallel_2p.c +++ b/main/adapter/wired/parallel_2p.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "parallel_2p.h" #include "soc/gpio_struct.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "driver/gpio.h" #define P1_TR_PIN 27 @@ -131,6 +132,8 @@ void para_2p_from_generic(int32_t dev_mode, struct wired_ctrl *ctrl_data, struct TESTS_CMDS_LOG("\"wired_output\": {\"btns\": [%ld, %ld]},\n", map_tmp.buttons, map_tmp.buttons_high); + BT_MON_LOG("\"wired_output\": {\"btns\": [%08lX, %08lX]},\n", + map_tmp.buttons, map_tmp.buttons_high); } } diff --git a/main/adapter/wired/pce.c b/main/adapter/wired/pce.c index 90654472..676d95d1 100644 --- a/main/adapter/wired/pce.c +++ b/main/adapter/wired/pce.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024, Jacques Gagnon + * Copyright (c) 2021-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "zephyr/types.h" #include "tools/util.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "pce.h" #include "driver/gpio.h" @@ -320,6 +321,8 @@ static void pce_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_dat TESTS_CMDS_LOG("\"wired_output\": {\"btns\": [%ld, %ld, %ld, %ld, %ld]},\n", map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3], map_tmp.buttons[4]); + BT_MON_LOG("\"wired_output\": {\"btns\": [%08lX, %08lX, %08lX, %08lX, %08lX]},\n", + map_tmp.buttons[0], map_tmp.buttons[1], map_tmp.buttons[2], map_tmp.buttons[3], map_tmp.buttons[4]); } void IRAM_ATTR pce_init_buffer(int32_t dev_mode, struct wired_data *wired_data) { diff --git a/main/adapter/wired/pcfx.c b/main/adapter/wired/pcfx.c index 09ae0ee0..489cb196 100644 --- a/main/adapter/wired/pcfx.c +++ b/main/adapter/wired/pcfx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -9,6 +9,7 @@ #include "adapter/config.h" #include "adapter/wired/wired.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "pcfx.h" enum { @@ -192,6 +193,7 @@ void pcfx_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wir memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp)); TESTS_CMDS_LOG("\"wired_output\": {\"btns\": %d},\n", map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"btns\": %04X},\n", map_tmp.buttons); } static void pcfx_mouse_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/ps.c b/main/adapter/wired/ps.c index 77814f46..a7e809c1 100644 --- a/main/adapter/wired/ps.c +++ b/main/adapter/wired/ps.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "adapter/kb_monitor.h" #include "adapter/wired/wired.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "ps.h" #define PS_JOYSTICK_AXES_CNT 4 @@ -301,6 +302,10 @@ static void ps_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data map_tmp.axes[ps_axes_idx[0]], map_tmp.axes[ps_axes_idx[1]], map_tmp.axes[ps_axes_idx[2]], map_tmp.axes[ps_axes_idx[3]], map_tmp.buttons, map_tmp.analog_btn); + BT_MON_LOG("\"wired_output\": {\"axes\": [%02X, %02X, %02X, %02X], \"btns\": [%04X, %02X]},\n", + map_tmp.axes[ps_axes_idx[0]], map_tmp.axes[ps_axes_idx[1]], + map_tmp.axes[ps_axes_idx[2]], map_tmp.axes[ps_axes_idx[3]], + map_tmp.buttons, map_tmp.analog_btn); } static void ps_mouse_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/real.c b/main/adapter/wired/real.c index fab67511..87205183 100644 --- a/main/adapter/wired/real.c +++ b/main/adapter/wired/real.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "adapter/wired/wired.h" #include "system/manager.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "real.h" enum { @@ -236,6 +237,7 @@ void real_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wir memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp)); TESTS_CMDS_LOG("\"wired_output\": {\"btns\": %d},\n", map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"btns\": %04X},\n", map_tmp.buttons); } /* I didn't RE this one my self, base on : */ diff --git a/main/adapter/wired/saturn.c b/main/adapter/wired/saturn.c index 6fd193fd..4867fa09 100644 --- a/main/adapter/wired/saturn.c +++ b/main/adapter/wired/saturn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -11,6 +11,7 @@ #include "adapter/wired/wired.h" #include "system/manager.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "saturn.h" enum { @@ -306,6 +307,9 @@ void saturn_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *w TESTS_CMDS_LOG("\"wired_output\": {\"axes\": [%d, %d, %d, %d], \"btns\": %d},\n", map_tmp.axes[saturn_axes_idx[0]], map_tmp.axes[saturn_axes_idx[1]], map_tmp.axes[saturn_axes_idx[4]], map_tmp.axes[saturn_axes_idx[5]], map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"axes\": [%02X, %02X, %02X, %02X], \"btns\": %04X},\n", + map_tmp.axes[saturn_axes_idx[0]], map_tmp.axes[saturn_axes_idx[1]], + map_tmp.axes[saturn_axes_idx[4]], map_tmp.axes[saturn_axes_idx[5]], map_tmp.buttons); } static void saturn_mouse_from_generic(struct wired_ctrl *ctrl_data, struct wired_data *wired_data) { diff --git a/main/adapter/wired/sea.c b/main/adapter/wired/sea.c index 902b48f9..01373463 100644 --- a/main/adapter/wired/sea.c +++ b/main/adapter/wired/sea.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -11,6 +11,7 @@ #include "driver/gpio.h" #include "wired/sea_io.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "sea.h" #define P1_LD_UP 19 @@ -219,7 +220,9 @@ void sea_from_generic(int32_t dev_mode, struct wired_ctrl *ctrl_data, struct wir gbahd_osd(ctrl_data, wired_data); - printf("\"wired_output\": {\"btns\": [%ld, %ld, %d]},\n", + TESTS_CMDS_LOG("\"wired_output\": {\"btns\": [%ld, %ld, %d]},\n", + map_tmp->buttons, map_tmp->buttons_high, map_tmp->buttons_osd); + BT_MON_LOG("\"wired_output\": {\"btns\": [%08lX, %08lX, %04X]},\n", map_tmp->buttons, map_tmp->buttons_high, map_tmp->buttons_osd); } } diff --git a/main/adapter/wired/wii.c b/main/adapter/wired/wii.c index 91bf2886..f056b013 100644 --- a/main/adapter/wired/wii.c +++ b/main/adapter/wired/wii.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Jacques Gagnon + * Copyright (c) 2019-2025, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -9,6 +9,7 @@ #include "adapter/config.h" #include "adapter/wired/wired.h" #include "tests/cmds.h" +#include "bluetooth/mon.h" #include "wii.h" enum { @@ -155,7 +156,10 @@ void wii_from_generic(int32_t dev_mode, struct wired_ctrl *ctrl_data, struct wir memcpy(wired_data->output, (void *)&map_tmp, sizeof(map_tmp)); - printf("\"wired_output\": {\"axes\": [%d, %d, %d, %d, %d, %d], \"btns\": %d},\n", + TESTS_CMDS_LOG("\"wired_output\": {\"axes\": [%d, %d, %d, %d, %d, %d], \"btns\": %d},\n", + map_tmp.axes[wiic_axes_idx[0]], map_tmp.axes[wiic_axes_idx[1]], map_tmp.axes[wiic_axes_idx[2]], + map_tmp.axes[wiic_axes_idx[3]], map_tmp.axes[wiic_axes_idx[4]], map_tmp.axes[wiic_axes_idx[5]], map_tmp.buttons); + BT_MON_LOG("\"wired_output\": {\"axes\": [%02X, %02X, %02X, %02X, %02X, %02X], \"btns\": %04X},\n", map_tmp.axes[wiic_axes_idx[0]], map_tmp.axes[wiic_axes_idx[1]], map_tmp.axes[wiic_axes_idx[2]], map_tmp.axes[wiic_axes_idx[3]], map_tmp.axes[wiic_axes_idx[4]], map_tmp.axes[wiic_axes_idx[5]], map_tmp.buttons); } diff --git a/main/bluetooth/mon.h b/main/bluetooth/mon.h index 7eb0e748..3edecdf0 100644 --- a/main/bluetooth/mon.h +++ b/main/bluetooth/mon.h @@ -14,6 +14,12 @@ #define BT_MON_ACL_RX 5 #define BT_MON_SYS_NOTE 12 +#ifdef CONFIG_BLUERETRO_BTMON_VERBOSE +#define BT_MON_LOG(...) bt_mon_log(true, __VA_ARGS__) +#else +#define BT_MON_LOG(...) +#endif + void bt_mon_init(void); void bt_mon_tx(uint16_t opcode, uint8_t *data, uint16_t len); void bt_mon_log(bool end, const char * format, ...);