MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / runLspci

Function runLspci

launcher/minecraft/launch/PrintInstanceInfo.cpp:36–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void runLspci(QStringList& log)
37{
38 // FIXME: fixed size buffers...
39 char buff[512];
40 int gpuline = -1;
41 int cline = 0;
42 FILE* lspci = popen("lspci -k", "r");
43
44 if (!lspci)
45 return;
46
47 while (fgets(buff, 512, lspci) != NULL) {
48 std::string str(buff);
49 if (str.length() < 9)
50 continue;
51 if (str.substr(8, 3) == "VGA") {
52 gpuline = cline;
53 log << QString::fromStdString(str.substr(35, std::string::npos));
54 }
55 if (gpuline > -1 && gpuline != cline) {
56 if (cline - gpuline < 3) {
57 log << QString::fromStdString(str.substr(1, std::string::npos));
58 }
59 }
60 cline++;
61 }
62 pclose(lspci);
63}
64#elif defined(Q_OS_FREEBSD)
65void runSysctlHwModel(QStringList& log)
66{

Callers 1

executeTaskMethod · 0.85

Calls 1

fromStdStringFunction · 0.85

Tested by

no test coverage detected