summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>2012-12-26 17:29:39 +0100
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>2012-12-26 17:29:39 +0100
commit6160434793e72f17715246b27e90a7e1733b706c (patch)
tree2d1d237d1ddd35bda746c19a7fdb2d7d8531ca84
parentf9b7d2a6eb831f2fccfe42d815ad29a5982753c4 (diff)
downloadvdr-plugin-inputdev-6160434793e72f17715246b27e90a7e1733b706c.tar.gz
vdr-plugin-inputdev-6160434793e72f17715246b27e90a7e1733b706c.tar.bz2
implemented dump operation
-rw-r--r--inputdev.c34
-rw-r--r--inputdev.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/inputdev.c b/inputdev.c
index 09a177b..407936f 100644
--- a/inputdev.c
+++ b/inputdev.c
@@ -75,6 +75,8 @@ public:
char const *get_description(void) const { return description_; }
char const *get_dev_path(void) const { return dev_path_; }
+ void dump(void) const;
+
static uint64_t generate_code(uint16_t type, uint16_t code,
uint32_t value);
static void install_keymap(char const *remote);
@@ -92,6 +94,13 @@ cInputDevice::~cInputDevice()
controller_.close(fd_);
}
+void cInputDevice::dump(void) const
+{
+ dsyslog("%s: %lx %s (%s), fd=%d\n", controller_.plugin_name(),
+ static_cast<unsigned long>(dev_t_),
+ get_dev_path(), get_description(), get_fd());
+}
+
uint64_t cInputDevice::generate_code(uint16_t type, uint16_t code,
uint32_t value)
{
@@ -651,6 +660,24 @@ bool cInputDeviceController::add_device(char const *dev_name)
return res;
}
+void cInputDeviceController::dump_active_devices(void)
+{
+ cMutexLock lock(&dev_mutex_);
+
+ dsyslog("%s: active devices:\n", plugin_name());
+ for (cInputDevice *i = devices_.First(); i; i = devices_.Next(i))
+ i->dump();
+}
+
+void cInputDeviceController::dump_gc_devices(void)
+{
+ cMutexLock lock(&dev_mutex_);
+
+ dsyslog("%s: gc devices:\n", plugin_name());
+ for (cInputDevice *i = gc_devices_.First(); i; i = gc_devices_.Next(i))
+ i->dump();
+}
+
void cInputDeviceController::handle_uevent(void)
{
char buf[128];
@@ -687,6 +714,13 @@ void cInputDeviceController::handle_uevent(void)
add_device(dev);
} else if (strcasecmp(cmd, "remove") == 0) {
remove_device(dev);
+ } else if (strcasecmp(cmd, "dump") == 0) {
+ bool is_all = strcasecmp(dev, "all") == 0;
+ if (is_all || strcasecmp(dev, "active") == 0)
+ dump_active_devices();
+
+ if (is_all || strcasecmp(dev, "gc") == 0)
+ dump_gc_devices();
} else {
esyslog("%s: invalid command '%s' for '%s'\n", plugin_name(),
cmd, dev);
diff --git a/inputdev.h b/inputdev.h
index 847ff5a..3957cef 100644
--- a/inputdev.h
+++ b/inputdev.h
@@ -42,6 +42,9 @@ private:
void handle_uevent(void);
bool coldplug_devices(char const *);
+ void dump_active_devices();
+ void dump_gc_devices();
+
protected:
virtual void Action(void);