From 6ebd1550db1192b335eba09dd349ce098b35aaf1 Mon Sep 17 00:00:00 2001 From: Maciej-Mudita Date: Wed, 21 Sep 2022 16:26:27 +0200 Subject: [PATCH] [MOS-686] Revert - Fix the accessibility of user files by MTP This reverts commit 42ca53a732487f7dabf5e06ee4c03f73c329882b. --- module-bsp/board/linux/usb_cdc/usb_cdc.cpp | 5 --- module-bsp/bsp/usb/usb.hpp | 1 - .../service-desktop/ServiceDesktop.cpp | 11 +++---- .../service-desktop/WorkerDesktop.cpp | 32 ------------------- .../service-desktop/WorkerDesktop.hpp | 7 ---- .../service-desktop/ServiceDesktop.hpp | 9 ++---- pure_changelog.md | 1 - third-party/usb_stack | 2 +- 8 files changed, 8 insertions(+), 60 deletions(-) diff --git a/module-bsp/board/linux/usb_cdc/usb_cdc.cpp b/module-bsp/board/linux/usb_cdc/usb_cdc.cpp index f028de9dd2ab18c17e89f6d8474c026feaebbe0b..20182ac7abc8192dcb6436f817a0d219c8b3e4e5 100644 --- a/module-bsp/board/linux/usb_cdc/usb_cdc.cpp +++ b/module-bsp/board/linux/usb_cdc/usb_cdc.cpp @@ -160,11 +160,6 @@ namespace bsp LOG_INFO("usbSuspend"); } - void usbStartMTP() - { - LOG_INFO("mtpStart"); - } - int usbInit(const bsp::usbInitParams &initParams) { diff --git a/module-bsp/bsp/usb/usb.hpp b/module-bsp/bsp/usb/usb.hpp index 5cc1f63a6ff0a6ff687213b1814d4635e0a81dc3..c0577c041a5e180656e9ea2b8b284248593835f0 100644 --- a/module-bsp/bsp/usb/usb.hpp +++ b/module-bsp/bsp/usb/usb.hpp @@ -47,6 +47,5 @@ namespace bsp void usbReinit(const std::string& rootPath); void usbSuspend(); void usbHandleDataReceived(); - void usbStartMTP(); } // namespace bsp diff --git a/module-services/service-desktop/ServiceDesktop.cpp b/module-services/service-desktop/ServiceDesktop.cpp index 0a19d2b9200117019102e663c9fe5e8305117642..fcdc6801bcb2ccce33a074507bceec95305b6c13 100644 --- a/module-services/service-desktop/ServiceDesktop.cpp +++ b/module-services/service-desktop/ServiceDesktop.cpp @@ -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(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::phone_modes::Tethering::On), service::name::system_manager); isPlugEventUnhandled = false; - desktopWorker->notify(WorkerDesktop::Signal::startMTP); } } diff --git a/module-services/service-desktop/WorkerDesktop.cpp b/module-services/service-desktop/WorkerDesktop.cpp index 7bb70341b4833067f3a5dc492ce587c8d72721c7..6b282ec30a61c30f92298837fc8b1f973f00bd35 100644 --- a/module-services/service-desktop/WorkerDesktop.cpp +++ b/module-services/service-desktop/WorkerDesktop.cpp @@ -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 &que return true; } -bool WorkerDesktop::handleSignallingQueueMessage(std::shared_ptr &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(command.command)) { - case Signal::startMTP: - bsp::usbStartMTP(); - break; - default: - LOG_ERROR("Command not valid."); - return false; - } - return true; -} - void WorkerDesktop::suspendUsb() { bsp::usbSuspend(); diff --git a/module-services/service-desktop/WorkerDesktop.hpp b/module-services/service-desktop/WorkerDesktop.hpp index 10b6d5e1ef25c45e448266fc45a749aae7a51f3b..ac283b4e63daf456d1234d4afeb854cfa058580b 100644 --- a/module-services/service-desktop/WorkerDesktop.hpp +++ b/module-services/service-desktop/WorkerDesktop.hpp @@ -19,11 +19,6 @@ class WorkerDesktop : public sys::Worker { public: - enum class Signal - { - startMTP - }; - WorkerDesktop(sys::Service *ownerServicePtr, std::function 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 &queue); bool handleServiceQueueMessage(std::shared_ptr &queue); bool handleIrqQueueMessage(std::shared_ptr &queue); - bool handleSignallingQueueMessage(std::shared_ptr &queue); std::atomic initialized = false; diff --git a/module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp b/module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp index 31b03868a3e5133d413d6c7955f07c0414f3301a..5e8ecc6aafa743295a4cb0de81fe7c145dd70660 100644 --- a/module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp +++ b/module-services/service-desktop/include/service-desktop/ServiceDesktop.hpp @@ -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"; diff --git a/pure_changelog.md b/pure_changelog.md index 70d78c2ac531c2caf918030b3a2ef97f1f2afe7d..681effe037a607975c977b8f27ebf08940f0ee10 100644 --- a/pure_changelog.md +++ b/pure_changelog.md @@ -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 diff --git a/third-party/usb_stack b/third-party/usb_stack index f8081cb29540aa96f228de7a82d3b5ef3170f121..6caba85bdcdf31ebd30beb91f28810ecc4016c56 160000 --- a/third-party/usb_stack +++ b/third-party/usb_stack @@ -1 +1 @@ -Subproject commit f8081cb29540aa96f228de7a82d3b5ef3170f121 +Subproject commit 6caba85bdcdf31ebd30beb91f28810ecc4016c56