blob: 890905863cfd4754b5ba75340c9ba2ddd2c3f4e4 [file] [log] [blame]
Alex Deymo42432912013-07-12 20:21:15 -07001// Copyright (c) 2013 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#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_HARDWARE_INTERFACE_H__
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_HARDWARE_INTERFACE_H__
7
8#include <string>
9
10namespace chromeos_update_engine {
11
12// The hardware interface allows access to the following parts of the system,
13// closely related to the hardware:
14// * crossystem exposed properties: firmware, hwid, etc.
15// * Physical disk: partition booted from and partition name conversions.
16// These stateless functions are tied together in this interface to facilitate
17// unit testing.
18class HardwareInterface {
19 public:
20 // Returns the currently booted device. "/dev/sda3", for example.
21 // This will not interpret LABEL= or UUID=. You'll need to use findfs
22 // or something with equivalent funcionality to interpret those.
23 virtual const std::string BootDevice() = 0;
24
J. Richard Barnette056b0ab2013-10-29 15:24:56 -070025 // Returns true if this is an official Chrome OS build, false otherwise.
26 virtual bool IsOfficialBuild() = 0;
27
28 // Returns true if the boot mode is normal or if it's unable to
29 // determine the boot mode. Returns false if the boot mode is
30 // developer.
31 virtual bool IsNormalBootMode() = 0;
J. Richard Barnette522d36f2013-10-28 17:22:12 -070032
33 // Returns the HWID or an empty string on error.
34 virtual std::string GetHardwareClass() = 0;
35
36 // Returns the firmware version or an empty string if the system is
37 // not running chrome os firmware.
38 virtual std::string GetFirmwareVersion() = 0;
39
40 // Returns the ec version or an empty string if the system is not
41 // running a custom chrome os ec.
42 virtual std::string GetECVersion() = 0;
Alex Deymo42432912013-07-12 20:21:15 -070043
44 virtual ~HardwareInterface() {}
45};
46
47} // namespace chromeos_update_engine
48
49#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_HARDWARE_INTERFACE_H__