diff options
author | Stany MARCEL <stanypub@gmail.com> | 2016-12-02 14:04:30 +0300 |
---|---|---|
committer | Stany MARCEL <stanypub@gmail.com> | 2016-12-02 14:04:30 +0300 |
commit | 0c439095333dfed5aa36e594ef6840008128b36f (patch) | |
tree | 82ce7dba68d8a987b595327be73ee49059c5fbe9 /scripts | |
parent | 82e84c5cd1773f3236f09cd1a22c7ab363b72008 (diff) |
Close issue #47 close uinput and turn off controller
A long press (>2s) to the steam button close and deleate the uinput device
The device is created on first event to prevent it to be created at daemon
restart
When the daeomon is stopped the controller should also be powered off
Signed-off-by: Stany MARCEL <stanypub@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/sc-desktop.py | 5 | ||||
-rwxr-xr-x | scripts/sc-mixed.py | 6 | ||||
-rwxr-xr-x | scripts/sc-xbox.py | 8 |
3 files changed, 16 insertions, 3 deletions
diff --git a/scripts/sc-desktop.py b/scripts/sc-desktop.py index fcbc51c..9eff430 100755 --- a/scripts/sc-desktop.py +++ b/scripts/sc-desktop.py @@ -30,6 +30,8 @@ from steamcontroller.uinput import Keys from steamcontroller.daemon import Daemon +import gc + def evminit(): evm = EventMapper() evm.setPadMouse(Pos.RIGHT) @@ -68,6 +70,9 @@ class SCDaemon(Daemon): evm = evminit() sc = SteamController(callback=evm.process) sc.run() + del sc + del evm + gc.collect() if __name__ == '__main__': import argparse diff --git a/scripts/sc-mixed.py b/scripts/sc-mixed.py index 6cfebce..4a9c3c0 100755 --- a/scripts/sc-mixed.py +++ b/scripts/sc-mixed.py @@ -35,6 +35,7 @@ from steamcontroller.uinput import \ Axes from steamcontroller.daemon import Daemon +import gc def set_evm_pad(evm): evm.setStickAxes(Axes.ABS_X, Axes.ABS_Y) @@ -87,8 +88,6 @@ def set_evm_desktop(evm): evm.setButtonAction(SCButtons.LPAD, Keys.BTN_MIDDLE) evm.setButtonAction(SCButtons.RPAD, Keys.KEY_SPACE) - - pad = True def toggle_callback(evm, btn, pressed): global pad @@ -110,6 +109,9 @@ class SCDaemon(Daemon): evm = evminit() sc = SteamController(callback=evm.process) sc.run() + del sc + del evm + gc.collect() if __name__ == '__main__': import argparse diff --git a/scripts/sc-xbox.py b/scripts/sc-xbox.py index d25668b..814c8bc 100755 --- a/scripts/sc-xbox.py +++ b/scripts/sc-xbox.py @@ -35,6 +35,8 @@ from steamcontroller.uinput import \ Axes from steamcontroller.daemon import Daemon +import gc + def evminit(): evm = EventMapper() @@ -67,6 +69,9 @@ class SCDaemon(Daemon): evm = evminit() sc = SteamController(callback=evm.process) sc.run() + del sc + del evm + gc.collect() if __name__ == '__main__': import argparse @@ -92,7 +97,8 @@ if __name__ == '__main__': evm = evminit() sc = SteamController(callback=evm.process) sc.run() + except KeyboardInterrupt: - return + pass _main() |