OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // ActiveMainFirmware implementation |
| 6 |
| 7 #include "active_main_firmware.h" |
| 8 |
| 9 #include <sys/types.h> |
| 10 |
| 11 #include "helpers.h" |
| 12 |
| 13 namespace cros_boot_mode { |
| 14 |
| 15 const char *ActiveMainFirmware::kActiveMainFirmwareText[] = { |
| 16 "recovery", |
| 17 "a", |
| 18 "b", |
| 19 }; |
| 20 |
| 21 const char *ActiveMainFirmware::c_str() const { |
| 22 return (value() >= 0 ? kActiveMainFirmwareText[value()] : "unsupported"); |
| 23 } |
| 24 |
| 25 const size_t ActiveMainFirmware::kActiveMainFirmwareCount = |
| 26 sizeof(kActiveMainFirmwareText) / sizeof(*kActiveMainFirmwareText); |
| 27 |
| 28 ActiveMainFirmware::ActiveMainFirmware() { } |
| 29 ActiveMainFirmware::~ActiveMainFirmware() { } |
| 30 |
| 31 int ActiveMainFirmware::Process(const char *contents, size_t length) { |
| 32 int volume = helpers::to_int(contents, length); |
| 33 if (volume >= 0 && |
| 34 volume < static_cast<int>(kActiveMainFirmwareCount)) |
| 35 return volume; |
| 36 return kUnsupported; |
| 37 } |
| 38 |
| 39 } // namespace cros_boot_mode |
OLD | NEW |