Allow custom data sync for community modules (#25955)

* Allow custom data sync for community modules

* Stub out community_config.h codegen

* Fix SPLIT_TRANSACTION_RPC logic
This commit is contained in:
Joel Challis
2026-02-19 11:03:26 +00:00
committed by GitHub
parent a0166fef43
commit 5591a68b65
10 changed files with 154 additions and 13 deletions
+11 -2
View File
@@ -18,6 +18,10 @@
#include "compiler_support.h"
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
# define SPLIT_TRANSACTION_RPC
#endif
enum serial_transaction_id {
#ifdef USE_I2C
I2C_EXECUTE_CALLBACK,
@@ -99,12 +103,12 @@ enum serial_transaction_id {
PUT_ACTIVITY,
#endif // SPLIT_ACTIVITY_ENABLE
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#if defined(SPLIT_TRANSACTION_RPC)
PUT_RPC_INFO,
PUT_RPC_REQ_DATA,
EXECUTE_RPC,
GET_RPC_RESP_DATA,
#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#endif // defined(SPLIT_TRANSACTION_RPC)
// keyboard-specific
#ifdef SPLIT_TRANSACTION_IDS_KB
@@ -116,6 +120,11 @@ enum serial_transaction_id {
SPLIT_TRANSACTION_IDS_USER,
#endif // SPLIT_TRANSACTION_IDS_USER
// community module specific
#ifdef COMMUNITY_MODULES_ENABLE
# include "split_transaction_id_community_modules.inc"
#endif // COMMUNITY_MODULES_ENABLE
#if defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
PUT_DETECTED_OS,
#endif // defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
+6 -6
View File
@@ -85,11 +85,11 @@
#define transport_read(id, data, length) transport_execute_transaction(id, NULL, 0, data, length)
#define transport_exec(id) transport_execute_transaction(id, NULL, 0, NULL, 0)
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#if defined(SPLIT_TRANSACTION_RPC)
// Forward-declare the RPC callback handlers
void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer);
void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer);
#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#endif // defined(SPLIT_TRANSACTION_RPC)
////////////////////////////////////////////////////
// Helpers
@@ -943,12 +943,12 @@ split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = {
TRANSACTIONS_DETECTED_OS_REGISTRATIONS
// clang-format on
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#if defined(SPLIT_TRANSACTION_RPC)
[PUT_RPC_INFO] = trans_initiator2target_initializer_cb(rpc_info, slave_rpc_info_callback),
[PUT_RPC_REQ_DATA] = trans_initiator2target_initializer(rpc_m2s_buffer),
[EXECUTE_RPC] = trans_initiator2target_initializer_cb(rpc_info.payload.transaction_id, slave_rpc_exec_callback),
[GET_RPC_RESP_DATA] = trans_target2initiator_initializer(rpc_s2m_buffer),
#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#endif // defined(SPLIT_TRANSACTION_RPC)
};
bool transactions_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
@@ -996,7 +996,7 @@ void transactions_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[
TRANSACTIONS_DETECTED_OS_SLAVE();
}
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#if defined(SPLIT_TRANSACTION_RPC)
void transaction_register_rpc(int8_t transaction_id, slave_callback_t callback) {
// Prevent invoking RPC on QMK core sync data
@@ -1073,4 +1073,4 @@ void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *i
}
}
#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#endif // defined(SPLIT_TRANSACTION_RPC)
+5 -4
View File
@@ -22,6 +22,7 @@
#include "progmem.h"
#include "action_layer.h"
#include "matrix.h"
#include "transaction_id_define.h"
#ifndef RPC_M2S_BUFFER_SIZE
# define RPC_M2S_BUFFER_SIZE 32
@@ -132,7 +133,7 @@ typedef struct _split_slave_activity_sync_t {
} split_slave_activity_sync_t;
#endif // defined(SPLIT_ACTIVITY_ENABLE)
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#if defined(SPLIT_TRANSACTION_RPC)
typedef struct _rpc_sync_info_t {
uint8_t checksum;
struct {
@@ -141,7 +142,7 @@ typedef struct _rpc_sync_info_t {
uint8_t s2m_length;
} payload;
} rpc_sync_info_t;
#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#endif // defined(SPLIT_TRANSACTION_RPC)
#if defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
# include "os_detection.h"
@@ -222,11 +223,11 @@ typedef struct _split_shared_memory_t {
split_slave_activity_sync_t activity_sync;
#endif // defined(SPLIT_ACTIVITY_ENABLE)
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#if defined(SPLIT_TRANSACTION_RPC)
rpc_sync_info_t rpc_info;
uint8_t rpc_m2s_buffer[RPC_M2S_BUFFER_SIZE];
uint8_t rpc_s2m_buffer[RPC_S2M_BUFFER_SIZE];
#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
#endif // defined(SPLIT_TRANSACTION_RPC)
#if defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
os_variant_t detected_os;