shithub: rc

Download patch

ref: e766eab051cc93254cc3d359715c1a4c188d09bf
parent: c9268c57f9f831f21069cbf86e52645b0450c276
author: qwx <qwx@sciops.net>
date: Wed Oct 28 21:47:52 EDT 2020

add nesj: attempt to get usb endpoint before launching nes with joynes

--- /dev/null
+++ b/nesj
@@ -1,0 +1,20 @@
+#!/bin/rc
+
+n=`{sed -n '/ep.\.0/h;${g;s/^(ep.\.0).*/\1/p;}' /dev/usb/ctl}
+while(~ $1 -?){
+	switch($1){
+	case -k	# just make /sys/src/9/boot/nusbrc do nothing if it sees your
+		# device instead
+		p=`{ps | sed -n '/ kb$/h;${g;s/^[^ ]+ +([0-9]+) .*/\1/p;}'}
+		echo kill >/proc/$p/note
+		wait $p
+	case -n
+		n=ep$2.0
+		shift
+	}
+	shift
+}
+
+echo resize -dx 776 -dy 728 >/dev/wctl
+nusb/joy /dev/usb/$n | joynes 1 | games/nes -a3 $*
+# press Kdel again to kill nusb/joy...