Fix SIM2 QMI UIM provisioning, auto-enable ModemManager, PIN auto-prompt, call audio, and Dunst clearing

This commit is contained in:
Luxferre committed 2026-10-25 11:31:41 +02:00
1 parent 9b712dcbca
commit b56f310f21
41 files changed
+1193 -352

No files matched your search

+15 -14
View File
@@ -183,7 +183,14 @@ inline bool sendPluginCommand(const char* name, const std::string& cmdLine) {
return false;
}
std::string fifoPath = getPluginFifoPath(name);
int fd = ::open(fifoPath.c_str(), O_WRONLY | O_NONBLOCK | O_CLOEXEC);
int fd = -1;
for (int attempt = 0; attempt < 6; ++attempt) {
fd = ::open(fifoPath.c_str(), O_WRONLY | O_NONBLOCK | O_CLOEXEC);
if (fd >= 0) {
break;
}
::usleep(25000);
}
if (fd < 0) {
return false;
}
@@ -1651,20 +1658,12 @@ inline std::string sendModemUssd(const std::string& input,
if (clean.empty()) return "Empty USSD request.";
int rc = 0;
std::string cmd;
if (isReply && !isUssdCode(clean)) {
cmd = "mmcli -m any --3gpp-ussd-respond=" + shellQuote(clean) + " 2>&1";
} else {
cmd = "mmcli -m any --3gpp-ussd-cancel >/dev/null 2>&1; "
"mmcli -m any --3gpp-ussd-initiate=" + shellQuote(clean) + " 2>&1";
}
std::string mode = (isReply && !isUssdCode(clean)) ? "respond" : "initiate";
std::string cmd =
"doas -n /usr/libexec/msm-modem-uim-selection ussd " + mode + " " +
shellQuote(clean) + " 2>&1";
std::string out = trimStr(runCaptureCmd(cmd, &rc));
size_t q1 = out.find('\'');
size_t q2 = out.rfind('\'');
if (q1 != std::string::npos && q2 != std::string::npos && q2 > q1) {
out = out.substr(q1 + 1, q2 - q1 - 1);
}
if (out.empty()) {
out = (rc == 0) ? "USSD request completed." : "USSD request failed.";
}
@@ -1698,7 +1697,9 @@ inline std::string sendModemUssd(const std::string& input,
}
inline void cancelModemUssd() {
runAsyncCmd("mmcli -m any --3gpp-ussd-cancel >/dev/null 2>&1");
runAsyncCmd(
"doas -n /usr/libexec/msm-modem-uim-selection ussd cancel >/dev/null 2>&1 "
"|| mmcli -m any --3gpp-ussd-cancel >/dev/null 2>&1");
}
} // namespace bananarchy