~aleteoryx/muditaos

6ebd1550db1192b335eba09dd349ce098b35aaf1 — Maciej-Mudita 3 years ago 242f97c
[MOS-686] Revert - Fix the accessibility of user files by MTP

This reverts commit 42ca53a732487f7dabf5e06ee4c03f73c329882b.
M module-bsp/board/linux/usb_cdc/usb_cdc.cpp => module-bsp/board/linux/usb_cdc/usb_cdc.cpp +0 -5
@@ 160,11 160,6 @@ namespace bsp
        LOG_INFO("usbSuspend");
    }

    void usbStartMTP()
    {
        LOG_INFO("mtpStart");
    }

    int usbInit(const bsp::usbInitParams &initParams)
    {


M module-bsp/bsp/usb/usb.hpp => module-bsp/bsp/usb/usb.hpp +0 -1
@@ 47,6 47,5 @@ namespace bsp
    void usbReinit(const std::string& rootPath);
    void usbSuspend();
    void usbHandleDataReceived();
    void usbStartMTP();

} // namespace bsp

M module-services/service-desktop/ServiceDesktop.cpp => module-services/service-desktop/ServiceDesktop.cpp +4 -7
@@ 201,11 201,10 @@ auto ServiceDesktop::usbWorkerInit() -> sys::ReturnCodes
                                                    serialNumber,
                                                    purefs::dir::getUserDiskPath() / "music");

    initialized = desktopWorker->init(
        {{sdesktop::RECEIVE_QUEUE_BUFFER_NAME, sizeof(std::string *), sdesktop::cdcReceiveQueueLength},
         {sdesktop::SEND_QUEUE_BUFFER_NAME, sizeof(std::string *), sdesktop::cdcSendQueueLength},
         {sdesktop::IRQ_QUEUE_BUFFER_NAME, sdesktop::irqQueueSize, sdesktop::irqQueueLength},
         {sdesktop::SIGNALLING_QUEUE_BUFFER_NAME, sizeof(WorkerDesktop::Signal), sdesktop::signallingQueueLength}});
    initialized =
        desktopWorker->init({{sdesktop::RECEIVE_QUEUE_BUFFER_NAME, sizeof(std::string *), sdesktop::cdc_queue_len},
                             {sdesktop::SEND_QUEUE_BUFFER_NAME, sizeof(std::string *), sdesktop::cdc_queue_object_size},
                             {sdesktop::IRQ_QUEUE_BUFFER_NAME, 1, sdesktop::irq_queue_object_size}});

    if (!initialized) {
        LOG_ERROR("!!! service-desktop usbWorkerInit failed to initialize worker, service-desktop won't work");


@@ 265,7 264,6 @@ auto ServiceDesktop::handle(locks::UnlockedPhone * /*msg*/) -> std::shared_ptr<s
        bus.sendUnicast(std::make_shared<sys::TetheringStateRequest>(sys::phone_modes::Tethering::On),
                        service::name::system_manager);
        isPlugEventUnhandled = false;
        desktopWorker->notify(WorkerDesktop::Signal::startMTP);
    }

    return sys::MessageNone{};


@@ 371,7 369,6 @@ auto ServiceDesktop::handle(sdesktop::usb::USBConfigured *msg) -> std::shared_pt
            bus.sendUnicast(std::make_shared<sys::TetheringStateRequest>(sys::phone_modes::Tethering::On),
                            service::name::system_manager);
            isPlugEventUnhandled = false;
            desktopWorker->notify(WorkerDesktop::Signal::startMTP);
        }
    }


M module-services/service-desktop/WorkerDesktop.cpp => module-services/service-desktop/WorkerDesktop.cpp +0 -32
@@ 112,13 112,6 @@ void WorkerDesktop::reset()
    }
}

void WorkerDesktop::notify(Signal command)
{
    if (auto queue = getQueueByName(sdesktop::SIGNALLING_QUEUE_BUFFER_NAME); !queue->Overwrite(&command)) {
        LOG_ERROR("Unable to overwrite the command in the commands queue.");
    }
}

bool WorkerDesktop::handleMessage(std::uint32_t queueID)
{
    bool result       = false;


@@ 137,9 130,6 @@ bool WorkerDesktop::handleMessage(std::uint32_t queueID)
    else if (qname == sdesktop::IRQ_QUEUE_BUFFER_NAME) {
        result = handleIrqQueueMessage(queue);
    }
    else if (qname == sdesktop::SIGNALLING_QUEUE_BUFFER_NAME) {
        result = handleSignallingQueueMessage(queue);
    }
    else {
        LOG_INFO("handeMessage got message on an unhandled queue");
    }


@@ 250,28 240,6 @@ bool WorkerDesktop::handleIrqQueueMessage(std::shared_ptr<sys::WorkerQueue> &que
    return true;
}

bool WorkerDesktop::handleSignallingQueueMessage(std::shared_ptr<sys::WorkerQueue> &queue)
{
    if (!initialized) {
        return false;
    }
    sys::WorkerCommand command;
    if (!queue->Dequeue(&command, 0)) {
        LOG_ERROR("handleMessage failed to receive from \"%s\"", sdesktop::SIGNALLING_QUEUE_BUFFER_NAME);
        return false;
    }

    switch (static_cast<Signal>(command.command)) {
    case Signal::startMTP:
        bsp::usbStartMTP();
        break;
    default:
        LOG_ERROR("Command not valid.");
        return false;
    }
    return true;
}

void WorkerDesktop::suspendUsb()
{
    bsp::usbSuspend();

M module-services/service-desktop/WorkerDesktop.hpp => module-services/service-desktop/WorkerDesktop.hpp +0 -7
@@ 19,11 19,6 @@
class WorkerDesktop : public sys::Worker
{
  public:
    enum class Signal
    {
        startMTP
    };

    WorkerDesktop(sys::Service *ownerServicePtr,
                  std::function<void()> messageProcessedCallback,
                  const sdesktop::USBSecurityModel &securityModel,


@@ 35,7 30,6 @@ class WorkerDesktop : public sys::Worker
    bool reinit(const std::filesystem::path &path);

    bool handleMessage(std::uint32_t queueID) override final;
    void notify(Signal command);

    xQueueHandle getReceiveQueue()
    {


@@ 50,7 44,6 @@ class WorkerDesktop : public sys::Worker
    bool handleSendQueueMessage(std::shared_ptr<sys::WorkerQueue> &queue);
    bool handleServiceQueueMessage(std::shared_ptr<sys::WorkerQueue> &queue);
    bool handleIrqQueueMessage(std::shared_ptr<sys::WorkerQueue> &queue);
    bool handleSignallingQueueMessage(std::shared_ptr<sys::WorkerQueue> &queue);

    std::atomic<bool> initialized = false;


M module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp => module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp +3 -6
@@ 28,17 28,14 @@ namespace sdesktop
{
    inline constexpr auto service_stack             = 8192;
    inline constexpr auto worker_stack              = 8704;
    inline constexpr auto cdcReceiveQueueLength        = 1024;
    inline constexpr auto cdcSendQueueLength           = 1024;
    inline constexpr auto signallingQueueLength        = 4;
    inline constexpr auto irqQueueLength               = 4;
    inline constexpr auto irqQueueSize                 = sizeof(bsp::USBDeviceStatus);
    inline constexpr auto cdc_queue_len             = 1024;
    inline constexpr auto cdc_queue_object_size     = 1024;
    inline constexpr auto irq_queue_object_size     = sizeof(bsp::USBDeviceStatus);
    constexpr auto connectionActiveTimerName        = "connectionActiveTimer";
    constexpr auto connectionActiveTimerDelayMs     = std::chrono::milliseconds{1000 * 20};
    inline constexpr auto RECEIVE_QUEUE_BUFFER_NAME = "receiveQueueBuffer";
    inline constexpr auto SEND_QUEUE_BUFFER_NAME    = "sendQueueBuffer";
    inline constexpr auto IRQ_QUEUE_BUFFER_NAME     = "irqQueueBuffer";
    inline constexpr auto SIGNALLING_QUEUE_BUFFER_NAME = "signallingQueueBuffer";
    inline constexpr auto DeviceUniqueIdLength      = 32;
    inline constexpr auto DeviceUniqueIdName        = "sd_device_unique_id";
    constexpr auto pathFactoryDataSerial            = "factory_data/serial";

M pure_changelog.md => pure_changelog.md +0 -1
@@ 10,7 10,6 @@
### Fixed
* Fixed mixed SMS messages
* Fixed disappearing manual alarm and vibration volume setting in German
* Fixed the accessibility of user files by MTP
* Fixed SIM card pop-ups not showing
* Fixed lost bytes in logs
* Fixed passcode lock time discrepancy between lock screen and 'Wrong password' popup

M third-party/usb_stack => third-party/usb_stack +1 -1
@@ 1,1 1,1 @@
Subproject commit f8081cb29540aa96f228de7a82d3b5ef3170f121
Subproject commit 6caba85bdcdf31ebd30beb91f28810ecc4016c56