From 3cb525ca25a9b3f2306fec062b4bb665a574b53b Mon Sep 17 00:00:00 2001 From: Penguin Date: Tue, 26 Apr 2022 17:29:18 -0500 Subject: [PATCH] init --- .gitignore | 1 + interface.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .gitignore create mode 100644 interface.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..137e678 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +env.sh diff --git a/interface.py b/interface.py new file mode 100644 index 0000000..581d1a2 --- /dev/null +++ b/interface.py @@ -0,0 +1,28 @@ +import time +import zmq +from pyPS4Controller.controller import Controller + + +ctx = zmq.Context() +socket = ctx.socket(zmq.PUB) + +class ps4if(Controller): + def __init__(self, **kwargs): + Controller.__init__(self, **kwargs) + + def on_x_press(self): + socket.send_string("Hit x") + + +def main(): + # do stuff + print("Hello world") + socket.bind("ipc:///penguinator/pubsub"); + + controller = ps4if(interface="/dev/input/js0", + connecting_using_ds4drv=False) + controller.listen() + while(True): + time.sleep(1) + +main()