Skip to content

Instantly share code, notes, and snippets.

@nima2007
Created November 6, 2019 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nima2007/dcf633df33f0c772932388862e8c8d4b to your computer and use it in GitHub Desktop.
Save nima2007/dcf633df33f0c772932388862e8c8d4b to your computer and use it in GitHub Desktop.
attempt apply patch
diff --git a/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/usbd_mhid.h b/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/usbd_mhid.h
index af483adc6..6a977ff8b 100644
--- a/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/usbd_mhid.h
+++ b/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/usbd_mhid.h
@@ -6,7 +6,7 @@
#define USBD_MHID_CONFIG_DESC_SIZE 32
#define USBD_MHID_DESC_SIZE 9
-#define USBD_MHID_REPORT_DESC_SIZE 178
+#define USBD_MHID_REPORT_DESC_SIZE /*178*/45
#define USBD_MHID_DIGITIZER_REPORT_DESC_SIZE 65
diff --git a/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/src/usbd_mhid.c b/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/src/usbd_mhid.c
index de9806131..4af69d5fd 100644
--- a/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/src/usbd_mhid.c
+++ b/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/src/usbd_mhid.c
@@ -97,7 +97,7 @@ static const uint8_t USBD_MHID_CfgDesc[USBD_MHID_CONFIG_DESC_SIZE] =
__ALIGN_BEGIN static const uint8_t USBD_MHID_DefaultReportDesc[USBD_MHID_REPORT_DESC_SIZE] __ALIGN_END =
{
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
+ /* 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x01, // REPORT_ID (1)
@@ -133,11 +133,11 @@ __ALIGN_BEGIN static const uint8_t USBD_MHID_DefaultReportDesc[USBD_MHID_REPORT_
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x06, // INPUT (Data,Var,Rel)
0xc0, // END_COLLECTION
- 0xc0, // END_COLLECTION
+ 0xc0, // END_COLLECTION */
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
+ /*0x85, 0x02, // REPORT_ID (2)*/
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
@@ -168,7 +168,7 @@ __ALIGN_BEGIN static const uint8_t USBD_MHID_DefaultReportDesc[USBD_MHID_REPORT_
0x29, 0xdd, // USAGE_MAXIMUM (Keypad Hexadecimal)
0x81, 0x00, // INPUT (Data,Ary,Abs)
0xc0, // END_COLLECTION
- 0x05, 0x0d, // USAGE_PAGE (Digitizer)
+/* 0x05, 0x0d, // USAGE_PAGE (Digitizer)
0x09, 0x02, // USAGE (Pen)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x03, // REPORT_ID (3)
@@ -199,7 +199,7 @@ __ALIGN_BEGIN static const uint8_t USBD_MHID_DefaultReportDesc[USBD_MHID_REPORT_
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0, // END_COLLECTION
- 0xc0 // END_COLLECTION
+ 0xc0 // END_COLLECTION */
};
static uint8_t USBD_MHID_Init(void* pdev, USBD_Composite_Class_Data* cls, uint8_t cfgidx)
diff --git a/wiring/inc/spark_wiring_usbkeyboard.h b/wiring/inc/spark_wiring_usbkeyboard.h
index 84bf58692..e30810835 100644
--- a/wiring/inc/spark_wiring_usbkeyboard.h
+++ b/wiring/inc/spark_wiring_usbkeyboard.h
@@ -34,7 +34,7 @@
typedef struct
{
- uint8_t reportId; // 0x02
+ /*uint8_t reportId; // 0x02*/
uint8_t modifiers;
uint8_t reserved;
uint8_t keys[6];
diff --git a/wiring/src/spark_wiring_usbkeyboard.cpp b/wiring/src/spark_wiring_usbkeyboard.cpp
index ab06089fb..0ca2ba130 100644
--- a/wiring/src/spark_wiring_usbkeyboard.cpp
+++ b/wiring/src/spark_wiring_usbkeyboard.cpp
@@ -168,7 +168,7 @@ extern const uint8_t usb_hid_asciimap[128] =
USBKeyboard::USBKeyboard(void)
{
memset((void*)&keyReport, 0, sizeof(keyReport));
- keyReport.reportId = 0x02;
+ /*keyReport.reportId = 0x02;*/
HAL_USB_HID_Init(0, NULL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment