MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / readMacId

Function readMacId

app/src/Licensing/MachineID.cpp:91–114  ·  view source on GitHub ↗

* @brief Reads the macOS IOPlatformUUID from the IO registry; only the * `key = "value"` shape is accepted, never a line lacking the '=' separator. */

Source from the content-addressed store, hash-verified

89 * `key = "value"` shape is accepted, never a line lacking the '=' separator.
90 */
91static QString readMacId(bool& complete)
92{
93 QProcess process;
94 const auto ioregTool = resolveSystemTool({"/usr/sbin/ioreg"}, "ioreg");
95 process.start(ioregTool, {"-rd1", "-c", "IOPlatformExpertDevice"});
96 awaitTool(process);
97 QString output = process.readAllStandardOutput();
98
99 QString id;
100 QStringList lines = output.split("\n");
101 for (const QString& line : std::as_const(lines)) {
102 if (line.contains("IOPlatformUUID")) {
103 const auto parts = line.split("=");
104 if (parts.size() >= 2) {
105 id = parts.last().trimmed();
106 id.remove("\"");
107 }
108 break;
109 }
110 }
111
112 complete = !id.isEmpty();
113 return id;
114}
115#endif
116
117#if defined(Q_OS_WIN)

Callers 1

readPlatformIdFunction · 0.85

Calls 8

resolveSystemToolFunction · 0.85
awaitToolFunction · 0.85
lastMethod · 0.80
isEmptyMethod · 0.80
startMethod · 0.45
containsMethod · 0.45
sizeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected