summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Popov <pinkbyte@gentoo.org>2013-01-09 14:19:23 +0000
committerSergey Popov <pinkbyte@gentoo.org>2013-01-09 14:19:23 +0000
commit3bdae400f44a23914279f3008fa66fb30f504003 (patch)
tree877256bda6a7e4334494e0d565ea4b2b3b84b262 /games-util/xboxdrv
parentVersion bump (diff)
downloadhistorical-3bdae400f44a23914279f3008fa66fb30f504003.tar.gz
historical-3bdae400f44a23914279f3008fa66fb30f504003.tar.bz2
historical-3bdae400f44a23914279f3008fa66fb30f504003.zip
Revision bump: EAPI 5, use base eclass, add compatibility fix for libusbx, wrt bug #435832
Package-Manager: portage-2.2.0_alpha149/cvs/Linux x86_64
Diffstat (limited to 'games-util/xboxdrv')
-rw-r--r--games-util/xboxdrv/ChangeLog11
-rw-r--r--games-util/xboxdrv/Manifest20
-rw-r--r--games-util/xboxdrv/files/xboxdrv-0.8.4-libusbx-1.0.13-fix.patch358
-rw-r--r--games-util/xboxdrv/xboxdrv-0.8.4-r1.ebuild45
4 files changed, 416 insertions, 18 deletions
diff --git a/games-util/xboxdrv/ChangeLog b/games-util/xboxdrv/ChangeLog
index 971c97849185..c0d991cec70f 100644
--- a/games-util/xboxdrv/ChangeLog
+++ b/games-util/xboxdrv/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for games-util/xboxdrv
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/games-util/xboxdrv/ChangeLog,v 1.26 2012/11/29 02:07:15 ssuominen Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/games-util/xboxdrv/ChangeLog,v 1.27 2013/01/09 14:19:22 pinkbyte Exp $
+
+*xboxdrv-0.8.4-r1 (09 Jan 2013)
+
+ 09 Jan 2013; Sergey Popov <pinkbyte@gentoo.org> +xboxdrv-0.8.4-r1.ebuild,
+ +files/xboxdrv-0.8.4-libusbx-1.0.13-fix.patch:
+ Revision bump: EAPI 5, use base eclass, add compatibility fix for libusbx,
+ wrt bug #435832
29 Nov 2012; Samuli Suominen <ssuominen@gentoo.org> -xboxdrv-0.8.2.ebuild:
old
diff --git a/games-util/xboxdrv/Manifest b/games-util/xboxdrv/Manifest
index 37a0e0a3dd1d..fd824439c6f8 100644
--- a/games-util/xboxdrv/Manifest
+++ b/games-util/xboxdrv/Manifest
@@ -1,18 +1,6 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
-
-DIST xboxdrv-linux-0.8.4.tar.bz2 264484 SHA256 01611a1add7f26d6b59e02fe869bbbdb2ad4358c922c85c446c2019f87ff519c
+AUX xboxdrv-0.8.4-libusbx-1.0.13-fix.patch 10580 SHA256 79af5a9bb56d8cea6528536691d1256ecbc32aeeb88b7ff00f4c93b81ce11187 SHA512 bcbbec3744de536d1eef485eb313e7b08b376acd1a719e352e2ba244c58d95702dc0431cba0f6b7e58ad094f2ef8f09b998678b01aba556c823c657b92a129c8 WHIRLPOOL 59a4cca39fada0ff5fa8413b58d96488b1a72bb4baeb2c6e73709b22b3a555e7ea1b488fab231dbd1f491bf2f7c36444bb447edf452c0708fa799726acf00f13
+DIST xboxdrv-linux-0.8.4.tar.bz2 264484 SHA256 01611a1add7f26d6b59e02fe869bbbdb2ad4358c922c85c446c2019f87ff519c SHA512 ecee6987a2be9021a70bf0fbf6eb93cca17cbac62e583ebe5bf63544217fdf9b78715ec8e709e503475421171711b7340cf2d2c297f2a75de21490bb879d1235 WHIRLPOOL 2615170b3e428da3bd57ef8d0fb3f07923289160ff669b48bf8a39f0ab2816f44367effb1af431744ef4efc2c6dcbf785ef49a3b823492be8be80fa927c5352d
+EBUILD xboxdrv-0.8.4-r1.ebuild 1075 SHA256 0ca680402274c7a95847377c929d28f69ce02b03ecd1e33648b1094b2616be95 SHA512 336c57b7a23ed815c87a667a12946df5e224619f3cfdea3026858fb6c148b6a9efa948c695d4b5d939ed9c230588ec16ab65c6809a7e65dfc110de237bf4c0e4 WHIRLPOOL 2e9346618c9cc51a3a13382c5bf8266d06fb7f570425562f667d109c35cac2519764f785f328e76743859839cb0b6fb89af3fd834a13495516cd74fc9bdf0f90
EBUILD xboxdrv-0.8.4.ebuild 1009 SHA256 9e756a887c18ed59920074b370231ca95afbc1388a329ea4c8db88ee61cd588e SHA512 d05352216d53244147f3e2609b74c53e35bff4cc69ec3f66c5656df25e457fa9b42c282fcf7af143b2c47141a3808310fe38d3478774268f862609a349442c6b WHIRLPOOL 95a97d5791b2798f876dc346642fe51728bb4948a158e179b29cb5b59333da0fb69c87479edb8e278856c154d438f2bced11f84b2782b2aacf5a04078fb903eb
-MISC ChangeLog 3499 SHA256 95e21c973a854d92ae0486eb2bef483974114ba522af392d823f54cf29aacb55 SHA512 b4243b86df6b9f81ff3d678e26a19af92120c52993bcdfe90a4bb77db7a956816348bf93eaca3d3558fb2f8dee00e09351fb9e29058b131a07c60250d5a12f71 WHIRLPOOL cec0b407e598003ac41f6a5585b8ad28b525b66b476b27e995381e46bcfe928186dda01aaaa76d8b5c49182b1f131605de2259d7823633a18629fa161c68bbf9
+MISC ChangeLog 3752 SHA256 9bfa45d3f11de75c3115d0b8a875680a9ee7c42c9504b5aa349ba005917887ad SHA512 2706dfe1afeca1da2ecbc915006065ad5a42ada848268c5a91fdbc50ec9c754531e564e42bd1550b8ffef4a2967d46ac45d04c8904c5cd17d274553081471ed5 WHIRLPOOL 2313010ee08acd63acf7d632a3913239db24bc00901727c485c6acfd031d0880804f3b09bef3cdf2532441c5875aa29cbfa51c8a800c60c14499eed8bb008aa0
MISC metadata.xml 254 SHA256 94013c86722577c3622e96f1c5a36b40520c1115a3edd5843b366a0cea0b23c6 SHA512 c154f0ec5e052c95141c1e182294e35c49bd8404157765a75b18025ad4b969d5007fab3363861f8e15dccd989e499d0eec4bafdc060bbf4400004969be8a6d8e WHIRLPOOL 536a04b316c96f02ebeb6d8198bccf0b0a7de25707d5b7f69b4cbf0e81e6919c4345d03b22b6f87aa72fe6bebf3aa14f42a94cd31194491e93bfeb775897a68d
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.19 (GNU/Linux)
-
-iQEcBAEBCAAGBQJQtsMbAAoJEEdUh39IaPFN5soH/Rke7E/MDDCfRSXoJtjA71Db
-GUI2YfG/pLVotIVWl7A5Pl191NwRVlvPmx4McQuFTONVfezl29gkrAJh1klHL/bh
-BzSn36poosufjeFxmWpPIiFYisVURz0c9CZtk2KDz7y2/pnDNMah9yYafYGKwIhm
-ahNrAMzI6jQyXjvFVxRPo0l8jCDFeWqnoOntIwsXkK17eMVjGyNeY8N6otdJO6Hk
-4hHFiba/BhzjkS4Ttb+/AOB5RlUZ6m4TqO0gyT7DHI/Mi6TQ2QFXAnkX6UPRndN6
-vLrMRGrkfMhpKxGLF+EygkEfnYlW4ezhKb6Oac1E8m95GDJ6tCec8irUV0I4m5w=
-=MdqE
------END PGP SIGNATURE-----
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..6da7e7dab5d2
--- /dev/null
+++ b/games-util/xboxdrv/files/xboxdrv-0.8.4-libusbx-1.0.13-fix.patch
@@ -0,0 +1,358 @@
+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
+
+diff --git a/src/firestorm_dual_controller.cpp b/src/firestorm_dual_controller.cpp
+index 675949c..5255b9b 100644
+--- 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
+diff --git a/src/generic_usb_controller.cpp b/src/generic_usb_controller.cpp
+index 1c5ce31..b8ad696 100644
+--- 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
+diff --git a/src/playstation3_usb_controller.cpp b/src/playstation3_usb_controller.cpp
+index 86b5c72..676ebf9 100644
+--- 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
+diff --git a/src/saitek_p2500_controller.cpp b/src/saitek_p2500_controller.cpp
+index a3be21b..4734776 100644
+--- 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
+diff --git a/src/usb_controller.cpp b/src/usb_controller.cpp
+index 828b3b6..6c9c5e4 100644
+--- 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)
+ {
+diff --git a/src/usb_controller.hpp b/src/usb_controller.hpp
+index 726e9c2..f808be3 100644
+--- 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,
+diff --git a/src/xbox360_controller.cpp b/src/xbox360_controller.cpp
+index 818b61f..dfae576 100644
+--- 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
+diff --git a/src/xbox360_wireless_controller.cpp b/src/xbox360_wireless_controller.cpp
+index 5b24db3..4e7ea1f 100644
+--- 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
+diff --git a/src/xbox_controller.cpp b/src/xbox_controller.cpp
+index afa5bd2..8e72353 100644
+--- 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/xboxdrv-0.8.4-r1.ebuild b/games-util/xboxdrv/xboxdrv-0.8.4-r1.ebuild
new file mode 100644
index 000000000000..cabeb58a8b3c
--- /dev/null
+++ b/games-util/xboxdrv/xboxdrv-0.8.4-r1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-util/xboxdrv/xboxdrv-0.8.4-r1.ebuild,v 1.1 2013/01/09 14:19:22 pinkbyte Exp $
+
+EAPI=5
+inherit base linux-info scons-utils toolchain-funcs
+
+MY_P="${PN}-linux-${PV}"
+DESCRIPTION="Userspace Xbox 360 Controller driver"
+HOMEPAGE="http://pingus.seul.org/~grumbel/xboxdrv/"
+SRC_URI="http://pingus.seul.org/~grumbel/xboxdrv/${MY_P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/boost
+ virtual/udev
+ sys-apps/dbus
+ dev-libs/glib:2
+ virtual/libusb:1
+ x11-libs/libX11"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+CONFIG_CHECK="~INPUT_EVDEV ~INPUT_JOYDEV ~INPUT_UINPUT ~!JOYSTICK_XPAD"
+
+PATCHES=( "${FILESDIR}/${P}-libusbx-1.0.13-fix.patch" ) # bug #435832
+
+src_compile() {
+ escons \
+ BUILD=custom \
+ CXX="$(tc-getCXX)" \
+ CXXFLAGS="-Wall ${CXXFLAGS}" \
+ LINKFLAGS="${LDFLAGS}"
+}
+
+src_install() {
+ dobin xboxdrv
+ doman doc/xboxdrv.1
+ dodoc AUTHORS NEWS PROTOCOL README TODO
+}