system/xboxdrv-linux: Fix 15.0 build.

Apply some patches from arch to fix build with py3 scons on 15.0.

Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Andrew Clemons 2022-02-18 18:06:50 +13:00 committed by Willy Sudiarto Raharjo
parent b933c905c2
commit b08754ba17
No known key found for this signature in database
GPG key ID: 3F617144D7238786
7 changed files with 204 additions and 19 deletions

View file

@ -0,0 +1,27 @@
From 7326421eeaadbc2aeb3828628c2e65bb7be323a9 Mon Sep 17 00:00:00 2001
From: buxit <buti@bux.at>
Date: Wed, 2 Nov 2016 16:25:14 +0100
Subject: [PATCH] fix 60 seconds delay
use `libusb_handle_events_timeout_completed()` instead of `libusb_handle_events()`
should fix #144
---
src/usb_gsource.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/usb_gsource.cpp b/src/usb_gsource.cpp
index 00bf1315..afb38f65 100644
--- a/src/usb_gsource.cpp
+++ b/src/usb_gsource.cpp
@@ -174,7 +174,10 @@ USBGSource::on_source_dispatch(GSource* source, GSourceFunc callback, gpointer u
gboolean
USBGSource::on_source()
{
- libusb_handle_events(NULL);
+ struct timeval to;
+ to.tv_sec = 0;
+ to.tv_usec = 0;
+ libusb_handle_events_timeout_completed(NULL, &to, NULL);
return TRUE;
}

View file

@ -0,0 +1,63 @@
From 17bd43a7d3ef86216abc36b42b4e6a1f70aa9979 Mon Sep 17 00:00:00 2001
From: xnick <xnick@users.noreply.github.com>
Date: Thu, 12 Oct 2017 20:34:35 +0300
Subject: [PATCH] Update SConstruct
python3 compatible
---
SConstruct | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/SConstruct b/SConstruct
index 4cd79704..c0007054 100644
--- a/SConstruct
+++ b/SConstruct
@@ -19,7 +19,7 @@ def build_dbus_glue(target, source, env):
xml = re.sub(r"callback = \(([A-Za-z_]+)\) \(marshal_data \? marshal_data : cc->callback\);",
r"union { \1 fn; void* obj; } conv;\n "
"conv.obj = (marshal_data ? marshal_data : cc->callback);\n "
- "callback = conv.fn;", xml)
+ "callback = conv.fn;", xml.decode('utf-8'))
with open(target[0].get_path(), "w") as f:
f.write(xml)
@@ -29,10 +29,10 @@ def build_bin2h(target, source, env):
Takes a list of files and converts them into a C source that can be included
"""
def c_escape(str):
- return str.translate(string.maketrans("/.-", "___"))
+ return str.translate(bytes.maketrans(b"/.-", b"___"))
- print target
- print source
+ print(target)
+ print(source)
with open(target[0].get_path(), "w") as fout:
fout.write("// autogenerated by scons Bin2H builder, do not edit by hand!\n\n")
@@ -45,8 +45,8 @@ def build_bin2h(target, source, env):
data = fin.read()
fout.write("// \"%s\"\n" % src.get_path())
fout.write("const char %s[] = {" % c_escape(src.get_path()))
- bytes_arr = ["0x%02x" % ord(c) for c in data]
- for i in xrange(len(bytes_arr)):
+ bytes_arr = ["0x%02x" % c for c in data]
+ for i in range(len(bytes_arr)):
if i % 13 == 0:
fout.write("\n ")
fout.write(bytes_arr[i])
@@ -131,12 +131,12 @@ env.Append(CPPDEFINES = { 'PACKAGE_VERSION': "'\"%s\"'" % package_version })
conf = Configure(env)
if not conf.env['CXX']:
- print "g++ must be installed!"
+ print('g++ must be installed!')
Exit(1)
# X11 checks
if not conf.CheckLibWithHeader('X11', 'X11/Xlib.h', 'C++'):
- print 'libx11-dev must be installed!'
+ print('libx11-dev must be installed!')
Exit(1)
env = conf.Finish()

View file

@ -0,0 +1,20 @@
--- a/SConstruct 2021-10-31 20:42:44.232084185 -0400
+++ b/SConstruct 2021-10-31 20:42:54.063024444 -0400
@@ -36,7 +36,7 @@
with open(target[0].get_path(), "w") as fout:
fout.write("// autogenerated by scons Bin2H builder, do not edit by hand!\n\n")
- if env.has_key("BIN2H_NAMESPACE"):
+ if "BIN2H_NAMESPACE" in env:
fout.write("namespace %s {\n\n" % env["BIN2H_NAMESPACE"])
# write down data
@@ -62,7 +62,7 @@
for src in source], ",\n"))
fout.write("\n}\n\n")
- if env.has_key("BIN2H_NAMESPACE"):
+ if "BIN2H_NAMESPACE" in env:
fout.write("} // namespace %s\n\n" % env["BIN2H_NAMESPACE"])
fout.write("/* EOF */\n")

View file

@ -13,7 +13,7 @@ xboxdrv-linux: userspace. It is an alternative to the xpad kernel driver and has
xboxdrv-linux: support for Xbox1 gamepads, Xbox360 USB gamepads and Xbox360 wireless
xboxdrv-linux: gamepads, both first and third party.
xboxdrv-linux:
xboxdrv-linux: Homepage: https://pingus.seul.org/~grumbel/xboxdrv/
xboxdrv-linux: Homepage: https://xboxdrv.gitlab.io/
xboxdrv-linux:
xboxdrv-linux:
xboxdrv-linux:

View file

@ -26,17 +26,20 @@
# 20220209 bkw: Modified by SlackBuilds.org: handle both possibilities for
# the tarball filename. However, this is *still broken* due to scons issues.
# 20220218 acl: Modified by SlackBuilds.org: fix scons issues with arch
# patches. Update homepage to gitlab.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=xboxdrv-linux
VERSION=${VERSION:-0.8.8}
BUILD=${BUILD:-2}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
@ -54,8 +57,8 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@ -70,24 +73,23 @@ fi
set -e
# 20220209 bkw: different clients (browsers, wget, curl) save the file with
# a different filename, depending on whether they respect Content-disposition.
TARBALL=$CWD/6e5e8a57628095d8d0c8bbb38187afb0f3a42112.tar.gz
[ -e "$TARBALL" ] || TARBALL=$CWD/xboxdrv-6e5e8a57628095d8d0c8bbb38187afb0f3a42112.tar.gz
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir $PRGNAM-$VERSION
tar xvf $TARBALL --strip-components 1 -C $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
# thanks arch maintainers
patch -p1 < "$CWD/fix-60-sec-delay.patch"
patch -p1 < "$CWD/scons-py3.patch"
patch -p1 < "$CWD/scons-v4.2.0.patch"
patch -p1 < "$CWD/xboxdrvctl-py3.patch"
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
scons \
CFLAGS="$SLKCFLAGS" \

View file

@ -1,8 +1,8 @@
PRGNAM="xboxdrv-linux"
VERSION="0.8.8"
HOMEPAGE="https://pingus.seul.org/~grumbel/xboxdrv/"
DOWNLOAD="https://github.com/chewi/xboxdrv/archive/6e5e8a57628095d8d0c8bbb38187afb0f3a42112.tar.gz"
MD5SUM="f0cfa15f509a3858ccae94a0d0da3d6a"
HOMEPAGE="https://xboxdrv.gitlab.io/"
DOWNLOAD="https://xboxdrv.gitlab.io/xboxdrv-linux-0.8.8.tar.bz2"
MD5SUM="a62703eda7d59393538b2f22d5b0c791"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""

View file

@ -0,0 +1,73 @@
--- a/xboxdrvctl 2021-06-21 19:39:51.000000000 -0400
+++ b/xboxdrvctl 19:43:27.467984928 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
## Xbox360 USB Gamepad Userspace Driver
## Copyright (C) 2011 Ingo Ruhnke <grumbel@gmail.com>
@@ -37,23 +37,23 @@
help="print controller status")
group.add_option("-s", "--slot", metavar="SLOT", type="int",
- dest="slot",
+ dest="slot",
help="use slot SLOT for actions")
group.add_option("-l", "--led", metavar="NUM", type="int",
- dest="led",
+ dest="led",
help="set LED")
-group.add_option("-r", "--rumble", metavar="L:R",
- dest="rumble",
+group.add_option("-r", "--rumble", metavar="L:R",
+ dest="rumble",
help="print controller status")
group.add_option("-c", "--config", metavar="NUM", type="int",
- dest="config",
+ dest="config",
help="switches to controller configuration NUM")
group.add_option("--shutdown", action="store_true",
- dest="shutdown",
+ dest="shutdown",
help="shuts down the daemon")
parser.add_option_group(group)
@@ -69,9 +69,9 @@
try:
bus.get_object("org.seul.Xboxdrv", '/org/seul/Xboxdrv/Daemon')
except dbus.exceptions.DBusException:
- bus = dbus.SystemBus()
+ bus = dbus.SystemBus()
else:
- print "Error: invalid argument to --bus. Must be 'auto', 'session, or 'system'"
+ print("Error: invalid argument to --bus. Must be 'auto', 'session, or 'system'")
exit()
if options.status:
@@ -82,19 +82,19 @@
daemon.Shutdown()
else:
if (options.led or options.rumble or options.config) and options.slot == None:
- print "Error: --slot argument required"
+ print("Error: --slot argument required")
exit()
else:
if options.slot != None:
slot = bus.get_object("org.seul.Xboxdrv", '/org/seul/Xboxdrv/ControllerSlots/%d' % options.slot)
-
+
if options.led != None:
slot.SetLed(options.led)
if options.rumble:
m = re.match('^(\d+):(\d+)$', options.rumble)
if not m:
- print "Error: invalid argument to --rumble"
+ print("Error: invalid argument to --rumble")
exit()
else:
left = int(m.group(1))