[xboxdrv] 23/78: Removed trailing whitespace
Andrey Rahmatullin
wrar-guest at moszumanska.debian.org
Sun Feb 21 17:55:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
wrar-guest pushed a commit to branch master
in repository xboxdrv.
commit d7139d89817690660970634d3473d25d08bf121b
Author: Ingo Ruhnke <grumbel at gmail.com>
Date: Wed Apr 1 09:58:52 2015 +0200
Removed trailing whitespace
---
src/arg_parser.cpp | 96 +++++++++---------
src/arg_parser.hpp | 16 +--
src/axis_event.cpp | 8 +-
src/axis_event.hpp | 2 +-
src/axis_filter.cpp | 2 +-
src/axis_map.hpp | 2 +-
src/axisevent/abs_axis_event_handler.cpp | 12 +--
src/axisevent/key_axis_event_handler.cpp | 8 +-
src/axisevent/key_axis_event_handler.hpp | 4 +-
src/axisevent/rel_axis_event_handler.cpp | 8 +-
src/axisevent/rel_repeat_axis_event_handler.cpp | 6 +-
src/axisfilter/deadzone_axis_filter.cpp | 12 +--
src/axisfilter/log_axis_filter.cpp | 2 +-
src/axisfilter/log_axis_filter.hpp | 2 +-
src/axisfilter/response_curve_axis_filter.cpp | 4 +-
src/axisfilter/response_curve_axis_filter.hpp | 2 +-
src/axisfilter/sensitivity_axis_filter.cpp | 4 +-
src/button_event.cpp | 6 +-
src/button_event.hpp | 4 +-
src/button_filter.cpp | 2 +-
src/button_map.cpp | 2 +-
src/button_map.hpp | 2 +-
src/buttonevent/abs_button_event_handler.cpp | 2 +-
src/buttonevent/cycle_key_button_event_handler.cpp | 4 +-
src/buttonevent/cycle_key_button_event_handler.hpp | 8 +-
src/buttonevent/cycle_key_sequence.cpp | 4 +-
src/buttonevent/cycle_key_sequence.hpp | 6 +-
src/buttonevent/key_button_event_handler.cpp | 6 +-
src/buttonevent/key_button_event_handler.hpp | 2 +-
src/buttonevent/macro_button_event_handler.cpp | 4 +-
src/buttonevent/macro_button_event_handler.hpp | 4 +-
src/buttonevent/rel_button_event_handler.cpp | 10 +-
src/buttonfilter/log_button_filter.cpp | 2 +-
src/chatpad.cpp | 108 ++++++++++-----------
src/chatpad.hpp | 6 +-
src/command_line_options.cpp | 64 ++++++------
src/command_line_options.hpp | 8 +-
src/controller.cpp | 2 +-
src/controller.hpp | 2 +-
src/controller_config.hpp | 2 +-
src/controller_factory.cpp | 20 ++--
src/controller_factory.hpp | 6 +-
src/controller_match_rule.cpp | 10 +-
src/controller_slot.hpp | 4 +-
src/controller_slot_config.cpp | 22 ++---
src/controller_slot_config.hpp | 4 +-
src/controller_slot_options.cpp | 2 +-
src/controller_thread.cpp | 4 +-
src/controller_thread.hpp | 2 +-
src/dbus_subsystem.cpp | 10 +-
src/enum_box.hpp | 8 +-
src/evdev_absmap.cpp | 16 +--
src/evdev_controller.cpp | 10 +-
src/evdev_controller.hpp | 4 +-
src/evdev_helper.cpp | 24 ++---
src/evdev_helper.hpp | 2 +-
src/firestorm_dual_controller.cpp | 18 ++--
src/firestorm_dual_controller.hpp | 2 +-
src/force_feedback_handler.cpp | 14 +--
src/force_feedback_handler.hpp | 10 +-
src/generic_usb_controller.cpp | 4 +-
src/headset.cpp | 10 +-
src/headset.hpp | 2 +-
src/helper.cpp | 8 +-
src/helper.hpp | 4 +-
src/ini_parser.cpp | 14 +--
src/ini_parser.hpp | 8 +-
src/ini_schema.cpp | 50 +++++-----
src/ini_schema.hpp | 8 +-
src/linux_uinput.cpp | 22 ++---
src/linux_uinput.hpp | 10 +-
src/log.cpp | 6 +-
src/modifier.cpp | 2 +-
src/modifier.hpp | 2 +-
src/modifier/axismap_modifier.hpp | 2 +-
src/modifier/buttonmap_modifier.cpp | 8 +-
src/modifier/buttonmap_modifier.hpp | 2 +-
src/modifier/dpad_restrictor_modifier.cpp | 2 +-
src/modifier/dpad_rotation_modifier.cpp | 6 +-
src/modifier/rotate_axis_modifier.hpp | 2 +-
src/modifier/statistic_modifier.cpp | 6 +-
src/options.cpp | 10 +-
src/options.hpp | 12 +--
src/playstation3_usb_controller.cpp | 20 ++--
src/pretty_printer.cpp | 12 +--
src/pretty_printer.hpp | 2 +-
src/saitek_p2500_controller.cpp | 12 +--
src/saitek_p2500_controller.hpp | 4 +-
src/select.hpp | 2 +-
src/udev_subsystem.cpp | 32 +++---
src/ui_abs_event_collector.cpp | 2 +-
src/ui_event.cpp | 8 +-
src/ui_event.hpp | 6 +-
src/ui_event_collector.cpp | 6 +-
src/ui_event_collector.hpp | 2 +-
src/ui_event_emitter.hpp | 2 +-
src/ui_event_sequence.cpp | 2 +-
src/ui_event_sequence.hpp | 8 +-
src/ui_rel_event_collector.cpp | 2 +-
src/uinput.cpp | 36 +++----
src/uinput.hpp | 6 +-
src/uinput_config.cpp | 16 +--
src/uinput_config.hpp | 2 +-
src/uinput_message_processor.cpp | 12 +--
src/uinput_options.cpp | 32 +++---
src/uinput_options.hpp | 4 +-
src/usb_controller.cpp | 26 ++---
src/usb_controller.hpp | 2 +-
src/usb_gsource.cpp | 6 +-
src/usb_helper.cpp | 2 +-
src/usb_interface.cpp | 10 +-
src/usb_interface.hpp | 2 +-
src/usb_subsystem.cpp | 6 +-
src/word_wrap.cpp | 2 +-
src/xbox360_controller.cpp | 16 +--
src/xbox360_controller.hpp | 12 +--
src/xbox360_wireless_controller.cpp | 18 ++--
src/xbox360_wireless_controller.hpp | 4 +-
src/xbox_controller.cpp | 4 +-
src/xbox_controller.hpp | 4 +-
src/xboxdrv.cpp | 38 ++++----
src/xboxdrv.hpp | 2 +-
src/xboxdrv_daemon.cpp | 38 ++++----
src/xboxdrv_daemon.hpp | 8 +-
src/xboxdrv_g_controller.cpp | 2 +-
src/xboxdrv_g_controller.hpp | 2 +-
src/xboxdrv_main.cpp | 22 ++---
src/xboxdrv_main.hpp | 4 +-
src/xboxmsg.cpp | 50 +++++-----
src/xboxmsg.hpp | 6 +-
src/xpad_device.hpp | 4 +-
test/ini_parser_test.cpp | 4 +-
test/usb_system_test.cpp | 6 +-
tools/evsend.cpp | 2 +-
tools/evtestplus.cpp | 20 ++--
tools/usbcat.cpp | 48 ++++-----
tools/usbdebug.cpp | 72 +++++++-------
tools/usbread.cpp | 6 +-
138 files changed, 760 insertions(+), 760 deletions(-)
diff --git a/src/arg_parser.cpp b/src/arg_parser.cpp
index 39c25e4..2ee4a57 100644
--- a/src/arg_parser.cpp
+++ b/src/arg_parser.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -37,23 +37,23 @@ ArgParser::parse_args(int argc, char** argv)
programm = argv[0];
- for(int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (argv[i][0] == '-')
+ if (argv[i][0] == '-')
{
- if (argv[i][1] == '-')
+ if (argv[i][1] == '-')
{
// We got a long option
- if (argv[i][2] == '\0')
- {
+ if (argv[i][2] == '\0')
+ {
// Got a '--', so we stop evaluating arguments
++i;
- while(i < argc)
+ while(i < argc)
{
parsed_options.push_back(ParsedOption(ArgParser::REST_ARG, "", argv[i]));
++i;
}
- }
+ }
else
{
std::string opt = argv[i] + 2;
@@ -62,12 +62,12 @@ ArgParser::parse_args(int argc, char** argv)
std::string::size_type pos = opt.find('=');
- if (pos != std::string::npos)
+ if (pos != std::string::npos)
{
long_opt = opt.substr(0, pos);
long_opt_arg = opt.substr(pos+1);
}
- else
+ else
{
long_opt = opt;
}
@@ -75,25 +75,25 @@ ArgParser::parse_args(int argc, char** argv)
// Long Option
Option* option = lookup_long_option(long_opt);
- if (option)
+ if (option)
{
- if (option->argument.empty())
+ if (option->argument.empty())
{
parsed_options.push_back(ParsedOption(option->key, long_opt, ""));
- }
+ }
else
{
- if (pos != std::string::npos)
+ if (pos != std::string::npos)
{
parsed_options.push_back(ParsedOption(option->key, long_opt, long_opt_arg));
}
else
- {
- if (i == argc - 1)
+ {
+ if (i == argc - 1)
{
throw std::runtime_error("option '" + std::string(argv[i]) + "' requires an argument");
}
- else
+ else
{
parsed_options.push_back(ParsedOption(option->key, long_opt, argv[i + 1]));
++i;
@@ -106,29 +106,29 @@ ArgParser::parse_args(int argc, char** argv)
throw std::runtime_error("unrecognized option '" + std::string(argv[i]) + "'");
}
}
- }
- else
+ }
+ else
{
// We got a short option
char* p = argv[i] + 1;
-
+
if (*p != '\0')
{
// Handle option chains
- while (*p)
+ while (*p)
{
// Short option(s)
Option* option = lookup_short_option(*p);
- if (option)
+ if (option)
{
- if (option->argument.empty())
+ if (option->argument.empty())
{
parsed_options.push_back(ParsedOption(option->key, std::string(1, *p), ""));
- }
- else
+ }
+ else
{
- if (i == argc - 1 || *(p+1) != '\0')
+ if (i == argc - 1 || *(p+1) != '\0')
{
// No more arguments
throw std::runtime_error("option requires an argument -- " + std::string(1, *p));
@@ -139,20 +139,20 @@ ArgParser::parse_args(int argc, char** argv)
++i;
}
}
- }
- else
+ }
+ else
{
throw std::runtime_error("invalid option -- " + std::string(1, *p));
}
- ++p;
+ ++p;
}
- }
+ }
else
{
parsed_options.push_back(ParsedOption(ArgParser::REST_ARG, "", "-"));
}
}
- }
+ }
else
{
parsed_options.push_back(ParsedOption(ArgParser::REST_ARG, "", argv[i]));
@@ -189,7 +189,7 @@ ArgParser::print_help(std::ostream& out) const
{
const int terminal_width = get_terminal_width();
const int column_min_width = 8;
- int column_width = column_min_width;
+ int column_width = column_min_width;
{ // Calculate left column width
for(Options::const_iterator i = options.begin(); i != options.end(); ++i)
@@ -197,7 +197,7 @@ ArgParser::print_help(std::ostream& out) const
int width = 2; // add two leading space
if (i->short_option)
width += 2; // "-a"
-
+
if (!i->long_option.empty())
width += i->long_option.size() + 2; // "--foobar"
@@ -223,27 +223,27 @@ ArgParser::print_help(std::ostream& out) const
{
if (i->visible)
{
- if (i->key == USAGE)
+ if (i->key == USAGE)
{
- if (first_usage)
+ if (first_usage)
{
- out << "Usage: " << programm << " " << i->help << std::endl;
+ out << "Usage: " << programm << " " << i->help << std::endl;
first_usage = false;
}
else
{
- out << " " << programm << " " << i->help << std::endl;
+ out << " " << programm << " " << i->help << std::endl;
}
- }
- else if (i->key == TEXT)
+ }
+ else if (i->key == TEXT)
{
pprint.print(i->help);
}
- else if (i->key == PSEUDO)
+ else if (i->key == PSEUDO)
{
pprint.print(std::string(column_width, ' '), i->long_option, i->help);
}
- else
+ else
{
char option[256] = { 0 };
char argument[256] = { 0 };
@@ -305,14 +305,14 @@ ArgParser::add_pseudo(const std::string& left, const std::string& doc)
options.push_back(option);
- return *this;
+ return *this;
}
ArgParser&
ArgParser::add_newline()
{
add_text("");
-
+
return *this;
}
@@ -325,15 +325,15 @@ ArgParser::add_text(const std::string& grouptopic)
option.help = grouptopic;
option.visible = true;
- options.push_back(option);
+ options.push_back(option);
return *this;
}
ArgParser&
-ArgParser::add_option(int key,
- char short_option,
- const std::string& long_option,
+ArgParser::add_option(int key,
+ char short_option,
+ const std::string& long_option,
const std::string& argument,
const std::string& help,
bool visible)
@@ -363,7 +363,7 @@ int main(int argc, char** argv)
try
{
ArgParser argp;
-
+
argp
.add_usage("bar [FILES]... [BLA]..")
.add_usage("foo [FILES]... [BLA]..")
diff --git a/src/arg_parser.hpp b/src/arg_parser.hpp
index 0202a12..2e06b2c 100644
--- a/src/arg_parser.hpp
+++ b/src/arg_parser.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -51,14 +51,14 @@ public:
std::string option;
std::string argument;
- ParsedOption() :
+ ParsedOption() :
key(-1),
option(),
argument()
{}
ParsedOption(int key_, const std::string& option_, const std::string& argument_) :
- key(key_),
+ key(key_),
option(option_),
argument(argument_)
{}
@@ -73,11 +73,11 @@ public:
private:
std::string programm;
-
+
typedef std::vector<Option> Options;
Options options;
-public:
+public:
typedef std::vector<ParsedOption> ParsedOptions;
ArgParser();
@@ -86,17 +86,17 @@ public:
ArgParser& add_text(const std::string& doc);
ArgParser& add_pseudo(const std::string& left, const std::string& doc);
ArgParser& add_newline();
-
+
ArgParser& add_option(int key,
char short_option,
- const std::string& long_option,
+ const std::string& long_option,
const std::string& argument,
const std::string& help,
bool visible = true);
ParsedOptions parse_args(int argc, char** argv);
void print_help(std::ostream& out) const;
-
+
bool next();
int get_key();
std::string get_argument();
diff --git a/src/axis_event.cpp b/src/axis_event.cpp
index 35c4c37..a6953ec 100644
--- a/src/axis_event.cpp
+++ b/src/axis_event.cpp
@@ -33,8 +33,8 @@
#include "axisevent/rel_repeat_axis_event_handler.hpp"
AxisEventPtr
-AxisEvent::invalid()
-{
+AxisEvent::invalid()
+{
return AxisEventPtr();
}
@@ -51,7 +51,7 @@ AxisEvent::create_rel(int device_id, int code, int repeat, float value)
{
return AxisEventPtr(new AxisEvent(new RelAxisEventHandler(device_id, code, repeat, value)));
}
-
+
AxisEventPtr
AxisEvent::from_string(const std::string& str)
{
@@ -61,7 +61,7 @@ AxisEvent::from_string(const std::string& str)
const std::string& token = str.substr(0, p);
std::string rest;
- if (p != std::string::npos)
+ if (p != std::string::npos)
rest = str.substr(p+1);
if (token == "abs")
diff --git a/src/axis_event.hpp b/src/axis_event.hpp
index a90c731..7dcb066 100644
--- a/src/axis_event.hpp
+++ b/src/axis_event.hpp
@@ -38,7 +38,7 @@ public:
static AxisEventPtr create_abs(int device_id, int code, int min, int max, int fuzz, int flat);
static AxisEventPtr create_rel(int device_id, int code, int repeat = 10, float value = 5);
- /** If an AxisEvent gets created the user has to set min/max with set_axis_range() */
+ /** If an AxisEvent gets created the user has to set min/max with set_axis_range() */
static AxisEventPtr from_string(const std::string& str);
public:
diff --git a/src/axis_filter.cpp b/src/axis_filter.cpp
index c5dc2f0..c936488 100644
--- a/src/axis_filter.cpp
+++ b/src/axis_filter.cpp
@@ -37,7 +37,7 @@ AxisFilter::from_string(const std::string& str)
const std::string& filtername = str.substr(0, p);
std::string rest;
- if (p != std::string::npos)
+ if (p != std::string::npos)
rest = str.substr(p+1);
if (filtername == "invert" || filtername == "inv")
diff --git a/src/axis_map.hpp b/src/axis_map.hpp
index 2cd9cab..73824d6 100644
--- a/src/axis_map.hpp
+++ b/src/axis_map.hpp
@@ -26,7 +26,7 @@ class AxisMap
{
private:
AxisEventPtr m_axis_map[XBOX_BTN_MAX][XBOX_AXIS_MAX];
-
+
public:
AxisMap();
diff --git a/src/axisevent/abs_axis_event_handler.cpp b/src/axisevent/abs_axis_event_handler.cpp
index c7ec395..f9dd98d 100644
--- a/src/axisevent/abs_axis_event_handler.cpp
+++ b/src/axisevent/abs_axis_event_handler.cpp
@@ -28,7 +28,7 @@ AbsAxisEventHandler::from_string(const std::string& str)
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
tokenizer tokens(str, boost::char_separator<char>(":", "", boost::keep_empty_tokens));
-
+
int j = 0;
UIEvent code = UIEvent::invalid();
for(tokenizer::iterator i = tokens.begin(); i != tokens.end(); ++i, ++j)
@@ -39,7 +39,7 @@ AbsAxisEventHandler::from_string(const std::string& str)
code = str2abs_event(*i);
break;
- default:
+ default:
throw std::runtime_error("AxisEventHandlers::abs_from_string(): to many arguments: " + str);
}
}
@@ -81,7 +81,7 @@ AbsAxisEventHandler::init(UInput& uinput, int slot, bool extra_devices)
assert(!m_abs_emitter);
m_code.resolve_device_id(slot, extra_devices);
- m_abs_emitter = uinput.add_abs(m_code.get_device_id(), m_code.code,
+ m_abs_emitter = uinput.add_abs(m_code.get_device_id(), m_code.code,
m_min, m_max, m_fuzz, m_flat);
}
@@ -90,7 +90,7 @@ AbsAxisEventHandler::send(UInput& uinput, int value)
{
m_abs_emitter->send(value);
}
-
+
void
AbsAxisEventHandler::update(UInput& uinput, int msec_delta)
{
@@ -100,8 +100,8 @@ std::string
AbsAxisEventHandler::str() const
{
std::ostringstream out;
- out << m_code.get_device_id() << "-" << m_code.code << ":"
- << m_min << ":" << m_max << ":"
+ out << m_code.get_device_id() << "-" << m_code.code << ":"
+ << m_min << ":" << m_max << ":"
<< m_fuzz << ":" << m_flat;
return out.str();
}
diff --git a/src/axisevent/key_axis_event_handler.cpp b/src/axisevent/key_axis_event_handler.cpp
index fbe942c..293dd44 100644
--- a/src/axisevent/key_axis_event_handler.cpp
+++ b/src/axisevent/key_axis_event_handler.cpp
@@ -29,7 +29,7 @@ KeyAxisEventHandler::from_string(const std::string& str)
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
tokenizer tokens(str, boost::char_separator<char>(":", "", boost::keep_empty_tokens));
-
+
std::auto_ptr<KeyAxisEventHandler> ev(new KeyAxisEventHandler);
int j = 0;
@@ -58,12 +58,12 @@ KeyAxisEventHandler::from_string(const std::string& str)
}
}
break;
-
+
case 2:
ev->m_threshold = boost::lexical_cast<int>(*i);
break;
-
- default:
+
+ default:
throw std::runtime_error("AxisEvent::key_from_string(): to many arguments: " + str);
}
}
diff --git a/src/axisevent/key_axis_event_handler.hpp b/src/axisevent/key_axis_event_handler.hpp
index 56eb4f8..cea4029 100644
--- a/src/axisevent/key_axis_event_handler.hpp
+++ b/src/axisevent/key_axis_event_handler.hpp
@@ -27,7 +27,7 @@ class KeyAxisEventHandler : public AxisEventHandler
{
public:
static KeyAxisEventHandler* from_string(const std::string& str);
-
+
public:
KeyAxisEventHandler();
@@ -41,7 +41,7 @@ private:
void send_up(UInput& uinput, int value);
void send_down(UInput& uinput, int value);
int get_zone(int value) const;
-
+
private:
int m_old_value;
diff --git a/src/axisevent/rel_axis_event_handler.cpp b/src/axisevent/rel_axis_event_handler.cpp
index 2f86549..7763a4b 100644
--- a/src/axisevent/rel_axis_event_handler.cpp
+++ b/src/axisevent/rel_axis_event_handler.cpp
@@ -42,14 +42,14 @@ RelAxisEventHandler::from_string(const std::string& str)
break;
case 1:
- ev->m_value = boost::lexical_cast<float>(*i);
+ ev->m_value = boost::lexical_cast<float>(*i);
break;
case 2:
- ev->m_repeat = boost::lexical_cast<int>(*i);
+ ev->m_repeat = boost::lexical_cast<int>(*i);
break;
- default:
+ default:
throw std::runtime_error("AxisEvent::rel_from_string(): to many arguments: " + str);
}
}
@@ -98,7 +98,7 @@ RelAxisEventHandler::send(UInput& uinput, int value)
m_stick_value = value / static_cast<float>(m_max);
if (m_repeat != -1)
- {
+ {
// regular old style sending of REL events
float v = m_value * m_stick_value;
diff --git a/src/axisevent/rel_repeat_axis_event_handler.cpp b/src/axisevent/rel_repeat_axis_event_handler.cpp
index dbe171d..8659404 100644
--- a/src/axisevent/rel_repeat_axis_event_handler.cpp
+++ b/src/axisevent/rel_repeat_axis_event_handler.cpp
@@ -29,7 +29,7 @@ RelRepeatAxisEventHandler*
RelRepeatAxisEventHandler::from_string(const std::string& str)
{
// split string at ':'
- boost::tokenizer<boost::char_separator<char> >
+ boost::tokenizer<boost::char_separator<char> >
tokens(str, boost::char_separator<char>(":", "", boost::keep_empty_tokens));
std::vector<std::string> args;
std::copy(tokens.begin(), tokens.end(), std::back_inserter(args));
@@ -53,7 +53,7 @@ RelRepeatAxisEventHandler::RelRepeatAxisEventHandler(const UIEvent& code, int va
m_stick_value(0),
m_timer(0),
m_rel_emitter()
-{
+{
}
void
@@ -100,7 +100,7 @@ RelRepeatAxisEventHandler::update(UInput& uinput, int msec_delta)
{
m_rel_emitter->send(m_value);
}
-
+
m_timer -= m_repeat;
}
}
diff --git a/src/axisfilter/deadzone_axis_filter.cpp b/src/axisfilter/deadzone_axis_filter.cpp
index dee4e05..3180413 100644
--- a/src/axisfilter/deadzone_axis_filter.cpp
+++ b/src/axisfilter/deadzone_axis_filter.cpp
@@ -39,18 +39,18 @@ DeadzoneAxisFilter::from_string(const std::string& str)
max_deadzone = boost::lexical_cast<int>(*t);
min_deadzone = -max_deadzone;
break;
-
+
case 1:
min_deadzone = -min_deadzone;
- max_deadzone = boost::lexical_cast<int>(*t);
+ max_deadzone = boost::lexical_cast<int>(*t);
break;
case 2:
- smooth = boost::lexical_cast<bool>(*t);
+ smooth = boost::lexical_cast<bool>(*t);
break;
default:
- throw std::runtime_error("to many arguments");
+ throw std::runtime_error("to many arguments");
break;
}
}
@@ -85,11 +85,11 @@ DeadzoneAxisFilter::filter(int value, int min, int max)
{
return min * (value - m_min_deadzone) / (min - m_min_deadzone);
}
- else if (value > m_max_deadzone)
+ else if (value > m_max_deadzone)
{
return max * (value - m_max_deadzone) / (max - m_max_deadzone);
}
- else
+ else
{
return 0;
}
diff --git a/src/axisfilter/log_axis_filter.cpp b/src/axisfilter/log_axis_filter.cpp
index 8a004d0..f07c0b8 100644
--- a/src/axisfilter/log_axis_filter.cpp
+++ b/src/axisfilter/log_axis_filter.cpp
@@ -41,7 +41,7 @@ LogAxisFilter::filter(int value, int min, int max)
}
else
{
- std::cout << m_name << ": " << value << std::endl;
+ std::cout << m_name << ": " << value << std::endl;
}
return value;
diff --git a/src/axisfilter/log_axis_filter.hpp b/src/axisfilter/log_axis_filter.hpp
index fb40109..80345ca 100644
--- a/src/axisfilter/log_axis_filter.hpp
+++ b/src/axisfilter/log_axis_filter.hpp
@@ -23,7 +23,7 @@
class LogAxisFilter : public AxisFilter
{
-public:
+public:
static LogAxisFilter* from_string(const std::string& str);
public:
diff --git a/src/axisfilter/response_curve_axis_filter.cpp b/src/axisfilter/response_curve_axis_filter.cpp
index b469364..f2e6ef7 100644
--- a/src/axisfilter/response_curve_axis_filter.cpp
+++ b/src/axisfilter/response_curve_axis_filter.cpp
@@ -59,11 +59,11 @@ ResponseCurveAxisFilter::filter(int value, int min, int max)
// that the edge conditions are meet
int bucket_count = m_samples.size() - 1;
float bucket_size = (max - min) / static_cast<float>(bucket_count);
-
+
int bucket_index = int((value - min) / bucket_size);
float t = ((value - min) - (static_cast<float>(bucket_index) * bucket_size)) / bucket_size;
-
+
return ((1.0f - t) * m_samples[bucket_index]) + (t * m_samples[bucket_index + 1]);
}
}
diff --git a/src/axisfilter/response_curve_axis_filter.hpp b/src/axisfilter/response_curve_axis_filter.hpp
index 112d205..29155bb 100644
--- a/src/axisfilter/response_curve_axis_filter.hpp
+++ b/src/axisfilter/response_curve_axis_filter.hpp
@@ -23,7 +23,7 @@
class ResponseCurveAxisFilter : public AxisFilter
{
-public:
+public:
static ResponseCurveAxisFilter* from_string(const std::string& str);
public:
diff --git a/src/axisfilter/sensitivity_axis_filter.cpp b/src/axisfilter/sensitivity_axis_filter.cpp
index b1eec41..a2797ae 100644
--- a/src/axisfilter/sensitivity_axis_filter.cpp
+++ b/src/axisfilter/sensitivity_axis_filter.cpp
@@ -29,7 +29,7 @@ SensitivityAxisFilter::from_string(const std::string& str)
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
tokenizer tokens(str, boost::char_separator<char>(":", "", boost::keep_empty_tokens));
-
+
float sensitivity = 0.0f;
int j = 0;
@@ -47,7 +47,7 @@ SensitivityAxisFilter::from_string(const std::string& str)
SensitivityAxisFilter::SensitivityAxisFilter(float sensitivity) :
m_sensitivity(sensitivity)
-{
+{
}
int
diff --git a/src/button_event.cpp b/src/button_event.cpp
index 46da18d..587fac1 100644
--- a/src/button_event.cpp
+++ b/src/button_event.cpp
@@ -52,7 +52,7 @@ ButtonEvent::create_abs(int code)
return ButtonEvent::create(new AbsButtonEventHandler(code));
}
-ButtonEventPtr
+ButtonEventPtr
ButtonEvent::create_key(int device_id, int code)
{
return ButtonEvent::create(new KeyButtonEventHandler(device_id, code));
@@ -83,7 +83,7 @@ ButtonEvent::from_string(const std::string& str, const std::string& directory)
const std::string& token = str.substr(0, p);
std::string rest;
- if (p != std::string::npos)
+ if (p != std::string::npos)
rest = str.substr(p+1);
if (token == "abs")
@@ -194,7 +194,7 @@ ButtonEvent::update(UInput& uinput, int msec_delta)
}
m_handler->update(uinput, msec_delta);
-
+
send(uinput, m_last_raw_state);
}
diff --git a/src/button_event.hpp b/src/button_event.hpp
index 53a8609..5e18427 100644
--- a/src/button_event.hpp
+++ b/src/button_event.hpp
@@ -46,7 +46,7 @@ public:
protected:
ButtonEvent(ButtonEventHandler* handler);
-public:
+public:
void init(UInput& uinput, int slot, bool extra_devices);
void send(UInput& uinput, bool value);
void update(UInput& uinput, int msec_delta);
@@ -66,7 +66,7 @@ class ButtonEventHandler
{
public:
virtual ~ButtonEventHandler() {}
-
+
virtual void init(UInput& uinput, int slot, bool extra_devices) =0;
virtual void send(UInput& uinput, bool value) =0;
virtual void update(UInput& uinput, int msec_delta) =0;
diff --git a/src/button_filter.cpp b/src/button_filter.cpp
index e7b7093..3a3b8c2 100644
--- a/src/button_filter.cpp
+++ b/src/button_filter.cpp
@@ -36,7 +36,7 @@ ButtonFilter::from_string(const std::string& str)
std::string filtername = str.substr(0, p);
std::string rest;
- if (p != std::string::npos)
+ if (p != std::string::npos)
rest = str.substr(p+1);
if (filtername == "toggle" || filtername == "tog")
diff --git a/src/button_map.cpp b/src/button_map.cpp
index d364a23..606c356 100644
--- a/src/button_map.cpp
+++ b/src/button_map.cpp
@@ -107,7 +107,7 @@ ButtonMap::update(UInput& uinput, int msec_delta)
btn_map[shift_code][code]->update(uinput, msec_delta);
}
}
- }
+ }
}
/* EOF */
diff --git a/src/button_map.hpp b/src/button_map.hpp
index 7e39d1d..8828633 100644
--- a/src/button_map.hpp
+++ b/src/button_map.hpp
@@ -26,7 +26,7 @@ class ButtonMap
{
private:
ButtonEventPtr btn_map[XBOX_BTN_MAX][XBOX_BTN_MAX];
-
+
public:
ButtonMap();
diff --git a/src/buttonevent/abs_button_event_handler.cpp b/src/buttonevent/abs_button_event_handler.cpp
index fef285e..7d39ee8 100644
--- a/src/buttonevent/abs_button_event_handler.cpp
+++ b/src/buttonevent/abs_button_event_handler.cpp
@@ -54,7 +54,7 @@ std::string
AbsButtonEventHandler::str() const
{
std::ostringstream out;
- out << "abs: " << m_code.get_device_id() << "-" << m_code.code << ":" << m_value;
+ out << "abs: " << m_code.get_device_id() << "-" << m_code.code << ":" << m_value;
return out.str();
}
diff --git a/src/buttonevent/cycle_key_button_event_handler.cpp b/src/buttonevent/cycle_key_button_event_handler.cpp
index e79144e..95905c2 100644
--- a/src/buttonevent/cycle_key_button_event_handler.cpp
+++ b/src/buttonevent/cycle_key_button_event_handler.cpp
@@ -28,7 +28,7 @@ std::map<std::string, CycleKeySequencePtr> CycleKeyButtonEventHandler::s_lookup_
namespace {
-CycleKeyButtonEventHandler::Direction
+CycleKeyButtonEventHandler::Direction
direction_from_string(const std::string& value)
{
if (value == "forward")
@@ -134,7 +134,7 @@ CycleKeyButtonEventHandler::lookup(const std::string& name)
}
CycleKeyButtonEventHandler::CycleKeyButtonEventHandler(CycleKeySequencePtr sequence,
- Direction direction,
+ Direction direction,
bool send_press) :
m_sequence(sequence),
m_direction(direction),
diff --git a/src/buttonevent/cycle_key_button_event_handler.hpp b/src/buttonevent/cycle_key_button_event_handler.hpp
index 69a5a50..68b985b 100644
--- a/src/buttonevent/cycle_key_button_event_handler.hpp
+++ b/src/buttonevent/cycle_key_button_event_handler.hpp
@@ -35,13 +35,13 @@ public:
static CycleKeyButtonEventHandler* from_string(const std::string& str, bool wrap_around);
static CycleKeyButtonEventHandler* from_string_named(const std::string& str, bool wrap_around);
- /**
+ /**
Syntax: "{direction}:{press}"
-
+
direction: can either be 'forward', 'backward', 'none' or an
integer, in the case of an integer, the pointer is moved to that key
-
- press: a bool, true if a keypress is send,
+
+ press: a bool, true if a keypress is send,
false when only the current key should change
*/
static CycleKeyButtonEventHandler* from_string_ref(const std::string& value);
diff --git a/src/buttonevent/cycle_key_sequence.cpp b/src/buttonevent/cycle_key_sequence.cpp
index 0c25399..cefb475 100644
--- a/src/buttonevent/cycle_key_sequence.cpp
+++ b/src/buttonevent/cycle_key_sequence.cpp
@@ -24,7 +24,7 @@
CycleKeySequencePtr
CycleKeySequence::from_range(std::vector<std::string>::const_iterator beg,
- std::vector<std::string>::const_iterator end,
+ std::vector<std::string>::const_iterator end,
bool wrap_around)
{
Keys keys;
@@ -72,7 +72,7 @@ CycleKeySequence::send(UInput& uinput, bool value)
{
int send_key = has_current_key() ? m_current_key : m_last_key;
- m_keys[send_key].send(uinput, value);
+ m_keys[send_key].send(uinput, value);
m_last_key = send_key;
m_current_key = -1;
diff --git a/src/buttonevent/cycle_key_sequence.hpp b/src/buttonevent/cycle_key_sequence.hpp
index 5fe9879..3323d48 100644
--- a/src/buttonevent/cycle_key_sequence.hpp
+++ b/src/buttonevent/cycle_key_sequence.hpp
@@ -32,13 +32,13 @@ class CycleKeySequence
{
public:
static CycleKeySequencePtr from_range(std::vector<std::string>::const_iterator beg,
- std::vector<std::string>::const_iterator end,
+ std::vector<std::string>::const_iterator end,
bool wrap_around);
private:
typedef std::vector<UIEventSequence> Keys;
Keys m_keys;
-
+
/** If set the sequence wraps around when at the begin/end */
bool m_wrap_around;
@@ -57,7 +57,7 @@ public:
void next_key();
void prev_key();
-
+
void init(UInput& uinput, int slot, bool extra_devices);
void send(UInput& uinput, bool value);
diff --git a/src/buttonevent/key_button_event_handler.cpp b/src/buttonevent/key_button_event_handler.cpp
index c5c9a41..7e23c8c 100644
--- a/src/buttonevent/key_button_event_handler.cpp
+++ b/src/buttonevent/key_button_event_handler.cpp
@@ -38,7 +38,7 @@ KeyButtonEventHandler::from_string(const std::string& str)
{
switch(idx)
{
- case 0:
+ case 0:
{
ev.reset(new KeyButtonEventHandler());
ev->m_codes = UIEventSequence::from_string(*i);
@@ -51,7 +51,7 @@ KeyButtonEventHandler::from_string(const std::string& str)
ev->m_hold_threshold = 250;
}
break;
-
+
case 2:
{
ev->m_hold_threshold = boost::lexical_cast<int>(*i);
@@ -148,7 +148,7 @@ KeyButtonEventHandler::send(UInput& uinput, bool value)
}
void
-KeyButtonEventHandler::update(UInput& uinput, int msec_delta)
+KeyButtonEventHandler::update(UInput& uinput, int msec_delta)
{
if (m_state && m_hold_threshold)
{
diff --git a/src/buttonevent/key_button_event_handler.hpp b/src/buttonevent/key_button_event_handler.hpp
index a865f63..a2418ae 100644
--- a/src/buttonevent/key_button_event_handler.hpp
+++ b/src/buttonevent/key_button_event_handler.hpp
@@ -37,7 +37,7 @@ public:
void update(UInput& uinput, int msec_delta);
std::string str() const;
-
+
private:
bool m_state;
UIEventSequence m_codes;
diff --git a/src/buttonevent/macro_button_event_handler.cpp b/src/buttonevent/macro_button_event_handler.cpp
index 42481f5..188d476 100644
--- a/src/buttonevent/macro_button_event_handler.cpp
+++ b/src/buttonevent/macro_button_event_handler.cpp
@@ -63,7 +63,7 @@ MacroButtonEventHandler::macro_event_from_string(const std::string& str)
{
if (!args[0].empty() && args[0][0] == '#')
{
- // ignore '#' comments
+ // ignore '#' comments
MacroEvent event;
event.type = MacroEvent::kNull;
return event;
@@ -162,7 +162,7 @@ MacroButtonEventHandler::init(UInput& uinput, int slot, bool extra_devices)
case EV_ABS:
i->init.event.resolve_device_id(slot, extra_devices);
uinput.add_abs(i->init.event.get_device_id(), i->init.event.code,
- i->init.minimum, i->init.maximum,
+ i->init.minimum, i->init.maximum,
i->init.fuzz, i->init.flat);
break;
diff --git a/src/buttonevent/macro_button_event_handler.hpp b/src/buttonevent/macro_button_event_handler.hpp
index 65647d2..2b12ba5 100644
--- a/src/buttonevent/macro_button_event_handler.hpp
+++ b/src/buttonevent/macro_button_event_handler.hpp
@@ -26,8 +26,8 @@ class MacroButtonEventHandler : public ButtonEventHandler
public:
private:
struct MacroEvent {
- enum { kInitOp, kSendOp, kWaitOp, kNull } type;
-
+ enum { kInitOp, kSendOp, kWaitOp, kNull } type;
+
union {
struct {
UIEvent event;
diff --git a/src/buttonevent/rel_button_event_handler.cpp b/src/buttonevent/rel_button_event_handler.cpp
index 9cc8bbb..32cb84c 100644
--- a/src/buttonevent/rel_button_event_handler.cpp
+++ b/src/buttonevent/rel_button_event_handler.cpp
@@ -40,12 +40,12 @@ RelButtonEventHandler::from_string(const std::string& str)
ev.reset(new RelButtonEventHandler(str2rel_event(*i)));
break;
- case 1:
+ case 1:
ev->m_value = boost::lexical_cast<int>(*i);
break;
-
- case 2:
- ev->m_repeat = boost::lexical_cast<int>(*i);
+
+ case 2:
+ ev->m_repeat = boost::lexical_cast<int>(*i);
break;
}
}
@@ -88,7 +88,7 @@ RelButtonEventHandler::send(UInput& uinput, bool value)
{
uinput.send_rel_repetitive(m_code, m_value, -1);
}
- }
+ }
}
std::string
diff --git a/src/buttonfilter/log_button_filter.cpp b/src/buttonfilter/log_button_filter.cpp
index 9290bee..dfc6c5a 100644
--- a/src/buttonfilter/log_button_filter.cpp
+++ b/src/buttonfilter/log_button_filter.cpp
@@ -52,7 +52,7 @@ LogButtonFilter::str() const
{
std::ostringstream out;
out << "log:" << m_name;
- return out.str();
+ return out.str();
}
/* EOF */
diff --git a/src/chatpad.cpp b/src/chatpad.cpp
index f4fa69e..7221404 100644
--- a/src/chatpad.cpp
+++ b/src/chatpad.cpp
@@ -23,7 +23,7 @@
#include "raise_exception.hpp"
#include "usb_helper.hpp"
-struct USBControlMsg
+struct USBControlMsg
{
uint8_t bmRequestType;
uint8_t bRequest;
@@ -38,8 +38,8 @@ struct USBControlMsg
==================
bInterfaceNumber 2
bInterfaceClass 255 Vendor Specific Class
- bInterfaceSubClass 93
- bInterfaceProtocol 2
+ bInterfaceSubClass 93
+ bInterfaceProtocol 2
*/
Chatpad::Chatpad(libusb_device_handle* handle, uint16_t bcdDevice,
bool no_init, bool debug) :
@@ -63,56 +63,56 @@ Chatpad::Chatpad(libusb_device_handle* handle, uint16_t bcdDevice,
memset(m_state, 0, 256);
m_keymap[CHATPAD_KEY_1] = KEY_1;
- m_keymap[CHATPAD_KEY_2] = KEY_2;
- m_keymap[CHATPAD_KEY_3] = KEY_3;
- m_keymap[CHATPAD_KEY_4] = KEY_4;
- m_keymap[CHATPAD_KEY_5] = KEY_5;
- m_keymap[CHATPAD_KEY_6] = KEY_6;
- m_keymap[CHATPAD_KEY_7] = KEY_7;
- m_keymap[CHATPAD_KEY_8] = KEY_8;
- m_keymap[CHATPAD_KEY_9] = KEY_9;
- m_keymap[CHATPAD_KEY_0] = KEY_0;
- m_keymap[CHATPAD_KEY_Q] = KEY_Q;
- m_keymap[CHATPAD_KEY_W] = KEY_W;
- m_keymap[CHATPAD_KEY_E] = KEY_E;
- m_keymap[CHATPAD_KEY_R] = KEY_R;
- m_keymap[CHATPAD_KEY_T] = KEY_T;
- m_keymap[CHATPAD_KEY_Y] = KEY_Y;
- m_keymap[CHATPAD_KEY_U] = KEY_U;
- m_keymap[CHATPAD_KEY_I] = KEY_I;
- m_keymap[CHATPAD_KEY_O] = KEY_O;
- m_keymap[CHATPAD_KEY_P] = KEY_P;
- m_keymap[CHATPAD_KEY_A] = KEY_A;
- m_keymap[CHATPAD_KEY_S] = KEY_S;
- m_keymap[CHATPAD_KEY_D] = KEY_D;
- m_keymap[CHATPAD_KEY_F] = KEY_F;
- m_keymap[CHATPAD_KEY_G] = KEY_G;
- m_keymap[CHATPAD_KEY_H] = KEY_H;
- m_keymap[CHATPAD_KEY_J] = KEY_J;
- m_keymap[CHATPAD_KEY_K] = KEY_K;
- m_keymap[CHATPAD_KEY_L] = KEY_L;
- m_keymap[CHATPAD_KEY_COMMA] = KEY_COMMA;
- m_keymap[CHATPAD_KEY_Z] = KEY_Z;
- m_keymap[CHATPAD_KEY_X] = KEY_X;
- m_keymap[CHATPAD_KEY_C] = KEY_C;
- m_keymap[CHATPAD_KEY_V] = KEY_V;
- m_keymap[CHATPAD_KEY_B] = KEY_B;
- m_keymap[CHATPAD_KEY_N] = KEY_N;
- m_keymap[CHATPAD_KEY_M] = KEY_M;
+ m_keymap[CHATPAD_KEY_2] = KEY_2;
+ m_keymap[CHATPAD_KEY_3] = KEY_3;
+ m_keymap[CHATPAD_KEY_4] = KEY_4;
+ m_keymap[CHATPAD_KEY_5] = KEY_5;
+ m_keymap[CHATPAD_KEY_6] = KEY_6;
+ m_keymap[CHATPAD_KEY_7] = KEY_7;
+ m_keymap[CHATPAD_KEY_8] = KEY_8;
+ m_keymap[CHATPAD_KEY_9] = KEY_9;
+ m_keymap[CHATPAD_KEY_0] = KEY_0;
+ m_keymap[CHATPAD_KEY_Q] = KEY_Q;
+ m_keymap[CHATPAD_KEY_W] = KEY_W;
+ m_keymap[CHATPAD_KEY_E] = KEY_E;
+ m_keymap[CHATPAD_KEY_R] = KEY_R;
+ m_keymap[CHATPAD_KEY_T] = KEY_T;
+ m_keymap[CHATPAD_KEY_Y] = KEY_Y;
+ m_keymap[CHATPAD_KEY_U] = KEY_U;
+ m_keymap[CHATPAD_KEY_I] = KEY_I;
+ m_keymap[CHATPAD_KEY_O] = KEY_O;
+ m_keymap[CHATPAD_KEY_P] = KEY_P;
+ m_keymap[CHATPAD_KEY_A] = KEY_A;
+ m_keymap[CHATPAD_KEY_S] = KEY_S;
+ m_keymap[CHATPAD_KEY_D] = KEY_D;
+ m_keymap[CHATPAD_KEY_F] = KEY_F;
+ m_keymap[CHATPAD_KEY_G] = KEY_G;
+ m_keymap[CHATPAD_KEY_H] = KEY_H;
+ m_keymap[CHATPAD_KEY_J] = KEY_J;
+ m_keymap[CHATPAD_KEY_K] = KEY_K;
+ m_keymap[CHATPAD_KEY_L] = KEY_L;
+ m_keymap[CHATPAD_KEY_COMMA] = KEY_COMMA;
+ m_keymap[CHATPAD_KEY_Z] = KEY_Z;
+ m_keymap[CHATPAD_KEY_X] = KEY_X;
+ m_keymap[CHATPAD_KEY_C] = KEY_C;
+ m_keymap[CHATPAD_KEY_V] = KEY_V;
+ m_keymap[CHATPAD_KEY_B] = KEY_B;
+ m_keymap[CHATPAD_KEY_N] = KEY_N;
+ m_keymap[CHATPAD_KEY_M] = KEY_M;
m_keymap[CHATPAD_KEY_PERIOD] = KEY_DOT;
- m_keymap[CHATPAD_KEY_ENTER] = KEY_ENTER;
- m_keymap[CHATPAD_KEY_BACKSPACE] = KEY_BACKSPACE;
- m_keymap[CHATPAD_KEY_LEFT] = KEY_LEFT;
- m_keymap[CHATPAD_KEY_SPACEBAR] = KEY_SPACE;
+ m_keymap[CHATPAD_KEY_ENTER] = KEY_ENTER;
+ m_keymap[CHATPAD_KEY_BACKSPACE] = KEY_BACKSPACE;
+ m_keymap[CHATPAD_KEY_LEFT] = KEY_LEFT;
+ m_keymap[CHATPAD_KEY_SPACEBAR] = KEY_SPACE;
m_keymap[CHATPAD_KEY_RIGHT] = KEY_RIGHT;
m_keymap[CHATPAD_MOD_SHIFT] = KEY_LEFTSHIFT;
m_keymap[CHATPAD_MOD_GREEN] = KEY_LEFTALT;
m_keymap[CHATPAD_MOD_ORANGE] = KEY_LEFTCTRL;
m_keymap[CHATPAD_MOD_PEOPLE] = KEY_LEFTMETA;
-
+
init_uinput();
-
+
if (no_init)
{
m_init_state = kStateKeepAlive_1e;
@@ -196,7 +196,7 @@ Chatpad::on_read_data(libusb_transfer* transfer)
{
//log_tmp("chatpad data: " << usb_transfer_strerror(transfer->status) << " "
// << raw2str(transfer->buffer, transfer->actual_length));
-
+
if (transfer->actual_length == 5 && transfer->buffer[0] == 0x00)
{
struct ChatpadKeyMsg msg;
@@ -219,7 +219,7 @@ Chatpad::send_timeout(int msec)
{
// FIMXE: must keep track of sources and destroy them in ~Chatpad()
//assert(m_timeout_id == -1);
- //m_timeout_id =
+ //m_timeout_id =
g_timeout_add(1000, &Chatpad::on_timeout_wrap, this);
}
@@ -370,7 +370,7 @@ Chatpad::on_timeout()
void
Chatpad::send_ctrl(uint8_t request_type, uint8_t request, uint16_t value, uint16_t index,
- uint8_t* data_in, uint16_t length,
+ uint8_t* data_in, uint16_t length,
libusb_transfer_cb_fn callback, void* userdata)
{
libusb_transfer* transfer = libusb_alloc_transfer(0);
@@ -382,7 +382,7 @@ Chatpad::send_ctrl(uint8_t request_type, uint8_t request, uint16_t value, uint16
libusb_fill_control_setup(data, request_type, request, value, index, length);
memcpy(data + 8, data_in, length);
libusb_fill_control_transfer(transfer, m_handle, data,
- callback, userdata,
+ callback, userdata,
0);
int ret;
@@ -505,7 +505,7 @@ Chatpad::process(const ChatpadKeyMsg& msg)
void
Chatpad::read_thread()
{
- try
+ try
{
uint8_t data[5];
while(!m_quit_thread)
@@ -523,7 +523,7 @@ Chatpad::read_thread()
{
log_debug("read: " << len << "/5: data: " << raw2str(data, len));
}
-
+
if (data[0] == 0x00)
{
struct ChatpadKeyMsg msg;
@@ -550,7 +550,7 @@ Chatpad::keep_alive_thread()
send_ctrl(0x41, 0x0, 0x1f, 0x02, NULL, 0);
log_debug("0x1f");
sleep(1);
-
+
send_ctrl(0x41, 0x0, 0x1e, 0x02, NULL, 0);
log_debug("0x1e");
sleep(1);
@@ -608,7 +608,7 @@ Chatpad::send_init()
ret = libusb_control_transfer(m_handle, 0x40, 0xa1, 0x0000, 0xe416, buf, 2, 0); // (send 2 bytes, data must be 0x09 0x00)
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)
log_debug("ret: " << usb_strerror(ret) << " " << static_cast<int>(buf[0]) << " " << static_cast<int>(buf[1]));
@@ -626,7 +626,7 @@ Chatpad::send_init()
libusb_control_transfer(m_handle, 0x41, 0x0, 0x1f, 0x02, 0, 0, 0);
log_debug("0x1f");
sleep(1);
-
+
libusb_control_transfer(m_handle, 0x41, 0x0, 0x1e, 0x02, 0, 0, 0);
log_debug("0x1e");
diff --git a/src/chatpad.hpp b/src/chatpad.hpp
index 9ea067f..75aa604 100644
--- a/src/chatpad.hpp
+++ b/src/chatpad.hpp
@@ -115,7 +115,7 @@ private:
struct ChatpadMsg
{
uint8_t type;
-
+
union {
struct {
uint8_t unknown1;
@@ -166,7 +166,7 @@ public:
void send_init();
void set_led(unsigned int led, bool state);
- bool get_led(unsigned int led);
+ bool get_led(unsigned int led);
void process(const ChatpadKeyMsg& msg);
void init_uinput();
@@ -175,7 +175,7 @@ private:
void send_command();
void send_timeout(int msec);
void send_ctrl(uint8_t request_type, uint8_t request, uint16_t value, uint16_t index,
- uint8_t* data_in = NULL, uint16_t length = 0,
+ uint8_t* data_in = NULL, uint16_t length = 0,
libusb_transfer_cb_fn callback = NULL, void* userdata = NULL);
void usb_submit_read(int endpoint, int len);
diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp
index 3a8783a..8173af3 100644
--- a/src/command_line_options.cpp
+++ b/src/command_line_options.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -153,7 +153,7 @@ CommandLineParser::init_argp()
.add_usage("[OPTION]...")
.add_text("Xbox360 USB Gamepad Userspace Driver")
.add_newline()
-
+
.add_text("General Options: ")
.add_option(OPTION_HELP, 'h', "help", "", "display this help and exit")
.add_option(OPTION_VERSION, 'V', "version", "", "print the version number and exit")
@@ -182,7 +182,7 @@ CommandLineParser::init_argp()
.add_text("Config File 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")
+ .add_option(OPTION_CONFIG_OPTION,'o', "option", "NAME=VALUE", "Set the given configuration option")
.add_option(OPTION_WRITE_CONFIG, 0, "write-config", "FILE", "write an example configuration to FILE")
.add_newline()
@@ -321,7 +321,7 @@ CommandLineParser::init_argp()
.add_pseudo(" square, square-axis=XAXIS:YAXIS", "Convert the circular motion range of the given stick to a square one")
.add_pseudo(" rotate=XAXIS:YAXIS:DEGREE[:MIRROR]", "Rotate the given stick by DEGREE, optionally also mirror it")
.add_newline()
-
+
.add_text("See README for more documentation and examples.")
.add_text("Report bugs to Ingo Ruhnke <grumbel at gmail.com>");
}
@@ -349,7 +349,7 @@ CommandLineParser::init_ini(Options* opts)
("busid", &opts->busid)
("devid", &opts->devid)
("vendor-id", &opts->vendor_id)
- ("product-id", &opts->product_id)
+ ("product-id", &opts->product_id)
("evdev", &opts->evdev_device)
("evdev-grab", &opts->evdev_grab)
("evdev-debug", &opts->evdev_debug)
@@ -395,7 +395,7 @@ CommandLineParser::init_ini(Options* opts)
;
m_ini.section("xboxdrv-daemon")
- ("detach",
+ ("detach",
boost::bind(&Options::set_daemon_detach, opts, true),
boost::bind(&Options::set_daemon_detach, opts, false))
("dbus", boost::bind(&Options::set_dbus_mode, opts, _1))
@@ -426,21 +426,21 @@ CommandLineParser::init_ini(Options* opts)
boost::bind(&CommandLineParser::set_modifier_n, this, controller, config, _1, _2));
m_ini.section((boost::format("controller%d/config%d/ui-buttonmap") % controller % config).str(),
boost::bind(&CommandLineParser::set_ui_buttonmap_n, this, controller, config, _1, _2));
- m_ini.section((boost::format("controller%d/config%d/ui-axismap") % controller % config).str(),
+ m_ini.section((boost::format("controller%d/config%d/ui-axismap") % controller % config).str(),
boost::bind(&CommandLineParser::set_ui_axismap_n, this, controller, config, _1, _2));
m_ini.section((boost::format("controller%d/config%d/buttonmap") % controller % config).str(),
boost::bind(&CommandLineParser::set_buttonmap_n, this, controller, config, _1, _2));
- m_ini.section((boost::format("controller%d/config%d/axismap") % controller % config).str(),
+ m_ini.section((boost::format("controller%d/config%d/axismap") % controller % config).str(),
boost::bind(&CommandLineParser::set_axismap_n, this, controller, config, _1, _2));
- m_ini.section((boost::format("controller%d/config%d/autofire") % controller % config).str(),
+ m_ini.section((boost::format("controller%d/config%d/autofire") % controller % config).str(),
boost::bind(&CommandLineParser::set_autofire_n, this, controller, config, _1, _2));
- m_ini.section((boost::format("controller%d/config%d/relative-axis") % controller % config).str(),
+ m_ini.section((boost::format("controller%d/config%d/relative-axis") % controller % config).str(),
boost::bind(&CommandLineParser::set_relative_axis_n, this, controller, config, _1, _2));
- m_ini.section((boost::format("controller%d/config%d/calibration") % controller % config).str(),
+ m_ini.section((boost::format("controller%d/config%d/calibration") % controller % config).str(),
boost::bind(&CommandLineParser::set_calibration_n, this, controller, config, _1, _2));
- m_ini.section((boost::format("controller%d/config%d/axis-sensitivity") % controller % config).str(),
+ m_ini.section((boost::format("controller%d/config%d/axis-sensitivity") % controller % config).str(),
boost::bind(&CommandLineParser::set_axis_sensitivity_n, this, controller, config, _1, _2));
}
}
@@ -451,7 +451,7 @@ CommandLineParser::init_ini(Options* opts)
void
CommandLineParser::parse_args(int argc, char** argv, Options* options)
-{
+{
init_ini(options);
m_options = options;
@@ -471,7 +471,7 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
case OPTION_VERSION:
opts.mode = Options::PRINT_VERSION;
break;
-
+
case OPTION_VERBOSE:
opts.set_verbose();
break;
@@ -697,7 +697,7 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
case OPTION_DEVICE_USBIDS:
process_name_value_string(opt.argument, boost::bind(&CommandLineParser::set_device_usbid, this, _1, _2));
break;
-
+
case OPTION_DEVICE_NAME:
opts.set_device_name(opt.argument);
break;
@@ -757,7 +757,7 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
case OPTION_EVDEV_DEBUG:
opts.evdev_debug = true;
break;
-
+
case OPTION_EVDEV_NO_GRAB:
opts.evdev_grab = false;
break;
@@ -800,11 +800,11 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
case OPTION_NO_EXTRA_EVENTS:
opts.extra_events = false;
break;
-
+
case OPTION_DPAD_ONLY:
opts.set_dpad_only();
break;
-
+
case OPTION_DPAD_AS_BUTTON:
opts.set_dpad_as_button();
break;
@@ -820,11 +820,11 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
case OPTION_TRIGGER_AS_BUTTON:
opts.set_trigger_as_button();
break;
-
+
case OPTION_TRIGGER_AS_ZAXIS:
opts.set_trigger_as_zaxis();
break;
-
+
case OPTION_AUTOFIRE:
process_name_value_string(opt.argument, boost::bind(&CommandLineParser::set_autofire, this, _1, _2));
break;
@@ -903,7 +903,7 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
char devid[4] = { '\0' };
if (sscanf(opt.argument.c_str(), "%3s:%3s", busid, devid) != 2)
- {
+ {
raise_exception(std::runtime_error, opt.option << " expected an argument in form BUS:DEV (i.e. 006:003)");
}
else
@@ -917,7 +917,7 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
case OPTION_GENERIC_USB_SPEC:
set_generic_usb_spec(opt.argument);
break;
-
+
case OPTION_LIST_SUPPORTED_DEVICES:
opts.mode = Options::RUN_LIST_SUPPORTED_DEVICES;
break;
@@ -991,7 +991,7 @@ CommandLineParser::print_help() const
void
CommandLineParser::print_led_help() const
{
- std::cout <<
+ std::cout <<
"Possible values for '--led VALUE' are:\n\n"
" 0: off\n"
" 1: all blinking\n"
@@ -1011,7 +1011,7 @@ CommandLineParser::print_led_help() const
" 15: blink once\n"
<< std::endl;
}
-
+
void
CommandLineParser::print_version() const
{
@@ -1066,7 +1066,7 @@ CommandLineParser::set_ui_buttonmap(ButtonMap& btn_map, const std::string& name,
for(tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t, ++idx)
{
switch(idx)
- {
+ {
case 0: // shift+key portion
{
std::string::size_type j = t->find('+');
@@ -1080,7 +1080,7 @@ CommandLineParser::set_ui_buttonmap(ButtonMap& btn_map, const std::string& name,
shift = string2btn(t->substr(0, j));
btn = string2btn(t->substr(j+1));
}
-
+
if (value.empty())
{ // if no rhs value is given, add filters to the current binding
event = btn_map.lookup(shift, btn);
@@ -1130,7 +1130,7 @@ CommandLineParser::set_ui_axismap(AxisMap& axis_map, const std::string& name, co
for(tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t, ++idx)
{
switch(idx)
- {
+ {
case 0: // shift+key portion
{
std::string::size_type j = t->find('+');
@@ -1144,7 +1144,7 @@ CommandLineParser::set_ui_axismap(AxisMap& axis_map, const std::string& name, co
shift = string2btn(t->substr(0, j));
axis = string2axis(t->substr(j+1));
}
-
+
if (value.empty())
{ // if no rhs value is given, add filters to the current binding
event = axis_map.lookup(shift, axis);
@@ -1236,7 +1236,7 @@ CommandLineParser::set_calibration(const std::string& name, const std::string& v
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
tokenizer tokens(value, boost::char_separator<char>(":", "", boost::keep_empty_tokens));
std::vector<std::string> args(tokens.begin(), tokens.end());
-
+
if (args.size() != 3)
{
throw std::runtime_error("calibration requires MIN:CENTER:MAX as argument");
@@ -1244,8 +1244,8 @@ CommandLineParser::set_calibration(const std::string& name, const std::string& v
else
{
m_options->get_controller_options().calibration_map[string2axis(name)]
- = AxisFilterPtr(new CalibrationAxisFilter(boost::lexical_cast<int>(args[0]),
- boost::lexical_cast<int>(args[1]),
+ = AxisFilterPtr(new CalibrationAxisFilter(boost::lexical_cast<int>(args[0]),
+ boost::lexical_cast<int>(args[1]),
boost::lexical_cast<int>(args[2])));
}
}
@@ -1293,7 +1293,7 @@ CommandLineParser::set_dpad_rotation(const std::string& value)
}
void
-CommandLineParser::read_buildin_config_file(const std::string& filename,
+CommandLineParser::read_buildin_config_file(const std::string& filename,
const char* data, unsigned int data_len)
{
log_info("reading 'buildin://" << filename << "'");
diff --git a/src/command_line_options.hpp b/src/command_line_options.hpp
index 0bbcde1..4f65fe2 100644
--- a/src/command_line_options.hpp
+++ b/src/command_line_options.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -30,14 +30,14 @@ class Xboxdrv;
class ButtonMap;
class AxisMap;
-class CommandLineParser
+class CommandLineParser
{
public:
ArgParser m_argp;
INISchema m_ini;
Options* m_options;
std::vector<std::string> m_directory_context;
-
+
public:
CommandLineParser();
@@ -89,7 +89,7 @@ private:
void set_evdev_absmap(const std::string& name, const std::string& value);
void set_evdev_keymap(const std::string& name, const std::string& value);
- void read_buildin_config_file(const std::string& filename,
+ void read_buildin_config_file(const std::string& filename,
const char* data, unsigned int data_len);
void read_config_file(const std::string& filename);
void read_alt_config_file(const std::string& filename);
diff --git a/src/controller.cpp b/src/controller.cpp
index 1776377..c6e955c 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -69,7 +69,7 @@ Controller::set_led(uint8_t status)
if (m_led_status != status)
{
m_led_status = status;
-
+
set_led_real(m_led_status);
}
}
diff --git a/src/controller.hpp b/src/controller.hpp
index b8f7f25..b3b132d 100644
--- a/src/controller.hpp
+++ b/src/controller.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
diff --git a/src/controller_config.hpp b/src/controller_config.hpp
index bbd955a..8571655 100644
--- a/src/controller_config.hpp
+++ b/src/controller_config.hpp
@@ -33,7 +33,7 @@ private:
UInputConfig m_uinput;
public:
- ControllerConfig(UInput& uinput, int slot, bool extra_devices,
+ ControllerConfig(UInput& uinput, int slot, bool extra_devices,
const ControllerOptions& opts);
std::vector<ModifierPtr>& get_modifier();
diff --git a/src/controller_factory.cpp b/src/controller_factory.cpp
index 0bfb08b..904c539 100644
--- a/src/controller_factory.cpp
+++ b/src/controller_factory.cpp
@@ -33,7 +33,7 @@ ControllerFactory::create(const XPadDevice& dev_type, libusb_device* dev, const
{
switch (dev_type.type)
{
- case GAMEPAD_XBOX360_PLAY_N_CHARGE:
+ case GAMEPAD_XBOX360_PLAY_N_CHARGE:
// FIXME: only trigger this error message in single-instance mode, not in daemon mode
throw std::runtime_error("The Xbox360 Play&Charge cable is for recharging only, it does not transmit data, "
"thus xboxdrv can't support it. You have to get a wireless receiver:\n"
@@ -47,10 +47,10 @@ ControllerFactory::create(const XPadDevice& dev_type, libusb_device* dev, const
case GAMEPAD_XBOX360:
case GAMEPAD_XBOX360_GUITAR:
- return ControllerPtr(new Xbox360Controller(dev,
+ return ControllerPtr(new Xbox360Controller(dev,
opts.chatpad, opts.chatpad_no_init, opts.chatpad_debug,
- opts.headset,
- opts.headset_debug,
+ opts.headset,
+ opts.headset_debug,
opts.headset_dump,
opts.headset_play,
opts.detach_kernel_driver));
@@ -74,7 +74,7 @@ ControllerFactory::create(const XPadDevice& dev_type, libusb_device* dev, const
case GAMEPAD_GENERIC_USB:
{
Options::GenericUSBSpec spec = opts.find_generic_usb_spec(dev_type.idVendor, dev_type.idProduct);
- return ControllerPtr(new GenericUSBController(dev, spec.m_interface, spec.m_endpoint,
+ return ControllerPtr(new GenericUSBController(dev, spec.m_interface, spec.m_endpoint,
opts.detach_kernel_driver));
}
@@ -90,7 +90,7 @@ ControllerFactory::create_multiple(const XPadDevice& dev_type, libusb_device* de
switch (dev_type.type)
{
- case GAMEPAD_XBOX360_PLAY_N_CHARGE:
+ case GAMEPAD_XBOX360_PLAY_N_CHARGE:
// FIXME: only trigger this error message in single-instance mode, not in daemon mode
throw std::runtime_error("The Xbox360 Play&Charge cable is for recharging only, it does not transmit data, "
"thus xboxdrv can't support it. You have to get a wireless receiver:\n"
@@ -105,10 +105,10 @@ ControllerFactory::create_multiple(const XPadDevice& dev_type, libusb_device* de
case GAMEPAD_XBOX360:
case GAMEPAD_XBOX360_GUITAR:
- lst.push_back(ControllerPtr(new Xbox360Controller(dev,
+ lst.push_back(ControllerPtr(new Xbox360Controller(dev,
opts.chatpad, opts.chatpad_no_init, opts.chatpad_debug,
- opts.headset,
- opts.headset_debug,
+ opts.headset,
+ opts.headset_debug,
opts.headset_dump,
opts.headset_play,
opts.detach_kernel_driver)));
@@ -140,7 +140,7 @@ ControllerFactory::create_multiple(const XPadDevice& dev_type, libusb_device* de
case GAMEPAD_GENERIC_USB:
{
Options::GenericUSBSpec spec = opts.find_generic_usb_spec(dev_type.idVendor, dev_type.idProduct);
- lst.push_back(ControllerPtr(new GenericUSBController(dev, spec.m_interface, spec.m_endpoint,
+ lst.push_back(ControllerPtr(new GenericUSBController(dev, spec.m_interface, spec.m_endpoint,
opts.detach_kernel_driver)));
}
break;
diff --git a/src/controller_factory.hpp b/src/controller_factory.hpp
index dbfdcf8..206964f 100644
--- a/src/controller_factory.hpp
+++ b/src/controller_factory.hpp
@@ -27,11 +27,11 @@
class ControllerFactory
{
public:
- static ControllerPtr create(const XPadDevice& dev_type,
- libusb_device* dev,
+ static ControllerPtr create(const XPadDevice& dev_type,
+ libusb_device* dev,
const Options& opts);
- static std::vector<ControllerPtr> create_multiple(const XPadDevice& dev_type,
+ static std::vector<ControllerPtr> create_multiple(const XPadDevice& dev_type,
libusb_device* dev, const Options& opts);
private:
diff --git a/src/controller_match_rule.cpp b/src/controller_match_rule.cpp
index 589ec51..2cef842 100644
--- a/src/controller_match_rule.cpp
+++ b/src/controller_match_rule.cpp
@@ -110,7 +110,7 @@ ControllerMatchRule::match(udev_device* device) const
case kMatchEvdevPath:
assert(!"not implemented");
return false;
-
+
default:
assert(!"never reached");
return false;
@@ -135,10 +135,10 @@ ControllerMatchRule::from_string(const std::string& lhs,
else
{
boost::shared_ptr<ControllerMatchRuleGroup> group(new ControllerMatchRuleGroup);
-
+
group->add_rule(ControllerMatchRulePtr(new ControllerMatchRuleProperty("ID_VENDOR_ID", args[0])));
group->add_rule(ControllerMatchRulePtr(new ControllerMatchRuleProperty("ID_MODEL_ID", args[1])));
-
+
return group;
}
}
@@ -184,10 +184,10 @@ ControllerMatchRule::from_string(const std::string& lhs,
else
{
boost::shared_ptr<ControllerMatchRuleGroup> group(new ControllerMatchRuleGroup);
-
+
group->add_rule(ControllerMatchRulePtr(new ControllerMatchRuleProperty("BUSNUM", args[0])));
group->add_rule(ControllerMatchRulePtr(new ControllerMatchRuleProperty("DEVNUM", args[1])));
-
+
return group;
}
}
diff --git a/src/controller_slot.hpp b/src/controller_slot.hpp
index a7a842e..e433b20 100644
--- a/src/controller_slot.hpp
+++ b/src/controller_slot.hpp
@@ -32,7 +32,7 @@ private:
std::vector<ControllerMatchRulePtr> m_rules;
int m_led_status;
ControllerThreadPtr m_thread;
-
+
const Options& m_opts;
UInput* m_uinput;
@@ -52,7 +52,7 @@ public:
int get_led_status() const { return m_led_status; }
int get_id() const { return m_id; }
ControllerSlotConfigPtr get_config() const { return m_config; }
-
+
ControllerThreadPtr get_thread() const { return m_thread; }
ControllerPtr get_controller() const { return m_thread ? m_thread->get_controller() : ControllerPtr(); }
diff --git a/src/controller_slot_config.cpp b/src/controller_slot_config.cpp
index 57a15b7..d472c02 100644
--- a/src/controller_slot_config.cpp
+++ b/src/controller_slot_config.cpp
@@ -31,7 +31,7 @@
ControllerSlotConfigPtr
ControllerSlotConfig::create(UInput& uinput, int slot, bool extra_devices, const ControllerSlotOptions& opts)
-{
+{
ControllerSlotConfigPtr m_config(new ControllerSlotConfig);
for(ControllerSlotOptions::Options::const_iterator i = opts.get_options().begin();
@@ -46,8 +46,8 @@ ControllerSlotConfig::create(UInput& uinput, int slot, bool extra_devices, const
#ifdef FIXME
// introspection of the config
std::cout << "==[[ Active Modifier ]]==" << std::endl;
- for(std::vector<ModifierPtr>::iterator mod = config->get_modifier().begin();
- mod != config->get_modifier().end();
+ for(std::vector<ModifierPtr>::iterator mod = config->get_modifier().begin();
+ mod != config->get_modifier().end();
++mod)
{
std::cout << (*mod)->str() << std::endl;
@@ -72,7 +72,7 @@ ControllerSlotConfig::create(UInput& uinput, int slot, bool extra_devices, const
// |- FF_SAW_UP
// |- FF_SAW_DOWN
// '- FF_CUSTOM
-
+
// FIXME: this should go through the regular resolution process
uint32_t ff_device = UInput::create_device_id(slot, opts.get_ff_device());
@@ -116,7 +116,7 @@ ControllerSlotConfig::create_modifier(const ControllerOptions& opts, std::vector
i != opts.calibration_map.end();
++i)
{
- axismap->add_filter(i->first, i->second);
+ axismap->add_filter(i->first, i->second);
}
modifier->push_back(axismap);
@@ -128,7 +128,7 @@ ControllerSlotConfig::create_modifier(const ControllerOptions& opts, std::vector
XboxAxis axes[] = { XBOX_AXIS_X1,
XBOX_AXIS_Y1,
-
+
XBOX_AXIS_X2,
XBOX_AXIS_Y2 };
@@ -174,7 +174,7 @@ ControllerSlotConfig::create_modifier(const ControllerOptions& opts, std::vector
for(std::map<XboxAxis, AxisFilterPtr>::const_iterator i = opts.sensitivity_map.begin();
i != opts.sensitivity_map.end(); ++i)
{
- axismap->add_filter(i->first, i->second);
+ axismap->add_filter(i->first, i->second);
}
modifier->push_back(axismap);
@@ -193,7 +193,7 @@ ControllerSlotConfig::create_modifier(const ControllerOptions& opts, std::vector
for(std::map<XboxAxis, AxisFilterPtr>::const_iterator i = opts.relative_axis_map.begin();
i != opts.relative_axis_map.end(); ++i)
{
- axismap->add_filter(i->first, i->second);
+ axismap->add_filter(i->first, i->second);
}
modifier->push_back(axismap);
@@ -211,7 +211,7 @@ ControllerSlotConfig::create_modifier(const ControllerOptions& opts, std::vector
for(std::map<XboxButton, ButtonFilterPtr>::const_iterator i = opts.autofire_map.begin();
i != opts.autofire_map.end(); ++i)
{
- buttonmap->add_filter(i->first, i->second);
+ buttonmap->add_filter(i->first, i->second);
}
modifier->push_back(buttonmap);
@@ -253,7 +253,7 @@ void
ControllerSlotConfig::prev_config()
{
m_current_config -= 1;
-
+
if (m_current_config < 0)
{
m_current_config = static_cast<int>(m_config.size()) - 1;
@@ -279,7 +279,7 @@ void
ControllerSlotConfig::set_current_config(int num)
{
if (num >= 0 && num < static_cast<int>(m_config.size()))
- {
+ {
m_current_config = num;
}
else
diff --git a/src/controller_slot_config.hpp b/src/controller_slot_config.hpp
index 8696bc6..b9f52e6 100644
--- a/src/controller_slot_config.hpp
+++ b/src/controller_slot_config.hpp
@@ -34,12 +34,12 @@ class ControllerSlotConfig
{
public:
/** Creates a ControllerSlotConfig from the Options object and connects it to UInput */
- static ControllerSlotConfigPtr create(UInput& uinput, int slot, bool extra_devices,
+ static ControllerSlotConfigPtr create(UInput& uinput, int slot, bool extra_devices,
const ControllerSlotOptions& opts);
private:
static void create_modifier(const ControllerOptions& options, std::vector<ModifierPtr>* modifier);
-
+
private:
std::vector<ControllerConfigPtr> m_config;
int m_current_config;
diff --git a/src/controller_slot_options.cpp b/src/controller_slot_options.cpp
index b33f13e..e98776b 100644
--- a/src/controller_slot_options.cpp
+++ b/src/controller_slot_options.cpp
@@ -66,7 +66,7 @@ ControllerSlotOptions::get_match_rules() const
const std::map<int, ControllerOptions>&
ControllerSlotOptions::get_options() const
{
- return m_options;
+ return m_options;
}
int
diff --git a/src/controller_thread.cpp b/src/controller_thread.cpp
index 883aac0..cee72c3 100644
--- a/src/controller_thread.cpp
+++ b/src/controller_thread.cpp
@@ -29,7 +29,7 @@
extern bool global_exit_xboxdrv;
-ControllerThread::ControllerThread(ControllerPtr controller,
+ControllerThread::ControllerThread(ControllerPtr controller,
std::auto_ptr<MessageProcessor> processor,
const Options& opts) :
m_controller(controller),
@@ -78,7 +78,7 @@ ControllerThread::on_message(const XboxGenericMsg& msg)
int msec_delta = static_cast<int>(g_timer_elapsed(m_timer, NULL) * 1000.0f);
g_timer_reset(m_timer);
-
+
if (m_processor.get())
{
m_processor->send(msg, msec_delta);
diff --git a/src/controller_thread.hpp b/src/controller_thread.hpp
index 2d3849d..8acee8d 100644
--- a/src/controller_thread.hpp
+++ b/src/controller_thread.hpp
@@ -48,7 +48,7 @@ private:
GTimer* m_timer;
public:
- ControllerThread(ControllerPtr controller, std::auto_ptr<MessageProcessor> processor,
+ ControllerThread(ControllerPtr controller, std::auto_ptr<MessageProcessor> processor,
const Options& opts);
~ControllerThread();
diff --git a/src/dbus_subsystem.cpp b/src/dbus_subsystem.cpp
index b37e836..6c0bc2d 100644
--- a/src/dbus_subsystem.cpp
+++ b/src/dbus_subsystem.cpp
@@ -65,17 +65,17 @@ DBusSubsystem::request_name(const std::string& name)
name.c_str(),
DBUS_NAME_FLAG_REPLACE_EXISTING,
&error);
-
+
if (dbus_error_is_set(&error))
- {
+ {
std::ostringstream out;
out << "failed to get unique dbus name: " << error.message;
dbus_error_free(&error);
throw std::runtime_error(out.str());
}
- if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
- {
+ if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+ {
raise_exception(std::runtime_error, "failed to become primary owner of dbus name");
}
}
@@ -96,7 +96,7 @@ DBusSubsystem::register_controller_slots(const std::vector<ControllerSlotPtr>& s
{
XboxdrvGController* controller = xboxdrv_g_controller_new(i->get());
dbus_g_object_type_install_info(XBOXDRV_TYPE_G_CONTROLLER, &dbus_glib_xboxdrv_controller_object_info);
- dbus_g_connection_register_g_object(m_connection,
+ dbus_g_connection_register_g_object(m_connection,
(boost::format("/org/seul/Xboxdrv/ControllerSlots/%d")
% (i - slots.begin())).str().c_str(),
G_OBJECT(controller));
diff --git a/src/enum_box.hpp b/src/enum_box.hpp
index 29830a7..0e1d3d5 100644
--- a/src/enum_box.hpp
+++ b/src/enum_box.hpp
@@ -40,10 +40,10 @@ protected:
m_string2enum()
{
}
-
+
virtual ~EnumBox() {}
- void add(Enum i, const std::string& name)
+ void add(Enum i, const std::string& name)
{
m_enum2string[i] = name;
m_string2enum[name] = i;
@@ -52,14 +52,14 @@ protected:
public:
typedef typename std::map<Enum, std::string>::iterator iterator;
typedef typename std::map<Enum, std::string>::const_iterator const_iterator;
-
+
const_iterator begin() const { return m_enum2string.begin(); }
const_iterator end() const { return m_enum2string.end(); }
iterator begin() { return m_enum2string.begin(); }
iterator end() { return m_enum2string.end(); }
- Enum operator[](const std::string& str) const
+ Enum operator[](const std::string& str) const
{
typename std::map<std::string, Enum>::const_iterator i = m_string2enum.find(str);
if (i == m_string2enum.end())
diff --git a/src/evdev_absmap.cpp b/src/evdev_absmap.cpp
index bd385ed..f6d492e 100644
--- a/src/evdev_absmap.cpp
+++ b/src/evdev_absmap.cpp
@@ -36,13 +36,13 @@ EvdevAbsMap::bind_plus(int code, XboxAxis axis)
void
EvdevAbsMap::bind_minus(int code, XboxAxis axis)
{
- m_minus_map[code] = axis;
+ m_minus_map[code] = axis;
}
void
EvdevAbsMap::bind_both(int code, XboxAxis axis)
{
- m_both_map[code] = axis;
+ m_both_map[code] = axis;
}
void
@@ -60,10 +60,10 @@ EvdevAbsMap::process(XboxGenericMsg& msg, int code, int value, int min, int max)
std::map<int, XboxAxis>::const_iterator it = m_plus_map.find(code);
if (it != m_plus_map.end())
{
- // '+ 1' so that we round up, instead of round down
+ // '+ 1' so that we round up, instead of round down
const int center = (max - min + 1) / 2;
const float v = to_float(value, center, min);
- set_axis_float(msg, it->second, v);
+ set_axis_float(msg, it->second, v);
}
}
@@ -71,10 +71,10 @@ EvdevAbsMap::process(XboxGenericMsg& msg, int code, int value, int min, int max)
std::map<int, XboxAxis>::const_iterator it = m_minus_map.find(code);
if (it != m_minus_map.end())
{
- // '+ 1' so that we round up, instead of round down
+ // '+ 1' so that we round up, instead of round down
const int center = (max - min + 1) / 2;
const float v = to_float(value, center, max);
- set_axis_float(msg, it->second, v);
+ set_axis_float(msg, it->second, v);
}
}
@@ -82,9 +82,9 @@ EvdevAbsMap::process(XboxGenericMsg& msg, int code, int value, int min, int max)
std::map<int, XboxAxis>::const_iterator it = m_both_map.find(code);
if (it != m_both_map.end())
{
- // '+ 1' so that we round up, instead of round down
+ // '+ 1' so that we round up, instead of round down
const float v = to_float(value, min, max);
- set_axis_float(msg, it->second, v);
+ set_axis_float(msg, it->second, v);
}
}
}
diff --git a/src/evdev_controller.cpp b/src/evdev_controller.cpp
index 6679fda..2922d7b 100644
--- a/src/evdev_controller.cpp
+++ b/src/evdev_controller.cpp
@@ -101,7 +101,7 @@ EvdevController::EvdevController(const std::string& filename,
{
struct input_absinfo absinfo;
ioctl(m_fd, EVIOCGABS(i), &absinfo);
-
+
log_debug(boost::format("abs: %-20s min: %6d max: %6d") % abs2str(i) % absinfo.minimum % absinfo.maximum);
m_absinfo[i] = absinfo;
}
@@ -137,7 +137,7 @@ EvdevController::EvdevController(const std::string& filename,
g_io_channel_set_buffered(m_io_channel, false);
- g_io_add_watch(m_io_channel,
+ g_io_add_watch(m_io_channel,
static_cast<GIOCondition>(G_IO_IN | G_IO_ERR | G_IO_HUP),
&EvdevController::on_read_data_wrap, this);
}
@@ -215,10 +215,10 @@ EvdevController::parse(const struct input_event& ev, XboxGenericMsg& msg_inout)
case EV_ABS:
{
const struct input_absinfo& absinfo = m_absinfo[ev.code];
- m_absmap.process(msg_inout, ev.code,
+ m_absmap.process(msg_inout, ev.code,
// some buggy USB devices report values
// outside the given range, so we clamp it
- Math::clamp(absinfo.minimum, ev.value, absinfo.maximum),
+ Math::clamp(absinfo.minimum, ev.value, absinfo.maximum),
absinfo.minimum, absinfo.maximum);
return true; // FIXME: wrong
break;
@@ -251,7 +251,7 @@ EvdevController::on_read_data(GIOChannel* source, GIOCondition condition)
}
}
}
-
+
return TRUE;
}
diff --git a/src/evdev_controller.hpp b/src/evdev_controller.hpp
index d94aa67..321cdc6 100644
--- a/src/evdev_controller.hpp
+++ b/src/evdev_controller.hpp
@@ -51,7 +51,7 @@ private:
XboxGenericMsg m_msg;
public:
- EvdevController(const std::string& filename,
+ EvdevController(const std::string& filename,
const EvdevAbsMap& absmap,
const std::map<int, XboxButton>& keyMap,
bool grab,
@@ -72,7 +72,7 @@ private:
GIOCondition condition);
static gboolean on_read_data_wrap(GIOChannel* source,
GIOCondition condition,
- gpointer userdata)
+ gpointer userdata)
{
return static_cast<EvdevController*>(userdata)->on_read_data(source, condition);
}
diff --git a/src/evdev_helper.cpp b/src/evdev_helper.cpp
index 1685ac5..57569be 100644
--- a/src/evdev_helper.cpp
+++ b/src/evdev_helper.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -66,7 +66,7 @@ X11KeysymEnum::X11KeysymEnum() :
}
}
-void
+void
X11KeysymEnum::process_keymap(Display* dpy)
{
int min_keycode, max_keycode;
@@ -255,11 +255,11 @@ UIEvent str2abs_event(const std::string& str)
std::string key2str(int v)
{
- try
+ try
{
return evdev_key_names[v];
- }
- catch(const std::exception& err)
+ }
+ catch(const std::exception& err)
{
std::ostringstream str;
str << "KEY_#" << v;
@@ -269,25 +269,25 @@ std::string key2str(int v)
std::string abs2str(int v)
{
- try
+ try
{
return evdev_abs_names[v];
- }
- catch(const std::exception& err)
+ }
+ catch(const std::exception& err)
{
std::ostringstream str;
str << "ABS_#" << v;
- return str.str();
+ return str.str();
}
}
std::string rel2str(int v)
{
- try
+ try
{
return evdev_rel_names[v];
- }
- catch(const std::exception& err)
+ }
+ catch(const std::exception& err)
{
std::ostringstream str;
str << "REL_#" << v;
diff --git a/src/evdev_helper.hpp b/src/evdev_helper.hpp
index d3979b2..31b97de 100644
--- a/src/evdev_helper.hpp
+++ b/src/evdev_helper.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
diff --git a/src/firestorm_dual_controller.cpp b/src/firestorm_dual_controller.cpp
index 5255b9b..c9f91e3 100644
--- a/src/firestorm_dual_controller.cpp
+++ b/src/firestorm_dual_controller.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -40,7 +40,7 @@ struct Firestorm_vsb_Msg
unsigned int back :1;
unsigned int start :1;
-
+
unsigned int thumb_l :1;
unsigned int thumb_r :1;
@@ -49,7 +49,7 @@ struct Firestorm_vsb_Msg
int x1 :8;
int y1 :8;
int x2 :8;
- unsigned int y2 :8;
+ unsigned int y2 :8;
} __attribute__((__packed__));
// 044f:b304
@@ -67,7 +67,7 @@ struct FirestormMsg
unsigned int back :1;
unsigned int start :1;
-
+
unsigned int thumb_l :1;
unsigned int thumb_r :1;
@@ -150,7 +150,7 @@ FirestormDualController::parse_vsb(uint8_t* data_in, int len, XboxGenericMsg* ms
msg.xbox360.thumb_l = data.thumb_l;
msg.xbox360.thumb_r = data.thumb_r;
-
+
msg.xbox360.x1 = scale_8to16(data.x1);
msg.xbox360.y1 = scale_8to16(data.y1);
@@ -172,7 +172,7 @@ FirestormDualController::parse_vsb(uint8_t* data_in, int len, XboxGenericMsg* ms
if (data.dpad == 0x3 || data.dpad == 0x4 || data.dpad == 0x5)
msg.xbox360.dpad_down = 1;
-
+
if (data.dpad == 0x5 || data.dpad == 0x6 || data.dpad == 0x7)
msg.xbox360.dpad_left = 1;
@@ -181,7 +181,7 @@ FirestormDualController::parse_vsb(uint8_t* data_in, int len, XboxGenericMsg* ms
else
{
return false;
- }
+ }
}
bool
@@ -213,7 +213,7 @@ FirestormDualController::parse_default(uint8_t* data_in, int len, XboxGenericMsg
msg.xbox360.thumb_l = data.thumb_l;
msg.xbox360.thumb_r = data.thumb_r;
-
+
msg.xbox360.x1 = scale_8to16(data.x1);
msg.xbox360.y1 = scale_8to16(data.y1);
@@ -235,7 +235,7 @@ FirestormDualController::parse_default(uint8_t* data_in, int len, XboxGenericMsg
if (data.dpad == 0x30 || data.dpad == 0x40 || data.dpad == 0x50)
msg.xbox360.dpad_down = 1;
-
+
if (data.dpad == 0x50 || data.dpad == 0x60 || data.dpad == 0x70)
msg.xbox360.dpad_left = 1;
diff --git a/src/firestorm_dual_controller.hpp b/src/firestorm_dual_controller.hpp
index 37d36c9..62c9045 100644
--- a/src/firestorm_dual_controller.hpp
+++ b/src/firestorm_dual_controller.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
diff --git a/src/force_feedback_handler.cpp b/src/force_feedback_handler.cpp
index 91a1b6f..73480d2 100644
--- a/src/force_feedback_handler.cpp
+++ b/src/force_feedback_handler.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -64,7 +64,7 @@ std::ostream& operator<<(std::ostream& out, const struct ff_effect& effect)
break;
case FF_RAMP:
- out << "FF_RAMP("
+ out << "FF_RAMP("
<< "start_level:" << effect.u.ramp.start_level
<< ", end_level:" << effect.u.ramp.end_level
<< ", envelope:" << effect.u.ramp.envelope << ")";
@@ -190,7 +190,7 @@ ForceFeedbackEffect::ForceFeedbackEffect(const struct ff_effect& effect) :
end_weak_magnitude = clamp(0, 0x7fff, effect.u.rumble.weak_magnitude);
end_strong_magnitude = clamp(0, 0x7fff, effect.u.rumble.strong_magnitude);
break;
-
+
default:
// Unsupported effects
// case FF_SPRING:
@@ -226,7 +226,7 @@ ForceFeedbackEffect::update(int msec_delta)
{ // attack
strong_magnitude = get_pos(start_strong_magnitude, end_strong_magnitude, t, length);
weak_magnitude = get_pos(start_weak_magnitude, end_weak_magnitude, t, length);
-
+
// apply envelope
strong_magnitude = ((envelope.attack_level * t) + strong_magnitude * (envelope.attack_length - t)) / envelope.attack_length;
weak_magnitude = ((envelope.attack_level * t) + weak_magnitude * (envelope.attack_length - t)) / envelope.attack_length;
@@ -276,12 +276,12 @@ ForceFeedbackHandler::ForceFeedbackHandler() :
weak_magnitude(0),
strong_magnitude(0)
{
-
+
}
ForceFeedbackHandler::~ForceFeedbackHandler()
{
-
+
}
int
@@ -296,7 +296,7 @@ ForceFeedbackHandler::upload(const struct ff_effect& effect)
log_debug("FF_UPLOAD("
<< "effect_id:" << effect.id
<< ", effect_type:" << effect.type
- << ",\n " << effect
+ << ",\n " << effect
<< ")");
std::map<int, ForceFeedbackEffect>::iterator i = effects.find(effect.id);
diff --git a/src/force_feedback_handler.hpp b/src/force_feedback_handler.hpp
index ff330f2..54481b8 100644
--- a/src/force_feedback_handler.hpp
+++ b/src/force_feedback_handler.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -41,9 +41,9 @@ public:
// Rumble motor strength
int end_strong_magnitude;
int end_weak_magnitude;
-
+
// Envelope
- struct Envelope
+ struct Envelope
{
Envelope()
: attack_length(0),
@@ -52,7 +52,7 @@ public:
fade_level(0)
{}
- Envelope(const struct ff_envelope& e)
+ Envelope(const struct ff_envelope& e)
: attack_length(e.attack_length),
attack_level(e.attack_level),
fade_length(e.fade_length),
@@ -100,7 +100,7 @@ public:
void upload(const struct ff_effect& effect);
void erase(int id);
-
+
void play(int id);
void stop(int id);
diff --git a/src/generic_usb_controller.cpp b/src/generic_usb_controller.cpp
index b8ad696..79eef70 100644
--- a/src/generic_usb_controller.cpp
+++ b/src/generic_usb_controller.cpp
@@ -23,7 +23,7 @@
#include "helper.hpp"
#include "raise_exception.hpp"
-GenericUSBController::GenericUSBController(libusb_device* dev,
+GenericUSBController::GenericUSBController(libusb_device* dev,
int interface, int endpoint,
bool try_detach) :
USBController(dev),
@@ -41,7 +41,7 @@ GenericUSBController::GenericUSBController(libusb_device* dev,
{
raise_exception(std::runtime_error, "no interfaces available");
}
-
+
if (config->interface[0].num_altsetting == 0)
{
raise_exception(std::runtime_error, "no interface descriptors available");
diff --git a/src/headset.cpp b/src/headset.cpp
index 2d7819e..02994fb 100644
--- a/src/headset.cpp
+++ b/src/headset.cpp
@@ -48,7 +48,7 @@ Headset::play_file(const std::string& filename)
{
std::ostringstream out;
out << "[headset] " << filename << ": " << strerror(errno);
- throw std::runtime_error(out.str());
+ throw std::runtime_error(out.str());
}
else
{
@@ -60,9 +60,9 @@ Headset::play_file(const std::string& filename)
}
else
{
- m_interface->submit_write(4, reinterpret_cast<uint8_t*>(data), len,
+ m_interface->submit_write(4, reinterpret_cast<uint8_t*>(data), len,
boost::bind(&Headset::send_data, this, _1));
- }
+ }
}
}
@@ -70,7 +70,7 @@ void
Headset::record_file(const std::string& filename)
{
m_fout.reset(new std::ofstream(filename.c_str(), std::ios::binary));
-
+
if (!*m_fout)
{
raise_exception(std::runtime_error, filename << ": " << strerror(errno));
@@ -86,7 +86,7 @@ Headset::send_data(libusb_transfer* transfer)
{
// fill the buffer with new data from the file
int len = m_fin->read(reinterpret_cast<char*>(transfer->buffer), transfer->length).gcount();
-
+
if (len != 32)
{
log_error("short read");
diff --git a/src/headset.hpp b/src/headset.hpp
index af69afb..227e747 100644
--- a/src/headset.hpp
+++ b/src/headset.hpp
@@ -38,7 +38,7 @@ public:
~Headset();
void play_file(const std::string& play_filename);
- void record_file(const std::string& dump_filename);
+ void record_file(const std::string& dump_filename);
private:
bool send_data(libusb_transfer* transfer);
diff --git a/src/helper.cpp b/src/helper.cpp
index addebf2..05815dd 100644
--- a/src/helper.cpp
+++ b/src/helper.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -51,9 +51,9 @@ int hexstr2int(const std::string& str)
std::string raw2str(uint8_t* data, int len)
{
std::ostringstream out;
- out << "len: " << len
+ out << "len: " << len
<< " data: ";
-
+
for(int i = 0; i < len; ++i)
out << boost::format("%02x ") % int(data[i]);
@@ -189,7 +189,7 @@ pid_t spawn_exe(const std::string& arg0)
pid_t spawn_exe(const std::vector<std::string>& args)
{
assert(!args.empty());
-
+
pid_t pid = fork();
if (pid == 0)
{
diff --git a/src/helper.hpp b/src/helper.hpp
index 6ab18aa..d1ed3c4 100644
--- a/src/helper.hpp
+++ b/src/helper.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -60,7 +60,7 @@ inline int16_t s16_invert(int16_t v)
inline int16_t scale_8to16(int8_t a)
{
- if (a > 0)
+ if (a > 0)
return static_cast<int16_t>(a * 32767 / 127);
else
return static_cast<int16_t>(a * 32768 / 128);
diff --git a/src/ini_parser.cpp b/src/ini_parser.cpp
index d8c8a98..87a28e6 100644
--- a/src/ini_parser.cpp
+++ b/src/ini_parser.cpp
@@ -28,7 +28,7 @@ INIParser::INIParser(std::istream& in, INIBuilder& builder, const std::string& c
m_context(context),
m_line(1),
m_column(0),
- m_current_char(-1)
+ m_current_char(-1)
{}
void
@@ -37,7 +37,7 @@ INIParser::run()
// read the first char
next();
- while(peek() != -1)
+ while(peek() != -1)
{
if (accept('['))
{
@@ -64,7 +64,7 @@ INIParser::run()
name = get_ident_or_string();
whitespace();
-
+
if (accept(';') || accept('#'))
{ // "name"
eat_rest_of_line();
@@ -80,9 +80,9 @@ INIParser::run()
}
else
{ // "name = value"
- value = get_value_or_string();
+ value = get_value_or_string();
whitespace();
-
+
if (accept(';') || accept('#'))
{ // "name = value # comment"
eat_rest_of_line();
@@ -94,7 +94,7 @@ INIParser::run()
}
}
}
-
+
m_builder.send_pair(name, value);
}
}
@@ -329,7 +329,7 @@ INIParser::get_section()
std::ostringstream str;
while(peek() != ']')
{
- str << static_cast<char>(peek());
+ str << static_cast<char>(peek());
next();
}
return str.str();
diff --git a/src/ini_parser.hpp b/src/ini_parser.hpp
index 57437ed..957012b 100644
--- a/src/ini_parser.hpp
+++ b/src/ini_parser.hpp
@@ -35,7 +35,7 @@ private:
public:
INIParser(std::istream& in, INIBuilder& builder, const std::string& context);
-
+
void run();
private:
@@ -46,14 +46,14 @@ private:
void expect(char c);
std::string get_string();
std::string get_value();
- std::string get_ident();
+ std::string get_ident();
std::string get_value_or_string();
- std::string get_ident_or_string();
+ std::string get_ident_or_string();
void newline();
void eat_rest_of_line();
std::string get_section();
void whitespace();
- int getchar();
+ int getchar();
private:
INIParser(const INIParser&);
diff --git a/src/ini_schema.cpp b/src/ini_schema.cpp
index 628d61f..f85b4b1 100644
--- a/src/ini_schema.cpp
+++ b/src/ini_schema.cpp
@@ -25,12 +25,12 @@ class INIPairSchemaBoolCallback : public INIPairSchema
private:
boost::function<void ()> m_true_callback;
boost::function<void ()> m_false_callback;
-
+
public:
INIPairSchemaBoolCallback(boost::function<void ()> true_callback,
boost::function<void ()> false_callback) :
m_true_callback(true_callback),
- m_false_callback(false_callback)
+ m_false_callback(false_callback)
{}
void call(const std::string& value)
@@ -59,7 +59,7 @@ public:
}
}
- std::string str() const
+ std::string str() const
{
// FIXME: implement me
return "<not implemented>";
@@ -70,7 +70,7 @@ class INIPairSchemaBool : public INIPairSchema
{
private:
bool* m_data;
-
+
public:
INIPairSchemaBool(bool* data) : m_data(data) {}
void call(const std::string& value)
@@ -89,7 +89,7 @@ public:
}
}
- std::string str() const
+ std::string str() const
{
if (m_data)
{
@@ -110,7 +110,7 @@ class INIPairSchemaInt : public INIPairSchema
{
private:
int* m_data;
-
+
public:
INIPairSchemaInt(int* data) : m_data(data) {}
void call(const std::string& value)
@@ -118,7 +118,7 @@ public:
*m_data = atoi(value.c_str());
}
- std::string str() const
+ std::string str() const
{
std::ostringstream out;
out << *m_data;
@@ -134,7 +134,7 @@ class INIPairSchemaFloat : public INIPairSchema
{
private:
float* m_data;
-
+
public:
INIPairSchemaFloat(float* data) : m_data(data) {}
void call(const std::string& value)
@@ -142,7 +142,7 @@ public:
*m_data = atoi(value.c_str());
}
- std::string str() const
+ std::string str() const
{
std::ostringstream out;
out << *m_data;
@@ -158,7 +158,7 @@ class INIPairSchemaString : public INIPairSchema
{
private:
std::string* m_data;
-
+
public:
INIPairSchemaString(std::string* data) : m_data(data) {}
void call(const std::string& value)
@@ -166,7 +166,7 @@ public:
*m_data = value;
}
- std::string str() const
+ std::string str() const
{
// FIXME: implement proper escaping
return *m_data;
@@ -181,10 +181,10 @@ class INIPairSchemaCallback : public INIPairSchema
{
private:
boost::function<void (const std::string&)> m_callback;
-
+
public:
- INIPairSchemaCallback(boost::function<void (const std::string&)> callback) :
- m_callback(callback)
+ INIPairSchemaCallback(boost::function<void (const std::string&)> callback) :
+ m_callback(callback)
{}
void call(const std::string& value)
@@ -193,7 +193,7 @@ public:
m_callback(value);
}
- std::string str() const
+ std::string str() const
{
// FIXME: implement me
return "<not implemented>";
@@ -214,7 +214,7 @@ INISchemaSection::~INISchemaSection()
}
}
-INISchemaSection&
+INISchemaSection&
INISchemaSection::add(const std::string& name, INIPairSchema* schema)
{
Schema::iterator i = m_schema.find(name);
@@ -223,9 +223,9 @@ INISchemaSection::add(const std::string& name, INIPairSchema* schema)
{
delete i->second;
}
-
+
m_schema.insert(std::pair<std::string, INIPairSchema*>(name, schema));
-
+
return *this;
}
@@ -236,21 +236,21 @@ INISchemaSection::operator()(const std::string& name, bool* value)
return *this;
}
-INISchemaSection&
+INISchemaSection&
INISchemaSection::operator()(const std::string& name, int* value)
{
add(name, new INIPairSchemaInt(value));
return *this;
}
-INISchemaSection&
+INISchemaSection&
INISchemaSection::operator()(const std::string& name, float* value)
{
add(name, new INIPairSchemaFloat(value));
return *this;
}
-INISchemaSection&
+INISchemaSection&
INISchemaSection::operator()(const std::string& name, std::string* value)
{
add(name, new INIPairSchemaString(value));
@@ -258,15 +258,15 @@ INISchemaSection::operator()(const std::string& name, std::string* value)
}
INISchemaSection&
-INISchemaSection::operator()(const std::string& name,
+INISchemaSection::operator()(const std::string& name,
boost::function<void ()> true_callback,
boost::function<void ()> false_callback)
{
add(name, new INIPairSchemaBoolCallback(true_callback, false_callback));
- return *this;
+ return *this;
}
-INISchemaSection&
+INISchemaSection&
INISchemaSection::operator()(const std::string& name, boost::function<void (const std::string&)> callback)
{
add(name, new INIPairSchemaCallback(callback));
@@ -317,7 +317,7 @@ INISchema::clear()
}
INISchemaSection&
-INISchema::section(const std::string& name,
+INISchema::section(const std::string& name,
boost::function<void (const std::string&, const std::string&)> callback)
{
Sections::iterator i = m_sections.find(name);
diff --git a/src/ini_schema.hpp b/src/ini_schema.hpp
index 5888a6f..355899b 100644
--- a/src/ini_schema.hpp
+++ b/src/ini_schema.hpp
@@ -34,7 +34,7 @@ public:
class INISchemaSection
{
private:
- typedef std::map<std::string, INIPairSchema*> Schema;
+ typedef std::map<std::string, INIPairSchema*> Schema;
Schema m_schema;
public:
@@ -49,7 +49,7 @@ public:
INISchemaSection& operator()(const std::string& name, float* value);
INISchemaSection& operator()(const std::string& name, std::string* value);
INISchemaSection& operator()(const std::string& name, boost::function<void (const std::string&)> callback);
- INISchemaSection& operator()(const std::string& name,
+ INISchemaSection& operator()(const std::string& name,
boost::function<void ()> true_callback,
boost::function<void ()> false_callback);
@@ -77,8 +77,8 @@ public:
void clear();
- INISchemaSection& section(const std::string& name,
- boost::function<void (const std::string&, const std::string&)> callback
+ INISchemaSection& section(const std::string& name,
+ boost::function<void (const std::string&, const std::string&)> callback
= boost::function<void (const std::string&, const std::string&)>());
INISchemaSection* get_section(const std::string& name) const;
diff --git a/src/linux_uinput.cpp b/src/linux_uinput.cpp
index 234fea7..6d85a86 100644
--- a/src/linux_uinput.cpp
+++ b/src/linux_uinput.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -26,7 +26,7 @@
#include "force_feedback_handler.hpp"
#include "raise_exception.hpp"
-LinuxUinput::LinuxUinput(DeviceType device_type, const std::string& name_,
+LinuxUinput::LinuxUinput(DeviceType device_type, const std::string& name_,
const struct input_id& usbid_) :
m_device_type(device_type),
name(name_),
@@ -115,7 +115,7 @@ LinuxUinput::add_abs(uint16_t code, int min, int max, int fuzz, int flat)
ioctl(m_fd, UI_SET_ABSBIT, code);
user_dev.absmin[code] = min;
- user_dev.absmax[code] = max;
+ user_dev.absmax[code] = max;
user_dev.absfuzz[code] = fuzz;
user_dev.absflat[code] = flat;
}
@@ -175,7 +175,7 @@ LinuxUinput::add_ff(uint16_t code)
}
ioctl(m_fd, UI_SET_FFBIT, code);
- }
+ }
}
void
@@ -277,7 +277,7 @@ LinuxUinput::finish()
g_io_channel_set_buffered(m_io_channel, false);
- m_source_id = g_io_add_watch(m_io_channel,
+ m_source_id = g_io_add_watch(m_io_channel,
static_cast<GIOCondition>(G_IO_IN | G_IO_ERR | G_IO_HUP),
&LinuxUinput::on_read_data_wrap, this);
}
@@ -288,7 +288,7 @@ LinuxUinput::send(uint16_t type, uint16_t code, int32_t value)
{
needs_sync = true;
- struct input_event ev;
+ struct input_event ev;
memset(&ev, 0, sizeof(ev));
gettimeofday(&ev.time, NULL);
@@ -300,7 +300,7 @@ LinuxUinput::send(uint16_t type, uint16_t code, int32_t value)
ev.value = value;
if (write(m_fd, &ev, sizeof(ev)) < 0)
- throw std::runtime_error(std::string("uinput:send_button: ") + strerror(errno));
+ throw std::runtime_error(std::string("uinput:send_button: ") + strerror(errno));
}
void
@@ -381,7 +381,7 @@ LinuxUinput::on_read_data(GIOChannel* source, GIOCondition condition)
ioctl(m_fd, UI_BEGIN_FF_UPLOAD, &upload);
m_ff_handler->upload(upload.effect);
upload.retval = 0;
-
+
ioctl(m_fd, UI_END_FF_UPLOAD, &upload);
}
break;
@@ -399,12 +399,12 @@ LinuxUinput::on_read_data(GIOChannel* source, GIOCondition condition)
ioctl(m_fd, UI_BEGIN_FF_ERASE, &erase);
m_ff_handler->erase(erase.effect_id);
erase.retval = 0;
-
+
ioctl(m_fd, UI_END_FF_ERASE, &erase);
}
break;
- default:
+ default:
log_warn("unhandled event code read");
break;
}
@@ -431,7 +431,7 @@ LinuxUinput::on_read_data(GIOChannel* source, GIOCondition condition)
{
log_error("short read: " << ret);
}
-
+
return TRUE;
}
diff --git a/src/linux_uinput.hpp b/src/linux_uinput.hpp
index 1eb599a..675f21c 100644
--- a/src/linux_uinput.hpp
+++ b/src/linux_uinput.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -41,14 +41,14 @@ private:
int m_fd;
GIOChannel* m_io_channel;
guint m_source_id;
-
+
uinput_user_dev user_dev;
bool key_bit;
bool rel_bit;
bool abs_bit;
bool led_bit;
bool ff_bit;
-
+
bool abs_lst[ABS_CNT];
bool rel_lst[REL_CNT];
bool key_lst[KEY_CNT];
@@ -60,7 +60,7 @@ private:
bool needs_sync;
public:
- LinuxUinput(DeviceType device_type, const std::string& name,
+ LinuxUinput(DeviceType device_type, const std::string& name,
const struct input_id& usbid_);
~LinuxUinput();
@@ -94,7 +94,7 @@ private:
GIOCondition condition);
static gboolean on_read_data_wrap(GIOChannel* source,
GIOCondition condition,
- gpointer userdata)
+ gpointer userdata)
{
return static_cast<LinuxUinput*>(userdata)->on_read_data(source, condition);
}
diff --git a/src/log.cpp b/src/log.cpp
index 156d5e4..2e3f3a7 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -50,7 +50,7 @@ Logger::incr_log_level(LogLevel level)
{
if (get_log_level() < level)
{
- set_log_level(level);
+ set_log_level(level);
}
}
@@ -77,12 +77,12 @@ Logger::append_unchecked(LogLevel level, const std::string& str)
case kDebug: std::cout << "[DEBUG] "; break;
case kTemp: std::cout << "[TEMP] "; break;
}
-
+
std::cout << str << std::endl;
}
void
-Logger::append(LogLevel level, const std::string& str)
+Logger::append(LogLevel level, const std::string& str)
{
if (m_log_level >= level)
{
diff --git a/src/modifier.cpp b/src/modifier.cpp
index 27868df..6d73c66 100644
--- a/src/modifier.cpp
+++ b/src/modifier.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
diff --git a/src/modifier.hpp b/src/modifier.hpp
index 2deb8df..e5005ca 100644
--- a/src/modifier.hpp
+++ b/src/modifier.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
diff --git a/src/modifier/axismap_modifier.hpp b/src/modifier/axismap_modifier.hpp
index 9ffd50e..a3e77d8 100644
--- a/src/modifier/axismap_modifier.hpp
+++ b/src/modifier/axismap_modifier.hpp
@@ -39,7 +39,7 @@ struct AxisMapping
{}
};
-class AxismapModifier : public Modifier
+class AxismapModifier : public Modifier
{
public:
AxismapModifier();
diff --git a/src/modifier/buttonmap_modifier.cpp b/src/modifier/buttonmap_modifier.cpp
index 937c345..c7ca1b8 100644
--- a/src/modifier/buttonmap_modifier.cpp
+++ b/src/modifier/buttonmap_modifier.cpp
@@ -21,7 +21,7 @@
#include <boost/tokenizer.hpp>
#include <sstream>
-ButtonMapping
+ButtonMapping
ButtonMapping::from_string(const std::string& lhs, const std::string& rhs)
{
ButtonMapping mapping;
@@ -57,7 +57,7 @@ ButtonmapModifier::ButtonmapModifier() :
m_buttonmap()
{
}
-
+
void
ButtonmapModifier::update(int msec_delta, XboxGenericMsg& msg)
{
@@ -88,12 +88,12 @@ ButtonmapModifier::update(int msec_delta, XboxGenericMsg& msg)
for(std::vector<ButtonFilterPtr>::iterator j = i->filters.begin(); j != i->filters.end(); ++j)
{
value = (*j)->filter(value);
- }
+ }
set_button(newmsg, i->rhs, value || get_button(newmsg, i->rhs));
}
- msg = newmsg;
+ msg = newmsg;
}
void
diff --git a/src/modifier/buttonmap_modifier.hpp b/src/modifier/buttonmap_modifier.hpp
index 82b6069..d2ef106 100644
--- a/src/modifier/buttonmap_modifier.hpp
+++ b/src/modifier/buttonmap_modifier.hpp
@@ -43,7 +43,7 @@ class ButtonmapModifier : public Modifier
{
public:
ButtonmapModifier();
-
+
void update(int msec_delta, XboxGenericMsg& msg);
void add(const ButtonMapping& mapping);
diff --git a/src/modifier/dpad_restrictor_modifier.cpp b/src/modifier/dpad_restrictor_modifier.cpp
index 8c66ee9..25cea88 100644
--- a/src/modifier/dpad_restrictor_modifier.cpp
+++ b/src/modifier/dpad_restrictor_modifier.cpp
@@ -64,7 +64,7 @@ DpadRestrictorModifier::update(int msec_delta, XboxGenericMsg& msg)
{
case kRestrictFourWay:
if (get_axis(msg, XBOX_AXIS_DPAD_X) && get_axis(msg, XBOX_AXIS_DPAD_Y))
- {
+ {
// a diagonal was pressed, thus we reset the axis that wasn't
// pressed the last time the dpad was touched
set_axis(msg, m_last_unpressed_axis, 0);
diff --git a/src/modifier/dpad_rotation_modifier.cpp b/src/modifier/dpad_rotation_modifier.cpp
index 29969cd..f19e5b1 100644
--- a/src/modifier/dpad_rotation_modifier.cpp
+++ b/src/modifier/dpad_rotation_modifier.cpp
@@ -40,9 +40,9 @@ DpadRotationModifier::from_string(const std::string& value)
int degree = boost::lexical_cast<int>(value);
degree /= 45;
degree %= 8;
- if (degree < 0)
+ if (degree < 0)
degree += 8;
-
+
return new DpadRotationModifier(degree);
}
@@ -95,7 +95,7 @@ DpadRotationModifier::update(int msec_delta, XboxGenericMsg& msg)
}
if (direction != -1)
- {
+ {
direction += m_dpad_rotation;
direction %= 8;
if (direction < 0)
diff --git a/src/modifier/rotate_axis_modifier.hpp b/src/modifier/rotate_axis_modifier.hpp
index 026f8d8..b68951b 100644
--- a/src/modifier/rotate_axis_modifier.hpp
+++ b/src/modifier/rotate_axis_modifier.hpp
@@ -27,7 +27,7 @@ class RotateAxisModifier : public Modifier
{
public:
static RotateAxisModifier* from_string(const std::vector<std::string>& args);
-
+
public:
RotateAxisModifier(XboxAxis xaxis, XboxAxis yaxis, float angle, bool mirror);
diff --git a/src/modifier/statistic_modifier.cpp b/src/modifier/statistic_modifier.cpp
index f844c8c..748e59c 100644
--- a/src/modifier/statistic_modifier.cpp
+++ b/src/modifier/statistic_modifier.cpp
@@ -45,12 +45,12 @@ StatisticModifier::print_stats()
{
std::cout << "Button Press Statistics\n"
<< "=======================\n\n";
-
- std::cout << boost::format("%12s | %5d") % "Name" % "Count" << std::endl;
+
+ std::cout << boost::format("%12s | %5d") % "Name" % "Count" << std::endl;
std::cout << "-------------+---------" << std::endl;
for(int btn = 1; btn < XBOX_BTN_MAX; ++btn)
{
- std::cout << boost::format("%12s : %5d")
+ std::cout << boost::format("%12s : %5d")
% btn2string(static_cast<XboxButton>(btn)) % m_press_count[btn]
<< std::endl;
}
diff --git a/src/options.cpp b/src/options.cpp
index c5b9e89..5bdfc14 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -134,7 +134,7 @@ Options::get_controller_slot() const
else
{
return it->second;
- }
+ }
}
ControllerOptions&
@@ -255,7 +255,7 @@ Options::set_dbus_mode(const std::string& value)
}
else
{
- dbus = kDBusDisabled;
+ dbus = kDBusDisabled;
}
}
catch(const std::exception& err)
@@ -422,7 +422,7 @@ Options::find_generic_usb_spec(int vendor_id_, int product_id_) const
{
for(std::vector<GenericUSBSpec>::const_iterator i = m_generic_usb_specs.begin(); i != m_generic_usb_specs.end(); ++i)
{
- //log_tmp(i->m_vendor_id << " - " << vendor_id_ << " "
+ //log_tmp(i->m_vendor_id << " - " << vendor_id_ << " "
// << i->m_product_id << " - " << product_id_);
if (i->m_vendor_id == vendor_id_ &&
@@ -432,7 +432,7 @@ Options::find_generic_usb_spec(int vendor_id_, int product_id_) const
}
}
- raise_exception(std::runtime_error, "no matching GenericUSBSpec found for "
+ raise_exception(std::runtime_error, "no matching GenericUSBSpec found for "
<< boost::format("%04x:%04x") % static_cast<int>(vendor_id_) % static_cast<int>(product_id_));
}
@@ -441,7 +441,7 @@ Options::finish()
{
// if we have multiple configurations and the toggle button isn't
// set, set it to the guide button
- if (!config_toggle_button_is_set &&
+ if (!config_toggle_button_is_set &&
controller_slots[controller_slot].get_options().size() > 1)
{
config_toggle_button = XBOX_BTN_GUIDE;
diff --git a/src/options.hpp b/src/options.hpp
index 37c929c..a49ced3 100644
--- a/src/options.hpp
+++ b/src/options.hpp
@@ -34,7 +34,7 @@ class Options
{
public:
enum { RUN_DEFAULT,
- RUN_DAEMON,
+ RUN_DAEMON,
RUN_LIST_CONTROLLER,
RUN_LIST_SUPPORTED_DEVICES,
RUN_LIST_SUPPORTED_DEVICES_XPAD,
@@ -76,7 +76,7 @@ public:
Priority priority;
GamepadType gamepad_type;
-
+
// device options
std::string busid;
std::string devid;
@@ -106,7 +106,7 @@ public:
std::string headset_play;
// daemon options
- bool detach;
+ bool detach;
enum DBusSubsystemMode {
kDBusDisabled, /// disable dbus
kDBusAuto, /// choice system or session bus on uid
@@ -164,7 +164,7 @@ public:
m_endpoint(endpoint),
m_packetsize(packetsize)
{}
-
+
int m_vendor_id;
int m_product_id;
int m_interface;
@@ -179,7 +179,7 @@ public:
ControllerSlotOptions& get_controller_slot();
const ControllerSlotOptions& get_controller_slot() const;
-
+
/** Returns the currently active configuration */
ControllerOptions& get_controller_options();
const ControllerOptions& get_controller_options() const;
@@ -213,7 +213,7 @@ public:
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);
diff --git a/src/playstation3_usb_controller.cpp b/src/playstation3_usb_controller.cpp
index 676ebf9..2cf8727 100644
--- a/src/playstation3_usb_controller.cpp
+++ b/src/playstation3_usb_controller.cpp
@@ -54,7 +54,7 @@ void
Playstation3USBController::set_rumble_real(uint8_t left, uint8_t right)
{
//log_tmp("Rumble: " << static_cast<int>(left) << " " << static_cast<int>(right));
- uint8_t cmd[] = {
+ uint8_t cmd[] = {
// FIXME: 254 isn't quite right and the right motor seems to be on/off only
0x00, 254, right, 254, left, // rumble values
0x00, 0x00, 0x00, 0x00, 0x03, // 0x10=LED1 .. 0x02=LED4
@@ -64,7 +64,7 @@ Playstation3USBController::set_rumble_real(uint8_t left, uint8_t right)
0xff, 0x27, 0x10, 0x00, 0x32, // LED 1
0x00, 0x00, 0x00, 0x00, 0x00
};
-
+
usb_control(LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE, // RequestType
HID_SET_REPORT, // Request
(HID_REPORT_TYPE_OUTPUT << 8) | 0x01, // Value
@@ -110,7 +110,7 @@ Playstation3USBController::set_led_real(uint8_t status)
break;
}
- uint8_t cmd[] = {
+ uint8_t cmd[] = {
0x00, 0x00, 0x00, 0x00, 0x00, // rumble values
0x00, 0x00, 0x00, 0x00, ps3_status, // 0x10=LED1 .. 0x02=LED4
0xff, 0x27, 0x10, 0x00, 0x32, // LED 4
@@ -119,7 +119,7 @@ Playstation3USBController::set_led_real(uint8_t status)
0xff, 0x27, 0x10, 0x00, 0x32, // LED 1
0x00, 0x00, 0x00, 0x00, 0x00
};
-
+
usb_control(LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE, // RequestType
HID_SET_REPORT, // Request
(HID_REPORT_TYPE_OUTPUT << 8) | 0x01, // Value
@@ -144,23 +144,23 @@ Playstation3USBController::parse(uint8_t* data, int len, XboxGenericMsg* msg_out
if (false)
{
- log_debug(boost::format("X:%5d Y:%5d Z:%5d RZ:%5d\n")
- % (static_cast<int>(msg_out->ps3usb.accl_x) - 512)
+ log_debug(boost::format("X:%5d Y:%5d Z:%5d RZ:%5d\n")
+ % (static_cast<int>(msg_out->ps3usb.accl_x) - 512)
% (static_cast<int>(msg_out->ps3usb.accl_y) - 512)
% (static_cast<int>(msg_out->ps3usb.accl_z) - 512)
% (static_cast<int>(msg_out->ps3usb.rot_z)));
}
-
+
if (false)
{
// values are normalized to 1g (-116 is force by gravity)
- log_debug(boost::format("X:%6.3f Y:%6.3f Z:%6.3f RZ:%6.3f\n")
+ log_debug(boost::format("X:%6.3f Y:%6.3f Z:%6.3f RZ:%6.3f\n")
% ((static_cast<int>(msg_out->ps3usb.accl_x) - 512) / 116.0f)
% ((static_cast<int>(msg_out->ps3usb.accl_y) - 512) / 116.0f)
% ((static_cast<int>(msg_out->ps3usb.accl_z) - 512) / 116.0f)
% ((static_cast<int>(msg_out->ps3usb.rot_z) - 5)));
}
-
+
if (false)
{
std::ostringstream str;
@@ -173,7 +173,7 @@ Playstation3USBController::parse(uint8_t* data, int len, XboxGenericMsg* msg_out
log_debug(str.str());
}
- return true;
+ return true;
}
else
{
diff --git a/src/pretty_printer.cpp b/src/pretty_printer.cpp
index da824f4..65b1b03 100644
--- a/src/pretty_printer.cpp
+++ b/src/pretty_printer.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -31,7 +31,7 @@ PrettyPrinter::print(const std::string& str)
print("", "", str);
}
-void
+void
PrettyPrinter::print(const std::string& indent_str, const std::string& left, const std::string& str)
{
const int width = terminal_width - indent_str.size() - 1;
@@ -54,7 +54,7 @@ PrettyPrinter::print(const std::string& indent_str, const std::string& left, con
// skip leading space
std::string::size_type start = str.find_first_not_of(' ', 0);
-
+
std::string::size_type word_begin = 0;
int word_begin_column = 0;
enum { SPACE, WORD } state = isspace(str[0]) ? SPACE : WORD;
@@ -66,12 +66,12 @@ PrettyPrinter::print(const std::string& indent_str, const std::string& left, con
{ // flush a word or a space sequence to stdout when a state change occurs
switch(state)
{
- case SPACE:
+ case SPACE:
if (!isspace(str[i]))
{ // flush
state = WORD;
- if (word_begin_column == 0)
+ if (word_begin_column == 0)
{
// ignore space at the start of a new line
@@ -105,7 +105,7 @@ PrettyPrinter::print(const std::string& indent_str, const std::string& left, con
}
}
- { // process the current character
+ { // process the current character
if (str[i] == '\n')
{
std::cout << '\n' << indent_str;
diff --git a/src/pretty_printer.hpp b/src/pretty_printer.hpp
index 641b8c8..acdf5bf 100644
--- a/src/pretty_printer.hpp
+++ b/src/pretty_printer.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
diff --git a/src/saitek_p2500_controller.cpp b/src/saitek_p2500_controller.cpp
index 4734776..0c72914 100644
--- a/src/saitek_p2500_controller.cpp
+++ b/src/saitek_p2500_controller.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2009 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -47,12 +47,12 @@ struct SaitekP2500Msg
// data[6];
unsigned int thumb_l :1;
unsigned int thumb_r :1;
-
+
unsigned int start :1;
unsigned int back :1; // not supported
-
- unsigned int dpad :4;
-
+
+ unsigned int dpad :4;
+
} __attribute__((__packed__));
SaitekP2500Controller::SaitekP2500Controller(libusb_device* dev, bool try_detach) :
@@ -107,7 +107,7 @@ SaitekP2500Controller::parse(uint8_t* data, int len, XboxGenericMsg* msg_out)
msg_out->xbox360.thumb_l = msg_in.thumb_l;
msg_out->xbox360.thumb_r = msg_in.thumb_r;
-
+
msg_out->xbox360.x1 = scale_8to16(msg_in.x1);
msg_out->xbox360.y1 = scale_8to16(msg_in.y1);
diff --git a/src/saitek_p2500_controller.hpp b/src/saitek_p2500_controller.hpp
index dd97e13..fcf06ef 100644
--- a/src/saitek_p2500_controller.hpp
+++ b/src/saitek_p2500_controller.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2009 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -25,7 +25,7 @@
class SaitekP2500Controller : public USBController
{
-private:
+private:
int left_rumble;
int right_rumble;
diff --git a/src/select.hpp b/src/select.hpp
index 232e034..71a4174 100644
--- a/src/select.hpp
+++ b/src/select.hpp
@@ -35,7 +35,7 @@ public:
void clear();
void add_fd(int fd);
bool is_ready(int fd) const;
-
+
int wait();
private:
diff --git a/src/udev_subsystem.cpp b/src/udev_subsystem.cpp
index 3a4584f..dcaaad3 100644
--- a/src/udev_subsystem.cpp
+++ b/src/udev_subsystem.cpp
@@ -61,7 +61,7 @@ UdevSubsystem::set_device_callback(const boost::function<void (udev_device*)>& p
enumerate_udev_devices();
GIOChannel* udev_channel = g_io_channel_unix_new(udev_monitor_get_fd(m_monitor));
- g_io_add_watch(udev_channel,
+ g_io_add_watch(udev_channel,
static_cast<GIOCondition>(G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP),
&UdevSubsystem::on_udev_data_wrap, this);
g_io_channel_unref(udev_channel);
@@ -82,9 +82,9 @@ UdevSubsystem::enumerate_udev_devices()
struct udev_list_entry* devices;
struct udev_list_entry* dev_list_entry;
-
+
devices = udev_enumerate_get_list_entry(enumerate);
- udev_list_entry_foreach(dev_list_entry, devices)
+ udev_list_entry_foreach(dev_list_entry, devices)
{
// name is path, value is NULL
const char* path = udev_list_entry_get_name(dev_list_entry);
@@ -122,9 +122,9 @@ UdevSubsystem::on_udev_data(GIOChannel* channel, GIOCondition condition)
log_error("unknown condition: " << condition);
}
else
- {
+ {
log_info("trying to read data from udev");
-
+
log_info("trying to read data from udev monitor");
struct udev_device* device = udev_monitor_receive_device(m_monitor);
log_info("got data from udev monitor");
@@ -151,7 +151,7 @@ UdevSubsystem::on_udev_data(GIOChannel* channel, GIOCondition condition)
udev_device_unref(device);
}
}
-
+
return true;
}
@@ -160,7 +160,7 @@ UdevSubsystem::print_info(udev_device* device)
{
log_debug("/---------------------------------------------");
log_debug("devpath: " << udev_device_get_devpath(device));
-
+
if (udev_device_get_action(device))
log_debug("action: " << udev_device_get_action(device));
//log_debug("init: " << udev_device_get_is_initialized(device));
@@ -188,7 +188,7 @@ UdevSubsystem::print_info(udev_device* device)
if (udev_device_get_action(device))
log_debug("action: " << udev_device_get_action(device));
-
+
//udev_device_get_sysattr_value(device, "busnum");
//udev_device_get_sysattr_value(device, "devnum");
@@ -198,32 +198,32 @@ UdevSubsystem::print_info(udev_device* device)
log_debug("list: ");
struct udev_list_entry* it = udev_device_get_tags_list_entry(device);
while((it = udev_list_entry_get_next(it)) != 0)
- {
- log_debug(" "
+ {
+ log_debug(" "
<< udev_list_entry_get_name(it) << " = "
<< udev_list_entry_get_value(it)
);
}
}
-
+
{
log_debug("properties: ");
struct udev_list_entry* it = udev_device_get_properties_list_entry(device);
while((it = udev_list_entry_get_next(it)) != 0)
- {
- log_debug(" "
+ {
+ log_debug(" "
<< udev_list_entry_get_name(it) << " = "
<< udev_list_entry_get_value(it)
);
}
}
-
+
{
log_debug("devlist: ");
struct udev_list_entry* it = udev_device_get_tags_list_entry(device);
while((it = udev_list_entry_get_next(it)) != 0)
- {
- log_debug(" "
+ {
+ log_debug(" "
<< udev_list_entry_get_name(it) << " = "
<< udev_list_entry_get_value(it)
);
diff --git a/src/ui_abs_event_collector.cpp b/src/ui_abs_event_collector.cpp
index 4e7135f..97e4c45 100644
--- a/src/ui_abs_event_collector.cpp
+++ b/src/ui_abs_event_collector.cpp
@@ -20,7 +20,7 @@
#include "uinput.hpp"
-UIAbsEventCollector::UIAbsEventCollector(UInput& uinput, uint32_t device_id, int type, int code) :
+UIAbsEventCollector::UIAbsEventCollector(UInput& uinput, uint32_t device_id, int type, int code) :
UIEventCollector(uinput, device_id, type, code),
m_emitters()
{
diff --git a/src/ui_event.cpp b/src/ui_event.cpp
index e80e570..752b9ae 100644
--- a/src/ui_event.cpp
+++ b/src/ui_event.cpp
@@ -34,7 +34,7 @@ UIEvent::is_keyboard_button(int ev_code)
}
UIEvent
-UIEvent::create(int device_id, int type, int code)
+UIEvent::create(int device_id, int type, int code)
{
UIEvent ev;
ev.m_slot_id = SLOTID_AUTO;
@@ -66,7 +66,7 @@ UIEvent::invalid()
ev.m_device_id_resolved = false;
ev.type = -1;
ev.code = -1;
- return ev;
+ return ev;
}
bool
@@ -203,9 +203,9 @@ void split_event_name(const std::string& str, std::string* event_str, int* slot_
{
*event_str = str.substr(0, p);
std::string device = str.substr(p+1);
-
+
p = device.find(".");
-
+
if (p == std::string::npos)
{
*slot_id = SLOTID_AUTO;
diff --git a/src/ui_event.hpp b/src/ui_event.hpp
index b413d23..e51417c 100644
--- a/src/ui_event.hpp
+++ b/src/ui_event.hpp
@@ -34,7 +34,7 @@ enum {
SLOTID_AUTO = static_cast<uint16_t>(-1)
};
-class UIEvent
+class UIEvent
{
public:
static UIEvent create(int device_id, int type, int code);
@@ -60,10 +60,10 @@ private:
bool m_device_id_resolved;
};
-/** in: "BTN_A at 2"
+/** in: "BTN_A at 2"
out: "BTN_A", SLOTID_AUTO, 2
- in: "BTN_A at mouse.2"
+ in: "BTN_A at mouse.2"
out: "BTN_A", 3, DEVICEID_MOUSE
*/
void split_event_name(const std::string& str, std::string* event_str, int* slot_id, int* device_id);
diff --git a/src/ui_event_collector.cpp b/src/ui_event_collector.cpp
index a73df57..44ff957 100644
--- a/src/ui_event_collector.cpp
+++ b/src/ui_event_collector.cpp
@@ -23,9 +23,9 @@
#include "log.hpp"
#include "uinput.hpp"
-UIEventCollector::UIEventCollector(UInput& uinput,
- uint32_t device_id,
- int type,
+UIEventCollector::UIEventCollector(UInput& uinput,
+ uint32_t device_id,
+ int type,
int code) :
m_uinput(uinput),
m_device_id(device_id),
diff --git a/src/ui_event_collector.hpp b/src/ui_event_collector.hpp
index 4c09887..2818789 100644
--- a/src/ui_event_collector.hpp
+++ b/src/ui_event_collector.hpp
@@ -37,7 +37,7 @@ protected:
uint32_t m_device_id;
int m_type;
int m_code;
-
+
public:
UIEventCollector(UInput& uinput, uint32_t device_id, int type, int code);
virtual ~UIEventCollector();
diff --git a/src/ui_event_emitter.hpp b/src/ui_event_emitter.hpp
index c7a2d93..6e72d19 100644
--- a/src/ui_event_emitter.hpp
+++ b/src/ui_event_emitter.hpp
@@ -44,7 +44,7 @@ private:
class UIRelEmitter
{
private:
-
+
public:
UIRelEmitter();
diff --git a/src/ui_event_sequence.cpp b/src/ui_event_sequence.cpp
index 4850295..333996c 100644
--- a/src/ui_event_sequence.cpp
+++ b/src/ui_event_sequence.cpp
@@ -82,7 +82,7 @@ UIEventSequence::send(UInput& uinput, int value)
{
// on release, send events in reverse order
for(UIEventEmitters::reverse_iterator i = m_emitters.rbegin(); i != m_emitters.rend(); ++i)
- {
+ {
(*i)->send(value);
}
}
diff --git a/src/ui_event_sequence.hpp b/src/ui_event_sequence.hpp
index 3356b89..0749862 100644
--- a/src/ui_event_sequence.hpp
+++ b/src/ui_event_sequence.hpp
@@ -26,16 +26,16 @@
class UInput;
-/**
+/**
A sequence of UIEvents (only key events allowed right now)
-
+
FIXME: class name is kind of wrong
*/
class UIEventSequence
{
public:
- /**
- "KEY_LEFTSHIFT+KEY_B"
+ /**
+ "KEY_LEFTSHIFT+KEY_B"
*/
static UIEventSequence from_string(const std::string& value);
diff --git a/src/ui_rel_event_collector.cpp b/src/ui_rel_event_collector.cpp
index a20e940..add934d 100644
--- a/src/ui_rel_event_collector.cpp
+++ b/src/ui_rel_event_collector.cpp
@@ -41,7 +41,7 @@ UIRelEventCollector::send(int value)
}
void
-UIRelEventCollector::sync()
+UIRelEventCollector::sync()
{
}
diff --git a/src/uinput.cpp b/src/uinput.cpp
index 1d07fd8..12cd47e 100644
--- a/src/uinput.cpp
+++ b/src/uinput.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -44,7 +44,7 @@ UInput::parse_input_id(const std::string& str)
usbid.version = 0;
// split string at ':'
- boost::tokenizer<boost::char_separator<char> >
+ boost::tokenizer<boost::char_separator<char> >
tokens(str, boost::char_separator<char>(":", "", boost::keep_empty_tokens));
std::vector<std::string> args;
std::copy(tokens.begin(), tokens.end(), std::back_inserter(args));
@@ -59,7 +59,7 @@ UInput::parse_input_id(const std::string& str)
usbid.vendor = hexstr2int(args[0]);
usbid.product = hexstr2int(args[1]);
usbid.version = hexstr2int(args[2]);
- }
+ }
else if (args.size() == 4)
{ // VENDOR:PRODUCT:VERSION:BUS
usbid.vendor = hexstr2int(args[0]);
@@ -197,15 +197,15 @@ UInput::get_device_name(uint32_t device_id) const
case 0:
case DEVICEID_JOYSTICK:
break;
-
+
case DEVICEID_MOUSE:
str << " - Mouse Emulation";
break;
-
+
case DEVICEID_KEYBOARD:
str << " - Keyboard Emulation";
break;
-
+
default:
str << " - " << device_id+1;
break;
@@ -215,14 +215,14 @@ UInput::get_device_name(uint32_t device_id) const
else
{
it = m_device_names.find(create_device_id(SLOTID_AUTO, type_id));
-
+
if (it != m_device_names.end())
{
// found match for the type, build name and return it
std::ostringstream str;
str << it->second;
if (slot_id > 0)
- {
+ {
str << " #" << (slot_id+1);
}
return str.str();
@@ -246,15 +246,15 @@ UInput::get_device_name(uint32_t device_id) const
{
case DEVICEID_JOYSTICK:
break;
-
+
case DEVICEID_MOUSE:
str << " - Mouse Emulation";
break;
-
+
case DEVICEID_KEYBOARD:
str << " - Keyboard Emulation";
break;
-
+
default:
str << " - " << device_id+1;
break;
@@ -263,7 +263,7 @@ UInput::get_device_name(uint32_t device_id) const
{
str << " #" << (slot_id+1);
}
- return str.str();
+ return str.str();
}
}
}
@@ -271,7 +271,7 @@ UInput::get_device_name(uint32_t device_id) const
LinuxUinput*
UInput::create_uinput_device(uint32_t device_id)
-{
+{
// DEVICEID_AUTO should not happen at this point as the user should
// have called resolve_device_id()
assert(device_id != DEVICEID_AUTO);
@@ -302,7 +302,7 @@ UInput::create_uinput_device(uint32_t device_id)
case DEVICEID_MOUSE:
device_type = LinuxUinput::kMouseDevice;
break;
-
+
case DEVICEID_KEYBOARD:
device_type = LinuxUinput::kKeyboardDevice;
break;
@@ -363,8 +363,8 @@ UInput::create_emitter(int device_id, int type, int code)
// search for an already existing emitter
for(Collectors::iterator i = m_collectors.begin(); i != m_collectors.end(); ++i)
{
- if (static_cast<int>((*i)->get_device_id()) == device_id &&
- (*i)->get_type() == type &&
+ if (static_cast<int>((*i)->get_device_id()) == device_id &&
+ (*i)->get_type() == type &&
(*i)->get_code() == code)
{
return (*i)->create_emitter();
@@ -480,14 +480,14 @@ UInput::send_rel_repetitive(const UIEvent& code, float value, int repeat_interva
rel_rep.time_count = 0;
rel_rep.repeat_interval = repeat_interval;
m_rel_repeat_lst.insert(std::pair<UIEvent, RelRepeat>(code, rel_rep));
-
+
// Send the event once
get_uinput(code.get_device_id())->send(EV_REL, code.code, value);
}
else
{
// FIXME: send old value, store new value for rest
-
+
it->second.code = code;
it->second.value = value;
// it->second.time_count = do not touch this
diff --git a/src/uinput.hpp b/src/uinput.hpp
index 652ea84..263c8fb 100644
--- a/src/uinput.hpp
+++ b/src/uinput.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -30,7 +30,7 @@
struct Xbox360Msg;
struct XboxMsg;
struct Xbox360GuitarMsg;
-
+
class UInput
{
public:
@@ -65,7 +65,7 @@ private:
typedef std::vector<UIEventCollectorPtr> Collectors;
Collectors m_collectors;
- struct RelRepeat
+ struct RelRepeat
{
UIEvent code;
float value;
diff --git a/src/uinput_config.cpp b/src/uinput_config.cpp
index 17f56ca..027a609 100644
--- a/src/uinput_config.cpp
+++ b/src/uinput_config.cpp
@@ -40,7 +40,7 @@ int16_t u8_to_s16(uint8_t value)
UInputConfig::UInputConfig(UInput& uinput, int slot, bool extra_devices, const UInputOptions& opts) :
m_uinput(uinput),
- m_btn_map(opts.get_btn_map()),
+ m_btn_map(opts.get_btn_map()),
m_axis_map(opts.get_axis_map())
{
std::fill_n(axis_state, static_cast<int>(XBOX_AXIS_MAX), 0);
@@ -69,7 +69,7 @@ UInputConfig::send(XboxGenericMsg& msg)
case XBOX_MSG_PS3USB:
send(msg.ps3usb);
break;
-
+
default:
assert(!"never reached");
}
@@ -118,7 +118,7 @@ UInputConfig::send(Xbox360Msg& msg)
// analog sticks
send_axis(XBOX_AXIS_X1, msg.x1);
send_axis(XBOX_AXIS_Y1, s16_invert(msg.y1));
-
+
send_axis(XBOX_AXIS_X2, msg.x2);
send_axis(XBOX_AXIS_Y2, s16_invert(msg.y2));
@@ -230,7 +230,7 @@ UInputConfig::send(Playstation3USBMsg& msg)
// analog sticks
send_axis(XBOX_AXIS_X1, u8_to_s16(msg.x1));
send_axis(XBOX_AXIS_Y1, u8_to_s16(msg.y1));
-
+
send_axis(XBOX_AXIS_X2, u8_to_s16(msg.x2));
send_axis(XBOX_AXIS_Y2, u8_to_s16(msg.y2));
@@ -278,8 +278,8 @@ UInputConfig::send_button(XboxButton code, bool value)
{
for(int j = 0; j < XBOX_BTN_MAX; ++j) // iterate over all shift buttons
{
- m_btn_map.send(m_uinput,
- static_cast<XboxButton>(j), static_cast<XboxButton>(i),
+ m_btn_map.send(m_uinput,
+ static_cast<XboxButton>(j), static_cast<XboxButton>(i),
false);
}
}
@@ -333,10 +333,10 @@ UInputConfig::send_axis(XboxAxis code, int32_t value)
}
}
}
-
+
// find the last AxisEvent bound to current axis code
for(int shift = 1; shift < XBOX_BTN_MAX; ++shift)
- {
+ {
if (last_button_state[shift])
{
AxisEventPtr new_ev = m_axis_map.lookup(static_cast<XboxButton>(shift), code);
diff --git a/src/uinput_config.hpp b/src/uinput_config.hpp
index ae4454a..3c05eb1 100644
--- a/src/uinput_config.hpp
+++ b/src/uinput_config.hpp
@@ -44,7 +44,7 @@ private:
public:
UInputConfig(UInput& uinput, int slot, bool extra_devices, const UInputOptions& opts);
- void send(XboxGenericMsg& msg);
+ void send(XboxGenericMsg& msg);
void update(int msec_delta);
void reset_all_outputs();
diff --git a/src/uinput_message_processor.cpp b/src/uinput_message_processor.cpp
index d9ec3b7..8758cbb 100644
--- a/src/uinput_message_processor.cpp
+++ b/src/uinput_message_processor.cpp
@@ -21,8 +21,8 @@
#include "log.hpp"
#include "uinput.hpp"
-UInputMessageProcessor::UInputMessageProcessor(UInput& uinput,
- ControllerSlotConfigPtr config,
+UInputMessageProcessor::UInputMessageProcessor(UInput& uinput,
+ ControllerSlotConfigPtr config,
const Options& opts) :
m_uinput(uinput),
m_config(config),
@@ -44,13 +44,13 @@ UInputMessageProcessor::send(const XboxGenericMsg& msg_in, int msec_delta)
{
if (!m_config->empty())
{
- XboxGenericMsg msg = msg_in;
+ XboxGenericMsg msg = msg_in;
if (m_rumble_test)
{
log_debug("rumble: " << get_axis(msg, XBOX_AXIS_LT) << " " << get_axis(msg, XBOX_AXIS_RT));
- set_rumble(get_axis(msg, XBOX_AXIS_LT),
+ set_rumble(get_axis(msg, XBOX_AXIS_LT),
get_axis(msg, XBOX_AXIS_RT));
}
@@ -74,7 +74,7 @@ UInputMessageProcessor::send(const XboxGenericMsg& msg_in, int msec_delta)
// run the controller message through all modifier
for(std::vector<ModifierPtr>::iterator i = m_config->get_config()->get_modifier().begin();
- i != m_config->get_config()->get_modifier().end();
+ i != m_config->get_config()->get_modifier().end();
++i)
{
(*i)->update(msec_delta, msg);
@@ -103,7 +103,7 @@ UInputMessageProcessor::set_rumble(uint8_t lhs, uint8_t rhs)
{
lhs = std::min(lhs * m_rumble_gain / 255, 255);
rhs = std::min(rhs * m_rumble_gain / 255, 255);
-
+
m_rumble_callback(lhs, rhs);
}
}
diff --git a/src/uinput_options.cpp b/src/uinput_options.cpp
index 1130bb9..e8f0710 100644
--- a/src/uinput_options.cpp
+++ b/src/uinput_options.cpp
@@ -34,7 +34,7 @@ UInputOptions::get_btn_map()
return m_btn_map;
}
-AxisMap&
+AxisMap&
UInputOptions::get_axis_map()
{
return m_axis_map;
@@ -46,7 +46,7 @@ UInputOptions::get_btn_map() const
return m_btn_map;
}
-const AxisMap&
+const AxisMap&
UInputOptions::get_axis_map() const
{
return m_axis_map;
@@ -58,22 +58,22 @@ UInputOptions::mimic_xpad()
// device_name is set in Options::set_mimic_xpad()
get_axis_map().clear();
get_btn_map().clear();
-
+
get_btn_map().bind(XBOX_BTN_START, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_START));
get_btn_map().bind(XBOX_BTN_GUIDE, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_MODE));
get_btn_map().bind(XBOX_BTN_BACK, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_SELECT));
-
+
get_btn_map().bind(XBOX_BTN_A, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_A));
get_btn_map().bind(XBOX_BTN_B, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_B));
get_btn_map().bind(XBOX_BTN_X, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_X));
get_btn_map().bind(XBOX_BTN_Y, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_Y));
-
+
get_btn_map().bind(XBOX_BTN_LB, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TL));
get_btn_map().bind(XBOX_BTN_RB, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TR));
-
+
get_btn_map().bind(XBOX_BTN_THUMB_L, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_THUMBL));
get_btn_map().bind(XBOX_BTN_THUMB_R, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_THUMBR));
-
+
// Axis Mapping
get_axis_map().bind(XBOX_AXIS_X1, AxisEvent::create_abs(DEVICEID_JOYSTICK, ABS_X, -32768, 32767, 16, 128));
get_axis_map().bind(XBOX_AXIS_Y1, AxisEvent::create_abs(DEVICEID_JOYSTICK, ABS_Y, -32768, 32767, 16, 128));
@@ -91,7 +91,7 @@ UInputOptions::mimic_xpad_wireless()
// device_name is set in Options::set_mimic_xpad_wireless()
get_axis_map().clear();
get_btn_map().clear();
-
+
get_btn_map().bind(XBOX_DPAD_UP, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TRIGGER_HAPPY3));
get_btn_map().bind(XBOX_DPAD_DOWN, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TRIGGER_HAPPY4));
get_btn_map().bind(XBOX_DPAD_LEFT, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TRIGGER_HAPPY1));
@@ -100,18 +100,18 @@ UInputOptions::mimic_xpad_wireless()
get_btn_map().bind(XBOX_BTN_START, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_START));
get_btn_map().bind(XBOX_BTN_GUIDE, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_MODE));
get_btn_map().bind(XBOX_BTN_BACK, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_SELECT));
-
+
get_btn_map().bind(XBOX_BTN_A, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_A));
get_btn_map().bind(XBOX_BTN_B, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_B));
get_btn_map().bind(XBOX_BTN_X, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_X));
get_btn_map().bind(XBOX_BTN_Y, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_Y));
-
+
get_btn_map().bind(XBOX_BTN_LB, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TL));
get_btn_map().bind(XBOX_BTN_RB, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TR));
-
+
get_btn_map().bind(XBOX_BTN_THUMB_L, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_THUMBL));
get_btn_map().bind(XBOX_BTN_THUMB_R, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_THUMBR));
-
+
// Axis Mapping
get_axis_map().bind(XBOX_AXIS_X1, AxisEvent::create_abs(DEVICEID_JOYSTICK, ABS_X, -32768, 32767, 16, 128));
get_axis_map().bind(XBOX_AXIS_Y1, AxisEvent::create_abs(DEVICEID_JOYSTICK, ABS_Y, -32768, 32767, 16, 128));
@@ -159,11 +159,11 @@ UInputOptions::set_defaults()
get_axis_map().bind(XBOX_AXIS_X2, AxisEvent::create_abs(DEVICEID_AUTO, ABS_RX, -32768, 32767, 0, 0));
get_axis_map().bind(XBOX_AXIS_Y2, AxisEvent::create_abs(DEVICEID_AUTO, ABS_RY, -32768, 32767, 0, 0));
get_axis_map().bind(XBOX_AXIS_LT, AxisEvent::create_abs(DEVICEID_AUTO, ABS_BRAKE, 0, 255, 0, 0));
- get_axis_map().bind(XBOX_AXIS_RT, AxisEvent::create_abs(DEVICEID_AUTO, ABS_GAS, 0, 255, 0, 0));
+ get_axis_map().bind(XBOX_AXIS_RT, AxisEvent::create_abs(DEVICEID_AUTO, ABS_GAS, 0, 255, 0, 0));
// by default unmapped:
//get_axis_map().bind(XBOX_AXIS_TRIGGER, AxisEvent::create_abs(DEVICEID_AUTO, ABS_Z, -255, 255, 0, 0));
-
+
get_axis_map().bind(XBOX_AXIS_DPAD_X, AxisEvent::create_abs(DEVICEID_AUTO, ABS_HAT0X, -1, 1, 0, 0));
get_axis_map().bind(XBOX_AXIS_DPAD_Y, AxisEvent::create_abs(DEVICEID_AUTO, ABS_HAT0Y, -1, 1, 0, 0));
}
@@ -220,7 +220,7 @@ UInputOptions::guitar()
get_btn_map().bind(XBOX_BTN_GUIDE, ButtonEvent::create_key(BTN_MODE));
get_btn_map().bind(XBOX_BTN_BACK, ButtonEvent::create_key(BTN_SELECT));
- get_btn_map().bind(XBOX_BTN_A, ButtonEvent::create_key(BTN_0)); // green
+ get_btn_map().bind(XBOX_BTN_A, ButtonEvent::create_key(BTN_0)); // green
get_btn_map().bind(XBOX_BTN_B, ButtonEvent::create_key(BTN_1)); // red
get_btn_map().bind(XBOX_BTN_Y, ButtonEvent::create_key(BTN_2)); // blue
get_btn_map().bind(XBOX_BTN_X, ButtonEvent::create_key(BTN_3)); // yellow
@@ -229,7 +229,7 @@ UInputOptions::guitar()
// Axis Mapping
get_axis_map().bind(XBOX_AXIS_X2, AxisEvent::create_abs(DEVICEID_AUTO, ABS_X, -32768, 32767, 0, 0)); // whammy
get_axis_map().bind(XBOX_AXIS_Y2, AxisEvent::create_abs(DEVICEID_AUTO, ABS_Y, -32768, 32767, 0, 0)); // tilt
-
+
get_axis_map().bind(XBOX_AXIS_DPAD_X, AxisEvent::create_abs(DEVICEID_AUTO, ABS_HAT0X, -1, 1, 0, 0));
get_axis_map().bind(XBOX_AXIS_DPAD_Y, AxisEvent::create_abs(DEVICEID_AUTO, ABS_HAT0Y, -1, 1, 0, 0));
}
diff --git a/src/uinput_options.hpp b/src/uinput_options.hpp
index fc2c665..9e56ee0 100644
--- a/src/uinput_options.hpp
+++ b/src/uinput_options.hpp
@@ -27,12 +27,12 @@ class UInputOptions
private:
ButtonMap m_btn_map;
AxisMap m_axis_map;
-
+
public:
/** \addtogroup creation Creation Functions
** @{*/
UInputOptions();
-
+
/** Sets a button/axis mapping that is equal to the xpad kernel driver */
void mimic_xpad();
void mimic_xpad_wireless();
diff --git a/src/usb_controller.cpp b/src/usb_controller.cpp
index 6c9c5e4..b1895db 100644
--- a/src/usb_controller.cpp
+++ b/src/usb_controller.cpp
@@ -32,7 +32,7 @@ USBController::USBController(libusb_device* dev) :
m_interfaces(),
m_usbpath(),
m_usbid(),
- m_name()
+ m_name()
{
int ret = libusb_open(dev, &m_handle);
if (ret != LIBUSB_SUCCESS)
@@ -40,9 +40,9 @@ USBController::USBController(libusb_device* dev) :
raise_exception(std::runtime_error, "libusb_open() failed: " << usb_strerror(ret));
}
else
- {
+ {
// get usbpath, usbid and name
- m_usbpath = (boost::format("%03d:%03d")
+ m_usbpath = (boost::format("%03d:%03d")
% static_cast<int>(libusb_get_bus_number(dev))
% static_cast<int>(libusb_get_device_address(dev))).str();
@@ -50,10 +50,10 @@ USBController::USBController(libusb_device* dev) :
ret = libusb_get_device_descriptor(dev, &desc);
if (ret == LIBUSB_SUCCESS)
{
- m_usbid = (boost::format("%04x:%04x")
- % static_cast<int>(desc.idVendor)
+ m_usbid = (boost::format("%04x:%04x")
+ % static_cast<int>(desc.idVendor)
% static_cast<int>(desc.idProduct)).str();
-
+
char buf[1024];
int len;
if (false)
@@ -67,7 +67,7 @@ USBController::USBController(libusb_device* dev) :
}
}
- len = libusb_get_string_descriptor_ascii(m_handle, desc.iProduct,
+ len = libusb_get_string_descriptor_ascii(m_handle, desc.iProduct,
reinterpret_cast<unsigned char*>(buf), sizeof(buf));
if (len > 0)
{
@@ -86,7 +86,7 @@ USBController::~USBController()
}
// wait for cancel to succeed
- while (!m_transfers.empty())
+ while (!m_transfers.empty())
{
int ret = libusb_handle_events(NULL);
if (ret != 0)
@@ -190,7 +190,7 @@ USBController::usb_control(uint8_t bmRequestType, uint8_t bRequest,
libusb_fill_control_setup(data, bmRequestType, bRequest, wValue, wIndex, wLength);
memcpy(data + 8, data_in, wLength);
libusb_fill_control_transfer(transfer, m_handle, data,
- &USBController::on_control_wrap, this,
+ &USBController::on_control_wrap, this,
0);
int ret;
@@ -272,7 +272,7 @@ USBController::usb_claim_interface(int ifnum, bool try_detach)
m_interfaces.insert(ifnum);
int err = usb_claim_n_detach_interface(m_handle, ifnum, try_detach);
- if (err != 0)
+ if (err != 0)
{
std::ostringstream out;
out << " Error couldn't claim the USB interface: " << usb_strerror(err) << std::endl
@@ -305,9 +305,9 @@ USBController::usb_find_ep(int direction, uint8_t if_class, uint8_t if_subclass,
++altsetting)
{
log_debug("Interface: " << static_cast<int>(altsetting->bInterfaceNumber));
-
- for(const libusb_endpoint_descriptor* endpoint = altsetting->endpoint;
- endpoint != altsetting->endpoint + altsetting->bNumEndpoints;
+
+ for(const libusb_endpoint_descriptor* endpoint = altsetting->endpoint;
+ endpoint != altsetting->endpoint + altsetting->bNumEndpoints;
++endpoint)
{
log_debug(" Endpoint: " << int(endpoint->bEndpointAddress & LIBUSB_ENDPOINT_ADDRESS_MASK) <<
diff --git a/src/usb_controller.hpp b/src/usb_controller.hpp
index f808be3..23431ed 100644
--- a/src/usb_controller.hpp
+++ b/src/usb_controller.hpp
@@ -42,7 +42,7 @@ protected:
public:
USBController(libusb_device* dev);
virtual ~USBController();
-
+
virtual std::string get_usbpath() const;
virtual std::string get_usbid() const;
virtual std::string get_name() const;
diff --git a/src/usb_gsource.cpp b/src/usb_gsource.cpp
index aa193de..a940b20 100644
--- a/src/usb_gsource.cpp
+++ b/src/usb_gsource.cpp
@@ -57,7 +57,7 @@ USBGSource::USBGSource() :
free(fds);
// register pollfd callbacks
- libusb_set_pollfd_notifiers(NULL,
+ libusb_set_pollfd_notifiers(NULL,
&USBGSource::on_usb_pollfd_added_wrap,
&USBGSource::on_usb_pollfd_removed_wrap,
this);
@@ -67,7 +67,7 @@ USBGSource::~USBGSource()
{
// get rid of the callbacks as they will be triggered by libusb_exit()
libusb_set_pollfd_notifiers(NULL, NULL, NULL, NULL);
-
+
// get rid of the GSource created in the constructor
g_source_unref(reinterpret_cast<GSource*>(m_source));
}
@@ -106,7 +106,7 @@ USBGSource::on_usb_pollfd_removed(int fd)
break;
}
}
-
+
assert(it != m_pollfds.end());
// FIXME: here is a bug
diff --git a/src/usb_helper.cpp b/src/usb_helper.cpp
index bc06b80..efacad7 100644
--- a/src/usb_helper.cpp
+++ b/src/usb_helper.cpp
@@ -79,7 +79,7 @@ const char* usb_transfer_strerror(libusb_transfer_status err)
case LIBUSB_TRANSFER_ERROR: return "LIBUSB_TRANSFER_ERROR";
case LIBUSB_TRANSFER_TIMED_OUT: return "LIBUSB_TRANSFER_TIMED_OUT";
case LIBUSB_TRANSFER_CANCELLED: return "LIBUSB_TRANSFER_CANCELLED";
- case LIBUSB_TRANSFER_STALL: return "LIBUSB_TRANSFER_STALL";
+ case LIBUSB_TRANSFER_STALL: return "LIBUSB_TRANSFER_STALL";
case LIBUSB_TRANSFER_NO_DEVICE: return "LIBUSB_TRANSFER_NO_DEVICE";
case LIBUSB_TRANSFER_OVERFLOW: return "LIBUSB_TRANSFER_OVERFLOW";
default: return "<unknown libusb transfer error code>";
diff --git a/src/usb_interface.cpp b/src/usb_interface.cpp
index e7ed5f8..c692a02 100644
--- a/src/usb_interface.cpp
+++ b/src/usb_interface.cpp
@@ -31,7 +31,7 @@ struct USBReadCallback
iface(iface_),
callback(callback_)
{}
-
+
private:
USBReadCallback(const USBReadCallback&);
USBReadCallback& operator=(const USBReadCallback&);
@@ -105,7 +105,7 @@ USBInterface::~USBInterface()
}
void
-USBInterface::submit_read(int endpoint, int len,
+USBInterface::submit_read(int endpoint, int len,
const boost::function<bool (uint8_t*, int)>& callback)
{
assert(m_endpoints.find(endpoint) == m_endpoints.end());
@@ -117,7 +117,7 @@ USBInterface::submit_read(int endpoint, int len,
libusb_fill_interrupt_transfer(transfer, m_handle,
endpoint | LIBUSB_ENDPOINT_IN,
data, len,
- &USBInterface::on_read_data_wrap,
+ &USBInterface::on_read_data_wrap,
new USBReadCallback(this, callback),
0); // timeout
int ret;
@@ -148,7 +148,7 @@ USBInterface::submit_write(int endpoint, uint8_t* data_in, int len,
libusb_fill_interrupt_transfer(transfer, m_handle,
endpoint | LIBUSB_ENDPOINT_OUT,
data, len,
- &USBInterface::on_write_data_wrap,
+ &USBInterface::on_write_data_wrap,
new USBWriteCallback(this, callback),
0); // timeout
@@ -215,7 +215,7 @@ USBInterface::on_read_data(USBReadCallback* callback, libusb_transfer* transfer)
m_endpoints.erase(transfer->endpoint);
}
}
-
+
void
USBInterface::on_write_data(USBWriteCallback* callback, libusb_transfer* transfer)
{
diff --git a/src/usb_interface.hpp b/src/usb_interface.hpp
index 2dd83b3..65228df 100644
--- a/src/usb_interface.hpp
+++ b/src/usb_interface.hpp
@@ -38,7 +38,7 @@ public:
USBInterface(libusb_device_handle* handle, int interface, bool try_detach = false);
~USBInterface();
- void submit_read(int endpoint, int len,
+ void submit_read(int endpoint, int len,
const boost::function<bool (uint8_t*, int)>& callback);
void cancel_read(int endpoint);
diff --git a/src/usb_subsystem.cpp b/src/usb_subsystem.cpp
index f9bc445..39dcf50 100644
--- a/src/usb_subsystem.cpp
+++ b/src/usb_subsystem.cpp
@@ -79,11 +79,11 @@ USBSubsystem::find_controller(libusb_device** dev, XPadDevice& dev_type, const O
{
throw std::runtime_error("--device-by-id VENDOR:PRODUCT option must be used in combination with --type TYPE option");
}
- else
+ else
{
if (!find_controller_by_id(opts.controller_id, opts.vendor_id, opts.product_id, dev))
{
- raise_exception(std::runtime_error, "couldn't find device with "
+ raise_exception(std::runtime_error, "couldn't find device with "
<< (boost::format("%04x:%04x") % opts.vendor_id % opts.product_id));
}
else
@@ -105,7 +105,7 @@ USBSubsystem::find_controller(libusb_device** dev, XPadDevice& dev_type, const O
}
bool
-USBSubsystem::find_controller_by_path(const std::string& busid_str, const std::string& devid_str,
+USBSubsystem::find_controller_by_path(const std::string& busid_str, const std::string& devid_str,
libusb_device** xbox_device)
{
int busid = boost::lexical_cast<int>(busid_str);
diff --git a/src/word_wrap.cpp b/src/word_wrap.cpp
index 83e8f1f..dfe0924 100644
--- a/src/word_wrap.cpp
+++ b/src/word_wrap.cpp
@@ -51,7 +51,7 @@ WordWrap::para(const std::string& prefix, const std::string& str) const
tokenizer tokens(str, boost::char_separator<char>(" ", "", boost::drop_empty_tokens));
int len = prefix.size();
- std::cout << prefix;
+ std::cout << prefix;
for(tokenizer::iterator i = tokens.begin(); i != tokens.end(); ++i)
{
if (len + static_cast<int>(i->size()) + 1 >= m_terminal_width)
diff --git a/src/xbox360_controller.cpp b/src/xbox360_controller.cpp
index dfae576..c9b3ff5 100644
--- a/src/xbox360_controller.cpp
+++ b/src/xbox360_controller.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -27,9 +27,9 @@
#include "usb_helper.hpp"
Xbox360Controller::Xbox360Controller(libusb_device* dev,
- bool chatpad, bool chatpad_no_init, bool chatpad_debug,
- bool headset,
- bool headset_debug,
+ bool chatpad, bool chatpad_no_init, bool chatpad_debug,
+ bool headset,
+ bool headset_debug,
const std::string& headset_dump,
const std::string& headset_play,
bool try_detach) :
@@ -60,7 +60,7 @@ Xbox360Controller::Xbox360Controller(libusb_device* dev,
int ret = libusb_get_device_descriptor(dev, &desc);
if (ret != LIBUSB_SUCCESS)
{
- raise_exception(std::runtime_error, "libusb_get_config_descriptor() failed: " << usb_strerror(ret));
+ raise_exception(std::runtime_error, "libusb_get_config_descriptor() failed: " << usb_strerror(ret));
}
else
{
@@ -98,7 +98,7 @@ Xbox360Controller::set_rumble_real(uint8_t left, uint8_t right)
void
Xbox360Controller::set_led_real(uint8_t status)
{
- uint8_t ledcmd[] = { 0x01, 0x03, status };
+ uint8_t ledcmd[] = { 0x01, 0x03, status };
usb_write(endpoint_out, ledcmd, sizeof(ledcmd));
}
@@ -112,11 +112,11 @@ Xbox360Controller::parse(uint8_t* data, int len, XboxGenericMsg* msg_out)
//log_debug("zero length read");
}
else if (len == 3 && data[0] == 0x01 && data[1] == 0x03)
- {
+ {
log_debug("Xbox360Controller: LED Status: " << int(data[2]));
}
else if (len == 3 && data[0] == 0x03 && data[1] == 0x03)
- {
+ {
// data[2] == 0x00 means that rumble is disabled
// data[2] == 0x01 unknown, but rumble works
// data[2] == 0x02 unknown, but rumble works
diff --git a/src/xbox360_controller.hpp b/src/xbox360_controller.hpp
index d44bd0d..00fadba 100644
--- a/src/xbox360_controller.hpp
+++ b/src/xbox360_controller.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -33,7 +33,7 @@ class Xbox360Controller : public USBController
{
private:
XPadDevice* dev_type;
-
+
int endpoint_in;
int endpoint_out;
@@ -44,10 +44,10 @@ private:
uint8_t m_rumble_right;
public:
- Xbox360Controller(libusb_device* dev,
- bool chatpad, bool chatpad_no_init, bool chatpad_debug,
- bool headset,
- bool headset_debug,
+ Xbox360Controller(libusb_device* dev,
+ bool chatpad, bool chatpad_no_init, bool chatpad_debug,
+ bool headset,
+ bool headset_debug,
const std::string& headset_dump,
const std::string& headset_play,
bool try_detach);
diff --git a/src/xbox360_wireless_controller.cpp b/src/xbox360_wireless_controller.cpp
index 4e7ea1f..e5f2d13 100644
--- a/src/xbox360_wireless_controller.cpp
+++ b/src/xbox360_wireless_controller.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -27,7 +27,7 @@
#include "usb_helper.hpp"
#include "xboxmsg.hpp"
-Xbox360WirelessController::Xbox360WirelessController(libusb_device* dev, int controller_id,
+Xbox360WirelessController::Xbox360WirelessController(libusb_device* dev, int controller_id,
bool try_detach) :
USBController(dev),
m_endpoint(),
@@ -39,7 +39,7 @@ Xbox360WirelessController::Xbox360WirelessController(libusb_device* dev, int con
m_is_active = false;
assert(controller_id >= 0 && controller_id < 4);
-
+
// FIXME: Is hardcoding those ok?
m_endpoint = controller_id*2 + 1;
m_interface = controller_id*2;
@@ -81,7 +81,7 @@ Xbox360WirelessController::parse(uint8_t* data, int len, XboxGenericMsg* msg_out
{
if (len == 2 && data[0] == 0x08)
{ // Connection Status Message
- if (data[1] == 0x00)
+ if (data[1] == 0x00)
{
log_info("connection status: nothing");
@@ -91,17 +91,17 @@ Xbox360WirelessController::parse(uint8_t* data, int len, XboxGenericMsg* msg_out
return true;
}
- else if (data[1] == 0x80)
+ else if (data[1] == 0x80)
{
log_info("connection status: controller connected");
set_led_real(get_led());
set_active(true);
- }
- else if (data[1] == 0x40)
+ }
+ else if (data[1] == 0x40)
{
log_info("Connection status: headset connected");
}
- else if (data[1] == 0xc0)
+ else if (data[1] == 0xc0)
{
log_info("Connection status: controller and headset connected");
set_led_real(get_led());
@@ -194,7 +194,7 @@ Xbox360WirelessController::parse(uint8_t* data, int len, XboxGenericMsg* msg_out
}
}
- return false;
+ return false;
}
/* EOF */
diff --git a/src/xbox360_wireless_controller.hpp b/src/xbox360_wireless_controller.hpp
index 89380c8..00aeec6 100644
--- a/src/xbox360_wireless_controller.hpp
+++ b/src/xbox360_wireless_controller.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -44,7 +44,7 @@ public:
void set_rumble_real(uint8_t left, uint8_t right);
void set_led_real(uint8_t status);
uint8_t get_battery_status() const;
-
+
private:
Xbox360WirelessController (const Xbox360WirelessController&);
Xbox360WirelessController& operator= (const Xbox360WirelessController&);
diff --git a/src/xbox_controller.cpp b/src/xbox_controller.cpp
index 8e72353..5667fcd 100644
--- a/src/xbox_controller.cpp
+++ b/src/xbox_controller.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -34,7 +34,7 @@ XboxController::XboxController(libusb_device* dev, bool try_detach) :
// find endpoints
m_endpoint_in = usb_find_ep(LIBUSB_ENDPOINT_IN, 88, 66, 0);
m_endpoint_out = usb_find_ep(LIBUSB_ENDPOINT_OUT, 88, 66, 0);
-
+
usb_claim_interface(0, try_detach);
usb_submit_read(m_endpoint_in, 32);
}
diff --git a/src/xbox_controller.hpp b/src/xbox_controller.hpp
index d893e00..4bd20f0 100644
--- a/src/xbox_controller.hpp
+++ b/src/xbox_controller.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -30,7 +30,7 @@ class XboxController : public USBController
private:
int m_endpoint_in;
int m_endpoint_out;
-
+
public:
XboxController(libusb_device* dev, bool try_detach);
virtual ~XboxController();
diff --git a/src/xboxdrv.cpp b/src/xboxdrv.cpp
index 709541f..2b730ad 100644
--- a/src/xboxdrv.cpp
+++ b/src/xboxdrv.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -86,7 +86,7 @@ Xboxdrv::run_list_controller()
% wid
% int(xpad_devices[i].idVendor)
% int(xpad_devices[i].idProduct)
- % xpad_devices[i].name
+ % xpad_devices[i].name
% wid
<< std::endl;
}
@@ -98,7 +98,7 @@ Xboxdrv::run_list_controller()
% 0
% int(xpad_devices[i].idVendor)
% int(xpad_devices[i].idProduct)
- % xpad_devices[i].name
+ % xpad_devices[i].name
<< std::endl;
}
id += 1;
@@ -109,7 +109,7 @@ Xboxdrv::run_list_controller()
}
if (id == 0)
- std::cout << "\nno controller detected" << std::endl;
+ std::cout << "\nno controller detected" << std::endl;
libusb_free_device_list(list, 1 /* unref_devices */);
}
@@ -124,7 +124,7 @@ Xboxdrv::run_list_supported_devices()
% int(xpad_devices[i].idVendor)
% int(xpad_devices[i].idProduct)
% xpad_devices[i].name;
- }
+ }
}
bool xpad_device_sorter(const XPadDevice& lhs, const XPadDevice& rhs)
@@ -158,7 +158,7 @@ Xboxdrv::run_list_supported_devices_xpad()
% int(sorted_devices[i].idProduct)
% sorted_devices[i].name
% gamepadtype_to_macro_string(sorted_devices[i].type);
- }
+ }
}
void
@@ -171,9 +171,9 @@ Xboxdrv::run_help_devices()
std::cout << boost::format(" 0x%04x | 0x%04x | %s")
% int(xpad_devices[i].idVendor)
% int(xpad_devices[i].idProduct)
- % xpad_devices[i].name
+ % xpad_devices[i].name
<< std::endl;
- }
+ }
}
void
@@ -224,11 +224,11 @@ Xboxdrv::run_daemon(const Options& opts)
{
pid_t pid = fork();
- if (pid < 0)
+ if (pid < 0)
{ // fork error
raise_exception(std::runtime_error, "failed to fork(): " << strerror(errno));
}
- else if (pid > 0)
+ else if (pid > 0)
{ // parent, just exit
_exit(EXIT_SUCCESS);
}
@@ -270,24 +270,24 @@ Xboxdrv::run_list_enums(uint32_t enums)
wrap.para(" ", boost::algorithm::join(evdev_abs_names.get_names(), ", "));
wrap.newline();
}
-
+
if (enums & Options::LIST_REL)
{
wrap.println("EV_REL:");
wrap.para(" ", boost::algorithm::join(evdev_rel_names.get_names(), ", "));
wrap.newline();
}
-
+
if (enums & Options::LIST_KEY)
{
wrap.println("EV_KEY:");
wrap.para(" ", boost::algorithm::join(evdev_key_names.get_names(), ", "));
wrap.newline();
}
-
+
if (enums & Options::LIST_X11KEYSYM)
{
- std::vector<std::string> lst;
+ std::vector<std::string> lst;
for(X11KeysymEnum::const_iterator i = get_x11keysym_names().begin();
i != get_x11keysym_names().end(); ++i)
{
@@ -297,7 +297,7 @@ Xboxdrv::run_list_enums(uint32_t enums)
wrap.para(" ", boost::algorithm::join(lst, ", "));
wrap.newline();
}
-
+
if (enums & Options::LIST_AXIS)
{
std::vector<std::string> lst;
@@ -309,7 +309,7 @@ Xboxdrv::run_list_enums(uint32_t enums)
wrap.para(" ", boost::algorithm::join(lst, ", "));
wrap.newline();
}
-
+
if (enums & Options::LIST_BUTTON)
{
std::vector<std::string> lst;
@@ -341,7 +341,7 @@ Xboxdrv::set_scheduling(const Options& opts)
log_info("enabling realtime priority scheduling");
int policy = SCHED_RR;
-
+
struct sched_param param;
memset(¶m, 0, sizeof(struct sched_param));
param.sched_priority = sched_get_priority_max(policy);
@@ -351,7 +351,7 @@ Xboxdrv::set_scheduling(const Options& opts)
int ret;
if ((ret = sched_setscheduler(getpid(), policy, ¶m)) != 0)
- {
+ {
raise_exception(std::runtime_error, "sched_setschedparam() failed: " << strerror(errno));
}
}
@@ -360,7 +360,7 @@ Xboxdrv::set_scheduling(const Options& opts)
int
Xboxdrv::main(int argc, char** argv)
{
- try
+ try
{
Options opts;
diff --git a/src/xboxdrv.hpp b/src/xboxdrv.hpp
index db61da7..d851603 100644
--- a/src/xboxdrv.hpp
+++ b/src/xboxdrv.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
diff --git a/src/xboxdrv_daemon.cpp b/src/xboxdrv_daemon.cpp
index c2053fd..24815bd 100644
--- a/src/xboxdrv_daemon.cpp
+++ b/src/xboxdrv_daemon.cpp
@@ -131,7 +131,7 @@ XboxdrvDaemon::~XboxdrvDaemon()
void
XboxdrvDaemon::run()
{
- try
+ try
{
create_pid_file();
@@ -176,7 +176,7 @@ XboxdrvDaemon::run()
dbus_subsystem->register_xboxdrv_daemon(this);
dbus_subsystem->register_controller_slots(m_controller_slots);
}
-
+
log_debug("launching into main loop");
g_main_loop_run(m_gmain);
log_debug("main loop exited");
@@ -213,7 +213,7 @@ XboxdrvDaemon::process_match(struct udev_device* device)
" not a valid Xboxdrv device");
}
else
- {
+ {
int bus;
int dev;
if (!get_usb_path(device, &bus, &dev))
@@ -222,7 +222,7 @@ XboxdrvDaemon::process_match(struct udev_device* device)
}
else
{
- try
+ try
{
launch_controller_thread(device, dev_type, bus, dev);
}
@@ -256,7 +256,7 @@ XboxdrvDaemon::init_uinput()
// create controller slots
int slot_count = 0;
- for(Options::ControllerSlots::const_iterator controller = m_opts.controller_slots.begin();
+ for(Options::ControllerSlots::const_iterator controller = m_opts.controller_slots.begin();
controller != m_opts.controller_slots.end(); ++controller)
{
log_info("creating slot: " << slot_count);
@@ -307,7 +307,7 @@ XboxdrvDaemon::find_free_slot(udev_device* dev)
if (!(*i)->is_connected())
{
// found a free slot, check if the rules match
- for(std::vector<ControllerMatchRulePtr>::const_iterator rule = (*i)->get_rules().begin();
+ for(std::vector<ControllerMatchRulePtr>::const_iterator rule = (*i)->get_rules().begin();
rule != (*i)->get_rules().end(); ++rule)
{
if ((*rule)->match(dev))
@@ -317,7 +317,7 @@ XboxdrvDaemon::find_free_slot(udev_device* dev)
}
}
}
-
+
// second pass, look for slots that don't have any rules and thus match everything
for(ControllerSlots::iterator i = m_controller_slots.begin(); i != m_controller_slots.end(); ++i)
{
@@ -326,14 +326,14 @@ XboxdrvDaemon::find_free_slot(udev_device* dev)
return *i;
}
}
-
+
// no free slot found
return ControllerSlotPtr();
}
void
XboxdrvDaemon::launch_controller_thread(udev_device* udev_dev,
- const XPadDevice& dev_type,
+ const XPadDevice& dev_type,
uint8_t busnum, uint8_t devnum)
{
// FIXME: results must be libusb_unref_device()'ed
@@ -347,7 +347,7 @@ XboxdrvDaemon::launch_controller_thread(udev_device* udev_dev,
{
std::vector<ControllerPtr> controllers = ControllerFactory::create_multiple(dev_type, dev, m_opts);
for(std::vector<ControllerPtr>::iterator i = controllers.begin();
- i != controllers.end();
+ i != controllers.end();
++i)
{
ControllerPtr& controller = *i;
@@ -406,7 +406,7 @@ XboxdrvDaemon::connect(ControllerSlotPtr slot, ControllerPtr controller)
{
log_info("connecting slot to thread");
- try
+ try
{
// set the LED status
if (slot->get_led_status() == -1)
@@ -422,17 +422,17 @@ XboxdrvDaemon::connect(ControllerSlotPtr slot, ControllerPtr controller)
{
log_error("failed to set led: " << err.what());
}
-
+
slot->connect(controller);
on_connect(slot);
- log_info("controller connected: "
+ log_info("controller connected: "
<< controller->get_usbpath() << " "
<< controller->get_usbid() << " "
<< "'" << controller->get_name() << "'");
log_info("launched Controller for " << controller->get_usbpath()
- << " in slot " << slot->get_id() << ", free slots: "
+ << " in slot " << slot->get_id() << ", free slots: "
<< get_free_slot_count() << "/" << m_controller_slots.size());
}
@@ -468,7 +468,7 @@ XboxdrvDaemon::on_disconnect(ControllerSlotPtr slot)
ControllerPtr controller = slot->get_controller();
assert(controller);
- log_info("controller disconnected: "
+ log_info("controller disconnected: "
<< controller->get_usbpath() << " "
<< controller->get_usbid() << " "
<< "'" << controller->get_name() << "'");
@@ -501,7 +501,7 @@ XboxdrvDaemon::on_controller_disconnect()
}
// cleanup inactive controllers
- m_inactive_controllers.erase(std::remove_if(m_inactive_controllers.begin(), m_inactive_controllers.end(),
+ m_inactive_controllers.erase(std::remove_if(m_inactive_controllers.begin(), m_inactive_controllers.end(),
boost::bind(&Controller::is_disconnected, _1)),
m_inactive_controllers.end());
}
@@ -510,7 +510,7 @@ void
XboxdrvDaemon::on_controller_activate()
{
//log_tmp("on_controller_activate");
-
+
// check for inactive controller and free the slots
for(ControllerSlots::iterator i = m_controller_slots.begin(); i != m_controller_slots.end(); ++i)
{
@@ -599,13 +599,13 @@ XboxdrvDaemon::shutdown()
{
for(ControllerSlots::iterator i = m_controller_slots.begin(); i != m_controller_slots.end(); ++i)
{
- if ((*i)->get_controller() &&
+ if ((*i)->get_controller() &&
!(*i)->get_controller()->is_disconnected())
{
(*i)->get_controller()->set_led(0);
}
}
-
+
// give the LED message a few msec to reach the controller
g_usleep(10 * 1000); // FIXME: what is a good time to wait?
diff --git a/src/xboxdrv_daemon.hpp b/src/xboxdrv_daemon.hpp
index 6ce2545..79a72eb 100644
--- a/src/xboxdrv_daemon.hpp
+++ b/src/xboxdrv_daemon.hpp
@@ -45,12 +45,12 @@ private:
typedef std::vector<ControllerSlotPtr> ControllerSlots;
ControllerSlots m_controller_slots;
-
+
typedef std::vector<ControllerPtr> Controllers;
Controllers m_inactive_controllers;
std::auto_ptr<UInput> m_uinput;
-
+
private:
static void on_sigint(int);
static XboxdrvDaemon* current() { return s_current; }
@@ -73,10 +73,10 @@ private:
void process_match(struct udev_device* device);
void print_info(struct udev_device* device);
void launch_controller_thread(udev_device* dev,
- const XPadDevice& dev_type,
+ const XPadDevice& dev_type,
uint8_t busnum, uint8_t devnum);
int get_free_slot_count() const;
-
+
void connect(ControllerSlotPtr slot, ControllerPtr controller);
ControllerPtr disconnect(ControllerSlotPtr slot);
diff --git a/src/xboxdrv_g_controller.cpp b/src/xboxdrv_g_controller.cpp
index e003d93..3f23158 100644
--- a/src/xboxdrv_g_controller.cpp
+++ b/src/xboxdrv_g_controller.cpp
@@ -116,7 +116,7 @@ xboxdrv_g_controller_set_config(XboxdrvGController* self, int config_num, GError
MessageProcessor* gen_msg_proc = self->controller->get_thread()->get_message_proc();
UInputMessageProcessor* msg_proc = dynamic_cast<UInputMessageProcessor*>(gen_msg_proc);
- try
+ try
{
msg_proc->set_config(config_num);
return TRUE;
diff --git a/src/xboxdrv_g_controller.hpp b/src/xboxdrv_g_controller.hpp
index 3b866fa..7d3e630 100644
--- a/src/xboxdrv_g_controller.hpp
+++ b/src/xboxdrv_g_controller.hpp
@@ -38,7 +38,7 @@ typedef struct _XboxdrvGControllerClass XboxdrvGControllerClass;
struct _XboxdrvGController
{
GObject parent_instance;
-
+
ControllerSlot* controller;
};
diff --git a/src/xboxdrv_main.cpp b/src/xboxdrv_main.cpp
index a5a655c..971d052 100644
--- a/src/xboxdrv_main.cpp
+++ b/src/xboxdrv_main.cpp
@@ -77,8 +77,8 @@ XboxdrvMain::create_controller()
{
if (!m_opts.evdev_device.empty())
{ // normal PC joystick via evdev
- return ControllerPtr(new EvdevController(m_opts.evdev_device,
- m_opts.evdev_absmap,
+ return ControllerPtr(new EvdevController(m_opts.evdev_device,
+ m_opts.evdev_absmap,
m_opts.evdev_keymap,
m_opts.evdev_grab,
m_opts.evdev_debug));
@@ -90,18 +90,18 @@ XboxdrvMain::create_controller()
m_dev_type.name = "Evdev device";
}
else
- { // regular USB Xbox360 controller
+ { // regular USB Xbox360 controller
// FIXME: this must be libusb_unref_device()'ed, child code must not keep a copy around
libusb_device* dev = 0;
-
+
USBSubsystem::find_controller(&dev, m_dev_type, m_opts);
if (!dev)
{
throw std::runtime_error("no suitable USB device found, abort");
}
- else
+ else
{
if (!m_opts.quiet)
{
@@ -147,13 +147,13 @@ XboxdrvMain::run()
m_controller->set_disconnect_cb(boost::bind(&XboxdrvMain::on_controller_disconnect, this));
std::auto_ptr<MessageProcessor> message_proc;
init_controller(m_controller);
-
+
if (m_opts.instant_exit)
{
usleep(1000);
}
else
- {
+ {
if (m_opts.no_uinput)
{
if (!m_opts.quiet)
@@ -171,15 +171,15 @@ XboxdrvMain::run()
m_uinput->set_device_usbids(m_opts.uinput_device_usbids);
log_debug("creating ControllerSlotConfig");
- ControllerSlotConfigPtr config_set = ControllerSlotConfig::create(*m_uinput,
+ ControllerSlotConfigPtr config_set = ControllerSlotConfig::create(*m_uinput,
0, m_opts.extra_devices,
m_opts.get_controller_slot());
-
+
// After all the ControllerConfig registered their events, finish up
// the device creation
log_debug("finish UInput creation");
m_uinput->finish();
-
+
message_proc.reset(new UInputMessageProcessor(*m_uinput, config_set, m_opts));
}
@@ -202,7 +202,7 @@ XboxdrvMain::run()
{
ControllerThread thread(m_controller, message_proc, m_opts);
log_debug("launching thread");
-
+
pid_t pid = 0;
if (!m_opts.exec.empty())
{
diff --git a/src/xboxdrv_main.hpp b/src/xboxdrv_main.hpp
index 7ce21eb..f4654e4 100644
--- a/src/xboxdrv_main.hpp
+++ b/src/xboxdrv_main.hpp
@@ -39,7 +39,7 @@ private:
public:
static XboxdrvMain* current() { return s_current; }
-
+
private:
const Options& m_opts;
GMainLoop* m_gmain;
@@ -64,7 +64,7 @@ public:
private:
ControllerPtr create_controller();
-
+
void init_controller(const ControllerPtr& controller);
void print_info(libusb_device* dev,
diff --git a/src/xboxmsg.cpp b/src/xboxmsg.cpp
index c22e647..4107433 100644
--- a/src/xboxmsg.cpp
+++ b/src/xboxmsg.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -46,7 +46,7 @@ std::string gamepadtype_to_string(const GamepadType& type)
case GAMEPAD_XBOX360_WIRELESS:
return "xbox360-wireless";
- case GAMEPAD_XBOX360_PLAY_N_CHARGE:
+ case GAMEPAD_XBOX360_PLAY_N_CHARGE:
return "xbox360-playncharge";
case GAMEPAD_XBOX:
@@ -54,7 +54,7 @@ std::string gamepadtype_to_string(const GamepadType& type)
case GAMEPAD_XBOX_MAT:
return "xbox-mat";
-
+
case GAMEPAD_XBOX360_GUITAR:
return "xbox360-guitar";
@@ -99,7 +99,7 @@ std::string gamepadtype_to_macro_string(const GamepadType& type)
}
}
-std::ostream& operator<<(std::ostream& out, const GamepadType& type)
+std::ostream& operator<<(std::ostream& out, const GamepadType& type)
{
switch (type)
{
@@ -109,7 +109,7 @@ std::ostream& operator<<(std::ostream& out, const GamepadType& type)
case GAMEPAD_XBOX360_WIRELESS:
return out << "Xbox360 (wireless)";
- case GAMEPAD_XBOX360_PLAY_N_CHARGE:
+ case GAMEPAD_XBOX360_PLAY_N_CHARGE:
return out << "Xbox360 Play&Charge";
case GAMEPAD_XBOX:
@@ -117,7 +117,7 @@ std::ostream& operator<<(std::ostream& out, const GamepadType& type)
case GAMEPAD_XBOX_MAT:
return out << "Xbox Dancepad";
-
+
case GAMEPAD_XBOX360_GUITAR:
return out << "Xbox360 Guitar";
@@ -147,13 +147,13 @@ std::ostream& operator<<(std::ostream& out, const XboxGenericMsg& msg)
{
case XBOX_MSG_XBOX:
return out << msg.xbox;
-
+
case XBOX_MSG_XBOX360:
return out << msg.xbox360;
case XBOX_MSG_PS3USB:
return out << msg.ps3usb;
-
+
default:
return out << "Error: Unhandled XboxGenericMsg type: " << msg.type;
}
@@ -193,14 +193,14 @@ std::ostream& operator<<(std::ostream& out, const Playstation3USBMsg& msg)
return out;
}
-std::ostream& operator<<(std::ostream& out, const Xbox360Msg& msg)
+std::ostream& operator<<(std::ostream& out, const Xbox360Msg& msg)
{
- out << boost::format("X1:%6d Y1:%6d")
+ out << boost::format("X1:%6d Y1:%6d")
% int(msg.x1) % int(msg.y1);
out << boost::format(" X2:%6d Y2:%6d")
% int(msg.x2) % int(msg.y2);
-
+
out << boost::format(" du:%d dd:%d dl:%d dr:%d")
% int(msg.dpad_up)
% int(msg.dpad_down)
@@ -230,7 +230,7 @@ std::ostream& operator<<(std::ostream& out, const Xbox360Msg& msg)
return out;
}
-std::ostream& operator<<(std::ostream& out, const XboxMsg& msg)
+std::ostream& operator<<(std::ostream& out, const XboxMsg& msg)
{
out << boost::format(" X1:%6d Y1:%6d X2:%6d Y2:%6d "
" du:%d dd:%d dl:%d dr:%d "
@@ -261,7 +261,7 @@ std::ostream& operator<<(std::ostream& out, const XboxMsg& msg)
% int(msg.black)
% int(msg.white)
- % int(msg.lt)
+ % int(msg.lt)
% int(msg.rt);
// out << " Dummy: " << msg.dummy;
@@ -303,7 +303,7 @@ int get_button(XboxGenericMsg& msg, XboxButton button)
case XBOX_BTN_UNKNOWN: return 0;
}
break;
-
+
case XBOX_MSG_XBOX:
switch(button)
{
@@ -403,7 +403,7 @@ void set_button(XboxGenericMsg& msg, XboxButton button, bool v)
case XBOX_BTN_UNKNOWN: break;
}
break;
-
+
case XBOX_MSG_XBOX:
switch(button)
{
@@ -651,7 +651,7 @@ float s16_to_float(int16_t value)
/**
input: [0, 255]
- output: [ -1.0f, 1.0f ]
+ output: [ -1.0f, 1.0f ]
*/
float u8_to_float(uint8_t value)
{
@@ -672,7 +672,7 @@ int16_t float_to_s16(float v)
}
/**
- input: [ -1.0f, 1.0f ]
+ input: [ -1.0f, 1.0f ]
output: [0, 255]
*/
uint8_t float_to_u8(float v)
@@ -860,7 +860,7 @@ void set_axis_float(XboxGenericMsg& msg, XboxAxis axis, float v)
msg.xbox360.lt = v < 0 ? static_cast<int>(-v*255) : 0;
msg.xbox360.rt = v > 0 ? static_cast<int>(v*255) : 0;
break;
-
+
case XBOX_AXIS_DPAD_X:
if (v > 0.5f)
{
@@ -1296,12 +1296,12 @@ XboxAxis string2axis(const std::string& str_)
return XBOX_AXIS_X1;
else if (str == "y1")
return XBOX_AXIS_Y1;
-
+
else if (str == "x2" || str == "whammy")
return XBOX_AXIS_X2;
else if (str == "y2" || str == "tilt")
return XBOX_AXIS_Y2;
-
+
else if (str == "lt" || str == "l2")
return XBOX_AXIS_LT;
else if (str == "rt" || str == "r2")
@@ -1360,8 +1360,8 @@ std::string axis2string(XboxAxis axis)
case XBOX_AXIS_A: return "BTN_A";
case XBOX_AXIS_B: return "BTN_B";
- case XBOX_AXIS_X: return "BTN_X";
- case XBOX_AXIS_Y: return "BTN_Y";
+ case XBOX_AXIS_X: return "BTN_X";
+ case XBOX_AXIS_Y: return "BTN_Y";
case XBOX_AXIS_BLACK: return "Black";
case XBOX_AXIS_WHITE: return "White";
}
@@ -1407,7 +1407,7 @@ int get_axis_min(XboxAxis axis)
{
case XBOX_AXIS_X1: return -32768;
case XBOX_AXIS_Y1: return -32768;
-
+
case XBOX_AXIS_X2: return -32768;
case XBOX_AXIS_Y2: return -32768;
@@ -1436,7 +1436,7 @@ int get_axis_max(XboxAxis axis)
{
case XBOX_AXIS_X1: return 32767;
case XBOX_AXIS_Y1: return 32767;
-
+
case XBOX_AXIS_X2: return 32767;
case XBOX_AXIS_Y2: return 32767;
@@ -1458,5 +1458,5 @@ int get_axis_max(XboxAxis axis)
default: assert(!"never reached");
}
}
-
+
/* EOF */
diff --git a/src/xboxmsg.hpp b/src/xboxmsg.hpp
index 98c680b..80d4716 100644
--- a/src/xboxmsg.hpp
+++ b/src/xboxmsg.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox/Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -132,12 +132,12 @@ struct Playstation3USBMsg
unsigned int unknown01 :8; // always 00
// 02
- unsigned int select :1;
+ unsigned int select :1;
unsigned int l3 :1;
unsigned int r3 :1;
unsigned int start :1;
- unsigned int dpad_up :1;
+ unsigned int dpad_up :1;
unsigned int dpad_right :1;
unsigned int dpad_down :1;
unsigned int dpad_left :1;
diff --git a/src/xpad_device.hpp b/src/xpad_device.hpp
index 608f49f..c266fc0 100644
--- a/src/xpad_device.hpp
+++ b/src/xpad_device.hpp
@@ -1,4 +1,4 @@
-/*
+/*
** Xbox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -23,7 +23,7 @@
#include "xboxmsg.hpp"
-struct XPadDevice
+struct XPadDevice
{
GamepadType type;
uint16_t idVendor;
diff --git a/test/ini_parser_test.cpp b/test/ini_parser_test.cpp
index 651df09..2070e63 100644
--- a/test/ini_parser_test.cpp
+++ b/test/ini_parser_test.cpp
@@ -7,12 +7,12 @@
class INIParserTestBuilder : public INIBuilder
{
public:
- void send_section(const std::string& section)
+ void send_section(const std::string& section)
{
std::cout << "[" << section << "]" << std::endl;
}
- void send_pair(const std::string& name, const std::string& value)
+ void send_pair(const std::string& name, const std::string& value)
{
std::cout << "\"" << name << "\" = \"" << value << "\"" << std::endl;
}
diff --git a/test/usb_system_test.cpp b/test/usb_system_test.cpp
index f17b58d..b78516b 100644
--- a/test/usb_system_test.cpp
+++ b/test/usb_system_test.cpp
@@ -37,7 +37,7 @@ libusb_device* get_controller_dev()
{
libusb_device* dev = list[dev_it];
libusb_device_descriptor desc;
-
+
int ret = libusb_get_device_descriptor(dev, &desc);
if (ret != LIBUSB_SUCCESS)
{
@@ -85,14 +85,14 @@ int main()
assert(dev);
Xbox360Controller* controller = new Xbox360Controller(dev,
false, false, false,
- false,
+ false,
false,
"",
"",
false);
controller->set_led(2);
g_main_loop_run(m_gmain);
-
+
return 0;
}
diff --git a/tools/evsend.cpp b/tools/evsend.cpp
index 8ae32e6..f55d8a1 100644
--- a/tools/evsend.cpp
+++ b/tools/evsend.cpp
@@ -27,7 +27,7 @@ int main(int argc, char** argv)
event.value = atoi(argv[4]);
int fd = open(filename, O_RDWR);
- if (fd < 0)
+ if (fd < 0)
{
std::cout << argv[0] << ": couldn't access: " << filename << ": " << strerror(errno) << std::endl;
}
diff --git a/tools/evtestplus.cpp b/tools/evtestplus.cpp
index fb7e8ab..62b5046 100644
--- a/tools/evtestplus.cpp
+++ b/tools/evtestplus.cpp
@@ -12,7 +12,7 @@
void process_device(int fd)
{
int version;
- if (ioctl(fd, EVIOCGVERSION, &version) < 0)
+ if (ioctl(fd, EVIOCGVERSION, &version) < 0)
{
perror("evtest: can't get version");
exit(1);
@@ -21,7 +21,7 @@ void process_device(int fd)
if (1)
{
char phys[1024];
- if (ioctl(fd, EVIOCGNAME(sizeof(phys)), &phys) < 0)
+ if (ioctl(fd, EVIOCGNAME(sizeof(phys)), &phys) < 0)
{
perror("evtest: can't get name");
exit(1);
@@ -29,10 +29,10 @@ void process_device(int fd)
std::cout << "Name: " << phys << std::endl;
}
- if (1)
+ if (1)
{
char phys[1024];
- if (ioctl(fd, EVIOCGPHYS(sizeof(phys)), &phys) < 0)
+ if (ioctl(fd, EVIOCGPHYS(sizeof(phys)), &phys) < 0)
{
perror("evtest: can't get phys");
exit(1);
@@ -40,10 +40,10 @@ void process_device(int fd)
std::cout << "Phys: " << phys << std::endl;
}
- if (0)
+ if (0)
{
char phys[1024];
- if (ioctl(fd, EVIOCGUNIQ(sizeof(phys)), &phys) < 0)
+ if (ioctl(fd, EVIOCGUNIQ(sizeof(phys)), &phys) < 0)
{
perror("evtest: can't get uniq");
exit(1);
@@ -51,7 +51,7 @@ void process_device(int fd)
std::cout << "Uniq: " << phys << std::endl;
}
-
+
std::cout << "Version: " << (version >> 16) << "." << ((version >> 8) & 0xff) << "." << (version & 0xff) << std::endl;
@@ -63,7 +63,7 @@ void process_device(int fd)
}
/**
- evtestplus
+ evtestplus
--list List available devices
--test DEVICE Test device
--info DEVICE List properties of device
@@ -78,9 +78,9 @@ int main(int argc, char** argv)
else
{
const char* filename = argv[1];
-
+
int fd;
- if ((fd = open(filename, O_RDONLY)) < 0)
+ if ((fd = open(filename, O_RDONLY)) < 0)
{
perror(filename);
}
diff --git a/tools/usbcat.cpp b/tools/usbcat.cpp
index f501752..e87d54c 100644
--- a/tools/usbcat.cpp
+++ b/tools/usbcat.cpp
@@ -1,4 +1,4 @@
-/*
+/*
** XBox360 USB Gamepad Userspace Driver
** Copyright (C) 2008 Ingo Ruhnke <grumbel at gmx.de>
**
@@ -33,19 +33,19 @@ std::ostream& operator<<(std::ostream& out, struct usb_device* dev)
struct usb_dev_handle* handle = usb_open(dev);
if (handle)
{
- if (dev->descriptor.iProduct)
+ if (dev->descriptor.iProduct)
usb_get_string_simple(handle, dev->descriptor.iProduct, iProduct_buf, sizeof(iProduct_buf));
usb_close(handle);
}
-
- return out << boost::format("idVendor: 0x%04hx idProduct: 0x%04hx iProduct: %s")
+
+ return out << boost::format("idVendor: 0x%04hx idProduct: 0x%04hx iProduct: %s")
% uint16_t(dev->descriptor.idVendor) % uint16_t(dev->descriptor.idProduct)
% iProduct_buf;
}
else
{
return out << "(usb_device: null)";
- }
+ }
}
struct usb_device*
@@ -55,7 +55,7 @@ find_usb_device(uint16_t idVendor, uint16_t idProduct)
for (struct usb_bus* bus = busses; bus; bus = bus->next)
{
- for (struct usb_device* dev = bus->devices; dev; dev = dev->next)
+ for (struct usb_device* dev = bus->devices; dev; dev = dev->next)
{
if (dev->descriptor.idVendor == idVendor &&
dev->descriptor.idProduct == idProduct)
@@ -83,7 +83,7 @@ write_usb_device(struct usb_device* dev, int interface, int endpoint)
if (usb_detach_kernel_driver_np(handle, interface) < 0)
{
std::cout << "Failure to kick kernel driver: " << usb_strerror() << std::endl;
- exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (usb_claim_interface(handle, interface) != 0)
@@ -98,7 +98,7 @@ write_usb_device(struct usb_device* dev, int interface, int endpoint)
while(!quit)
{
uint8_t data[32];
-
+
if (1)
{
int ret = fread(data, sizeof(char), sizeof(data), stdin);
@@ -120,7 +120,7 @@ write_usb_device(struct usb_device* dev, int interface, int endpoint)
}
}
- }
+ }
}
void
@@ -139,7 +139,7 @@ read_usb_device(struct usb_device* dev, int interface, int endpoint)
if (usb_detach_kernel_driver_np(handle, interface) < 0)
{
std::cout << "Failure to kick kernel driver: " << usb_strerror() << std::endl;
- exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (usb_claim_interface(handle, interface) != 0)
@@ -164,7 +164,7 @@ read_usb_device(struct usb_device* dev, int interface, int endpoint)
fwrite(data, sizeof(char), ret, stdout);
}
- }
+ }
}
void
@@ -186,7 +186,7 @@ cat_usb_device(struct usb_device* dev, int interface, int endpoint)
if (usb_detach_kernel_driver_np(handle, interface) < 0)
{
std::cout << "Failure to kick kernel driver: " << usb_strerror() << std::endl;
- exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (usb_claim_interface(handle, interface) != 0)
@@ -211,9 +211,9 @@ cat_usb_device(struct usb_device* dev, int interface, int endpoint)
}
else
{
- std::cout << "len: " << ret
+ std::cout << "len: " << ret
<< " data: ";
-
+
for(int j = 0; j < ret; ++j)
{
std::cout << boost::format("0x%02x ") % int(data[j]);
@@ -229,7 +229,7 @@ cat_usb_device(struct usb_device* dev, int interface, int endpoint)
int ret2 = usb_interrupt_write(handle, 4, (char*)data, ret, 0);
printf("Ret2: %d\n", ret2);
}
-
+
if (0)
{
char arr[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 16, 32, 64, 128, 255 };
@@ -240,7 +240,7 @@ cat_usb_device(struct usb_device* dev, int interface, int endpoint)
{
for (size_t i = 0; i < sizeof(arr); ++i)
{
- char ledcmd[] = { front, len, arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i] };
+ char ledcmd[] = { front, len, arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i], arr[i] };
printf("%d %d %d\n", len, front, arr[i]);
usb_interrupt_write(handle, 5, ledcmd, len, 0);
@@ -248,7 +248,7 @@ cat_usb_device(struct usb_device* dev, int interface, int endpoint)
int ret = usb_interrupt_read(handle, endpoint, (char*)data, sizeof(data), 10);
if (ret == -110)
{
-
+
}
else if (ret < 0)
{
@@ -258,9 +258,9 @@ cat_usb_device(struct usb_device* dev, int interface, int endpoint)
}
else
{
- std::cout << "len: " << ret
+ std::cout << "len: " << ret
<< " data: ";
-
+
for(int j = 0; j < ret; ++j)
{
std::cout << boost::format("0x%02x ") % int(data[j]);
@@ -303,7 +303,7 @@ list_usb_devices()
int bus_idx = 0;
for (struct usb_bus* bus = busses; bus; bus = bus->next)
{
- for (struct usb_device* dev = bus->devices; dev; dev = dev->next)
+ for (struct usb_device* dev = bus->devices; dev; dev = dev->next)
{
std::cout << boost::format("Bus %s Device %s ") % bus->dirname % dev->filename
<< " " << dev << std::endl;
@@ -324,7 +324,7 @@ int main(int argc, char** argv)
list_usb_devices();
}
- else if ((argc == 4 || argc == 5 || argc == 6) &&
+ else if ((argc == 4 || argc == 5 || argc == 6) &&
(strcmp("cat", argv[1]) == 0 ||
strcmp("read", argv[1]) == 0 ||
strcmp("write", argv[1]) == 0))
@@ -339,7 +339,7 @@ int main(int argc, char** argv)
{
if (argc >= 5)
interface = atoi(argv[4]);
-
+
if (argc == 6)
endpoint = atoi(argv[5]);
@@ -350,14 +350,14 @@ int main(int argc, char** argv)
struct usb_device* dev = find_usb_device(idVendor, idProduct);
if (!dev)
{
- std::cout << "Error: Device (" << boost::format("idVendor: 0x%04hx, idProduct: 0x%04hx")
+ std::cout << "Error: Device (" << boost::format("idVendor: 0x%04hx, idProduct: 0x%04hx")
% idVendor % idProduct << ") not found" << std::endl;
}
else
{
if (strcmp("cat", argv[1]) == 0)
{
- std::cout << "Reading data from: " << dev << " Interface: " << interface << " Endpoint: " << endpoint << std::endl;
+ std::cout << "Reading data from: " << dev << " Interface: " << interface << " Endpoint: " << endpoint << std::endl;
cat_usb_device(dev, interface, endpoint);
}
else if (strcmp("read", argv[1]) == 0)
diff --git a/tools/usbdebug.cpp b/tools/usbdebug.cpp
index e2da1e6..56ed70d 100644
--- a/tools/usbdebug.cpp
+++ b/tools/usbdebug.cpp
@@ -23,7 +23,7 @@ find_usb_device(uint16_t idVendor, uint16_t idProduct)
for (struct usb_bus* bus = busses; bus; bus = bus->next)
{
- for (struct usb_device* dev = bus->devices; dev; dev = dev->next)
+ for (struct usb_device* dev = bus->devices; dev; dev = dev->next)
{
if (dev->descriptor.idVendor == idVendor &&
dev->descriptor.idProduct == idProduct)
@@ -47,7 +47,7 @@ private:
struct usb_dev_handle* handle;
std::vector<EndpointListenerThread*> threads;
-public:
+public:
USBDevice(struct usb_device* dev_)
: dev(dev_)
{
@@ -70,7 +70,7 @@ public:
if (usb_clear_halt(handle, ep) != 0)
{
std::cout << "Failure to reset_ep: " << ep << std::endl;
- }
+ }
}
void reset()
@@ -148,17 +148,17 @@ public:
uint16_t index;
uint16_t length;
*/
- int ctrl_msg(int requesttype, int request,
+ int ctrl_msg(int requesttype, int request,
int value, int index,
- uint8_t* data, int size)
+ uint8_t* data, int size)
{
- return usb_control_msg(handle,
- requesttype, request,
+ return usb_control_msg(handle,
+ requesttype, request,
value, index,
- (char*)data, size,
+ (char*)data, size,
0 /* timeout */);
}
-
+
void print_info()
{
for(int i = 0; i < dev->descriptor.bNumConfigurations; ++i)
@@ -171,7 +171,7 @@ public:
{
for(int l = 0; l < dev->config[i].interface[j].altsetting[k].bNumEndpoints; ++l)
{
- std::cout << " Endpoint: "
+ std::cout << " Endpoint: "
<< int(dev->config[i].interface[j].altsetting[k].endpoint[l].bEndpointAddress & USB_ENDPOINT_ADDRESS_MASK)
<< ((dev->config[i].interface[j].altsetting[k].endpoint[l].bEndpointAddress & USB_ENDPOINT_DIR_MASK) ? " (IN)" : " (OUT)")
<< std::endl;
@@ -201,7 +201,7 @@ public:
~EndpointListenerThread()
{
-
+
}
void start()
@@ -241,7 +241,7 @@ public:
}
};
-void
+void
USBDevice::launch_listener_thread(int endpoint)
{
try {
@@ -270,10 +270,10 @@ bool readline(const std::string& prompt,
return ret;
}
-std::vector<std::string>
+std::vector<std::string>
tokenize(const std::string& str, const std::string& delimiters = " ")
{
- std::vector<std::string> tokens;
+ std::vector<std::string> tokens;
// Skip delimiters at beginning.
std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
@@ -295,9 +295,9 @@ tokenize(const std::string& str, const std::string& delimiters = " ")
void print_raw_data(std::ostream& out, uint8_t* data, int len)
{
- std::cout << "[" << len
+ std::cout << "[" << len
<< "] { ";
-
+
for(int i = 0; i < len; ++i)
{
std::cout << boost::format("0x%02x") % int(data[i]);
@@ -398,7 +398,7 @@ void console_info_cmd(const std::vector<std::string>& args)
USBDevice::current()->print_info();
}
-class Sequence
+class Sequence
{
private:
int start;
@@ -406,7 +406,7 @@ private:
int idx;
public:
- Sequence(int start_, int end_)
+ Sequence(int start_, int end_)
: start(start_), end(end_), idx(start_)
{}
@@ -430,7 +430,7 @@ public:
idx -= 1;
}
}
-
+
bool eol() {
if (start <= end)
return idx > end;
@@ -474,11 +474,11 @@ public:
int start, end;
if (sscanf(i->c_str(), "%x-%x", &start, &end) == 2)
{
- sequences.push_back(Sequence(start, end));
+ sequences.push_back(Sequence(start, end));
}
else if (sscanf(i->c_str(), "%x", &start) == 1)
{
- sequences.push_back(Sequence(start));
+ sequences.push_back(Sequence(start));
}
else
{
@@ -492,7 +492,7 @@ public:
bool eol() {
return (idx == sequences.size());
}
-
+
void reset() {
for(std::vector<Sequence>::iterator i = sequences.begin(); i != sequences.end(); ++i)
i->reset();
@@ -514,15 +514,15 @@ public:
++idx;
if (idx < sequences.size())
sequences[idx].next();
- }
- else
+ }
+ else
{
return sequences[idx].next();
}
}
}
- std::string to_string() const
+ std::string to_string() const
{
std::ostringstream str;
std::vector<Sequence>::const_iterator i = sequences.begin();
@@ -531,7 +531,7 @@ public:
while (i != sequences.end())
{
const Sequence& seq = *i;
-
+
str << seq.to_string();
++i;
@@ -539,7 +539,7 @@ public:
str << ", ";
}
str << " }";
-
+
return str.str();
}
};
@@ -603,15 +603,15 @@ void console_probe_cmd(const std::vector<std::string>& args)
{
for(int i = 0; i < int(sequences.size()); ++i)
data[i] = sequences[i].get();
-
+
std::cout << "Data Ep: " << endpoint << ": ";
print_raw_data(std::cout, &*data.begin(), data.size());
int ret = USBDevice::current()->write(endpoint, &*data.begin(), data.size());
std::cout << " -> " << ret;
std::cout << std::endl;
-
+
next(sequences);
-
+
//usleep(100 * 1000);
usleep(10 * 1000);
}
@@ -678,7 +678,7 @@ void console_ctrlreq_cmd(const std::vector<std::string>& args)
uint8_t* data = (len == 0) ? NULL : new uint8_t[len];
memset(data, 0, len*sizeof(uint8_t));
-
+
int ret = USBDevice::current()->ctrl_msg(requesttype, request,
value, index,
data,
@@ -689,7 +689,7 @@ void console_ctrlreq_cmd(const std::vector<std::string>& args)
std::cout << "no data";
else
print_raw_data(std::cout, data, len);
-
+
std::cout << std::endl;
delete[] data;
@@ -763,7 +763,7 @@ void console_ctrl_cmd(const std::vector<std::string>& args)
std::cout << "no data";
else
print_raw_data(std::cout, &*data.begin(), data.size());
-
+
int ret = USBDevice::current()->ctrl_msg(requesttype, request,
value, index,
data.empty() ? NULL : &*data.begin(),
@@ -894,7 +894,7 @@ void eval_console_cmd(const std::string& line_)
void run_console()
{
std::cout << "Type 'help' to list all available commands" << std::endl;
-
+
std::string line;
while (!quit && readline("\033[32musb\033[0m> ", line))
@@ -904,7 +904,7 @@ void run_console()
eval_console_cmd(*i);
global_interrupt = false;
}
- std::cout << std::endl;
+ std::cout << std::endl;
}
@@ -939,7 +939,7 @@ int main(int argc, char** argv)
if (sscanf(argv[1], "%hx:%hx", &idVendor, &idProduct) == 2)
{
struct usb_device* dev = find_usb_device(idVendor, idProduct);
-
+
if (dev)
{
std::cout << boost::format("Opening device with idVendor: 0x%h04x, idProduct: 0x%h04x") % idVendor % idProduct << std::endl;
diff --git a/tools/usbread.cpp b/tools/usbread.cpp
index 057d106..dbef291 100644
--- a/tools/usbread.cpp
+++ b/tools/usbread.cpp
@@ -23,7 +23,7 @@ int main(int argc, char** argv)
{
if (argc >= 5)
interface = atoi(argv[4]);
-
+
if (argc == 6)
endpoint = atoi(argv[5]);
@@ -34,12 +34,12 @@ int main(int argc, char** argv)
struct usb_device* dev = find_usb_device(idVendor, idProduct);
if (!dev)
{
- std::cout << "Error: Device (" << boost::format("idVendor: 0x%04hx, idProduct: 0x%04hx")
+ std::cout << "Error: Device (" << boost::format("idVendor: 0x%04hx, idProduct: 0x%04hx")
% idVendor % idProduct << ") not found" << std::endl;
}
else
{
- std::cout << "Reading data from: " << dev << " Interface: " << interface << " Endpoint: " << endpoint << std::endl;
+ std::cout << "Reading data from: " << dev << " Interface: " << interface << " Endpoint: " << endpoint << std::endl;
cat_usb_device(dev, interface, endpoint);
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/xboxdrv.git
More information about the Pkg-games-commits
mailing list