From 1b0a5af23236165da9ad14632efc4cd07096b3e8 Mon Sep 17 00:00:00 2001 From: Jacek Konieczny Date: Mon, 9 Mar 2015 13:10:51 +0100 Subject: [PATCH] new package --- xboxdrv.init | 74 +++++++++++++++++++++++++++++++++++++ xboxdrv.service | 13 +++++++ xboxdrv.spec | 94 +++++++++++++++++++++++++++++++++++++++++++++++ xboxdrv.sysconfig | 2 + 4 files changed, 183 insertions(+) create mode 100644 xboxdrv.init create mode 100644 xboxdrv.service create mode 100644 xboxdrv.spec create mode 100644 xboxdrv.sysconfig diff --git a/xboxdrv.init b/xboxdrv.init new file mode 100644 index 0000000..37205ba --- /dev/null +++ b/xboxdrv.init @@ -0,0 +1,74 @@ +#!/bin/sh +# +# xboxdrv Xbox/Xbox360 USB Gamepad Driver +# +# chkconfig: 2345 23 77 +# description: Xbox/Xbox360 USB gamepad driver + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source xboxdrv configuration +. /etc/sysconfig/xboxdrv + +start() { + # Check if the service is already running? + if [ ! -f /var/lock/subsys/xboxdrv ]; then + msg_starting "xboxdrv" + daemon /usr/bin/xboxdrv --daemon --detach --dbus system --pid-file /var/run/xboxdrv.pid $XBOXDRV_OPTIONS + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xboxdrv + else + msg_already_running "xboxdrv" + fi +} + +stop() { + if [ -f /var/lock/subsys/xboxdrv ]; then + msg_stopping "xboxdrv" + killproc xboxdrv + rm -f /var/lock/subsys/xboxdrv + else + msg_not_running "xboxdrv" + fi +} + +condrestart() { + if [ -f /var/lock/subsys/xboxdrv ]; then + stop + start + else + msg_not_running "xboxdrv" + RETVAL=$1 + fi +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart|condrestart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + status) + status xboxdrv + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|force-reload|condrestart|status}" + exit 3 +esac + +exit $RETVAL diff --git a/xboxdrv.service b/xboxdrv.service new file mode 100644 index 0000000..f4e6e8e --- /dev/null +++ b/xboxdrv.service @@ -0,0 +1,13 @@ +[Unit] +Description=Xbox/Xbox360 USB Gamepad Driver + +[Service] +Type=dbus +BusName=org.seul.Xboxdrv +EnvironmentFile=/etc/sysconfig/xboxdrv +ExecStartPre=-/sbin/modprobe -r xpad +ExecStartPre=-/sbin/modprobe uinput +ExecStart=/usr/bin/xboxdrv --daemon --dbus system $XBOXDRV_OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/xboxdrv.spec b/xboxdrv.spec new file mode 100644 index 0000000..ce1a7dc --- /dev/null +++ b/xboxdrv.spec @@ -0,0 +1,94 @@ +Summary: Xbox/Xbox360 USB Gamepad userspace driver +Name: xboxdrv +Version: 0.8.5 +Release: 1 +License: GPL v3 +Group: Applications +Source0: http://pingus.seul.org/~grumbel/xboxdrv/%{name}-linux-%{version}.tar.bz2 +# Source0-md5: 7f20b12361770bbff9414a7c6d522c25 +Source1: %{name}.service +Source2: %{name}.init +Source3: %{name}.sysconfig +URL: http://pingus.seul.org/~grumbel/xboxdrv/ +BuildRequires: rpmbuild(macros) >= 1.228 +Requires(post,preun): /sbin/chkconfig +BuildRequires: rpmbuild(macros) >= 1.647 +Requires: rc-scripts +Requires(post,preun,postun): systemd-units >= 38 +BuildRequires: boost-devel +BuildRequires: dbus-devel +BuildRequires: glib2-devel +BuildRequires: libusb-devel +BuildRequires: pkgconfig +BuildRequires: scons +BuildRequires: udev-devel +BuildRequires: xorg-lib-libX11-devel +Requires: systemd-units >= 0.38 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +Xboxdrv 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. The Xbox360 guitar and some Xbox1 dancemats might work too. +The Xbox 360 racing wheel is not supported, but shouldn't be to hard +to add if somebody is interested. + +Some basic support for the Xbox360 Chatpad on USB controller is +provided, Chatpad on wireless ones is not supported. The headset is +not supported, but you can dump raw data from it. + +This driver is only of interest if the xpad kernel driver doesn't work +for you or if you want more configurabity. If the xpad kernel driver +works for you there is no need to try this driver. + +%prep +%setup -qn %{name}-linux-%{version} + +%build +%scons \ + BUILD=custom + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,%{systemdunitdir}} \ + $RPM_BUILD_ROOT{/etc/sysconfig,/etc/rc.d/init.d} + +install xboxdrv $RPM_BUILD_ROOT%{_bindir} +install xboxdrvctl $RPM_BUILD_ROOT%{_bindir} + +install doc/xboxdrv.1 $RPM_BUILD_ROOT%{_mandir}/man1 + +install %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service +install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} +install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%systemd_post %{name}.service +/sbin/chkconfig --add %{name} +%service %{name} restart + +%preun +%systemd_preun %{name}.service +if [ "$1" = "0" ]; then + %service -q %{name} stop + /sbin/chkconfig --del %{name} +fi + +%postun +%systemd_reload + +%files +%defattr(644,root,root,755) +%doc AUTHORS NEWS PROTOCOL README TODO +%doc doc/sensitivity.png doc/sensitivity.svg doc/xbox360-asciiart.txt +%doc examples +%attr(754,root,root) /etc/rc.d/init.d/%{name} +%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} +%{systemdunitdir}/%{name}.service +%attr(755,root,root) %{_bindir}/xboxdrv +%attr(755,root,root) %{_bindir}/xboxdrvctl +%{_mandir}/man1/xboxdrv.1* diff --git a/xboxdrv.sysconfig b/xboxdrv.sysconfig new file mode 100644 index 0000000..bc6e1d4 --- /dev/null +++ b/xboxdrv.sysconfig @@ -0,0 +1,2 @@ + +XBOXDRV_OPTIONS="--next-controller" -- 2.44.0