Skip to content

Commit

Permalink
[ADAPTER] Dump output to BT mon in verbose build
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Jan 20, 2025
1 parent 16b96b6 commit 8dc5869
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 18 deletions.
5 changes: 5 additions & 0 deletions main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion main/adapter/wired/cdi.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion main/adapter/wired/dc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions main/adapter/wired/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion main/adapter/wired/genesis.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2024, Jacques Gagnon
* Copyright (c) 2020-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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"

Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 6 additions & 1 deletion main/adapter/wired/jag.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, Jacques Gagnon
* Copyright (c) 2021-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion main/adapter/wired/jvs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion main/adapter/wired/n64.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion main/adapter/wired/npiso.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion main/adapter/wired/parallel_1p.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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
Expand Down Expand Up @@ -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);
}
}

Expand Down
5 changes: 4 additions & 1 deletion main/adapter/wired/parallel_2p.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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
Expand Down Expand Up @@ -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);
}
}

Expand Down
5 changes: 4 additions & 1 deletion main/adapter/wired/pce.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, Jacques Gagnon
* Copyright (c) 2021-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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"

Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion main/adapter/wired/pcfx.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 6 additions & 1 deletion main/adapter/wired/ps.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion main/adapter/wired/real.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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 {
Expand Down Expand Up @@ -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 : */
Expand Down
6 changes: 5 additions & 1 deletion main/adapter/wired/saturn.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, Jacques Gagnon
* Copyright (c) 2019-2025, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 8dc5869

Please sign in to comment.