Add script to restore xpad driver after using xboxdrv

This commit is contained in:
Mathieu Comandon 2015-11-18 02:47:58 -08:00
parent a9b8e071b1
commit ee48883b89
3 changed files with 28 additions and 0 deletions

View file

@ -276,6 +276,8 @@ class Game(object):
def xboxdrv_stop(self):
os.system("pkexec xboxdrvctl --shutdown")
if os.path.exists("/usr/share/lutris/bin/resetxpad"):
os.system("pkexec /usr/share/lutris/bin/resetxpad")
def beat(self):
"""Watch the game's process(es)."""

5
share/lutris/bin/resetxpad Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
rmmod xpad
sleep 2
modprobe xpad

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Lutris</vendor>
<vendor_url>http://lutris.net</vendor_url>
<action id="net.lutris.resetxpad.pkexec.run">
<description>Reset xpad module</description>
<message>Authentication is required to reset xpad</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/share/lutris/bin/resetxpad</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>