From 4b240dcec0e167d87ce11d0828a41316037c74d3 Mon Sep 17 00:00:00 2001 From: Karol Wachowski Date: Thu, 25 Jun 2020 07:21:27 +0000 Subject: Fix stopping usbgadget Changed recursive removal (std::filesystem::remove_all) of all files in /sys/kernel/config/usb_gadget/ to rmdir operation (std::filesystem::remove). configfs does not allow recursive file removal and returns operation not permitted on such operations. It is required to execute rmmdir. Tested: verified that VirtualMedia drives can be restarted properly (stopped and started again) Change-Id: Ib0c66723b451e29f28c9c90029365385a41dc558 Signed-off-by: Karol Wachowski --- src/system.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/system.hpp b/src/system.hpp index 500630f..a6dba84 100644 --- a/src/system.hpp +++ b/src/system.hpp @@ -568,13 +568,14 @@ struct UsbGadget // StateChange: unknown, notMonitored, inserted were handler // earlier. We'll get here only for removed, or cleanup + echoToFile(gadgetDir / "UDC", ""); const std::array dirs = { massStorageDir.c_str(), funcMassStorageDir.c_str(), configStringsDir.c_str(), configDir.c_str(), stringsDir.c_str(), gadgetDir.c_str()}; for (const char* dir : dirs) { - fs::remove_all(dir, ec); + fs::remove(dir, ec); if (ec) { success = false; -- cgit v1.2.3