Revert "feat: Split physical layout selection sync."
This reverts commit 03b5b38bc4.
This commit is contained in:
parent
58207fdb2c
commit
d52bb04090
5 changed files with 3 additions and 116 deletions
|
|
@ -19,7 +19,6 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|||
#include <drivers/behavior.h>
|
||||
#include <zmk/behavior.h>
|
||||
#include <zmk/matrix.h>
|
||||
#include <zmk/physical_layouts.h>
|
||||
#include <zmk/split/bluetooth/uuid.h>
|
||||
#include <zmk/split/bluetooth/service.h>
|
||||
|
||||
|
|
@ -139,42 +138,6 @@ static ssize_t split_svc_update_indicators(struct bt_conn *conn, const struct bt
|
|||
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS)
|
||||
|
||||
static uint8_t selected_phys_layout = 0;
|
||||
|
||||
static void split_svc_select_phys_layout_callback(struct k_work *work) {
|
||||
LOG_DBG("Selecting physical layout after GATT write of %d", selected_phys_layout);
|
||||
zmk_physical_layouts_select(selected_phys_layout);
|
||||
}
|
||||
|
||||
static K_WORK_DEFINE(split_svc_select_phys_layout_work, split_svc_select_phys_layout_callback);
|
||||
|
||||
static ssize_t split_svc_select_phys_layout(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len, uint16_t offset,
|
||||
uint8_t flags) {
|
||||
if (offset + len > sizeof(uint8_t) || len == 0) {
|
||||
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
|
||||
}
|
||||
|
||||
selected_phys_layout = *(uint8_t *)buf;
|
||||
|
||||
k_work_submit(&split_svc_select_phys_layout_work);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t split_svc_get_selected_phys_layout(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attrs, void *buf,
|
||||
uint16_t len, uint16_t offset) {
|
||||
int selected_ret = zmk_physical_layouts_get_selected();
|
||||
if (selected_ret < 0) {
|
||||
return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
uint8_t selected = (uint8_t)selected_ret;
|
||||
|
||||
return bt_gatt_attr_read(conn, attrs, buf, len, offset, &selected, sizeof(selected));
|
||||
}
|
||||
|
||||
BT_GATT_SERVICE_DEFINE(
|
||||
split_svc, BT_GATT_PRIMARY_SERVICE(BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SERVICE_UUID)),
|
||||
BT_GATT_CHARACTERISTIC(BT_UUID_DECLARE_128(ZMK_SPLIT_BT_CHAR_POSITION_STATE_UUID),
|
||||
|
|
@ -197,11 +160,7 @@ BT_GATT_SERVICE_DEFINE(
|
|||
BT_GATT_CHRC_WRITE_WITHOUT_RESP, BT_GATT_PERM_WRITE_ENCRYPT, NULL,
|
||||
split_svc_update_indicators, NULL),
|
||||
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS)
|
||||
BT_GATT_CHARACTERISTIC(BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SELECT_PHYS_LAYOUT_UUID),
|
||||
BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ,
|
||||
BT_GATT_PERM_WRITE_ENCRYPT | BT_GATT_PERM_READ_ENCRYPT,
|
||||
split_svc_get_selected_phys_layout, split_svc_select_phys_layout,
|
||||
NULL), );
|
||||
);
|
||||
|
||||
K_THREAD_STACK_DEFINE(service_q_stack, CONFIG_ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue