diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5803d05 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/xboxdrv-linux-0.8.5.tar.bz2 +/xboxdrv-0.8.8.tar.gz diff --git a/dead.package b/dead.package deleted file mode 100644 index 5204a84..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -Orphaned for 6+ weeks diff --git a/sources b/sources new file mode 100644 index 0000000..daf02d6 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +f138582ef182ab8c3acb3e6016b950af xboxdrv-0.8.8.tar.gz diff --git a/xboxdrv-config.txt b/xboxdrv-config.txt new file mode 100644 index 0000000..52796bc --- /dev/null +++ b/xboxdrv-config.txt @@ -0,0 +1,126 @@ +# Default Configuration +# =============== +# +# This is simply the default xboxdrv configuration, replicated as INI +# file with a few comments + +[xboxdrv] +# Debugging output and verbosity +silent=true +# verbose = false +# usb-debug = false + +# timeout = 25 + +# config=/etc/sysconfig/xboxdrvd +# alt-config = otherconfig.xboxdrv + +# busid = +# devid = + +# Chatpad +# chatpad = false +# chatpad-debug = false +# chatpad-no-init = false + +# controller-id = 0 +detach-kernel-driver=true +# device-name = +# evdev = +# evdev-debug = true +# evdev-grab = true +# extra-devices = true +# extra-events = true +# force-feedback = + +# Headset +# headset = false +# headset-debug = false +# headset-dump = /tmp/out.raw +# headset-play = /tmp/in.raw + +# instant-exit = false +led=1 +# next = true +# next-controller = true +# no-uinput = true +# product-id = -1 +# quiet = false +# rumble = false +# rumble-gain = 255 +# rumble-l = -1 +# rumble-r = -1 + +deadzone=4000 +deadzone-trigger=10 +mimic-xpad = true +# mouse = true +# square-axis = true +# trigger-as-button = true +# trigger-as-zaxis = true +# dpad-as-button = true +# dpad-only = true +# dpad-rotation = 45 +# four-way-restrictor = +# guitar = true + +# vendor-id = -1 +# wireless-id = 0 + +[xboxdrv-daemon] +detach=true +# on-connect = /home/juser/bin/on-connect.sh +# on-disconnect = /home/juser/bin/on-connect.sh +pid-file=/var/run/xboxdrv.pid + +[autofire] + +[axis-sensitivity] + +[axismap] + +[buttonmap] + +[calibration] + +[evdev-absmap] + +[evdev-keymap] + +[modifier] + +[relative-axis] + +[xboxdrv] +ui-clear=true + +[ui-axismap] +X1=ABS_X +Y1=ABS_Y + +X2=ABS_RX +Y2=ABS_RY + +LT=ABS_BRAKE +RT=ABS_GAS + +DPAD_X=ABS_HAT0X +DPAD_Y=ABS_HAT0Y + +[ui-buttonmap] +start=BTN_START +guide=BTN_MODE +back=BTN_SELECT + +A=BTN_A +B=BTN_B +X=BTN_X +Y=BTN_Y + +LB=BTN_TL +RB=BTN_TR + +TL=BTN_THUMBL +TR=BTN_THUMBR + +# EOF # diff --git a/xboxdrv-daemon b/xboxdrv-daemon new file mode 100644 index 0000000..9a74710 --- /dev/null +++ b/xboxdrv-daemon @@ -0,0 +1,128 @@ +#! /bin/sh + +# For RedHat and cousins: +# chkconfig: 2345 20 80 +# description: Userspace Xbox/Xbox360 Gamepad Driver Daemon +# processname: xboxdrvd + +### BEGIN INIT INFO +# Provides: xboxdrvd +# Should-Start: +# Default-Start: +# Default-Stop: 0 1 2 3 4 5 6 +# Short-Description: Userspace Xbox/Xbox360 Gamepad Driver Daemon +# Description: This is a Xbox/Xbox360 gamepad driver for Linux that works in userspace. +# It is an alternative to the xpad kernel driver and has support for +# Xbox1 gamepads, Xbox360 USB gamepads and Xbox360 wireless gamepads, +# both first and third party. +### END INIT INFO + +## Xbox360 USB Gamepad Userspace Driver +## Copyright (C) 2011 Ingo Ruhnke +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see . + +XBOXDRVD_BIN=/usr/bin/xboxdrv + +# Source function library +. /etc/rc.d/init.d/functions + +RETVAL=0 +prog=xboxdrvd +pidfile=/var/run/xboxdrv.pid +config=/etc/sysconfig/default.xboxdrv +lockfile=/var/lock/subsys/$prog + + [ -c /etc/sysconfig/default.xboxdrv ] && . /etc/sysconfig/default.xboxdrv + +start() { + [ -x $XBOXDRVD_BIN ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + daemon $XBOXDRVD_BIN + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + if [ -n "`pidfileofproc $XBOXDRVD_BIN`" ] ; then + killproc $XBOXDRVD_BIN + RETVAL=3 + else + failure $"Stopping $prog" + fi + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + # run checks to determine if the service is running or use generic status + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac +exit $? + diff --git a/xboxdrv-fix_defines_old_kernel.patch b/xboxdrv-fix_defines_old_kernel.patch new file mode 100644 index 0000000..faf6349 --- /dev/null +++ b/xboxdrv-fix_defines_old_kernel.patch @@ -0,0 +1,17 @@ +--- src/uinput_options.orig.cpp 2015-11-09 11:19:35.000000000 +0100 ++++ src/uinput_options.cpp 2016-03-05 18:33:32.308813779 +0100 +@@ -92,10 +92,10 @@ + get_axis_map().clear(); + get_btn_map().clear(); + +- get_btn_map().bind(XBOX_DPAD_UP, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TRIGGER_HAPPY3)); +- get_btn_map().bind(XBOX_DPAD_DOWN, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TRIGGER_HAPPY4)); +- get_btn_map().bind(XBOX_DPAD_LEFT, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TRIGGER_HAPPY1)); +- get_btn_map().bind(XBOX_DPAD_RIGHT, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_TRIGGER_HAPPY2)); ++ get_btn_map().bind(XBOX_DPAD_UP, ButtonEvent::create_key(DEVICEID_JOYSTICK, 0x2c2)); ++ get_btn_map().bind(XBOX_DPAD_DOWN, ButtonEvent::create_key(DEVICEID_JOYSTICK, 0x2c3)); ++ get_btn_map().bind(XBOX_DPAD_LEFT, ButtonEvent::create_key(DEVICEID_JOYSTICK, 0x2c0)); ++ get_btn_map().bind(XBOX_DPAD_RIGHT, ButtonEvent::create_key(DEVICEID_JOYSTICK, 0x2c1)); + + get_btn_map().bind(XBOX_BTN_START, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_START)); + get_btn_map().bind(XBOX_BTN_GUIDE, ButtonEvent::create_key(DEVICEID_JOYSTICK, BTN_MODE)); diff --git a/xboxdrv.service b/xboxdrv.service new file mode 100644 index 0000000..3e19784 --- /dev/null +++ b/xboxdrv.service @@ -0,0 +1,12 @@ +[Unit] +Description=Xbox controller driver daemon +Documentation=man:xboxdrv(1) + +[Service] +Type=forking +User=root +PIDFile=/var/run/xboxdrv.pid +ExecStart=/bin/xboxdrv -c /etc/xboxdrv.conf --daemon --detach --pid-file /var/run/xboxdrv.pid --dbus system + +[Install] +WantedBy=multi-user.target diff --git a/xboxdrv.spec b/xboxdrv.spec new file mode 100644 index 0000000..51dce7a --- /dev/null +++ b/xboxdrv.spec @@ -0,0 +1,207 @@ +%if 0%{?epel} < 7 +%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro} +%{!?__python2: %global __python2 /usr/bin/python2} +%endif + +Name: xboxdrv +Version: 0.8.8 +Release: 2%{?dist} +Summary: Userspace Xbox/Xbox360 Gamepad Driver for Linux + +License: GPLv3+ +URL: http://pingus.seul.org/~grumbel/xboxdrv/ +Source0: https://github.com/xboxdrv/xboxdrv/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: %{name}.service +Source2: %{name}-config.txt +Source3: %{name}-daemon + +Patch0: %{name}-fix_defines_old_kernel.patch + +BuildRequires: pkgconfig(sdl) +BuildRequires: pkgconfig(zlib) +BuildRequires: pkgconfig(gl) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(x11) +BuildRequires: scons +%if 0%{?fedora} +BuildRequires: libusbx-devel +BuildRequires: boost-devel +%else +BuildRequires: libusb1-devel +BuildRequires: boost148-devel +%endif +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: pkgconfig +BuildRequires: python2-devel +Requires: dbus-python + +%if 0%{?fedora} || 0%{?rhel} > 6 +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +BuildRequires: systemd +%endif + +%if 0%{?rhel} < 7 +Requires(post): chkconfig +Requires(preun): chkconfig +# This is for /sbin/service +Requires(preun): initscripts +Requires(postun): initscripts +%endif + +%description +This is a Xbox/Xbox360 gamepad driver for Linux that works in userspace. +It is an alternative to the xpad kernel driver and has support for +Xbox1 gamepads, Xbox360 USB gamepads and Xbox360 wireless gamepads, +both first and third party. + +%prep +%setup -q -n %{name}-%{version} + +%if 0%{?rhel} && 0%{?rhel} < 7 +%patch0 -p0 +%endif + +sed -i '1s|/usr/bin/env python|%{__python2}|' examples/responsecurve-generator.py + +%build +scons \ + CC=gcc \ + CXX=g++ \ + BUILD=custom \ + CCFLAGS="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now" \ + CXXFLAGS="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now" \ +%if 0%{?rhel} + CPPFLAGS=" -ansi -pedantic -I%{_includedir}/boost148 -I%{_includedir}/X11" \ +%else + CPPFLAGS=" -ansi -pedantic" \ +%endif + LINKFLAGS="%{__global_ldflags} -fPIC -pie -Wl,-z,now" + +%install +make install PREFIX=%{_prefix} DESTDIR=%{buildroot} + +rm -f %{buildroot}%{_bindir}/xboxdrvctl + +chmod 644 %{buildroot}%{_mandir}/man1/xboxdrv* +install -pm 644 doc/xboxdrv-daemon.1 %{buildroot}%{_mandir}/man1 + +# Install default configuration file +%if 0%{?rhel} && 0%{?rhel} < 7 +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +mkdir -p %{buildroot}%{_sysconfdir}/init.d +install -pm 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/default.%{name} +install -pm 755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/%{name}d +%endif + +# Install dbus rule +%if 0%{?fedora} || 0%{?rhel} > 6 +mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d +install -pm 644 data/org.seul.Xboxdrv.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d +install -pm 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}.conf +install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service +%endif + +%if 0%{?fedora} || 0%{?rhel} > 6 +%preun +%systemd_preun %{name}.service + +%post +%systemd_post %{name}.service + +%postun +%systemd_postun %{name}.service +%endif + +%if 0%{?rhel} && 0%{?rhel} < 7 +%preun +if [ $1 -eq 0 ] ; then + /sbin/service %{name}d stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name}d +fi + +%post +# This adds the proper /etc/rc*.d links for the script +/sbin/chkconfig --add %{name}d + +%postun +if [ "$1" -ge "1" ] ; then + /sbin/service %{name}d condrestart >/dev/null 2>&1 || : +fi +%endif + +%files +%{!?_licensedir:%global license %doc} +%doc PROTOCOL NEWS AUTHORS README.md examples +%license COPYING +%{_bindir}/xboxdrv +%{_mandir}/man1/xboxdrv* +%if 0%{?fedora} || 0%{?rhel} > 6 +%{_unitdir}/%{name}.service +%config(noreplace) %{_sysconfdir}/%{name}.conf +%{_sysconfdir}/dbus-1/system.d/org.seul.Xboxdrv.conf +%endif +%if 0%{?rhel} && 0%{?rhel} < 7 +%config(noreplace) %{_sysconfdir}/sysconfig/default.%{name} +%{_sysconfdir}/init.d/%{name}d +%endif + +%changelog +* Wed Mar 16 2016 Antonio Trande - 0.8.8-2 +- Made xboxdrv.conf file and moved into /etc +- Fix init script for EPEL6 + +* Sat Mar 05 2016 Antonio Trande - 0.8.8-1 +- Update to release 0.8.8 +- Patched for old kernels (EPEL6) +- Fixed systemd service file +- Added init script +- Added custom dbus rule + +* Fri Feb 05 2016 Fedora Release Engineering - 0.8.5-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sat Jan 16 2016 Jonathan Wakely - 0.8.5-14 +- Rebuilt for Boost 1.60 + +* Thu Aug 27 2015 Jonathan Wakely - 0.8.5-13 +- Rebuilt for Boost 1.59 + +* Wed Jul 29 2015 Fedora Release Engineering - 0.8.5-12 +- Rebuilt for https://fedoraproject.org/wiki/Changes/F23Boost159 + +* Wed Jul 22 2015 David Tardon - 0.8.5-11 +- rebuild for Boost 1.58 + +* Fri Jun 19 2015 Fedora Release Engineering - 0.8.5-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat May 02 2015 Kalev Lember - 0.8.5-9 +- Rebuilt for GCC 5 C++11 ABI change + +* Mon Jan 26 2015 Petr Machata - 0.8.5-8 +- Rebuild for boost 1.57.0 + +* Mon Aug 18 2014 Fedora Release Engineering - 0.8.5-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 0.8.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri May 23 2014 Petr Machata - 0.8.5-5 +- Rebuild for boost 1.55.0 + +* Sun Aug 04 2013 Fedora Release Engineering - 0.8.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Tue Jul 30 2013 Petr Machata - 0.8.5-3 +- Rebuild for boost 1.54.0 + +* Tue Jun 04 2013 Marcel Wysocki - 0.8.5-2 +- spec cleanups +- fix man page permission + +* Sun May 26 2013 Marcel Wysocki - 0.8.5-1 +- initial fedora port