ref: 307708d55f9de510055ba4024ddaecd97a938001
parent: e766eab051cc93254cc3d359715c1a4c188d09bf
author: qwx <qwx@sciops.net>
date: Wed Oct 28 21:48:56 EDT 2020
more joy scripts for other joysticks might need a more general way to specify controls, maybe based on pci did
--- /dev/null
+++ b/joygba2
@@ -1,0 +1,37 @@
+#!/bin/rc
+# run as "nusb/joy epX.Y | joygba"
+
+awk -safe '
+ BEGIN { k[0] = "" }
+
+ /^axis 0 0/ { k[0] = "left " }
+ /^axis 0 255/ { k[0] = "right " }
+ /^axis 0 128/ { k[0] = "" }
+
+ /^axis 1 0/ { k[1] = "up " }
+ /^axis 1 255/ { k[1] = "down " }
+ /^axis 1 128/ { k[1] = "" }
+
+ /^down 2$/ { k[3] = "b " }
+ /^down 1$/ { k[2] = "a " }
+ /^down 3$/ { k[8] = "x " }
+ /^down 4$/ { k[9] = "y " }
+ /^down 7$/ { k[4] = "control " }
+ /^down 8$/ { k[5] = "start " }
+ /^down 5$/ { k[6] = "l1 " }
+ /^down 6$/ { k[7] = "r1 " }
+
+ /^up 2$/ { k[3] = "" }
+ /^up 1$/ { k[2] = "" }
+ /^up 3$/ { k[8] = "" }
+ /^up 4$/ { k[9] = "" }
+ /^up 7$/ { k[4] = "" }
+ /^up 8$/ { k[5] = "" }
+ /^up 5$/ { k[6] = "" }
+ /^up 6$/ { k[7] = "" }
+
+ {
+ print k[0] k[1] k[2] k[3] k[4] k[5] k[6] k[7] k[8] k[9]
+ fflush
+ }
+'
--- /dev/null
+++ b/joynes
@@ -1,0 +1,33 @@
+#!/bin/rc
+# run as "nusb/joy epX.Y | joynes N", where N=[1,2]
+
+awk -safe -v 'joy='joy$1 '
+ BEGIN { k[0] = "" }
+
+ /^axis 0 0/ { k[0] = "left " }
+ /^axis 0 255/ { k[0] = "right " }
+ /^axis 0 128/ { k[0] = "" }
+
+ /^axis 1 0/ { k[1] = "up " }
+ /^axis 1 255/ { k[1] = "down " }
+ /^axis 1 128/ { k[1] = "" }
+
+ /^down 2$/ { k[3] = "b " }
+ /^down 1$/ { k[2] = "a " }
+ #/^down 3$/ { k[4] = "control " }
+ #/^down 4$/ { k[5] = "start " }
+ /^down 7$/ { k[4] = "control " }
+ /^down 8$/ { k[5] = "start " }
+
+ /^up 2$/ { k[3] = "" }
+ /^up 1$/ { k[2] = "" }
+ #/^up 3$/ { k[4] = "" }
+ #/^up 4$/ { k[5] = "" }
+ /^up 7$/ { k[4] = "" }
+ /^up 8$/ { k[5] = "" }
+
+ {
+ print joy " " k[0] k[1] k[2] k[3] k[4] k[5]
+ fflush
+ }
+'