summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/feature_rawhid.md6
-rw-r--r--tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c5
-rw-r--r--tmk_core/protocol/usb_descriptor.c5
-rw-r--r--tmk_core/protocol/usb_descriptor_common.h31
-rw-r--r--tmk_core/protocol/vusb/vusb.c7
5 files changed, 46 insertions, 8 deletions
diff --git a/docs/feature_rawhid.md b/docs/feature_rawhid.md
index ed848a4c79..01e215be45 100644
--- a/docs/feature_rawhid.md
+++ b/docs/feature_rawhid.md
@@ -44,7 +44,11 @@ To connect your host computer to your keyboard with raw HID you need four pieces
3. Usage Page
4. Usage
-The first two can easily be found in your keyboard's `config.h` in the keyboard's main directory under `VENDOR_ID` and `PRODUCT_ID`. **Usage Page** is **`0xFF60`** and **Usage** is **`0x0061`**.
+The first two can easily be found in your keyboard's `config.h` in the keyboard's main directory under `VENDOR_ID` and `PRODUCT_ID`.
+
+The final two can be overridden in your keyboard's `config.h` in the keyboard's main directory by redefining the values: `#define RAW_USAGE_PAGE 0xFF60` and `#define RAW_USAGE_ID 0x61`.
+
+By default, **Usage Page** is `0xFF60` and **Usage** is `0x61`.
### Building your host
diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c
index 3e9fbfdbed..9ea4addcfc 100644
--- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c
+++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd.c
@@ -55,6 +55,7 @@
#include "udi_hid_kbd.h"
#include <string.h>
#include "report.h"
+#include "usb_descriptor_common.h"
//***************************************************************************
// KBD
@@ -641,8 +642,8 @@ static uint8_t udi_hid_raw_report_recv[UDI_HID_RAW_REPORT_SIZE];
COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udi_hid_raw_report_desc_t udi_hid_raw_report_desc = {{
- 0x06, 0x60, 0xFF, // Usage Page (Vendor Defined)
- 0x09, 0x61, // Usage (Vendor Defined)
+ 0x06, RAW_USAGE_PAGE_LO, RAW_USAGE_PAGE_HI, // Usage Page (Vendor Defined)
+ 0x09, RAW_USAGE_ID, // Usage (Vendor Defined)
0xA1, 0x01, // Collection (Application)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index f2b91b099e..8c71dd1dda 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -39,6 +39,7 @@
#include "util.h"
#include "report.h"
#include "usb_descriptor.h"
+#include "usb_descriptor_common.h"
// clang-format off
@@ -232,8 +233,8 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = {
#ifdef RAW_ENABLE
const USB_Descriptor_HIDReport_Datatype_t PROGMEM RawReport[] = {
- HID_RI_USAGE_PAGE(16, 0xFF60), // Vendor Defined
- HID_RI_USAGE(8, 0x61), // Vendor Defined
+ HID_RI_USAGE_PAGE(16, RAW_USAGE_PAGE), // Vendor Defined
+ HID_RI_USAGE(8, RAW_USAGE_ID), // Vendor Defined
HID_RI_COLLECTION(8, 0x01), // Application
// Data to host
HID_RI_USAGE(8, 0x62), // Vendor Defined
diff --git a/tmk_core/protocol/usb_descriptor_common.h b/tmk_core/protocol/usb_descriptor_common.h
new file mode 100644
index 0000000000..b1f602c82e
--- /dev/null
+++ b/tmk_core/protocol/usb_descriptor_common.h
@@ -0,0 +1,31 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+/////////////////////
+// RAW Usage page and ID configuration
+
+#ifndef RAW_USAGE_PAGE
+# define RAW_USAGE_PAGE 0xFF60
+#endif
+
+#ifndef RAW_USAGE_ID
+# define RAW_USAGE_ID 0x61
+#endif
+
+#define RAW_USAGE_PAGE_HI ((uint8_t)(RAW_USAGE_PAGE >> 8))
+#define RAW_USAGE_PAGE_LO ((uint8_t)(RAW_USAGE_PAGE & 0xFF))
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index a9f37c61b0..4c8e6003fe 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "vusb.h"
#include "print.h"
#include "debug.h"
+#include "usb_descriptor_common.h"
#ifdef RAW_ENABLE
# include "raw_hid.h"
@@ -409,9 +410,9 @@ const PROGMEM uchar keyboard_hid_report[] = {
#ifdef RAW_ENABLE
const PROGMEM uchar raw_hid_report[] = {
- 0x06, 0x60, 0xFF, // Usage Page (Vendor Defined)
- 0x09, 0x61, // Usage (Vendor Defined)
- 0xA1, 0x01, // Collection (Application)
+ 0x06, RAW_USAGE_PAGE_LO, RAW_USAGE_PAGE_HI, // Usage Page (Vendor Defined)
+ 0x09, RAW_USAGE_ID, // Usage (Vendor Defined)
+ 0xA1, 0x01, // Collection (Application)
// Data to host
0x09, 0x62, // Usage (Vendor Defined)
0x15, 0x00, // Logical Minimum (0)