summarylogtreecommitdiffstats
path: root/fixcontroller.py
diff options
context:
space:
mode:
authorRyan O'Beirne2021-06-12 18:10:06 -0400
committerRyan O'Beirne2021-06-12 19:10:54 -0400
commit090255a241d677229239c1455307a04fafb9f373 (patch)
treec8cae2c6e71bbaa914ca26c071770062669f4b8e /fixcontroller.py
parent7225d7bd193328f044b3ba3a4820f1d606afaf26 (diff)
downloadaur-090255a241d677229239c1455307a04fafb9f373.tar.gz
Add install script
Diffstat (limited to 'fixcontroller.py')
-rwxr-xr-xfixcontroller.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/fixcontroller.py b/fixcontroller.py
index 54cf89d335c..ae5497b1080 100755
--- a/fixcontroller.py
+++ b/fixcontroller.py
@@ -1,15 +1,18 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3
import usb.core
import systemd.journal
+def jprint(*args):
+ print(*args)
+ systemd.journal.send(*args, SYSLOG_IDENTIFIER='xbox-generic-controller')
+
dev = usb.core.find(idVendor=0x045e, idProduct=0x028e)
if dev is None:
- systemd.journal.send('XBox generic controller not found', SYSLOG_IDENTIFIER='xbox-generic-controller')
- raise ValueError('Device not found')
+ jprint('XBox generic controller not found')
else:
dev.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)
- systemd.journal.send('XBox generic controller found and fixed', SYSLOG_IDENTIFIER='xbox-generic-controller')
+ jprint('XBox generic controller found and fixed')