From 1c13e057bc092e6dd85dd8a91314684422b16b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Wed, 9 Oct 2024 01:42:38 +0200 Subject: [PATCH] Make BLE PIDs larger by 0x8000 than USB PIDs. --- device/Kconfig | 6 ++++++ device/prj.conf.overlays/uhk-80-left.prj.conf | 3 ++- device/prj.conf.overlays/uhk-80-right.prj.conf | 3 ++- device/prj.conf.overlays/uhk-dongle.prj.conf | 3 ++- device/src/usb/usb.cpp | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/device/Kconfig b/device/Kconfig index 82edc734..d4238352 100644 --- a/device/Kconfig +++ b/device/Kconfig @@ -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. diff --git a/device/prj.conf.overlays/uhk-80-left.prj.conf b/device/prj.conf.overlays/uhk-80-left.prj.conf index 6cd28120..3fd36bc2 100644 --- a/device/prj.conf.overlays/uhk-80-left.prj.conf +++ b/device/prj.conf.overlays/uhk-80-left.prj.conf @@ -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 diff --git a/device/prj.conf.overlays/uhk-80-right.prj.conf b/device/prj.conf.overlays/uhk-80-right.prj.conf index 5d8c5903..e848bdd5 100644 --- a/device/prj.conf.overlays/uhk-80-right.prj.conf +++ b/device/prj.conf.overlays/uhk-80-right.prj.conf @@ -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 diff --git a/device/prj.conf.overlays/uhk-dongle.prj.conf b/device/prj.conf.overlays/uhk-dongle.prj.conf index 816a267a..264ac82d 100644 --- a/device/prj.conf.overlays/uhk-dongle.prj.conf +++ b/device/prj.conf.overlays/uhk-dongle.prj.conf @@ -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 diff --git a/device/src/usb/usb.cpp b/device/src/usb/usb.cpp index 018c8ceb..c09b3543 100644 --- a/device/src/usb/usb.cpp +++ b/device/src/usb/usb.cpp @@ -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