Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: platform_switch.h

Issue 3530001: first cut: establishes base helper classes and main (Closed) Base URL: http://git.chromium.org/git/cros_boot_mode.git
Patch Set: truncation is bad, m'kay. . . Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « platform_reader.cc ('k') | platform_switch.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Provides a default implementation of a platform switch. On CrOS, switch
6 // state is represented in an integer exposed via a file in /sys. Each
7 // switch recieves one bit which is checked with a subclass-defined
8 // bitmask().
9 //
10 // A subclass only needs to set its name and bitmask to "just work".
11
12 #ifndef CROS_BOOT_MODE_PLATFORM_SWITCH_H_
13 #define CROS_BOOT_MODE_PLATFORM_SWITCH_H_
14
15 #include "platform_reader.h"
16
17 namespace cros_boot_mode {
18
19 class PlatformSwitch : public PlatformReader {
20 public:
21 PlatformSwitch();
22 virtual ~PlatformSwitch();
23
24 enum { kDisabled, kEnabled };
25 static const char *kPositionText[];
26
27 virtual const char *c_str() const;
28 virtual const char *default_platform_file_path() const {
29 return "/sys/devices/platform/chromeos_acpi/CHSW";
30 }
31 virtual size_t max_size() const {
32 return sizeof("65535"); // largest allowed switch value
33 }
34 virtual int Process(const char *file_contents, size_t length);
35
36 // To be overriden by the implementation
37 virtual unsigned int bitmask() const = 0;
38 virtual const char *name() const = 0;
39 };
40
41 } // namespace cros_boot_mode
42 #endif // CROS_BOOT_MODE_PLATFORM_SWITCH_H_
OLDNEW
« no previous file with comments | « platform_reader.cc ('k') | platform_switch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698