Skip to content

Commit c409e1f

Browse files
author
Alrik Vidstrom
committed
Fix missing default Mbed configuration
Parts of the library don't know about the default Mbed configuration. If only the redefines are removed, Callback.h is included already in USBHostConf.h, but without any default Mbed configuration, so we get the trivial version of call(). Next, Arduino.h is included, which includes the Mbed configuration indirectly, but the damage has already been done. Over in USBHostSerial.h, USBHostConf.h is included. After that, Callback.h is included in USBHostSerial.h, and we have the correct Mbed configuration in place, but since it's already been included once, the correct version of call() is never actually used. So we get two versions of call() again, which is undefined behavior, and a crash.
1 parent 8922227 commit c409e1f

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

Diff for: src/USBHost/USBDeviceConnected.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "USBHost/USBEndpoint.h"
2222
#include "USBHost/USBHostConf.h"
2323
#include "rtos.h"
24+
#include "mbed_config.h"
2425
#include "Callback.h"
2526

2627
class USBHostHub;

Diff for: src/USBHost/USBEndpoint.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef USBENDPOINT_H
1818
#define USBENDPOINT_H
1919

20+
#include "mbed_config.h"
2021
#include "Callback.h"
2122
#include "USBHostTypes.h"
2223
#include "rtos.h"

Diff for: src/USBHost/USBHostConf.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef USBHOST_CONF_H
1818
#define USBHOST_CONF_H
1919

20+
#include "mbed_config.h"
2021
#include "Callback.h"
2122
#include "Arduino.h"
2223

Diff for: src/USBHostSerial/USBHostSerial.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "USBHost/USBHost.h"
2525
#include "Stream.h"
2626
#include "MtxCircBuffer.h"
27+
#include "mbed_config.h"
2728
#include "Callback.h"
2829

2930
/**

0 commit comments

Comments
 (0)