1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #include "PresenceGpio.hpp"
18 #include "PwmSensor.hpp"
19 #include "TachSensor.hpp"
20 #include "Thresholds.hpp"
21 #include "Utils.hpp"
22 #include "VariantVisitors.hpp"
23
24 #include <boost/algorithm/string/replace.hpp>
25 #include <boost/asio/error.hpp>
26 #include <boost/asio/io_context.hpp>
27 #include <boost/asio/post.hpp>
28 #include <boost/asio/steady_timer.hpp>
29 #include <boost/container/flat_map.hpp>
30 #include <boost/container/flat_set.hpp>
31 #include <phosphor-logging/lg2.hpp>
32 #include <sdbusplus/asio/connection.hpp>
33 #include <sdbusplus/asio/object_server.hpp>
34 #include <sdbusplus/bus.hpp>
35 #include <sdbusplus/bus/match.hpp>
36 #include <sdbusplus/message.hpp>
37
38 #include <array>
39 #include <chrono>
40 #include <cstddef>
41 #include <cstdint>
42 #include <filesystem>
43 #include <fstream>
44 #include <functional>
45 #include <ios>
46 #include <map>
47 #include <memory>
48 #include <optional>
49 #include <regex>
50 #include <string>
51 #include <system_error>
52 #include <utility>
53 #include <variant>
54 #include <vector>
55
56 // The following two structures need to be consistent
57 static auto sensorTypes{std::to_array<const char*>(
58 {"AspeedFan", "I2CFan", "NuvotonFan", "HPEFan"})};
59
60 enum FanTypes
61 {
62 aspeed = 0,
63 i2c,
64 nuvoton,
65 hpe,
66 max,
67 };
68
69 static_assert(std::tuple_size<decltype(sensorTypes)>::value == FanTypes::max,
70 "sensorTypes element number is not equal to FanTypes number");
71
72 constexpr const char* redundancyConfiguration =
73 "xyz.openbmc_project.Configuration.FanRedundancy";
74 static std::regex inputRegex(R"(fan(\d+)_input)");
75
76 // todo: power supply fan redundancy
77 std::optional<RedundancySensor> systemRedundancy;
78
79 static const std::map<std::string, FanTypes> compatibleFanTypes = {
80 {"aspeed,ast2400-pwm-tacho", FanTypes::aspeed},
81 {"aspeed,ast2500-pwm-tacho", FanTypes::aspeed},
82 {"aspeed,ast2600-pwm-tach", FanTypes::aspeed},
83 {"nuvoton,npcm750-pwm-fan", FanTypes::nuvoton},
84 {"nuvoton,npcm845-pwm-fan", FanTypes::nuvoton},
85 {"hpe,gxp-fan-ctrl", FanTypes::hpe}
86 // add compatible string here for new fan type
87 };
88
getFanType(const std::filesystem::path & parentPath)89 FanTypes getFanType(const std::filesystem::path& parentPath)
90 {
91 std::filesystem::path linkPath = parentPath / "of_node";
92 if (!std::filesystem::exists(linkPath))
93 {
94 return FanTypes::i2c;
95 }
96
97 std::string canonical = std::filesystem::canonical(linkPath);
98 std::string compatiblePath = canonical + "/compatible";
99 std::ifstream compatibleStream(compatiblePath);
100
101 if (!compatibleStream)
102 {
103 lg2::error("Error opening '{PATH}'", "PATH", compatiblePath);
104 return FanTypes::i2c;
105 }
106
107 std::string compatibleString;
108 while (std::getline(compatibleStream, compatibleString))
109 {
110 compatibleString.pop_back(); // trim EOL before comparisons
111
112 std::map<std::string, FanTypes>::const_iterator compatibleIterator =
113 compatibleFanTypes.find(compatibleString);
114
115 if (compatibleIterator != compatibleFanTypes.end())
116 {
117 return compatibleIterator->second;
118 }
119 }
120
121 return FanTypes::i2c;
122 }
enablePwm(const std::filesystem::path & filePath)123 void enablePwm(const std::filesystem::path& filePath)
124 {
125 std::fstream enableFile(filePath, std::ios::in | std::ios::out);
126 if (!enableFile.good())
127 {
128 lg2::error("Error read/write '{PATH}'", "PATH", filePath);
129 return;
130 }
131
132 std::string regulateMode;
133 std::getline(enableFile, regulateMode);
134 if (regulateMode == "0")
135 {
136 enableFile << 1;
137 }
138 }
findPwmfanPath(unsigned int configPwmfanIndex,std::filesystem::path & pwmPath)139 bool findPwmfanPath(unsigned int configPwmfanIndex,
140 std::filesystem::path& pwmPath)
141 {
142 /* Search PWM since pwm-fan had separated
143 * PWM from tach directory and 1 channel only*/
144 std::vector<std::filesystem::path> pwmfanPaths;
145 std::string pwnfanDevName("pwm-fan");
146
147 pwnfanDevName += std::to_string(configPwmfanIndex);
148
149 if (!findFiles(std::filesystem::path("/sys/class/hwmon"), R"(pwm\d+)",
150 pwmfanPaths))
151 {
152 lg2::error("No PWMs are found!");
153 return false;
154 }
155 for (const auto& path : pwmfanPaths)
156 {
157 std::error_code ec;
158 std::filesystem::path link =
159 std::filesystem::read_symlink(path.parent_path() / "device", ec);
160
161 if (ec)
162 {
163 lg2::error("read_symlink() failed: '{ERROR_MESSAGE}'",
164 "ERROR_MESSAGE", ec.message());
165 continue;
166 }
167
168 if (link.filename().string() == pwnfanDevName)
169 {
170 pwmPath = path;
171 return true;
172 }
173 }
174 return false;
175 }
findPwmPath(const std::filesystem::path & directory,unsigned int pwm,std::filesystem::path & pwmPath)176 bool findPwmPath(const std::filesystem::path& directory, unsigned int pwm,
177 std::filesystem::path& pwmPath)
178 {
179 std::error_code ec;
180
181 /* Assuming PWM file is appeared in the same directory as fanX_input */
182 auto path = directory / ("pwm" + std::to_string(pwm + 1));
183 bool exists = std::filesystem::exists(path, ec);
184
185 if (ec || !exists)
186 {
187 /* PWM file not exist or error happened */
188 if (ec)
189 {
190 lg2::error("exists() failed: '{ERROR_MESSAGE}'", "ERROR_MESSAGE",
191 ec.message());
192 }
193 /* try search form pwm-fanX directory */
194 return findPwmfanPath(pwm, pwmPath);
195 }
196
197 pwmPath = path;
198 return true;
199 }
200
201 // The argument to this function should be the fanN_input file that we want to
202 // enable. The function will locate the corresponding fanN_enable file if it
203 // exists. Note that some drivers don't provide this file if the sensors are
204 // always enabled.
enableFanInput(const std::filesystem::path & fanInputPath)205 void enableFanInput(const std::filesystem::path& fanInputPath)
206 {
207 std::error_code ec;
208 std::string path(fanInputPath.string());
209 boost::replace_last(path, "input", "enable");
210
211 bool exists = std::filesystem::exists(path, ec);
212 if (ec || !exists)
213 {
214 return;
215 }
216
217 std::fstream enableFile(path, std::ios::out);
218 if (!enableFile.good())
219 {
220 return;
221 }
222 enableFile << 1;
223 }
224
createRedundancySensor(const boost::container::flat_map<std::string,std::shared_ptr<TachSensor>> & sensors,const std::shared_ptr<sdbusplus::asio::connection> & conn,sdbusplus::asio::object_server & objectServer)225 void createRedundancySensor(
226 const boost::container::flat_map<std::string, std::shared_ptr<TachSensor>>&
227 sensors,
228 const std::shared_ptr<sdbusplus::asio::connection>& conn,
229 sdbusplus::asio::object_server& objectServer)
230 {
231 conn->async_method_call(
232 [&objectServer, &sensors](boost::system::error_code& ec,
233 const ManagedObjectType& managedObj) {
234 if (ec)
235 {
236 lg2::error("Error calling entity manager");
237 return;
238 }
239 for (const auto& [path, interfaces] : managedObj)
240 {
241 for (const auto& [intf, cfg] : interfaces)
242 {
243 if (intf == redundancyConfiguration)
244 {
245 // currently only support one
246 auto findCount = cfg.find("AllowedFailures");
247 if (findCount == cfg.end())
248 {
249 lg2::error("Malformed redundancy record");
250 return;
251 }
252 std::vector<std::string> sensorList;
253
254 for (const auto& [name, sensor] : sensors)
255 {
256 sensorList.push_back(
257 "/xyz/openbmc_project/sensors/fan_tach/" +
258 sensor->name);
259 }
260 systemRedundancy.reset();
261 systemRedundancy.emplace(RedundancySensor(
262 std::get<uint64_t>(findCount->second), sensorList,
263 objectServer, path));
264
265 return;
266 }
267 }
268 }
269 },
270 "xyz.openbmc_project.EntityManager", "/xyz/openbmc_project/inventory",
271 "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
272 }
273
createSensors(boost::asio::io_context & io,sdbusplus::asio::object_server & objectServer,boost::container::flat_map<std::string,std::shared_ptr<TachSensor>> & tachSensors,boost::container::flat_map<std::string,std::unique_ptr<PwmSensor>> & pwmSensors,boost::container::flat_map<std::string,std::weak_ptr<PresenceGpio>> & presenceGpios,std::shared_ptr<sdbusplus::asio::connection> & dbusConnection,const std::shared_ptr<boost::container::flat_set<std::string>> & sensorsChanged,size_t retries=0)274 void createSensors(
275 boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
276 boost::container::flat_map<std::string, std::shared_ptr<TachSensor>>&
277 tachSensors,
278 boost::container::flat_map<std::string, std::unique_ptr<PwmSensor>>&
279 pwmSensors,
280 boost::container::flat_map<std::string, std::weak_ptr<PresenceGpio>>&
281 presenceGpios,
282 std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
283 const std::shared_ptr<boost::container::flat_set<std::string>>&
284 sensorsChanged,
285 size_t retries = 0)
286 {
287 auto getter = std::make_shared<
288 GetSensorConfiguration>(dbusConnection, [&io, &objectServer,
289 &tachSensors, &pwmSensors,
290 &presenceGpios,
291 &dbusConnection,
292 sensorsChanged](
293 const ManagedObjectType&
294 sensorConfigurations) {
295 bool firstScan = sensorsChanged == nullptr;
296 std::vector<std::filesystem::path> paths;
297 if (!findFiles(std::filesystem::path("/sys/class/hwmon"),
298 R"(fan\d+_input)", paths))
299 {
300 lg2::error("No fan sensors in system");
301 return;
302 }
303
304 // iterate through all found fan sensors, and try to match them with
305 // configuration
306 for (const auto& path : paths)
307 {
308 std::smatch match;
309 std::string pathStr = path.string();
310
311 std::regex_search(pathStr, match, inputRegex);
312 std::string indexStr = *(match.begin() + 1);
313
314 std::filesystem::path directory = path.parent_path();
315 FanTypes fanType = getFanType(directory);
316 std::string cfgIntf = configInterfaceName(sensorTypes[fanType]);
317
318 // convert to 0 based
319 size_t index = std::stoul(indexStr) - 1;
320
321 const char* baseType = nullptr;
322 const SensorData* sensorData = nullptr;
323 const std::string* interfacePath = nullptr;
324 const SensorBaseConfiguration* baseConfiguration = nullptr;
325 for (const auto& [path, cfgData] : sensorConfigurations)
326 {
327 // find the base of the configuration to see if indexes
328 // match
329 auto sensorBaseFind = cfgData.find(cfgIntf);
330 if (sensorBaseFind == cfgData.end())
331 {
332 continue;
333 }
334
335 baseConfiguration = &(*sensorBaseFind);
336 interfacePath = &path.str;
337 baseType = sensorTypes[fanType];
338
339 auto findIndex = baseConfiguration->second.find("Index");
340 if (findIndex == baseConfiguration->second.end())
341 {
342 lg2::error("'{INTERFACE}' missing index", "INTERFACE",
343 baseConfiguration->first);
344 continue;
345 }
346 unsigned int configIndex = std::visit(
347 VariantToUnsignedIntVisitor(), findIndex->second);
348 if (configIndex != index)
349 {
350 continue;
351 }
352 if (fanType == FanTypes::aspeed ||
353 fanType == FanTypes::nuvoton || fanType == FanTypes::hpe)
354 {
355 // there will be only 1 aspeed or nuvoton or hpe sensor
356 // object in sysfs, we found the fan
357 sensorData = &cfgData;
358 break;
359 }
360 if (fanType == FanTypes::i2c)
361 {
362 std::string deviceName =
363 std::filesystem::read_symlink(directory / "device")
364 .filename();
365
366 size_t bus = 0;
367 size_t addr = 0;
368 if (!getDeviceBusAddr(deviceName, bus, addr))
369 {
370 continue;
371 }
372
373 auto findBus = baseConfiguration->second.find("Bus");
374 auto findAddress =
375 baseConfiguration->second.find("Address");
376 if (findBus == baseConfiguration->second.end() ||
377 findAddress == baseConfiguration->second.end())
378 {
379 lg2::error("'{INTERFACE}' missing bus or address",
380 "INTERFACE", baseConfiguration->first);
381 continue;
382 }
383 unsigned int configBus = std::visit(
384 VariantToUnsignedIntVisitor(), findBus->second);
385 unsigned int configAddress = std::visit(
386 VariantToUnsignedIntVisitor(), findAddress->second);
387
388 if (configBus == bus && configAddress == addr)
389 {
390 sensorData = &cfgData;
391 break;
392 }
393 }
394 }
395 if (sensorData == nullptr)
396 {
397 lg2::error("failed to find match for '{PATH}'", "PATH",
398 path.string());
399 continue;
400 }
401
402 auto findSensorName = baseConfiguration->second.find("Name");
403
404 if (findSensorName == baseConfiguration->second.end())
405 {
406 lg2::error(
407 "could not determine configuration name for '{PATH}'",
408 "PATH", path.string());
409 continue;
410 }
411 std::string sensorName =
412 std::get<std::string>(findSensorName->second);
413
414 // on rescans, only update sensors we were signaled by
415 auto findSensor = tachSensors.find(sensorName);
416 if (!firstScan && findSensor != tachSensors.end())
417 {
418 bool found = false;
419 for (auto it = sensorsChanged->begin();
420 it != sensorsChanged->end(); it++)
421 {
422 if (it->ends_with(findSensor->second->name))
423 {
424 sensorsChanged->erase(it);
425 findSensor->second = nullptr;
426 found = true;
427 break;
428 }
429 }
430 if (!found)
431 {
432 continue;
433 }
434 }
435 std::vector<thresholds::Threshold> sensorThresholds;
436 if (!parseThresholdsFromConfig(*sensorData, sensorThresholds))
437 {
438 lg2::error("error populating thresholds for '{NAME}'", "NAME",
439 sensorName);
440 }
441
442 auto presenceConfig =
443 sensorData->find(cfgIntf + std::string(".Presence"));
444
445 std::shared_ptr<PresenceGpio> presenceGpio(nullptr);
446
447 // presence sensors are optional
448 if (presenceConfig != sensorData->end())
449 {
450 auto findPolarity = presenceConfig->second.find("Polarity");
451 auto findPinName = presenceConfig->second.find("PinName");
452
453 if (findPinName == presenceConfig->second.end() ||
454 findPolarity == presenceConfig->second.end())
455 {
456 lg2::error("Malformed Presence Configuration");
457 }
458 else
459 {
460 bool inverted =
461 std::get<std::string>(findPolarity->second) == "Low";
462 const auto* pinName =
463 std::get_if<std::string>(&findPinName->second);
464
465 if (pinName != nullptr)
466 {
467 auto findPresenceGpio = presenceGpios.find(*pinName);
468 if (findPresenceGpio != presenceGpios.end())
469 {
470 auto p = findPresenceGpio->second.lock();
471 if (p)
472 {
473 presenceGpio = p;
474 }
475 }
476 if (!presenceGpio)
477 {
478 auto findMonitorType =
479 presenceConfig->second.find("MonitorType");
480 bool polling = false;
481 if (findMonitorType != presenceConfig->second.end())
482 {
483 auto mType = std::get<std::string>(
484 findMonitorType->second);
485 if (mType == "Polling")
486 {
487 polling = true;
488 }
489 else if (mType != "Event")
490 {
491 lg2::error(
492 "Unsupported GPIO MonitorType of '{TYPE}' for '{NAME}', "
493 "supported types: Polling, Event default",
494 "TYPE", mType, "NAME", sensorName);
495 }
496 }
497 try
498 {
499 if (polling)
500 {
501 presenceGpio =
502 std::make_shared<PollingPresenceGpio>(
503 "Fan", sensorName, *pinName,
504 inverted, io);
505 }
506 else
507 {
508 presenceGpio =
509 std::make_shared<EventPresenceGpio>(
510 "Fan", sensorName, *pinName,
511 inverted, io);
512 }
513 presenceGpios[*pinName] = presenceGpio;
514 }
515 catch (const std::system_error& e)
516 {
517 lg2::error(
518 "Failed to create GPIO monitor object for "
519 "'{PIN_NAME}' / '{SENSOR_NAME}': '{ERROR}'",
520 "PIN_NAME", *pinName, "SENSOR_NAME",
521 sensorName, "ERROR", e);
522 }
523 }
524 }
525 else
526 {
527 lg2::error(
528 "Malformed Presence pinName for sensor '{NAME}'",
529 "NAME", sensorName);
530 }
531 }
532 }
533 std::optional<RedundancySensor>* redundancy = nullptr;
534 if (fanType == FanTypes::aspeed)
535 {
536 redundancy = &systemRedundancy;
537 }
538
539 PowerState powerState = getPowerState(baseConfiguration->second);
540
541 constexpr double defaultMaxReading = 25000;
542 constexpr double defaultMinReading = 0;
543 std::pair<double, double> limits =
544 std::make_pair(defaultMinReading, defaultMaxReading);
545
546 auto connector =
547 sensorData->find(cfgIntf + std::string(".Connector"));
548
549 std::optional<std::string> led;
550 std::string pwmName;
551 std::filesystem::path pwmPath;
552
553 // The Mutable parameter is optional, defaulting to false
554 bool isValueMutable = false;
555 if (connector != sensorData->end())
556 {
557 auto findPwm = connector->second.find("Pwm");
558 if (findPwm != connector->second.end())
559 {
560 size_t pwm = std::visit(VariantToUnsignedIntVisitor(),
561 findPwm->second);
562 if (!findPwmPath(directory, pwm, pwmPath))
563 {
564 lg2::error(
565 "Connector for '{NAME}' no pwm channel found!",
566 "NAME", sensorName);
567 continue;
568 }
569
570 std::filesystem::path pwmEnableFile =
571 "pwm" + std::to_string(pwm + 1) + "_enable";
572 std::filesystem::path enablePath =
573 pwmPath.parent_path() / pwmEnableFile;
574 enablePwm(enablePath);
575
576 /* use pwm name override if found in configuration else
577 * use default */
578 auto findOverride = connector->second.find("PwmName");
579 if (findOverride != connector->second.end())
580 {
581 pwmName = std::visit(VariantToStringVisitor(),
582 findOverride->second);
583 }
584 else
585 {
586 pwmName = "Pwm_" + std::to_string(pwm + 1);
587 }
588
589 // Check PWM sensor mutability
590 auto findMutable = connector->second.find("Mutable");
591 if (findMutable != connector->second.end())
592 {
593 const auto* ptrMutable =
594 std::get_if<bool>(&(findMutable->second));
595 if (ptrMutable != nullptr)
596 {
597 isValueMutable = *ptrMutable;
598 }
599 }
600 }
601 else
602 {
603 lg2::error("Connector for '{NAME}' missing pwm!", "NAME",
604 sensorName);
605 }
606
607 auto findLED = connector->second.find("LED");
608 if (findLED != connector->second.end())
609 {
610 const auto* ledName =
611 std::get_if<std::string>(&(findLED->second));
612 if (ledName == nullptr)
613 {
614 lg2::error("Wrong format for LED of '{NAME}'", "NAME",
615 sensorName);
616 }
617 else
618 {
619 led = *ledName;
620 }
621 }
622 }
623
624 findLimits(limits, baseConfiguration);
625
626 enableFanInput(path);
627
628 auto& tachSensor = tachSensors[sensorName];
629 tachSensor = nullptr;
630 tachSensor = std::make_shared<TachSensor>(
631 path.string(), baseType, objectServer, dbusConnection,
632 presenceGpio, redundancy, io, sensorName,
633 std::move(sensorThresholds), *interfacePath, limits, powerState,
634 led);
635 tachSensor->setupRead();
636
637 if (!pwmPath.empty() && std::filesystem::exists(pwmPath) &&
638 (pwmSensors.count(pwmPath) == 0U))
639 {
640 pwmSensors[pwmPath] = std::make_unique<PwmSensor>(
641 pwmName, pwmPath, dbusConnection, objectServer,
642 *interfacePath, "Fan", isValueMutable);
643 }
644 }
645
646 createRedundancySensor(tachSensors, dbusConnection, objectServer);
647 });
648 getter->getConfiguration(
649 std::vector<std::string>{sensorTypes.begin(), sensorTypes.end()},
650 retries);
651 }
652
main()653 int main()
654 {
655 boost::asio::io_context io;
656 auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
657 sdbusplus::asio::object_server objectServer(systemBus, true);
658
659 objectServer.add_manager("/xyz/openbmc_project/sensors");
660 objectServer.add_manager("/xyz/openbmc_project/control");
661 objectServer.add_manager("/xyz/openbmc_project/inventory");
662 systemBus->request_name("xyz.openbmc_project.FanSensor");
663 boost::container::flat_map<std::string, std::shared_ptr<TachSensor>>
664 tachSensors;
665 boost::container::flat_map<std::string, std::unique_ptr<PwmSensor>>
666 pwmSensors;
667 boost::container::flat_map<std::string, std::weak_ptr<PresenceGpio>>
668 presenceGpios;
669 auto sensorsChanged =
670 std::make_shared<boost::container::flat_set<std::string>>();
671
672 boost::asio::post(io, [&]() {
673 createSensors(io, objectServer, tachSensors, pwmSensors, presenceGpios,
674 systemBus, nullptr);
675 });
676
677 boost::asio::steady_timer filterTimer(io);
678 std::function<void(sdbusplus::message_t&)> eventHandler =
679 [&](sdbusplus::message_t& message) {
680 if (message.is_method_error())
681 {
682 lg2::error("callback method error");
683 return;
684 }
685 sensorsChanged->insert(message.get_path());
686 // this implicitly cancels the timer
687 filterTimer.expires_after(std::chrono::seconds(1));
688
689 filterTimer.async_wait([&](const boost::system::error_code& ec) {
690 if (ec == boost::asio::error::operation_aborted)
691 {
692 /* we were canceled*/
693 return;
694 }
695 if (ec)
696 {
697 lg2::error("timer error");
698 return;
699 }
700 createSensors(io, objectServer, tachSensors, pwmSensors,
701 presenceGpios, systemBus, sensorsChanged, 5);
702 });
703 };
704
705 std::vector<std::unique_ptr<sdbusplus::bus::match_t>> matches =
706 setupPropertiesChangedMatches(*systemBus, sensorTypes, eventHandler);
707
708 // redundancy sensor
709 std::function<void(sdbusplus::message_t&)> redundancyHandler =
710 [&tachSensors, &systemBus, &objectServer](sdbusplus::message_t&) {
711 createRedundancySensor(tachSensors, systemBus, objectServer);
712 };
713 auto match = std::make_unique<sdbusplus::bus::match_t>(
714 static_cast<sdbusplus::bus_t&>(*systemBus),
715 "type='signal',member='PropertiesChanged',path_namespace='" +
716 std::string(inventoryPath) + "',arg0namespace='" +
717 redundancyConfiguration + "'",
718 std::move(redundancyHandler));
719 matches.emplace_back(std::move(match));
720
721 setupManufacturingModeMatch(*systemBus);
722 io.run();
723 return 0;
724 }
725