Minor stdout cleanup
This commit is contained in:
parent
f5f125b988
commit
734218c7ab
7 changed files with 32 additions and 10 deletions
2
TODO
2
TODO
|
@ -42,6 +42,8 @@ $ dput my-ppa ../xboxdrv_0.7.0-1~lucid1_source.changes
|
|||
Stuff to do before 0.7.0 release:
|
||||
=================================
|
||||
|
||||
* print controller type/name in daemon
|
||||
|
||||
* log levels:
|
||||
|
||||
debug: only shown when --debug is given
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "ini_schema.hpp"
|
||||
#include "uinput.hpp"
|
||||
|
||||
class Options;
|
||||
class Xboxdrv;
|
||||
|
||||
class CommandLineParser
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "evdev_helper.hpp"
|
||||
#include "linux_uinput.hpp"
|
||||
#include "uinput_options.hpp"
|
||||
#include "xboxdrv.hpp"
|
||||
#include "xpad_device.hpp"
|
||||
|
||||
struct Xbox360Msg;
|
||||
|
|
|
@ -37,6 +37,12 @@ WordWrap::newline()
|
|||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
WordWrap::para(const std::string& str) const
|
||||
{
|
||||
para("", str);
|
||||
}
|
||||
|
||||
void
|
||||
WordWrap::para(const std::string& prefix, const std::string& str) const
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ private:
|
|||
public:
|
||||
WordWrap(int terminal_width);
|
||||
|
||||
void para(const std::string& str) const;
|
||||
void para(const std::string& prefix, const std::string& str) const;
|
||||
void println(const std::string& str);
|
||||
void newline();
|
||||
|
|
|
@ -348,18 +348,25 @@ void set_rumble(XboxGenericController* controller, int gain, uint8_t lhs, uint8_
|
|||
}
|
||||
} // namespace
|
||||
|
||||
void
|
||||
Xboxdrv::print_copyright() const
|
||||
{
|
||||
WordWrap wrap(get_terminal_width());
|
||||
wrap.para("xboxdrv " PACKAGE_VERSION " - http://pingus.seul.org/~grumbel/xboxdrv/");
|
||||
wrap.para("Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>");
|
||||
wrap.para("Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
|
||||
wrap.para("This program comes with ABSOLUTELY NO WARRANTY.");
|
||||
wrap.para("This is free software, and you are welcome to redistribute it under certain "
|
||||
"conditions; see the file COPYING for details.");
|
||||
wrap.newline();
|
||||
}
|
||||
|
||||
void
|
||||
Xboxdrv::run_main(const Options& opts)
|
||||
{
|
||||
if (!opts.quiet)
|
||||
{
|
||||
std::cout
|
||||
<< "xboxdrv " PACKAGE_VERSION " - http://pingus.seul.org/~grumbel/xboxdrv/\n"
|
||||
<< "Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>\n"
|
||||
<< "Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
|
||||
<< "This program comes with ABSOLUTELY NO WARRANTY.\n"
|
||||
<< "This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.\n";
|
||||
std::cout << std::endl;
|
||||
print_copyright();
|
||||
}
|
||||
|
||||
std::auto_ptr<XboxGenericController> controller;
|
||||
|
@ -494,7 +501,7 @@ Xboxdrv::print_info(libusb_device* dev,
|
|||
raise_exception(std::runtime_error, "libusb_get_device_descriptor() failed: " << usb_strerror(ret));
|
||||
}
|
||||
|
||||
std::cout << "USB Device: " << boost::format("%03d:%03d:")
|
||||
std::cout << "USB Device: " << boost::format("%03d:%03d")
|
||||
% static_cast<int>(libusb_get_bus_number(dev))
|
||||
% static_cast<int>(libusb_get_device_address(dev)) << std::endl;
|
||||
std::cout << "Controller: " << boost::format("\"%s\" (idVendor: 0x%04x, idProduct: 0x%04x)")
|
||||
|
@ -578,6 +585,11 @@ Xboxdrv::run_help_devices()
|
|||
void
|
||||
Xboxdrv::run_daemon(const Options& opts)
|
||||
{
|
||||
if (!opts.quiet)
|
||||
{
|
||||
print_copyright();
|
||||
}
|
||||
|
||||
int ret = libusb_init(NULL);
|
||||
if (ret != LIBUSB_SUCCESS)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
struct XPadDevice;
|
||||
class Options;
|
||||
class Options;
|
||||
class XboxGenericController;
|
||||
|
||||
class Xboxdrv
|
||||
|
@ -52,6 +51,8 @@ private:
|
|||
bool find_controller_by_id(int id, int vendor_id, int product_id, libusb_device** xbox_device) const;
|
||||
bool find_xbox360_controller(int id, libusb_device** xbox_device, XPadDevice* type) const;
|
||||
|
||||
void print_copyright() const;
|
||||
|
||||
public:
|
||||
Xboxdrv();
|
||||
~Xboxdrv();
|
||||
|
|
Loading…
Add table
Reference in a new issue