Index: drm-tool.cc |
diff --git a/drm-tool.cc b/drm-tool.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0bd4f462680a61fa05e0701d0b297ba786cbf77d |
--- /dev/null |
+++ b/drm-tool.cc |
@@ -0,0 +1,38 @@ |
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <gdk/gdk.h> |
+#include <gflags/gflags.h> |
+#include <glib.h> |
+#include <inttypes.h> |
+ |
+#include <cstdio> |
+ |
+#include "base/logging.h" |
+#include "base/scoped_ptr.h" |
tfarina
2011/04/14 02:36:05
I don't see any uses of scoped_ptr here.
marcheu
2011/04/14 02:52:10
Done.
|
+#include "base/string_util.h" |
tfarina
2011/04/14 02:36:05
Why do you need this include?
marcheu
2011/04/14 02:52:10
Removed.
|
+#include "power_manager/udev_listener.h" |
+ |
+// drm-tool: A simple tool to monitor drm hotplug events with udev. |
+ |
+class DrmCallback : public power_manager::UdevCallback { |
+ public: |
+ void Run(GIOChannel* source, GIOCondition condition) { |
+ (void) source; |
tfarina
2011/04/14 02:36:05
hum? If it's to please the compiler, maybe /* sour
marcheu
2011/04/14 02:52:10
Done.
|
+ (void) condition; |
+ printf("Udev drm callback\n"); |
tfarina
2011/04/14 02:36:05
Could you use some other macro from logging.h inst
marcheu
2011/04/14 02:52:10
Hmm, but other *tool.cc files use printf.
|
+ } |
+}; |
+ |
+int main(int argc, char* argv[]) { |
tfarina
2011/04/14 02:36:05
I'd change this to char** argv (just personal pref
marcheu
2011/04/14 02:52:10
All of chrome OS (including other tools) uses int
|
+ google::ParseCommandLineFlags(&argc, &argv, true); |
+ DrmCallback callback; |
+ power_manager::UdevListener drm_listener(&callback, "drm"); |
+ if (!drm_listener.Init()) |
+ LOG(WARNING) << "Cannot initialize drm listener"; |
+ GMainLoop* loop = g_main_loop_new(NULL, false); |
+ g_main_loop_run(loop); |
+ return 0; |
+} |
+ |
tfarina
2011/04/14 02:36:05
remove this blank line.
marcheu
2011/04/14 02:52:10
Done.
|