~aleteoryx/muditaos

25096a1e8ba323f3a9dc4c51a8793ba3291852bc — Bartosz Szostak 3 years ago c0ccc32
[MOS-820] Fix crashes caused by plugging the charger

The deleting of the USBLinuxReceive task has been added
in the USB stack de-initialization process to avoid creating
multiple instances during next initializations.
1 files changed, 6 insertions(+), 1 deletions(-)

M module-bsp/board/linux/usb_cdc/usb_cdc.cpp
M module-bsp/board/linux/usb_cdc/usb_cdc.cpp => module-bsp/board/linux/usb_cdc/usb_cdc.cpp +6 -1
@@ 29,6 29,10 @@
#define LOG_FATAL(...)
#define LOG_CUSTOM(loggerLevel, ...)
#endif
namespace
{
    xTaskHandle taskHandleReceive;
}
namespace bsp
{
    int fd;


@@ 148,6 152,8 @@ namespace bsp
    {
        LOG_INFO("usbDeinit removing file %s", ptsFileName);
        std::remove(ptsFileName);
        if (taskHandleReceive)
            vTaskDelete(taskHandleReceive);
    }

    void usbReinit(const std::string &)


@@ 202,7 208,6 @@ namespace bsp
        cfsetospeed(&newtio, SERIAL_BAUDRATE);
        tcsetattr(fd, TCSANOW, &newtio);

        xTaskHandle taskHandleReceive;
        USBReceiveQueue = initParams.queueHandle;
        USBIrqQueue     = initParams.irqQueueHandle;