diff --git a/TODO b/TODO index 629547f..a03d8d3 100644 --- a/TODO +++ b/TODO @@ -44,8 +44,6 @@ Stuff to do before 0.7.2 release: == Generic == -* document that Xbox360 wireless controller shuts down at 15min - * add glib and dbus dependencies to .deb control file * mimic-xpad is broken, should handle wireless and wired controllers @@ -63,13 +61,31 @@ Stuff to do before 0.7.2 release: * implement Options::set_device_usbid() and CommandLineParser::set_device_usbid() + +== Unsolved/WontFix == -== Other == +* after every thread cleanup, do an enumeration over all USB devices, + find those not currently used by a Slot and recreate them, this + should fix resume issues, this would also fix the issue with + ignoring controllers when all slots are full -* give proper exit code when no controller is found + -> bad idea, as it would let unused controllers slip into the free + slots, could lead to unexpected behaviour -* sort options a bit more between global ones, slot local ones and - config local ones + -> maybe as D-Bus interface? + +* allow multiple controllers in non-daemon mode + -> not a good idea, complicates stuff and duplicates code + +* remember controllers that couldn't be used when all slots where full + and use them when a slot got free -> discard, bad idea, as it + results in confusing behaviour + + + +* glib/D-Bus causes crash/exit when USBController::get_name() returns an invalid unicode string?! + +* move sigint/sigterm handling out of main.cpp and into xboxdrv_daemon.cpp (needs to use gmain_quit()) * BTN_A@joystick.1 doesn't work for a single joystick, why? (joystick isn't id=0, why?) @@ -81,9 +97,15 @@ Stuff to do before 0.7.2 release: -> figure out how exactly device names are choosen (first free or are there other means? need to take special axes/buttons into account) -* add extra arguments to --on-connect and --on-disconnect (controller name, usb path, etc.) - * done -> document - * currently returns: "-1:-1" "-1:-1" "not implemented" +== Daemon == + +* check how daemon reacts on suspend + - suspending the computer leads to LIBUSB_ERROR_IO, unplugging the + controller leads to LIBUSB_ERROR_OTHER + -> couldn't be replicated, both give LIBUSB_ERROR_OTHER + - errno is set to EBUSY + - the device handle can't be reused, device has to be reallocated + - integrate this with the "keep backlog of devices currently in use" == Daemon == @@ -91,40 +113,15 @@ Stuff to do before 0.7.2 release: * improve output in daemon mode, when --quiet is not given print the number of allocated controller slots -* check how daemon reacts on suspend - - suspending the computer leads to LIBUSB_ERROR_IO, unplugging the - controller leads to LIBUSB_ERROR_OTHER - - errno is set to EBUSY - - the device handle can't be reused, device has to be reallocated - - integrate this with the "keep backlog of devices currently in use" - * get rid of all std::cout stuff when using detached daemon, redirect log output to a file, syslog or somewhere else: --silent: stops event output - --quiet: stops all stdout output (automatically used when --detach is given) + --quiet: stops all stdout output (automatically used when --detach is given, except for errors) --verbose: print info level log output --debug: print debug level log output -== Unsolved/WontFix == - -* after every thread cleanup, do an enumeration over all USB devices, - find those not currently used by a Slot and recreate them, this - should fix resume issues, this would also fix the issue with - ignoring controllers when all slots are full - - -> bad idea, as it would let unused controllers slip into the free - slots, could lead to unexpected behaviour - -* allow multiple controllers in non-daemon mode - -> not a good idea, complicates stuff and duplicates code - -* remember controllers that couldn't be used when all slots where full - and use them when a slot got free -> discard, bad idea, as it - results in confusing behaviour - - == D-Bus == * interface for next release: @@ -132,6 +129,15 @@ Stuff to do before 0.7.2 release: Daemon/GetControllerSlotCount -> INT // do we need those or can Daemon/GetControllerCount -> INT // directories be browsed? +== Other == + +* document that Xbox360 wireless controller shuts down at 15min + +* give proper exit code when no controller is found + +* sort options a bit more between global ones, slot local ones and + config local ones + * in INI files should allow: [xboxdrv] diff --git a/src/usb_controller.cpp b/src/usb_controller.cpp index 863ed0c..a29d728 100644 --- a/src/usb_controller.cpp +++ b/src/usb_controller.cpp @@ -50,19 +50,23 @@ USBController::USBController(libusb_device* dev) : % static_cast<int>(desc.idProduct)).str(); char buf[1024]; - ret = libusb_get_string_descriptor_ascii(m_handle, desc.iManufacturer, - reinterpret_cast<unsigned char*>(buf), sizeof(buf)); - if (ret == LIBUSB_SUCCESS) - { - m_name = buf; + int len; + if (false) + { // FIXME: do we need the manufacturer name? + len = libusb_get_string_descriptor_ascii(m_handle, desc.iManufacturer, + reinterpret_cast<unsigned char*>(buf), sizeof(buf)); + if (len > 0) + { + m_name.append(buf, len); + m_name.append(" "); + } } - ret = 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 (ret == LIBUSB_SUCCESS) + if (len > 0) { - m_name += " "; - m_name += buf; + m_name.append(buf, len); } } } diff --git a/src/xboxdrv_daemon.cpp b/src/xboxdrv_daemon.cpp index 8938b57..19ae6b6 100644 --- a/src/xboxdrv_daemon.cpp +++ b/src/xboxdrv_daemon.cpp @@ -875,39 +875,31 @@ XboxdrvDaemon::status() { std::ostringstream out; - out << boost::format("SLOT STATUS CONFIG USBID USBPATH NAME\n"); + out << boost::format("SLOT CFG NCFG USBID USBPATH NAME\n"); for(ControllerSlots::iterator i = m_controller_slots.begin(); i != m_controller_slots.end(); ++i) { if ((*i)->get_thread()) { - int config_count = -1; - int current_config = -1; - - if (UInputMessageProcessor* msg_proc - = dynamic_cast<UInputMessageProcessor*>((*i)->get_thread()->get_message_proc())) - { - current_config = msg_proc->get_config()->get_current_config(); - config_count = msg_proc->get_config()->config_count(); - } - - out << boost::format("%4d %6s %3d/%-2d %5s %7s %s\n") + out << boost::format("%4d %3d %4d %5s %7s %s\n") % (i - m_controller_slots.begin()) - % " ok " - % (current_config+1) % config_count + % (*i)->get_config()->get_current_config() + % (*i)->get_config()->config_count() % (*i)->get_thread()->get_usbid() % (*i)->get_thread()->get_usbpath() % (*i)->get_thread()->get_name(); } else { - out << boost::format("%4d empty\n") - % (i - m_controller_slots.begin()); + out << boost::format("%4d %3d %4d - -\n") + % (i - m_controller_slots.begin()) + % (*i)->get_config()->get_current_config() + % (*i)->get_config()->config_count(); } } for(Threads::iterator i = m_inactive_threads.begin(); i != m_inactive_threads.end(); ++i) { - out << boost::format(" - %5s %7s %s\n") + out << boost::format(" - %5s %7s %s\n") % (*i)->get_usbid() % (*i)->get_usbpath() % (*i)->get_name();