USBDevice library fork to add multi-function (e.g. Keyboard(HID) + Virtual COM Port(CDC)) usb support.
Fork of USBDevice by
Revision 70:7e8e3be9f0e3, committed 2018-10-04
- Comitter:
- Mahir Ozturk
- Date:
- Thu Oct 04 15:43:40 2018 +0300
- Parent:
- 69:dad310740b28
- Commit message:
- Solve diamond-shaped multiple inheritance problem to support multi-function usb devices
Changed in this revision
--- a/USBAudio/USBAudio.cpp Tue Sep 11 15:17:01 2018 +0300 +++ b/USBAudio/USBAudio.cpp Thu Oct 04 15:43:40 2018 +0300 @@ -57,7 +57,7 @@ volume = 0; // connect the device - USBDevice::connect(); + // USBDevice::connect(); XXX Removed from here to support multi-function usb devices } bool USBAudio::read(uint8_t * buf) {
--- a/USBAudio/USBAudio.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBAudio/USBAudio.h Thu Oct 04 15:43:40 2018 +0300 @@ -66,7 +66,7 @@ * } * @endcode */ -class USBAudio: public USBDevice { +class USBAudio: virtual public USBDevice { public: /**
--- a/USBHID/USBHID.cpp Tue Sep 11 15:17:01 2018 +0300 +++ b/USBHID/USBHID.cpp Thu Oct 04 15:43:40 2018 +0300 @@ -26,7 +26,7 @@ output_length = output_report_length; input_length = input_report_length; if(connect) { - USBDevice::connect(); + // USBDevice::connect(); XXX Removed from here to support multi-function usb devices } }
--- a/USBHID/USBHID.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBHID/USBHID.h Thu Oct 04 15:43:40 2018 +0300 @@ -47,7 +47,7 @@ * @endcode */ -class USBHID: public USBDevice { +class USBHID: virtual public USBDevice { public: /**
--- a/USBHID/USBKeyboard.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBHID/USBKeyboard.h Thu Oct 04 15:43:40 2018 +0300 @@ -103,9 +103,9 @@ * */ USBKeyboard(uint16_t vendor_id = 0x1235, uint16_t product_id = 0x0050, uint16_t product_release = 0x0001): - USBHID(0, 0, vendor_id, product_id, product_release, false) { + USBDevice(vendor_id, product_id, product_release), USBHID(0, 0, vendor_id, product_id, product_release, false) { lock_status = 0; - connect(); + // connect(); XXX Removed from here to support multi-function usb devices }; /**
--- a/USBHID/USBMouse.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBHID/USBMouse.h Thu Oct 04 15:43:40 2018 +0300 @@ -118,11 +118,11 @@ * */ USBMouse(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0001, uint16_t product_release = 0x0001): - USBHID(0, 0, vendor_id, product_id, product_release, false) + USBDevice(vendor_id, product_id, product_release), USBHID(0, 0, vendor_id, product_id, product_release, false) { button = 0; this->mouse_type = mouse_type; - connect(); + // connect(); XXX Removed from here to support multi-function usb devices }; /**
--- a/USBHID/USBMouseKeyboard.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBHID/USBMouseKeyboard.h Thu Oct 04 15:43:40 2018 +0300 @@ -82,12 +82,12 @@ * */ USBMouseKeyboard(MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x0021, uint16_t product_id = 0x0011, uint16_t product_release = 0x0001): - USBHID(0, 0, vendor_id, product_id, product_release, false) + USBDevice(vendor_id, product_id, product_release), USBHID(0, 0, vendor_id, product_id, product_release, false) { lock_status = 0; button = 0; this->mouse_type = mouse_type; - connect(); + // connect(); XXX Removed from here to support multi-function usb devices }; /**
--- a/USBMIDI/USBMIDI.cpp Tue Sep 11 15:17:01 2018 +0300 +++ b/USBMIDI/USBMIDI.cpp Thu Oct 04 15:43:40 2018 +0300 @@ -24,7 +24,7 @@ : USBDevice(vendor_id, product_id, product_release), cur_data(0), data_end(true) { midi_evt = NULL; - USBDevice::connect(); + // USBDevice::connect(); XXX Removed from here to support multi-function usb devices } // write plain MIDIMessage that will be converted to USBMidi event packet
--- a/USBMIDI/USBMIDI.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBMIDI/USBMIDI.h Thu Oct 04 15:43:40 2018 +0300 @@ -50,7 +50,7 @@ * } * @endcode */ -class USBMIDI: public USBDevice { +class USBMIDI: virtual public USBDevice { public: /**
--- a/USBMSD/USBMSD.cpp Tue Sep 11 15:17:01 2018 +0300 +++ b/USBMSD/USBMSD.cpp Thu Oct 04 15:43:40 2018 +0300 @@ -130,7 +130,7 @@ } //connect the device - USBDevice::connect(blocking); + // USBDevice::connect(blocking); XXX Removed from here to support multi-function usb devices return true; }
--- a/USBMSD/USBMSD.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBMSD/USBMSD.h Thu Oct 04 15:43:40 2018 +0300 @@ -55,7 +55,7 @@ * If disk_status() returns 1 (disk not initialized), then disk_initialize() is called. After this step, connect() will collect information * such as the number of blocks and the memory size. */ -class USBMSD: public USBDevice { +class USBMSD: virtual public USBDevice { public: /**
--- a/USBSerial/USBCDC.cpp Tue Sep 11 15:17:01 2018 +0300 +++ b/USBSerial/USBCDC.cpp Thu Oct 04 15:43:40 2018 +0300 @@ -35,7 +35,7 @@ USBCDC::USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking): USBDevice(vendor_id, product_id, product_release) { terminal_connected = false; - USBDevice::connect(connect_blocking); + // USBDevice::connect(connect_blocking); XXX Removed from here to support multi-function usb devices } bool USBCDC::USBCallback_request(void) {
--- a/USBSerial/USBCDC.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBSerial/USBCDC.h Thu Oct 04 15:43:40 2018 +0300 @@ -26,7 +26,7 @@ #include "USBDevice.h" -class USBCDC: public USBDevice { +class USBCDC: virtual public USBDevice { public: /*
--- a/USBSerial/USBSerial.h Tue Sep 11 15:17:01 2018 +0300 +++ b/USBSerial/USBSerial.h Thu Oct 04 15:43:40 2018 +0300 @@ -56,7 +56,8 @@ * @param connect_blocking define if the connection must be blocked if USB not plugged in * */ - USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001, bool connect_blocking = true): USBCDC(vendor_id, product_id, product_release, connect_blocking){ + USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001, bool connect_blocking = true): + USBDevice(vendor_id, product_id, product_release), USBCDC(vendor_id, product_id, product_release, connect_blocking) { settingsChangedCallback = 0; };