Chromium Code Reviews| Index: drm-tool.cc |
| diff --git a/drm-tool.cc b/drm-tool.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f065aeb7a7fea19b3ee1722d4a13c4fad9464423 |
| --- /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" |
| +#include "base/string_util.h" |
| +#include "power_manager/udev_listener.h" |
| + |
| +// drm-tool: A simple tool to monitor drm hotplug events with udev. |
| + |
| +class DrmCallBack : public power_manager::UdevCallBack { |
|
Daniel Erat
2011/04/13 23:33:26
nit: i think that i've typically seen this written
marcheu
2011/04/14 02:23:55
Done.
|
| + public: |
| + void CallBack(GIOChannel* source, GIOCondition condition) { |
| + (void) source; |
| + (void) condition; |
| + printf("Udev drm callback\n"); |
| + } |
| +}; |
| + |
| +int main(int argc, char* argv[]) { |
| + 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; |
| +} |
| + |