forked from mirrors/qmk_userspace
Make "detected_host_os()" available on the SLAVE side of the split keyboard (#19854)
Co-authored-by: ngs.ch <ngs.ch> Co-authored-by: Drashna Jaelre <drashna@drashna.net>
This commit is contained in:
parent
d82c6648f5
commit
ccda5d2d2f
5 changed files with 73 additions and 19 deletions
|
@ -819,6 +819,34 @@ static void activity_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s
|
|||
|
||||
#endif // defined(SPLIT_ACTIVITY_ENABLE)
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Detected OS
|
||||
|
||||
#if defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
|
||||
|
||||
static bool detected_os_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
|
||||
static uint32_t last_detected_os_update = 0;
|
||||
os_variant_t detected_os = detected_host_os();
|
||||
bool okay = send_if_condition(PUT_DETECTED_OS, &last_detected_os_update, (detected_os != split_shmem->detected_os), &detected_os, sizeof(os_variant_t));
|
||||
return okay;
|
||||
}
|
||||
|
||||
static void detected_os_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
|
||||
slave_update_detected_host_os(split_shmem->detected_os);
|
||||
}
|
||||
|
||||
# define TRANSACTIONS_DETECTED_OS_MASTER() TRANSACTION_HANDLER_MASTER(detected_os)
|
||||
# define TRANSACTIONS_DETECTED_OS_SLAVE() TRANSACTION_HANDLER_SLAVE_AUTOLOCK(detected_os)
|
||||
# define TRANSACTIONS_DETECTED_OS_REGISTRATIONS [PUT_DETECTED_OS] = trans_initiator2target_initializer(detected_os),
|
||||
|
||||
#else // defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
|
||||
|
||||
# define TRANSACTIONS_DETECTED_OS_MASTER()
|
||||
# define TRANSACTIONS_DETECTED_OS_SLAVE()
|
||||
# define TRANSACTIONS_DETECTED_OS_REGISTRATIONS
|
||||
|
||||
#endif // defined(OS_DETECTION_ENABLE) && defined(SPLIT_DETECTED_OS_ENABLE)
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = {
|
||||
|
@ -848,6 +876,7 @@ split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = {
|
|||
TRANSACTIONS_WATCHDOG_REGISTRATIONS
|
||||
TRANSACTIONS_HAPTIC_REGISTRATIONS
|
||||
TRANSACTIONS_ACTIVITY_REGISTRATIONS
|
||||
TRANSACTIONS_DETECTED_OS_REGISTRATIONS
|
||||
// clang-format on
|
||||
|
||||
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
|
||||
|
@ -877,6 +906,7 @@ bool transactions_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix
|
|||
TRANSACTIONS_WATCHDOG_MASTER();
|
||||
TRANSACTIONS_HAPTIC_MASTER();
|
||||
TRANSACTIONS_ACTIVITY_MASTER();
|
||||
TRANSACTIONS_DETECTED_OS_MASTER();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -899,6 +929,7 @@ void transactions_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[
|
|||
TRANSACTIONS_WATCHDOG_SLAVE();
|
||||
TRANSACTIONS_HAPTIC_SLAVE();
|
||||
TRANSACTIONS_ACTIVITY_SLAVE();
|
||||
TRANSACTIONS_DETECTED_OS_SLAVE();
|
||||
}
|
||||
|
||||
#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue