Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Make BLE PIDs larger by 0x8000 than USB PIDs. #319

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions device/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ config KEYBOARD_MAX_SCANCODE
The default is set so Android devices (which don't exchange the MTU from the default 23)
still receive the "NKRO" report layout. If a higher scancode is used, the report size will exceed this size,
causing a fallback to 6KRO report layout on Android.

config USB_PID
hex "USB product ID"
range 0x0000 0xFFFF
help
The USB product ID is used to identify the specific UHK device.
3 changes: 2 additions & 1 deletion device/prj.conf.overlays/uhk-80-left.prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ CONFIG_SHELL_PROMPT_UART="uhk80:left$ "
CONFIG_SHELL_PROMPT_RTT="uhk80:left$ "

CONFIG_BT_DIS_MODEL="UHK 80 left half"
CONFIG_BT_DIS_PNP_PID=0x0007
CONFIG_BT_DIS_PNP_PID=0x8007
CONFIG_USB_PID=0x0007
3 changes: 2 additions & 1 deletion device/prj.conf.overlays/uhk-80-right.prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ CONFIG_SHELL_PROMPT_UART="uhk80:right$ "
CONFIG_SHELL_PROMPT_RTT="uhk80:right$ "

CONFIG_BT_DIS_MODEL="UHK 80 right half"
CONFIG_BT_DIS_PNP_PID=0x0009
CONFIG_BT_DIS_PNP_PID=0x8009
CONFIG_USB_PID=0x0009
3 changes: 2 additions & 1 deletion device/prj.conf.overlays/uhk-dongle.prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ CONFIG_SHELL_PROMPT_UART="uhk-dongle$ "
CONFIG_SHELL_PROMPT_RTT="uhk-dongle$ "

CONFIG_BT_DIS_MODEL="UHK dongle"
CONFIG_BT_DIS_PNP_PID=0x0005
CONFIG_BT_DIS_PNP_PID=0x8005
CONFIG_USB_PID=0x0005
2 changes: 1 addition & 1 deletion device/src/usb/usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static_assert(CONFIG_BT_DIS_PNP_VID_SRC == 2);
uint8_t UsbSerialNumber[5];

constexpr usb::product_info product_info{CONFIG_BT_DIS_PNP_VID, CONFIG_BT_DIS_MANUF,
CONFIG_BT_DIS_PNP_PID, CONFIG_BT_DIS_MODEL,
CONFIG_USB_PID, CONFIG_BT_DIS_MODEL,
usb::version(CONFIG_BT_DIS_PNP_VER >> 8, CONFIG_BT_DIS_PNP_VER), UsbSerialNumber};

template <typename... Args>
Expand Down
2 changes: 1 addition & 1 deletion right/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CPU = -mcpu=cortex-m4
FPU = -mfpu=fpv4-sp-d16 -mfloat-abi=hard

# Command for flashing the right half of the keyboard.
FLASH_CMD = ../../lib/agent/node_modules/.bin/tsx ../../lib/agent/packages/usb/update-device-firmware.ts $(PROJECT_OBJ:.axf=.hex)
FLASH_CMD = ../../lib/agent/node_modules/.bin/tsx ../../lib/agent/packages/usb/update-device-firmware.ts --vid=14248 --pid=$(DEVICE_PID) --usb-interface=4 $(PROJECT_OBJ:.axf=.hex)

# Path to the JLink script used for the right half.
JLINK_SCRIPT = ../../scripts/flash-right.jlink
Expand Down
13 changes: 12 additions & 1 deletion right/src/config_parser/parse_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void readRgbColor(config_buffer_t *buffer, rgb_t* keyActionColors, key_action_co
color->blue = ReadUInt8(buffer);
}

parser_error_t ParseConfig(config_buffer_t *buffer)

parser_error_t parseConfig(config_buffer_t *buffer)
{
// Miscellaneous properties

Expand Down Expand Up @@ -338,3 +339,13 @@ parser_error_t ParseConfig(config_buffer_t *buffer)

return ParserError_Success;
}


parser_error_t ParseConfig(config_buffer_t *buffer) {
version_t oldModelVersion = DataModelVersion;
parser_error_t errorCode = parseConfig(buffer);
if (errorCode != ParserError_Success || ParserRunDry) {
DataModelVersion = oldModelVersion;
}
return errorCode;
}
1 change: 1 addition & 0 deletions right/uhk60v1/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PROJECT_NAME = uhk60v1
DEVICE_ID = DEVICE_ID_UHK60V1
DEVICE_PID = 1
include ../Makefile
1 change: 1 addition & 0 deletions right/uhk60v2/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PROJECT_NAME = uhk60v2
DEVICE_ID = DEVICE_ID_UHK60V2
DEVICE_PID = 3
include ../Makefile