MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / mainTestDevices

Function mainTestDevices

src/fe-testdevices.cc:8–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6static FlagGroup flags;
7
8int mainTestDevices(int argc, const char* argv[])
9{
10 flags.parseFlagsWithConfigFiles(argc, argv, {});
11
12 auto candidates = findUsbDevices();
13 switch (candidates.size())
14 {
15 case 0:
16 fmt::print("Detected no devices.\n");
17 break;
18
19 case 1:
20 fmt::print("Detected one device:\n");
21 break;
22
23 default:
24 fmt::print("Detected {} devices:\n", candidates.size());
25 }
26
27 if (!candidates.empty())
28 {
29 fmt::print(
30 "{:15} {:30} {}\n", "Type", "Serial number", "Port (if any)");
31 for (auto& candidate : candidates)
32 {
33 fmt::print("{:15} {:30} {}\n",
34 getDeviceName(candidate->type),
35 candidate->serial,
36 candidate->serialPort);
37 }
38 }
39
40 return 0;
41}

Callers

nothing calls this directly

Calls 6

findUsbDevicesFunction · 0.85
printFunction · 0.85
getDeviceNameFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected