From 88afcf459ef8acdd6bf490108c3c03b4a733c885 Mon Sep 17 00:00:00 2001
From: Ingo Ruhnke <grumbel@gmx.de>
Date: Thu, 27 Jan 2011 00:05:46 +0100
Subject: [PATCH] Cleaned up output, replaced std::cout with log_*

---
 src/arg_parser.cpp                  |  1 +
 src/arg_parser.hpp                  |  5 +--
 src/axis_event.cpp                  | 11 +++---
 src/button_event.cpp                |  4 +--
 src/button_filter.cpp               |  2 +-
 src/chatpad.cpp                     | 41 ++++++++--------------
 src/command_line_options.cpp        | 37 ++++++++++++++------
 src/evdev_controller.cpp            | 22 ++++++------
 src/evdev_controller.hpp            |  2 +-
 src/firestorm_dual_controller.cpp   | 17 ++++-----
 src/firestorm_dual_controller.hpp   |  6 ++--
 src/force_feedback_handler.cpp      | 44 ++++++++++++++----------
 src/headset.cpp                     | 27 +++++----------
 src/helper.cpp                      |  1 -
 src/log.cpp                         | 11 +++++-
 src/log.hpp                         |  3 +-
 src/options.cpp                     | 44 +++++++++++++++++++++++-
 src/options.hpp                     | 12 +++++--
 src/playstation3_usb_controller.cpp | 34 +++++++++---------
 src/playstation3_usb_controller.hpp |  2 +-
 src/saitek_p2500_controller.cpp     |  2 +-
 src/saitek_p2500_controller.hpp     |  2 +-
 src/uinput_config.cpp               | 12 +------
 src/word_wrap.cpp                   |  1 +
 src/word_wrap.hpp                   |  2 +-
 src/xbox360_controller.cpp          | 15 ++++----
 src/xbox360_controller.hpp          |  2 +-
 src/xbox360_wireless_controller.cpp |  2 +-
 src/xbox360_wireless_controller.hpp |  2 +-
 src/xbox_controller.cpp             |  2 +-
 src/xbox_controller.hpp             |  2 +-
 src/xbox_generic_controller.hpp     |  2 +-
 src/xboxdrv.cpp                     | 15 ++++----
 src/xboxdrv_daemon.cpp              | 53 ++++++++++++++---------------
 src/xboxdrv_thread.cpp              |  2 +-
 src/xboxmsg.cpp                     |  6 ++--
 36 files changed, 247 insertions(+), 201 deletions(-)

diff --git a/src/arg_parser.cpp b/src/arg_parser.cpp
index 5e6de7a..39c25e4 100644
--- a/src/arg_parser.cpp
+++ b/src/arg_parser.cpp
@@ -19,6 +19,7 @@
 #include "arg_parser.hpp"
 
 #include <stdio.h>
+#include <ostream>
 
 #include "helper.hpp"
 #include "pretty_printer.hpp"
diff --git a/src/arg_parser.hpp b/src/arg_parser.hpp
index f033cab..1624a38 100644
--- a/src/arg_parser.hpp
+++ b/src/arg_parser.hpp
@@ -19,8 +19,9 @@
 #ifndef HEADER_ARG_PARSER_HPP
 #define HEADER_ARG_PARSER_HPP
 
-#include <iostream>
+#include <iosfwd>
 #include <vector>
+#include <string>
 
 class ArgParser
 {
@@ -95,7 +96,7 @@ public:
                         bool visible = true);
 
   ParsedOptions parse_args(int argc, char** argv);
-  void print_help(std::ostream& out = std::cout) const;
+  void print_help(std::ostream& out) const;
   
   bool next();
   int  get_key();
diff --git a/src/axis_event.cpp b/src/axis_event.cpp
index 960cf6c..e81320f 100644
--- a/src/axis_event.cpp
+++ b/src/axis_event.cpp
@@ -19,8 +19,9 @@
 #include "axis_event.hpp"
 
 #include <boost/tokenizer.hpp>
-#include <iostream>
+#include <string>
 
+#include "log.hpp"
 #include "uinput.hpp"
 
 AxisEventPtr
@@ -83,17 +84,17 @@ AxisEvent::from_string(const std::string& str)
         ev.reset(new AxisEvent(KeyAxisEventHandler::from_string(str)));
         break;
 
-      case -1:
-        std::cout << "--------- invalid --------------" << std::endl;
+      case -1: // void/none
         ev = invalid();
         break;
 
       default:
-        assert(!"AxisEvent::from_string(): should never be reached");
+        assert(!"should never be reached");
     }
   }
 
-  //std::cout << "AxisEvent::from_string():\n  in:  " << str << "\n  out: " << ev->str() << std::endl;
+  log_debug("in:  " << str);
+  log_debug("out: " << ev->str());
 
   return ev;
 }
diff --git a/src/button_event.cpp b/src/button_event.cpp
index b320e5d..6e35e21 100644
--- a/src/button_event.cpp
+++ b/src/button_event.cpp
@@ -20,9 +20,9 @@
 
 #include <boost/tokenizer.hpp>
 #include <errno.h>
-#include <iostream>
 #include <fstream>
 
+#include "log.hpp"
 #include "uinput.hpp"
 
 ButtonEventPtr
@@ -519,7 +519,7 @@ ExecButtonEventHandler::send(UInput& uinput, bool value)
 
       if (execvp(m_args[0].c_str(), argv) == -1)
       {
-        std::cout << "error: ExecButtonEventHandler::send(): " << strerror(errno) << std::endl;
+        log_error("exec failed: " << strerror(errno));
         _exit(EXIT_FAILURE);
       }
     }
diff --git a/src/button_filter.cpp b/src/button_filter.cpp
index 7a0383e..dba34f1 100644
--- a/src/button_filter.cpp
+++ b/src/button_filter.cpp
@@ -18,9 +18,9 @@
 
 #include "button_filter.hpp"
 
-#include <iostream>
 #include <boost/tokenizer.hpp>
 #include <boost/lexical_cast.hpp>
+#include <iostream>
 
 ButtonFilterPtr
 ButtonFilter::from_string(const std::string& str)
diff --git a/src/chatpad.cpp b/src/chatpad.cpp
index 6bc2c74..6acd8d5 100644
--- a/src/chatpad.cpp
+++ b/src/chatpad.cpp
@@ -19,12 +19,12 @@
 #include "chatpad.hpp"
 
 #include <boost/format.hpp>
-#include <iostream>
 
+#include "helper.hpp"
 #include "linux_uinput.hpp"
 #include "log.hpp"
-#include "usb_helper.hpp"
 #include "raise_exception.hpp"
+#include "usb_helper.hpp"
 
 Chatpad::Chatpad(libusb_device_handle* handle, uint16_t bcdDevice,
                  bool no_init, bool debug) :
@@ -211,24 +211,11 @@ Chatpad::read_thread()
       {
         raise_exception(std::runtime_error, "libusb_interrupt_transfer() failed: " << usb_strerror(ret));
       }
-
-      if (len < 0)
-      {
-        std::cout << "Error in read_thread" << std::endl;
-        return;
-      }
       else
       {
         if (g_logger.get_log_level() > Logger::kDebug)
         {
-          std::ostringstream str;
-          str << "read: " << len << "/5: data: ";
-          for(int i = 0; i < len; ++i)
-          {
-            str << boost::format("0x%02x ") % int(data[i]);
-          }
-
-          log_debug(str);
+          log_debug("read: " << len << "/5: data: " << raw2str(data, len));
         }
         
         if (data[0] == 0x00)
@@ -304,11 +291,11 @@ Chatpad::keep_alive_thread()
     while(!m_quit_thread)
     {
       send_ctrl(0x41, 0x0, 0x1f, 0x02, NULL, 0);
-      if (m_debug) std::cout << "[chatpad] 0x1f" << std::endl;
+      log_debug("0x1f");
       sleep(1);
        
       send_ctrl(0x41, 0x0, 0x1e, 0x02, NULL, 0);
-      if (m_debug) std::cout << "[chatpad] 0x1e" << std::endl;
+      log_debug("0x1e");
       sleep(1);
     }
   }
@@ -328,17 +315,17 @@ Chatpad::send_init()
 
     // these three will fail, but are necessary to have the later ones succeed
     ret = libusb_control_transfer(m_handle, 0x40, 0xa9, 0xa30c, 0x4423, NULL, 0, 0);
-    if (m_debug) std::cout << "[chatpad] ret: " << usb_strerror(ret) << std::endl;
+    log_debug("ret: " << usb_strerror(ret));
 
     ret = libusb_control_transfer(m_handle, 0x40, 0xa9, 0x2344, 0x7f03, NULL, 0, 0);
-    if (m_debug) std::cout << "[chatpad] ret: " << usb_strerror(ret) << std::endl;
+    log_debug("ret: " << usb_strerror(ret));
 
     ret = libusb_control_transfer(m_handle, 0x40, 0xa9, 0x5839, 0x6832, NULL, 0, 0);
-    if (m_debug) std::cout << "[chatpad] ret: " << usb_strerror(ret) << std::endl;
+    log_debug("ret: " << usb_strerror(ret));
 
     // make chatpad ready
     ret = libusb_control_transfer(m_handle, 0xc0, 0xa1, 0x0000, 0xe416, buf, 2, 0); // (read 2 bytes, will return a mode)
-    if (m_debug) std::cout << "[chatpad] ret: " << usb_strerror(ret) << " " << static_cast<int>(buf[0]) << " " << static_cast<int>(buf[1])<< std::endl;
+    log_debug("ret: " << usb_strerror(ret) << " " << static_cast<int>(buf[0]) << " " << static_cast<int>(buf[1]));
 
     if (buf[1] & 2)
     {
@@ -363,10 +350,10 @@ Chatpad::send_init()
       }
 
       ret = libusb_control_transfer(m_handle, 0x40, 0xa1, 0x0000, 0xe416, buf, 2, 0); // (send 2 bytes, data must be 0x09 0x00)
-      if (m_debug) std::cout << "[chatpad] ret: " << usb_strerror(ret) << std::endl;
+      log_debug("ret: " << usb_strerror(ret));
  
       ret = libusb_control_transfer(m_handle, 0xc0, 0xa1, 0x0000, 0xe416, buf, 2, 0); // (read 2 bytes, this should return the NEW mode)
-      if (m_debug) std::cout << "[chatpad] ret: " << usb_strerror(ret) << " " << static_cast<int>(buf[0]) << " " << static_cast<int>(buf[1]) << std::endl;
+      log_debug("ret: " << usb_strerror(ret) << " " << static_cast<int>(buf[0]) << " " << static_cast<int>(buf[1]));
 
       /* FIXME: not proper way to check if the chatpad is alive
          if (!(buf[1] & 2)) // FIXME: check for {9,0} for bcdDevice==0x114
@@ -380,15 +367,15 @@ Chatpad::send_init()
 
   // only when we get "01 02" back is the chatpad ready
   libusb_control_transfer(m_handle, 0x41, 0x0, 0x1f, 0x02, 0, NULL, 0);
-  if (m_debug) std::cout << "[chatpad] 0x1f" << std::endl;
+  log_debug("0x1f");
   sleep(1);
        
   libusb_control_transfer(m_handle, 0x41, 0x0, 0x1e, 0x02, 0, NULL, 0);
-  if (m_debug) std::cout << "[chatpad] 0x1e" << std::endl;
+  log_debug("0x1e");
 
   // can't send 1b before 1f before one rotation
   libusb_control_transfer(m_handle, 0x41, 0x0, 0x1b, 0x02, 0, NULL, 0);
-  if (m_debug) std::cout << "[chatpad] 0x1b" << std::endl;
+  log_debug("0x1b");
 }
 
 /* EOF */
diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp
index d79f4f7..28fd368 100644
--- a/src/command_line_options.cpp
+++ b/src/command_line_options.cpp
@@ -19,12 +19,14 @@
 #include "command_line_options.hpp"
 
 #include <fstream>
+#include <iostream>
 #include <boost/bind.hpp>
 #include <boost/tokenizer.hpp>
 
 #include "helper.hpp"
 #include "ini_parser.hpp"
 #include "ini_schema_builder.hpp"
+#include "log.hpp"
 #include "options.hpp"
 
 #define RAISE_EXCEPTION(x) do {                         \
@@ -39,6 +41,7 @@ enum {
   OPTION_HELP,
   OPTION_VERBOSE,
   OPTION_VERSION,
+  OPTION_DEBUG,
   OPTION_QUIET,
   OPTION_SILENT,
   OPTION_DAEMON,
@@ -140,13 +143,13 @@ CommandLineParser::init_argp()
     .add_option(OPTION_HELP,         'h', "help",         "", "display this help and exit")
     .add_option(OPTION_VERSION,      'V', "version",      "", "print the version number and exit")
     .add_option(OPTION_VERBOSE,      'v', "verbose",      "", "print verbose messages")
-    .add_option(OPTION_HELP_LED,      0,  "help-led",     "", "list possible values for the led")
-    .add_option(OPTION_HELP_DEVICES,  0,  "help-devices", "", "list supported devices")
+    .add_option(OPTION_DEBUG,         0,  "debug",   "",  "be even more verbose then --verbose")
     .add_option(OPTION_SILENT,       's', "silent",  "",  "do not display events on console")
     .add_option(OPTION_QUIET,         0,  "quiet",   "",  "do not display startup text")
     .add_option(OPTION_LIST_CONTROLLER, 'L', "list-controller", "", "list available controllers")
-    .add_option(OPTION_LIST_SUPPORTED_DEVICES, 0, "list-supported-devices", "", "list supported devices (used by xboxdrv-daemon.py)")
-    .add_option(OPTION_LIST_SUPPORTED_DEVICES_XPAD, 0, "list-supported-devices-xpad", "", "list supported devices in xpad.c style")
+    .add_newline()
+
+    .add_text("Configuration Options: ")
     .add_option(OPTION_CONFIG,       'c', "config",      "FILE", "read configuration from FILE")
     .add_option(OPTION_ALT_CONFIG,    0, "alt-config",   "FILE", "read alternative configuration from FILE ")
     .add_option(OPTION_CONFIG_OPTION,'o', "option",      "NAME=VALUE", "Set the given configuration option") 
@@ -154,6 +157,10 @@ CommandLineParser::init_argp()
     .add_newline()
 
     .add_text("List Options: ")
+    .add_option(OPTION_LIST_SUPPORTED_DEVICES, 0, "list-supported-devices", "", "list supported devices (used by xboxdrv-daemon.py)")
+    .add_option(OPTION_LIST_SUPPORTED_DEVICES_XPAD, 0, "list-supported-devices-xpad", "", "list supported devices in xpad.c style")
+    .add_option(OPTION_HELP_LED,      0,  "help-led",     "", "list possible values for the led")
+    .add_option(OPTION_HELP_DEVICES,  0,  "help-devices", "", "list supported devices")
     .add_option(OPTION_LIST_ABS,       0, "list-abs",       "", "List all possible EV_ABS names")
     .add_option(OPTION_LIST_REL,       0, "list-rel",       "", "List all possible EV_REL names")
     .add_option(OPTION_LIST_KEY,       0, "list-key",       "", "List all possible EV_KEY names")
@@ -288,7 +295,7 @@ CommandLineParser::init_ini(Options* opts)
   m_ini.clear();
 
   m_ini.section("xboxdrv")
-    ("verbose", &opts->verbose)
+    ("verbose", boost::bind(&Options::set_verbose, boost::ref(opts)), boost::function<void ()>())
     ("silent", &opts->silent)
     ("quiet",  &opts->quiet)
     ("rumble", &opts->rumble)
@@ -343,8 +350,10 @@ CommandLineParser::init_ini(Options* opts)
     ;
 
   m_ini.section("xboxdrv-daemon")
-    ("detach",        &opts->detach)
-    ("pid-file",        &opts->pid_file)
+    ("detach",        
+     boost::bind(&Options::set_daemon_detach, boost::ref(opts), true),
+     boost::bind(&Options::set_daemon_detach, boost::ref(opts), false))
+    ("pid-file",      &opts->pid_file)
     ("on-connect",    &opts->on_connect)
     ("on-disconnect", &opts->on_disconnect)
     ;
@@ -389,19 +398,23 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
         break;
           
       case OPTION_VERBOSE:
-        opts.verbose = true;
+        opts.set_verbose();
         break;
 
       case OPTION_QUIET:
-        opts.quiet   = true;
+        opts.quiet = true;
         break;
 
       case OPTION_SILENT:
         opts.silent = true;
         break;
 
+      case OPTION_DEBUG:
+        opts.set_debug();
+        break;
+
       case OPTION_DAEMON:
-        opts.mode = Options::RUN_DAEMON;
+        opts.set_daemon();
         break;
 
       case OPTION_DAEMON_MATCH:
@@ -736,7 +749,7 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
         break;
 
       case OPTION_DAEMON_DETACH:
-        opts.detach = true;
+        opts.set_daemon_detach(true);
         break;
 
       case OPTION_DAEMON_PID_FILE:
@@ -845,6 +858,8 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
         break;
     }
   }
+
+  options->finish();
 }
 
 void
diff --git a/src/evdev_controller.cpp b/src/evdev_controller.cpp
index 04c7680..fe0c941 100644
--- a/src/evdev_controller.cpp
+++ b/src/evdev_controller.cpp
@@ -20,11 +20,11 @@
 
 #include <boost/format.hpp>
 #include <string.h>
-#include <iostream>
 #include <fcntl.h>
 #include <errno.h>
 
 #include "evdev_helper.hpp"
+#include "log.hpp"
 
 #define BITS_PER_LONG (sizeof(long) * 8)
 #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
@@ -62,7 +62,7 @@ EvdevController::EvdevController(const std::string& filename,
     char c_name[1024] = "unknown";
     ioctl(m_fd, EVIOCGNAME(sizeof(c_name)), c_name);
     m_name = c_name;
-    std::cout << "Name: " << m_name << std::endl;
+    log_debug("name: " << m_name);
   }
 
   if (m_grab)
@@ -99,7 +99,7 @@ EvdevController::EvdevController(const std::string& filename,
         struct input_absinfo absinfo;
         ioctl(m_fd, EVIOCGABS(i), &absinfo);
         
-        std::cout << boost::format("abs: %-20s min: %6d max: %6d") % abs2str(i) % absinfo.minimum % absinfo.maximum << std::endl;
+        log_debug(boost::format("abs: %-20s min: %6d max: %6d") % abs2str(i) % absinfo.minimum % absinfo.maximum);
         m_absinfo[i] = absinfo;
         //abs2idx[i] = abs_port_out.size();
         //abs_port_out.push_back(new AbsPortOut("EvdevDriver:abs", absinfo.minimum, absinfo.maximum));
@@ -110,7 +110,7 @@ EvdevController::EvdevController(const std::string& filename,
     {
       if (test_bit(i, rel_bit))
       {
-        std::cout << "rel: " << rel2str(i) << std::endl;
+        log_debug("rel: " << rel2str(i));
         //rel2idx[i] = rel_port_out.size();
         //rel_port_out.push_back(new RelPortOut("EvdevDriver:rel"));
       }
@@ -120,7 +120,7 @@ EvdevController::EvdevController(const std::string& filename,
     {
       if (test_bit(i, key_bit))
       {
-        std::cout << "key: " << key2str(i) << std::endl;
+        log_debug("key: " << key2str(i));
         //key2idx[i] = btn_port_out.size();
         //btn_port_out.push_back(new BtnPortOut("EvdevDriver:btn"));
       }
@@ -148,19 +148,19 @@ EvdevController::apply(XboxGenericMsg& msg, const struct input_event& ev)
     switch(ev.type)
     {
       case EV_KEY:
-        std::cout << "[evdev] EV_KEY " << key2str(ev.code) << " " << ev.value << std::endl;
+        log_debug("EV_KEY " << key2str(ev.code) << " " << ev.value);
         break;
 
       case EV_REL:
-        std::cout << "[evdev] EV_REL " << rel2str(ev.code) << " " << ev.value << std::endl;
+        log_debug("EV_REL " << rel2str(ev.code) << " " << ev.value);
         break;
 
       case EV_ABS:
-        std::cout << "[evdev] EV_ABS " << abs2str(ev.code) << " " << ev.value << std::endl;
+        log_debug("EV_ABS " << abs2str(ev.code) << " " << ev.value);
         break;
 
       case EV_SYN:
-        std::cout << "------------------- sync -------------------" << std::endl;
+        log_debug("------------------- sync -------------------");
         break;
 
       case EV_MSC:
@@ -169,7 +169,7 @@ EvdevController::apply(XboxGenericMsg& msg, const struct input_event& ev)
         break;
 
       default:
-        std::cout << "[evdev] unknown: " << ev.type << " " << ev.code << " " << ev.value << std::endl;
+        log_debug("unknown: " << ev.type << " " << ev.code << " " << ev.value);
         break;
     }
   }
@@ -221,7 +221,7 @@ EvdevController::read_data_to_buffer()
 }
 
 bool
-EvdevController::read(XboxGenericMsg& msg, bool verbose, int timeout)
+EvdevController::read(XboxGenericMsg& msg, int timeout)
 {
   read_data_to_buffer();
 
diff --git a/src/evdev_controller.hpp b/src/evdev_controller.hpp
index b3d34c2..fd87194 100644
--- a/src/evdev_controller.hpp
+++ b/src/evdev_controller.hpp
@@ -58,7 +58,7 @@ public:
   void set_led(uint8_t status);
 
   /** @param timeout   timeout in msec, 0 means forever */
-  bool read(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read(XboxGenericMsg& msg, int timeout);
 
 private:
   bool apply(XboxGenericMsg& msg, const struct input_event& ev);
diff --git a/src/firestorm_dual_controller.cpp b/src/firestorm_dual_controller.cpp
index 8b8021b..5035aed 100644
--- a/src/firestorm_dual_controller.cpp
+++ b/src/firestorm_dual_controller.cpp
@@ -18,11 +18,11 @@
 
 #include "firestorm_dual_controller.hpp"
 
-#include <iostream>
 #include <sstream>
 #include <boost/format.hpp>
 
 #include "helper.hpp"
+#include "log.hpp"
 #include "usb_helper.hpp"
 
 // 044f:b312
@@ -141,16 +141,16 @@ FirestormDualController::set_led(uint8_t status)
 }
 
 bool
-FirestormDualController::read(XboxGenericMsg& msg, bool verbose, int timeout)
+FirestormDualController::read(XboxGenericMsg& msg, int timeout)
 {
   if (is_vsb)
-    return read_vsb(msg, verbose, timeout);
+    return read_vsb(msg, timeout);
   else
-    return read_default(msg, verbose, timeout);
+    return read_default(msg, timeout);
 }
 
 bool
-FirestormDualController::read_vsb(XboxGenericMsg& msg, bool verbose, int timeout)
+FirestormDualController::read_vsb(XboxGenericMsg& msg, int timeout)
 {
   Firestorm_vsb_Msg data;
   int len = 0;
@@ -171,12 +171,13 @@ FirestormDualController::read_vsb(XboxGenericMsg& msg, bool verbose, int timeout
   {
     if (0)
     { // debug output
+      std::ostringstream str;
       for(size_t i = 0; i < sizeof(data); ++i)
       {
         uint8_t v = reinterpret_cast<char*>(&data)[i];
-        std::cout << boost::format("0x%02x ") % static_cast<int>(v);
+        str << boost::format("0x%02x ") % static_cast<int>(v);
       }
-      std::cout << std::endl;
+      log_debug(str.str());
     }
 
     memset(&msg, 0, sizeof(msg));
@@ -233,7 +234,7 @@ FirestormDualController::read_vsb(XboxGenericMsg& msg, bool verbose, int timeout
 }
 
 bool
-FirestormDualController::read_default(XboxGenericMsg& msg, bool verbose, int timeout)
+FirestormDualController::read_default(XboxGenericMsg& msg, int timeout)
 {
   FirestormMsg data;
   int len = 0;
diff --git a/src/firestorm_dual_controller.hpp b/src/firestorm_dual_controller.hpp
index 373bcfa..f7439b3 100644
--- a/src/firestorm_dual_controller.hpp
+++ b/src/firestorm_dual_controller.hpp
@@ -41,11 +41,11 @@ public:
   void set_led(uint8_t status);
 
   /** @param timeout   timeout in msec, 0 means forever */
-  bool read(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read(XboxGenericMsg& msg, int timeout);
 
 private:
-  bool read_default(XboxGenericMsg& msg, bool verbose, int timeout);
-  bool read_vsb(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read_default(XboxGenericMsg& msg, int timeout);
+  bool read_vsb(XboxGenericMsg& msg, int timeout);
 
 private:
   FirestormDualController(const FirestormDualController&);
diff --git a/src/force_feedback_handler.cpp b/src/force_feedback_handler.cpp
index cf50f91..91a1b6f 100644
--- a/src/force_feedback_handler.cpp
+++ b/src/force_feedback_handler.cpp
@@ -18,7 +18,7 @@
 
 #include "force_feedback_handler.hpp"
 
-#include <iostream>
+#include "log.hpp"
 #include "options.hpp"
 
 std::ostream& operator<<(std::ostream& out, const struct ff_envelope& envelope)
@@ -44,7 +44,7 @@ std::ostream& operator<<(std::ostream& out, const struct ff_trigger& trigger)
 
 std::ostream& operator<<(std::ostream& out, const struct ff_effect& effect)
 {
-  std::cout << "Effect(";
+  out << "Effect(";
   switch (effect.type)
   {
     case FF_CONSTANT:
@@ -197,7 +197,7 @@ ForceFeedbackEffect::ForceFeedbackEffect(const struct ff_effect& effect) :
       // case FF_FRICTION:
       // case FF_DAMPER
       // case FF_INERTIA:
-      std::cout << "Unsupported effect: " << effect << std::endl;
+      log_info("unsupported effect: " << effect);
       start_weak_magnitude   = 0;
       start_strong_magnitude = 0;
       end_weak_magnitude     = 0;
@@ -293,12 +293,11 @@ ForceFeedbackHandler::get_max_effects()
 void
 ForceFeedbackHandler::upload(const struct ff_effect& effect)
 {
-  if (g_options->verbose)
-    std::cout << "FF_UPLOAD("
-              << "effect_id:" << effect.id
-              << ", effect_type:" << effect.type
-              << ",\n          "  << effect 
-              << ")" << std::endl;
+  log_debug("FF_UPLOAD("
+            << "effect_id:" << effect.id
+            << ", effect_type:" << effect.type
+            << ",\n          "  << effect 
+            << ")");
 
   std::map<int, ForceFeedbackEffect>::iterator i = effects.find(effect.id);
   if (i == effects.end())
@@ -324,40 +323,49 @@ ForceFeedbackHandler::upload(const struct ff_effect& effect)
 void
 ForceFeedbackHandler::erase(int id)
 {
-  if (g_options->verbose)
-    std::cout << "FF_ERASE(effect_id:" << id << ")" << std::endl;
+  log_debug("FF_ERASE(effect_id:" << id << ")");
 
   std::map<int, ForceFeedbackEffect>::iterator i = effects.find(id);
   if (i != effects.end())
+  {
     effects.erase(i);
+  }
   else
-    std::cout << "Error: ForceFeedbackHandler::erase: Unknown id " << id << std::endl;
+  {
+    log_warn("unknown id " << id);
+  }
 }
 
 void
 ForceFeedbackHandler::play(int id)
 {
-  if (g_options->verbose)
-    std::cout << "FFPlay(effect_id:" << id << ")" << std::endl;
+  log_debug("FFPlay(effect_id:" << id << ")");
 
   std::map<int, ForceFeedbackEffect>::iterator i = effects.find(id);
   if (i != effects.end())
+  {
     i->second.play();
+  }
   else
-    std::cout << "Error: ForceFeedbackHandler::play: Unknown id " << id << std::endl;
+  {
+    log_warn("unknown id " << id);
+  }
 }
 
 void
 ForceFeedbackHandler::stop(int id)
 {
-  if (g_options->verbose)
-    std::cout << "FFStop(effect_id:" << id << ")" << std::endl;
+  log_debug("FFStop(effect_id:" << id << ")");
 
   std::map<int, ForceFeedbackEffect>::iterator i = effects.find(id);
   if (i != effects.end())
+  {
     i->second.stop();
+  }
   else
-    std::cout << "Error: ForceFeedbackHandler::play: Unknown id " << id << std::endl;
+  {
+    log_warn("unknown id " << id);
+  }
 }
 
 void
diff --git a/src/headset.cpp b/src/headset.cpp
index 9049f8d..18eaaa7 100644
--- a/src/headset.cpp
+++ b/src/headset.cpp
@@ -20,8 +20,9 @@
 
 #include <boost/format.hpp>
 #include <fstream>
-#include <iostream>
 
+#include "helper.hpp"
+#include "raise_exception.hpp"
 #include "usb_helper.hpp"
 
 Headset::Headset(libusb_device_handle* handle, 
@@ -84,7 +85,7 @@ Headset::write_thread(const std::string& filename)
     throw std::runtime_error(out.str());    
   }
 
-  std::cout << "[headset] starting playback: " << filename << std::endl;
+  log_info("starting playback: " << filename);
 
   uint8_t data[32];
   while(in)
@@ -103,14 +104,12 @@ Headset::write_thread(const std::string& filename)
                                                 &transferred, 0);
       if (ret != LIBUSB_SUCCESS)
       {
-        std::ostringstream out;
-        out << "[headset] " << usb_strerror(ret);
-        throw std::runtime_error(out.str());
+        raise_exception(std::runtime_error, "libusb_interrupt_transfer failed: " << usb_strerror(ret));
       }
     }
   }
 
-  std::cout << "[headset] finished playback: " << filename << std::endl;
+  log_info("finished playback: " << filename);
 }
 
 void
@@ -124,9 +123,7 @@ Headset::read_thread(const std::string& filename, bool debug)
   
     if (!*out)
     {
-      std::ostringstream outstr;
-      outstr << "[headset] " << filename << ": " << strerror(errno);
-      throw std::runtime_error(outstr.str());
+      raise_exception(std::runtime_error, filename << ": " << strerror(errno));
     }
   }
 
@@ -147,7 +144,7 @@ Headset::read_thread(const std::string& filename, bool debug)
     {
       if (len == 0)
       {
-        std::cout << "[headset] -- empty read --" << std::endl;
+        log_debug("-- empty read --");
       }
       else
       {
@@ -156,15 +153,7 @@ Headset::read_thread(const std::string& filename, bool debug)
           out->write(reinterpret_cast<char*>(data), sizeof(data));
         }
 
-        if (debug)
-        {
-          std::cout << "[headset] ";
-          for(int i = 0; i < len; ++i)
-          {
-            std::cout << boost::format("0x%02x ") % int(data[i]);
-          }
-          std::cout << std::endl;
-        }
+        log_debug(raw2str(data, len));
       }
     }
   }
diff --git a/src/helper.cpp b/src/helper.cpp
index d43d103..2d75945 100644
--- a/src/helper.cpp
+++ b/src/helper.cpp
@@ -18,7 +18,6 @@
 
 #include "helper.hpp"
 
-#include <iostream>
 #include <boost/format.hpp>
 #include <boost/tokenizer.hpp>
 #include <boost/lexical_cast.hpp>
diff --git a/src/log.cpp b/src/log.cpp
index cf036fe..efa290c 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -46,7 +46,16 @@ Logger::Logger() :
 {}
 
 void
-Logger::set_level(LogLevel level)
+Logger::incr_log_level(LogLevel level)
+{
+  if (get_log_level() < level)
+  {
+    set_log_level(level);    
+  }
+}
+
+void
+Logger::set_log_level(LogLevel level)
 {
   m_log_level = level;
 }
diff --git a/src/log.hpp b/src/log.hpp
index 99679ad..d9f9b30 100644
--- a/src/log.hpp
+++ b/src/log.hpp
@@ -49,7 +49,8 @@ private:
 
 public:
   Logger();
-  void set_level(LogLevel level);
+  void incr_log_level(LogLevel level);
+  void set_log_level(LogLevel level);
   LogLevel get_log_level() const;
   void append(LogLevel level, const std::string& str);
   void append_unchecked(LogLevel level, const std::string& str);
diff --git a/src/options.cpp b/src/options.cpp
index b17cc41..a68b4a1 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -28,7 +28,6 @@ Options* g_options;
 
 Options::Options() :
   mode(RUN_DEFAULT),
-  verbose(false),
   silent (false),
   quiet  (false),
   rumble (false),
@@ -148,6 +147,18 @@ Options::next_config()
   controller_slots[controller_slot].get_options(config_slot);
 }
 
+void
+Options::set_verbose()
+{
+  g_logger.incr_log_level(Logger::kInfo);
+}
+
+void
+Options::set_debug()
+{
+  g_logger.incr_log_level(Logger::kDebug);
+}
+
 void
 Options::set_device_name(const std::string& name)
 {
@@ -200,6 +211,31 @@ Options::set_mimic_xpad()
   get_controller_options().uinput.mimic_xpad();
 }
 
+void
+Options::set_daemon()
+{
+  mode = RUN_DAEMON;
+  silent = true;
+}
+
+void
+Options::set_daemon_detach(bool value)
+{
+  detach = value;
+  if (detach)
+  {
+    silent = true;
+    quiet  = true;
+  }
+}
+
+void
+Options::set_quiet()
+{
+  quiet  = true;
+  silent = true;
+}
+
 void
 Options::add_match(const std::string& lhs, const std::string& rhs)
 {
@@ -263,4 +299,10 @@ Options::set_match_group(const std::string& str)
   assert(!"not implemented");
 }
 
+void
+Options::finish()
+{
+  // FIXME: add some checks for conflicting options here
+}
+
 /* EOF */
diff --git a/src/options.hpp b/src/options.hpp
index 12e1bba..946c68a 100644
--- a/src/options.hpp
+++ b/src/options.hpp
@@ -55,7 +55,6 @@ public:
   };
 
   // General program options
-  bool verbose;
   bool silent;
   bool quiet;
   bool rumble;
@@ -101,7 +100,7 @@ public:
   std::string headset_play;
 
   // daemon options
-  bool detach;
+  bool detach; 
   std::string pid_file;
   std::string on_connect;
   std::string on_disconnect;
@@ -130,6 +129,10 @@ public:
   void next_controller();
   void next_config();
 
+  void set_verbose();
+  void set_debug();
+  void set_quiet();
+
   void set_device_name(const std::string& name);
   void set_mouse();
   void set_guitar();
@@ -140,9 +143,14 @@ public:
   void set_force_feedback(const std::string& value);
   void set_mimic_xpad();
 
+  void set_daemon();
+  void set_daemon_detach(bool value);
+  
   void add_match(const std::string& lhs, const std::string& rhs);
   void set_match(const std::string& str);
   void set_match_group(const std::string& str);
+
+  void finish();
 };
 
 extern Options* g_options;
diff --git a/src/playstation3_usb_controller.cpp b/src/playstation3_usb_controller.cpp
index ee4955b..f0a81ac 100644
--- a/src/playstation3_usb_controller.cpp
+++ b/src/playstation3_usb_controller.cpp
@@ -19,12 +19,12 @@
 #include "playstation3_usb_controller.hpp"
 
 #include <boost/format.hpp>
-#include <iostream>
 #include <sstream>
 #include <string.h>
 
-#include "xboxmsg.hpp"
+#include "log.hpp"
 #include "usb_helper.hpp"
+#include "xboxmsg.hpp"
 
 Playstation3USBController::Playstation3USBController(libusb_device* dev, bool try_detach) :
   m_handle(0),
@@ -72,7 +72,7 @@ Playstation3USBController::set_led(uint8_t status)
 #define bitswap(x) x = ((x & 0x00ff) << 8) | ((x & 0xff00) >> 8)
 
 bool
-Playstation3USBController::read(XboxGenericMsg& msg, bool verbose, int timeout)
+Playstation3USBController::read(XboxGenericMsg& msg, int timeout)
 {
   int len;
   uint8_t data[64] = {0};
@@ -101,32 +101,34 @@ Playstation3USBController::read(XboxGenericMsg& msg, bool verbose, int timeout)
 
     if (false)
     {
-      std::cout << boost::format("X:%5d Y:%5d Z:%5d RZ:%5d\n") 
-        % (static_cast<int>(msg.ps3usb.accl_x) - 512) 
-        % (static_cast<int>(msg.ps3usb.accl_y) - 512)
-        % (static_cast<int>(msg.ps3usb.accl_z) - 512)
-        % (static_cast<int>(msg.ps3usb.rot_z));
+      log_debug(boost::format("X:%5d Y:%5d Z:%5d RZ:%5d\n") 
+                % (static_cast<int>(msg.ps3usb.accl_x) - 512) 
+                % (static_cast<int>(msg.ps3usb.accl_y) - 512)
+                % (static_cast<int>(msg.ps3usb.accl_z) - 512)
+                % (static_cast<int>(msg.ps3usb.rot_z)));
     }
       
     if (false)
     {
       // values are normalized to 1g (-116 is force by gravity)
-      std::cout << boost::format("X:%6.3f Y:%6.3f Z:%6.3f RZ:%6.3f\n") 
-        % ((static_cast<int>(msg.ps3usb.accl_x) - 512) / 116.0f)
-        % ((static_cast<int>(msg.ps3usb.accl_y) - 512) / 116.0f)
-        % ((static_cast<int>(msg.ps3usb.accl_z) - 512) / 116.0f)
-        % ((static_cast<int>(msg.ps3usb.rot_z) - 5));
+      log_debug(boost::format("X:%6.3f Y:%6.3f Z:%6.3f RZ:%6.3f\n") 
+                % ((static_cast<int>(msg.ps3usb.accl_x) - 512) / 116.0f)
+                % ((static_cast<int>(msg.ps3usb.accl_y) - 512) / 116.0f)
+                % ((static_cast<int>(msg.ps3usb.accl_z) - 512) / 116.0f)
+                % ((static_cast<int>(msg.ps3usb.rot_z) - 5)));
     }
     
     if (false)
     {
-      std::cout << len << ": ";
+      std::ostringstream str;
+      str << len << ": ";
       for(int i = 0; i < len; ++i)
       {
         //std::cout << boost::format("%d:%02x ") % i % static_cast<int>(data[i]);
-        std::cout << boost::format("%02x ") % static_cast<int>(data[i]);
+        str << boost::format("%02x ") % static_cast<int>(data[i]);
       }
-      std::cout << std::endl;
+      str << std::endl;
+      log_debug(str.str());
     }
 
     return true;   
diff --git a/src/playstation3_usb_controller.hpp b/src/playstation3_usb_controller.hpp
index caa5cde..445a9a5 100644
--- a/src/playstation3_usb_controller.hpp
+++ b/src/playstation3_usb_controller.hpp
@@ -38,7 +38,7 @@ public:
   void set_rumble(uint8_t left, uint8_t right);
   void set_led(uint8_t status);
 
-  bool read(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read(XboxGenericMsg& msg, int timeout);
 
 private:
   Playstation3USBController(const Playstation3USBController&);
diff --git a/src/saitek_p2500_controller.cpp b/src/saitek_p2500_controller.cpp
index 47b3c5b..f52c3f3 100644
--- a/src/saitek_p2500_controller.cpp
+++ b/src/saitek_p2500_controller.cpp
@@ -109,7 +109,7 @@ SaitekP2500Controller::set_led(uint8_t status)
 }
 
 bool
-SaitekP2500Controller::read(XboxGenericMsg& msg, bool verbose, int timeout)
+SaitekP2500Controller::read(XboxGenericMsg& msg, int timeout)
 {
   SaitekP2500Msg data;
   int len = 0;
diff --git a/src/saitek_p2500_controller.hpp b/src/saitek_p2500_controller.hpp
index 79fc8e0..1707ca5 100644
--- a/src/saitek_p2500_controller.hpp
+++ b/src/saitek_p2500_controller.hpp
@@ -40,7 +40,7 @@ public:
   void set_led(uint8_t status);
 
   /** @param timeout   timeout in msec, 0 means forever */
-  bool read(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read(XboxGenericMsg& msg, int timeout);
 
 private:
   SaitekP2500Controller(const SaitekP2500Controller&);
diff --git a/src/uinput_config.cpp b/src/uinput_config.cpp
index 9fbe042..505e0b7 100644
--- a/src/uinput_config.cpp
+++ b/src/uinput_config.cpp
@@ -18,8 +18,6 @@
 
 #include "uinput_config.hpp"
 
-#include <iostream>
-
 #include "uinput.hpp"
 
 namespace {
@@ -71,8 +69,7 @@ UInputConfig::send(XboxGenericMsg& msg)
       break;
         
     default:
-      std::cout << "XboxGenericMsg type: " << msg.type << std::endl;
-      assert(!"UInputConfig: Unknown XboxGenericMsg type");
+      assert(!"never reached");
   }
 
   m_uinput.sync();
@@ -258,13 +255,6 @@ UInputConfig::update(int msec_delta)
   m_btn_map.update(m_uinput, msec_delta);
   m_axis_map.update(m_uinput, msec_delta);
 
-#ifdef FIXME
-  if (cfg.force_feedback)
-  {
-    get_force_feedback_uinput()->update_force_feedback(msec_delta);
-  }
-#endif
-
   m_uinput.sync();
 }
 
diff --git a/src/word_wrap.cpp b/src/word_wrap.cpp
index 7bd5135..83e8f1f 100644
--- a/src/word_wrap.cpp
+++ b/src/word_wrap.cpp
@@ -19,6 +19,7 @@
 #include "word_wrap.hpp"
 
 #include <boost/tokenizer.hpp>
+#include <iostream>
 
 WordWrap::WordWrap(int terminal_width) :
   m_terminal_width(terminal_width)
diff --git a/src/word_wrap.hpp b/src/word_wrap.hpp
index 1ebae80..0a6849c 100644
--- a/src/word_wrap.hpp
+++ b/src/word_wrap.hpp
@@ -19,7 +19,7 @@
 #ifndef HEADER_XBOXDRV_WORD_WRAP_HPP
 #define HEADER_XBOXDRV_WORD_WRAP_HPP
 
-#include <iostream>
+#include <string>
 
 class WordWrap
 {
diff --git a/src/xbox360_controller.cpp b/src/xbox360_controller.cpp
index f184d92..becf8da 100644
--- a/src/xbox360_controller.cpp
+++ b/src/xbox360_controller.cpp
@@ -183,7 +183,7 @@ Xbox360Controller::set_led(uint8_t status)
 }
 
 bool
-Xbox360Controller::read(XboxGenericMsg& msg, bool verbose, int timeout)
+Xbox360Controller::read(XboxGenericMsg& msg, int timeout)
 {
   uint8_t data[32];
   int len = 0;
@@ -212,14 +212,11 @@ Xbox360Controller::read(XboxGenericMsg& msg, bool verbose, int timeout)
   }
   else if (len == 3 && data[0] == 0x03 && data[1] == 0x03)
   { 
-    if (verbose)
-    {
-      // data[2] == 0x00 means that rumble is disabled
-      // data[2] == 0x01 unknown, but rumble works
-      // data[2] == 0x02 unknown, but rumble works
-      // data[2] == 0x03 is default with rumble enabled
-      log_info("Xbox360Controller: rumble status: " << int(data[2]));
-    }
+    // data[2] == 0x00 means that rumble is disabled
+    // data[2] == 0x01 unknown, but rumble works
+    // data[2] == 0x02 unknown, but rumble works
+    // data[2] == 0x03 is default with rumble enabled
+    log_info("rumble status: " << int(data[2]));
   }
   else if (len == 3 && data[0] == 0x08 && data[1] == 0x03)
   {
diff --git a/src/xbox360_controller.hpp b/src/xbox360_controller.hpp
index e534edb..f7f2383 100644
--- a/src/xbox360_controller.hpp
+++ b/src/xbox360_controller.hpp
@@ -54,7 +54,7 @@ public:
 
   void set_rumble(uint8_t left, uint8_t right);
   void set_led(uint8_t status);
-  bool read(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read(XboxGenericMsg& msg, int timeout);
 
 private:
   void find_endpoints();
diff --git a/src/xbox360_wireless_controller.cpp b/src/xbox360_wireless_controller.cpp
index 45ff273..c3e1b99 100644
--- a/src/xbox360_wireless_controller.cpp
+++ b/src/xbox360_wireless_controller.cpp
@@ -97,7 +97,7 @@ Xbox360WirelessController::set_led(uint8_t status)
 }
 
 bool
-Xbox360WirelessController::read(XboxGenericMsg& msg, bool verbose, int timeout)
+Xbox360WirelessController::read(XboxGenericMsg& msg, int timeout)
 {
   uint8_t data[32];
   int len = 0;
diff --git a/src/xbox360_wireless_controller.hpp b/src/xbox360_wireless_controller.hpp
index b5ae8d9..39a9a69 100644
--- a/src/xbox360_wireless_controller.hpp
+++ b/src/xbox360_wireless_controller.hpp
@@ -45,7 +45,7 @@ public:
 
   void set_rumble(uint8_t left, uint8_t right);
   void set_led(uint8_t status);
-  bool read(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read(XboxGenericMsg& msg, int timeout);
   uint8_t get_battery_status() const;
 private:
   Xbox360WirelessController (const Xbox360WirelessController&);
diff --git a/src/xbox_controller.cpp b/src/xbox_controller.cpp
index 8d876f2..8928e6a 100644
--- a/src/xbox_controller.cpp
+++ b/src/xbox_controller.cpp
@@ -126,7 +126,7 @@ XboxController::set_led(uint8_t status)
 }
 
 bool
-XboxController::read(XboxGenericMsg& msg, bool verbose, int timeout)
+XboxController::read(XboxGenericMsg& msg, int timeout)
 {
   // FIXME: Add tracking for duplicate data packages (send by logitech controller)
   uint8_t data[32];
diff --git a/src/xbox_controller.hpp b/src/xbox_controller.hpp
index 0c5a609..dc19324 100644
--- a/src/xbox_controller.hpp
+++ b/src/xbox_controller.hpp
@@ -42,7 +42,7 @@ public:
 
   void set_rumble(uint8_t left, uint8_t right);
   void set_led(uint8_t status);
-  bool read(XboxGenericMsg& msg, bool verbose, int timeout);
+  bool read(XboxGenericMsg& msg, int timeout);
 
 private:
   XboxController (const XboxController&);
diff --git a/src/xbox_generic_controller.hpp b/src/xbox_generic_controller.hpp
index 422d270..c5b3f23 100644
--- a/src/xbox_generic_controller.hpp
+++ b/src/xbox_generic_controller.hpp
@@ -37,7 +37,7 @@ public:
      @param timeout   timeout in msec, 0 means forever 
      @return true if something was read, false otherwise
    */  
-  virtual bool read(XboxGenericMsg& msg, bool verbose, int timeout) =0;
+  virtual bool read(XboxGenericMsg& msg, int timeout) =0;
 
 private:
   XboxGenericController (const XboxGenericController&);
diff --git a/src/xboxdrv.cpp b/src/xboxdrv.cpp
index 901a36d..14ca639 100644
--- a/src/xboxdrv.cpp
+++ b/src/xboxdrv.cpp
@@ -20,6 +20,7 @@
 
 #include <boost/format.hpp>
 #include <boost/algorithm/string/join.hpp>
+#include <iostream>
 #include <signal.h>
 #include <stdio.h>
 
@@ -498,19 +499,15 @@ Xboxdrv::print_info(libusb_device* dev,
   std::cout << "USB Device:        " << boost::format("%03d:%03d")
     % static_cast<int>(libusb_get_bus_number(dev))
     % static_cast<int>(libusb_get_device_address(dev)) << std::endl;
-  std::cout << "Controller:        " << boost::format("\"%s\" (idVendor: 0x%04x, idProduct: 0x%04x)")
-    % dev_type.name % uint16_t(desc.idVendor) % uint16_t(desc.idProduct) << std::endl;
+  std::cout << "Controller:        " << dev_type.name << std::endl;
+  std::cout << "Vendor/Product:    " << boost::format("%04x:%04x")
+    % uint16_t(desc.idVendor) % uint16_t(desc.idProduct) << std::endl;
   if (dev_type.type == GAMEPAD_XBOX360_WIRELESS)
     std::cout << "Wireless Port:     " << opts.wireless_id << std::endl;
-  std::cout << "Controller Type:   " << dev_type.type << std::endl;
-  std::cout << "Rumble Debug:      " << (opts.rumble ? "on" : "off") << std::endl;
-  std::cout << "Rumble Speed:      " << "left: " << opts.rumble_l << " right: " << opts.rumble_r << std::endl;
-  if (opts.led == -1)
-    std::cout << "LED Status:        " << "auto" << std::endl;
   else
-    std::cout << "LED Status:        " << opts.led << std::endl;
+    std::cout << "Wireless Port:     -" << std::endl;
+  std::cout << "Controller Type:   " << dev_type.type << std::endl;
 
-  std::cout << "RumbleGain:        " << opts.rumble_gain << std::endl;
   //std::cout << "ForceFeedback:     " << ((opts.controller.back().uinput.force_feedback) ? "enabled" : "disabled") << std::endl;
 }
 
diff --git a/src/xboxdrv_daemon.cpp b/src/xboxdrv_daemon.cpp
index 66d3219..daac59d 100644
--- a/src/xboxdrv_daemon.cpp
+++ b/src/xboxdrv_daemon.cpp
@@ -21,7 +21,6 @@
 #include <boost/format.hpp>
 #include <fstream>
 #include <stdexcept>
-#include <iostream>
 
 #include "uinput_message_processor.hpp"
 #include "dummy_message_processor.hpp"
@@ -139,7 +138,7 @@ XboxdrvDaemon::cleanup_threads()
 void
 XboxdrvDaemon::process_match(const Options& opts, struct udev_device* device)
 {
-  if (false)
+  if (g_logger.get_log_level() >= Logger::kDebug)
   {
     print_info(device);
   }
@@ -156,8 +155,8 @@ XboxdrvDaemon::process_match(const Options& opts, struct udev_device* device)
     XPadDevice dev_type;
     if (!find_xpad_device(vendor, product, &dev_type))
     {
-      log_info("ignoring " << boost::format("%04x:%04x") % vendor % product <<
-               " not a valid Xboxdrv device");
+      log_debug("ignoring " << boost::format("%04x:%04x") % vendor % product <<
+                " not a valid Xboxdrv device");
     }
     else
     {  
@@ -337,7 +336,7 @@ XboxdrvDaemon::run_loop(const Options& opts)
     if (!device)
     {
       // seem to be normal, do we get this when the given device is filtered out?
-      std::cout << "udev device couldn't be read: " << device << std::endl;
+      log_debug("udev device couldn't be read: " << device);
     }
     else
     {
@@ -355,77 +354,77 @@ XboxdrvDaemon::run_loop(const Options& opts)
 void
 XboxdrvDaemon::print_info(struct udev_device* device)
 {
-  std::cout << "/---------------------------------------------" << std::endl;
-  std::cout << "devpath: " << udev_device_get_devpath(device) << std::endl;
+  log_debug("/---------------------------------------------");
+  log_debug("devpath: " << udev_device_get_devpath(device));
   
   if (udev_device_get_action(device))
-    std::cout << "action: " << udev_device_get_action(device) << std::endl;
-  //std::cout << "init: " << udev_device_get_is_initialized(device) << std::endl;
+    log_debug("action: " << udev_device_get_action(device));
+  //log_debug("init: " << udev_device_get_is_initialized(device));
 
   if (udev_device_get_subsystem(device))
-    std::cout << "subsystem: " << udev_device_get_subsystem(device) << std::endl;
+    log_debug("subsystem: " << udev_device_get_subsystem(device));
 
   if (udev_device_get_devtype(device))
-    std::cout << "devtype:   " << udev_device_get_devtype(device) << std::endl;
+    log_debug("devtype:   " << udev_device_get_devtype(device));
 
   if (udev_device_get_syspath(device))
-    std::cout << "syspath:   " << udev_device_get_syspath(device) << std::endl;
+    log_debug("syspath:   " << udev_device_get_syspath(device));
 
   if (udev_device_get_sysname(device))
-    std::cout << "sysname:   " << udev_device_get_sysname(device) << std::endl;
+    log_debug("sysname:   " << udev_device_get_sysname(device));
 
   if (udev_device_get_sysnum(device))
-    std::cout << "sysnum:    " << udev_device_get_sysnum(device) << std::endl;
+    log_debug("sysnum:    " << udev_device_get_sysnum(device));
 
   if (udev_device_get_devnode(device))
-    std::cout << "devnode:   " << udev_device_get_devnode(device) << std::endl;
+    log_debug("devnode:   " << udev_device_get_devnode(device));
 
   if (udev_device_get_driver(device))
-    std::cout << "driver:    " << udev_device_get_driver(device) << std::endl;
+    log_debug("driver:    " << udev_device_get_driver(device));
 
   if (udev_device_get_action(device))
-    std::cout << "action:    " << udev_device_get_action(device) << std::endl;
+    log_debug("action:    " << udev_device_get_action(device));
           
   //udev_device_get_sysattr_value(device, "busnum");
   //udev_device_get_sysattr_value(device, "devnum");
 
   {
-    std::cout << "list: " << std::endl;
+    log_debug("list: ");
     struct udev_list_entry* it = udev_device_get_tags_list_entry(device);
     while((it = udev_list_entry_get_next(it)) != 0)
     {         
-      std::cout << "  " 
+      log_debug("  " 
                 << udev_list_entry_get_name(it) << " = "
                 << udev_list_entry_get_value(it)
-                << std::endl;
+               );
     }
   }
           
   {
-    std::cout << "properties: " << std::endl;
+    log_debug("properties: ");
     struct udev_list_entry* it = udev_device_get_properties_list_entry(device);
     while((it = udev_list_entry_get_next(it)) != 0)
     {         
-      std::cout << "  " 
+      log_debug("  " 
                 << udev_list_entry_get_name(it) << " = "
                 << udev_list_entry_get_value(it)
-                << std::endl;
+               );
     }
   }
           
   {
-    std::cout << "devlist: " << std::endl;
+    log_debug("devlist: ");
     struct udev_list_entry* it = udev_device_get_tags_list_entry(device);
     while((it = udev_list_entry_get_next(it)) != 0)
     {         
-      std::cout << "  " 
+      log_debug("  " 
                 << udev_list_entry_get_name(it) << " = "
                 << udev_list_entry_get_value(it)
-                << std::endl;
+               );
     }
   }
 
-  std::cout << "\\----------------------------------------------" << std::endl;
+  log_debug("\\----------------------------------------------");
 }
 
 XboxdrvDaemon::ControllerSlot*
diff --git a/src/xboxdrv_thread.cpp b/src/xboxdrv_thread.cpp
index 93613b8..e71c29f 100644
--- a/src/xboxdrv_thread.cpp
+++ b/src/xboxdrv_thread.cpp
@@ -128,7 +128,7 @@ XboxdrvThread::controller_loop(const Options& opts)
     {
       XboxGenericMsg msg;
 
-      if (m_controller->read(msg, opts.verbose, m_timeout))
+      if (m_controller->read(msg, m_timeout))
       {
         m_oldrealmsg = msg;
 
diff --git a/src/xboxmsg.cpp b/src/xboxmsg.cpp
index 943f43b..cb2fd78 100644
--- a/src/xboxmsg.cpp
+++ b/src/xboxmsg.cpp
@@ -220,8 +220,7 @@ std::ostream& operator<<(std::ostream& out, const Xbox360Msg& msg)
   out << boost::format("  LT:%3d RT:%3d")
     % int(msg.lt) % int(msg.rt);
 
-  if (g_options->verbose)
-    out << " Dummy: " << msg.dummy1 << " " << msg.dummy2 << " " << msg.dummy3;
+  // out << " Dummy: " << msg.dummy1 << " " << msg.dummy2 << " " << msg.dummy3;
 
   return out;
 }
@@ -260,8 +259,7 @@ std::ostream& operator<<(std::ostream& out, const XboxMsg& msg)
     % int(msg.lt) 
     % int(msg.rt);
 
-  if (g_options->verbose)
-    out << " Dummy: " << msg.dummy;
+  // out << " Dummy: " << msg.dummy;
 
   return out;
 }