diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /games-util/xboxdrv/files | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'games-util/xboxdrv/files')
-rw-r--r-- | games-util/xboxdrv/files/org.seul.Xboxdrv.conf | 7 | ||||
-rw-r--r-- | games-util/xboxdrv/files/xboxdrv-0.8.4-libusbx-1.0.13-fix.patch | 340 | ||||
-rw-r--r-- | games-util/xboxdrv/files/xboxdrv-0.8.5-scons.patch | 13 | ||||
-rw-r--r-- | games-util/xboxdrv/files/xboxdrv.confd | 6 | ||||
-rw-r--r-- | games-util/xboxdrv/files/xboxdrv.initd | 19 | ||||
-rw-r--r-- | games-util/xboxdrv/files/xboxdrv.service | 14 | ||||
-rw-r--r-- | games-util/xboxdrv/files/xboxdrv.udev-rules | 5 |
7 files changed, 404 insertions, 0 deletions
diff --git a/games-util/xboxdrv/files/org.seul.Xboxdrv.conf b/games-util/xboxdrv/files/org.seul.Xboxdrv.conf new file mode 100644 index 000000000000..fc685d6e8e83 --- /dev/null +++ b/games-util/xboxdrv/files/org.seul.Xboxdrv.conf @@ -0,0 +1,7 @@ +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <policy context="default"> + <allow own="org.seul.Xboxdrv"/> + </policy> +</busconfig> diff --git a/games-util/xboxdrv/files/xboxdrv-0.8.4-libusbx-1.0.13-fix.patch b/games-util/xboxdrv/files/xboxdrv-0.8.4-libusbx-1.0.13-fix.patch new file mode 100644 index 000000000000..5b8d2f453ede --- /dev/null +++ b/games-util/xboxdrv/files/xboxdrv-0.8.4-libusbx-1.0.13-fix.patch @@ -0,0 +1,340 @@ +commit 27cdd9c6a994f3059b8ae683adb711169341ffa5 +Author: Ingo Ruhnke <grumbel@gmail.com> +Date: Wed Dec 19 11:39:31 2012 +0100 + + Added additional bookkeeping to USBController to allow clean shutdowns with libusbx + + Fixes #28 + +--- a/src/firestorm_dual_controller.cpp ++++ b/src/firestorm_dual_controller.cpp +@@ -99,8 +99,6 @@ FirestormDualController::FirestormDualController(libusb_device* dev, bool is_vsb + + FirestormDualController::~FirestormDualController() + { +- usb_cancel_read(); +- usb_release_interface(0); + } + + void +--- a/src/generic_usb_controller.cpp ++++ b/src/generic_usb_controller.cpp +@@ -62,8 +62,6 @@ GenericUSBController::GenericUSBController(libusb_device* dev, + + GenericUSBController::~GenericUSBController() + { +- usb_cancel_read(); +- usb_release_interface(m_interface); + } + + void +--- a/src/playstation3_usb_controller.cpp ++++ b/src/playstation3_usb_controller.cpp +@@ -37,8 +37,6 @@ Playstation3USBController::Playstation3USBController(libusb_device* dev, bool tr + + Playstation3USBController::~Playstation3USBController() + { +- usb_cancel_read(); +- usb_release_interface(0); + } + + #define HID_GET_REPORT 0x01 +--- a/src/saitek_p2500_controller.cpp ++++ b/src/saitek_p2500_controller.cpp +@@ -66,8 +66,6 @@ SaitekP2500Controller::SaitekP2500Controller(libusb_device* dev, bool try_detach + + SaitekP2500Controller::~SaitekP2500Controller() + { +- usb_cancel_read(); +- usb_release_interface(0); + } + + void +--- a/src/usb_controller.cpp ++++ b/src/usb_controller.cpp +@@ -28,7 +28,8 @@ + USBController::USBController(libusb_device* dev) : + m_dev(dev), + m_handle(0), +- m_read_transfer(), ++ m_transfers(), ++ m_interfaces(), + m_usbpath(), + m_usbid(), + m_name() +@@ -78,7 +79,29 @@ USBController::USBController(libusb_device* dev) : + + USBController::~USBController() + { +- //log_tmp("~USBController"); ++ // cancel all transfers ++ for(std::set<libusb_transfer*>::iterator it = m_transfers.begin(); it != m_transfers.end(); ++it) ++ { ++ libusb_cancel_transfer(*it); ++ } ++ ++ // wait for cancel to succeed ++ while (!m_transfers.empty()) ++ { ++ int ret = libusb_handle_events(NULL); ++ if (ret != 0) ++ { ++ log_error("libusb_handle_events() failure: " << ret); ++ } ++ } ++ ++ // release all claimed interfaces ++ for(std::set<int>::iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it) ++ { ++ libusb_release_interface(m_handle, *it); ++ } ++ ++ // read and write transfers might still be going on and might need to be canceled + libusb_close(m_handle); + } + +@@ -103,23 +126,26 @@ USBController::get_name() const + void + USBController::usb_submit_read(int endpoint, int len) + { +- assert(!m_read_transfer); +- +- m_read_transfer = libusb_alloc_transfer(0); ++ libusb_transfer* transfer = libusb_alloc_transfer(0); + + uint8_t* data = static_cast<uint8_t*>(malloc(sizeof(uint8_t) * len)); +- m_read_transfer->flags |= LIBUSB_TRANSFER_FREE_BUFFER; +- libusb_fill_interrupt_transfer(m_read_transfer, m_handle, ++ transfer->flags |= LIBUSB_TRANSFER_FREE_BUFFER; ++ libusb_fill_interrupt_transfer(transfer, m_handle, + endpoint | LIBUSB_ENDPOINT_IN, + data, len, + &USBController::on_read_data_wrap, this, + 0); // timeout + int ret; +- ret = libusb_submit_transfer(m_read_transfer); ++ ret = libusb_submit_transfer(transfer); + if (ret != LIBUSB_SUCCESS) + { ++ libusb_free_transfer(transfer); + raise_exception(std::runtime_error, "libusb_submit_transfer(): " << usb_strerror(ret)); + } ++ else ++ { ++ m_transfers.insert(transfer); ++ } + } + + void +@@ -127,7 +153,6 @@ USBController::usb_write(int endpoint, uint8_t* data_in, int len) + { + libusb_transfer* transfer = libusb_alloc_transfer(0); + transfer->flags |= LIBUSB_TRANSFER_FREE_BUFFER; +- transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER; + + // copy data into a newly allocated buffer + uint8_t* data = static_cast<uint8_t*>(malloc(sizeof(uint8_t) * len)); +@@ -143,8 +168,13 @@ USBController::usb_write(int endpoint, uint8_t* data_in, int len) + ret = libusb_submit_transfer(transfer); + if (ret != LIBUSB_SUCCESS) + { ++ libusb_free_transfer(transfer); + raise_exception(std::runtime_error, "libusb_submit_transfer(): " << usb_strerror(ret)); + } ++ else ++ { ++ m_transfers.insert(transfer); ++ } + } + + void +@@ -154,7 +184,6 @@ USBController::usb_control(uint8_t bmRequestType, uint8_t bRequest, + { + libusb_transfer* transfer = libusb_alloc_transfer(0); + transfer->flags |= LIBUSB_TRANSFER_FREE_BUFFER; +- transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER; + + // create and fill control buffer + uint8_t* data = static_cast<uint8_t*>(malloc(wLength + 8)); +@@ -168,14 +197,22 @@ USBController::usb_control(uint8_t bmRequestType, uint8_t bRequest, + ret = libusb_submit_transfer(transfer); + if (ret != LIBUSB_SUCCESS) + { ++ libusb_free_transfer(transfer); + raise_exception(std::runtime_error, "libusb_submit_transfer(): " << usb_strerror(ret)); + } ++ else ++ { ++ m_transfers.insert(transfer); ++ } + } + + void + USBController::on_control(libusb_transfer* transfer) + { + log_debug("control transfer"); ++ ++ m_transfers.erase(transfer); ++ libusb_free_transfer(transfer); + } + + void +@@ -183,19 +220,12 @@ USBController::on_write_data(libusb_transfer* transfer) + { + if (transfer->status != LIBUSB_TRANSFER_COMPLETED) + { +- log_error("USB write failure: " << transfer->length << ": " << usb_transfer_strerror(transfer->status)); ++ if (transfer->status != LIBUSB_TRANSFER_CANCELLED) ++ log_error("USB write failure: " << transfer->length << ": " << usb_transfer_strerror(transfer->status)); + } +-} + +-void +-USBController::usb_cancel_read() +-{ +- if (m_read_transfer) +- { +- libusb_cancel_transfer(m_read_transfer); +- libusb_free_transfer(m_read_transfer); +- m_read_transfer = 0; +- } ++ m_transfers.erase(transfer); ++ libusb_free_transfer(transfer); + } + + void +@@ -203,31 +233,30 @@ USBController::on_read_data(libusb_transfer* transfer) + { + assert(transfer); + +- // FIXME: check for LIBUSB_TRANSFER_COMPLETED +- +- // process data +- XboxGenericMsg msg; +- if (parse(transfer->buffer, transfer->actual_length, &msg)) ++ if (transfer->status != LIBUSB_TRANSFER_COMPLETED) + { +- submit_msg(msg); +- } ++ if (transfer->status != LIBUSB_TRANSFER_CANCELLED) ++ log_error("USB read failure: " << transfer->length << ": " << usb_transfer_strerror(transfer->status)); + +- if (false) // cleanup +- { ++ m_transfers.erase(transfer); + libusb_free_transfer(transfer); + } +- else // resubmit +- { ++ else ++ { ++ // process data ++ XboxGenericMsg msg; ++ if (parse(transfer->buffer, transfer->actual_length, &msg)) ++ { ++ submit_msg(msg); ++ } ++ + int ret; + ret = libusb_submit_transfer(transfer); + if (ret != LIBUSB_SUCCESS) // could also check for LIBUSB_ERROR_NO_DEVICE + { + log_error("failed to resubmit USB transfer: " << usb_strerror(ret)); + +- assert(m_read_transfer == transfer); +- + libusb_free_transfer(transfer); +- m_read_transfer = 0; + + send_disconnect(); + } +@@ -237,6 +266,11 @@ USBController::on_read_data(libusb_transfer* transfer) + void + USBController::usb_claim_interface(int ifnum, bool try_detach) + { ++ // keep track of all claimed interfaces so they can be released in ++ // the destructor ++ assert(m_interfaces.find(ifnum) == m_interfaces.end()); ++ m_interfaces.insert(ifnum); ++ + int err = usb_claim_n_detach_interface(m_handle, ifnum, try_detach); + if (err != 0) + { +@@ -247,13 +281,6 @@ USBController::usb_claim_interface(int ifnum, bool try_detach) + } + } + +-void +-USBController::usb_release_interface(int ifnum) +-{ +- // should be called before closing the device handle +- libusb_release_interface(m_handle, ifnum); +-} +- + int + USBController::usb_find_ep(int direction, uint8_t if_class, uint8_t if_subclass, uint8_t if_protocol) + { +--- a/src/usb_controller.hpp ++++ b/src/usb_controller.hpp +@@ -22,6 +22,7 @@ + #include <libusb.h> + #include <string> + #include <memory> ++#include <set> + + #include "controller.hpp" + +@@ -31,7 +32,8 @@ protected: + libusb_device* m_dev; + libusb_device_handle* m_handle; + +- libusb_transfer* m_read_transfer; ++ std::set<libusb_transfer*> m_transfers; ++ std::set<int> m_interfaces; + + std::string m_usbpath; + std::string m_usbid; +@@ -50,10 +52,8 @@ public: + int usb_find_ep(int direction, uint8_t if_class, uint8_t if_subclass, uint8_t if_protocol); + + void usb_claim_interface(int ifnum, bool try_detach); +- void usb_release_interface(int ifnum); + + void usb_submit_read(int endpoint, int len); +- void usb_cancel_read(); + + void usb_write(int endpoint, uint8_t* data, int len); + void usb_control(uint8_t bmRequestType, uint8_t bRequest, +--- a/src/xbox360_controller.cpp ++++ b/src/xbox360_controller.cpp +@@ -86,8 +86,6 @@ Xbox360Controller::Xbox360Controller(libusb_device* dev, + + Xbox360Controller::~Xbox360Controller() + { +- usb_cancel_read(); +- usb_release_interface(0); + } + + void +--- a/src/xbox360_wireless_controller.cpp ++++ b/src/xbox360_wireless_controller.cpp +@@ -50,8 +50,6 @@ Xbox360WirelessController::Xbox360WirelessController(libusb_device* dev, int con + + Xbox360WirelessController::~Xbox360WirelessController() + { +- usb_cancel_read(); +- usb_release_interface(m_interface); + } + + void +--- a/src/xbox_controller.cpp ++++ b/src/xbox_controller.cpp +@@ -41,8 +41,6 @@ XboxController::XboxController(libusb_device* dev, bool try_detach) : + + XboxController::~XboxController() + { +- usb_cancel_read(); +- usb_release_interface(0); + } + + void diff --git a/games-util/xboxdrv/files/xboxdrv-0.8.5-scons.patch b/games-util/xboxdrv/files/xboxdrv-0.8.5-scons.patch new file mode 100644 index 000000000000..cb81f6d51470 --- /dev/null +++ b/games-util/xboxdrv/files/xboxdrv-0.8.5-scons.patch @@ -0,0 +1,13 @@ +http://dev.gentoo.org/~vapier/scons-blows.txt + +--- SConstruct ++++ SConstruct +@@ -85,6 +85,8 @@ + opts.Add('LINKFLAGS', 'Linker Compiler flags') + opts.Add('CC', 'C Compiler') + opts.Add('CXX', 'C++ Compiler') ++opts.Add('AR', 'Archiver') ++opts.Add('RANLIB', 'Archive indexer') + opts.Add('BUILD', 'Build type: release, custom, development') + + opts.Update(env) diff --git a/games-util/xboxdrv/files/xboxdrv.confd b/games-util/xboxdrv/files/xboxdrv.confd new file mode 100644 index 000000000000..c42cc9d1ec74 --- /dev/null +++ b/games-util/xboxdrv/files/xboxdrv.confd @@ -0,0 +1,6 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +XBOXDRV_OPTS="" +#XBOXDRV_OPTS="${XBOXDRV_OPTS} --next-controller --config /etc/xboxdrv/controller.ini" diff --git a/games-util/xboxdrv/files/xboxdrv.initd b/games-util/xboxdrv/files/xboxdrv.initd new file mode 100644 index 000000000000..d0cb58bd9025 --- /dev/null +++ b/games-util/xboxdrv/files/xboxdrv.initd @@ -0,0 +1,19 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +PIDFILE="/var/run/${SVCNAME}.pid" + +start() { + ebegin "Starting xboxdrv" + start-stop-daemon --start --pidfile "${PIDFILE}" --exec /usr/bin/xboxdrv -- \ + --daemon --detach --pid-file "${PIDFILE}" ${XBOXDRV_OPTS} + eend $? +} + +stop() { + ebegin "Stopping xboxdrv" + start-stop-daemon --stop --pidfile "${PIDFILE}" + eend $? +} diff --git a/games-util/xboxdrv/files/xboxdrv.service b/games-util/xboxdrv/files/xboxdrv.service new file mode 100644 index 000000000000..b0d372696e0a --- /dev/null +++ b/games-util/xboxdrv/files/xboxdrv.service @@ -0,0 +1,14 @@ +[Unit] +Description=Userspace Xbox 360 Controller driver +BindsTo=sys-subsystem-usb-xbox-controller0.device +After=sys-subsystem-usb-xbox-controller0.device + +[Service] +BusName=org.seul.Xboxdrv +ExecStart=/usr/bin/xboxdrv --silent --daemon +KillSignal=SIGINT +# xboxdrv can not stop gracefully if controller gets unplugged +TimeoutStopSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/games-util/xboxdrv/files/xboxdrv.udev-rules b/games-util/xboxdrv/files/xboxdrv.udev-rules new file mode 100644 index 000000000000..c571b2b5ab02 --- /dev/null +++ b/games-util/xboxdrv/files/xboxdrv.udev-rules @@ -0,0 +1,5 @@ +SUBSYSTEM=="usb", ACTION=="add",\ + ENV{ID_MODEL_FROM_DATABASE}=="Xbox*Controller|Xbox*Controller S",\ + TAG+="systemd",\ + ENV{SYSTEMD_ALIAS}="/sys/subsystem/usb/xbox/controller$number",\ + ENV{SYSTEMD_WANTS}+="xboxdrv.service" |