shithub: rc

Download patch

ref: 78121c49f76ce415ded466f394aafd04901d2b27
parent: 3fc055a3f967c9a56e93d4c6882b60c25609ebdc
author: qwx <qwx@sciops.net>
date: Thu Aug 18 02:15:55 EDT 2022

br: fix stupid

--- a/bin/br
+++ b/bin/br
@@ -1,7 +1,7 @@
 #!/bin/rc
 rfork e
 if(! ~ $#* 1 || {test $1 -lt 0 || test $1 -gt 100}){
-	echo usage: $0 [percent]
+	echo usage: $0 percent
 	exit usage >[1=2]
 }
 pci | awk -v 'fac='$1 '
@@ -13,7 +13,7 @@
 BEGIN{
 	# intel graphics
 	vid["8086"] = "igfx"
-	# gm15 (doesn''''t work on t43p)
+	# gm15 (not working on t43p)
 	did["8086/2592","r"] = "0x61254";  did["8086/2592","w"] = "0x61254"
 	# gm45
 	did["8086/27ae","r"] = "0x61254";  did["8086/27ae","w"] = "0x61254"
@@ -48,14 +48,10 @@
 }
 $2 == "vid" && dev == ""{
 	split($4, id, "/")
-	if(vid[id[1]] == ""){
-		print "unsupported vendor", id[1] >"/fd/2"
+	if(vid[id[1]] == "" || did[$4,"r"] == ""){
+		print "unsupported device", id[1] "/" id[2] >"/fd/2"
 		next
 	}
-	if(did[$4,"r"] == ""){
-		print "unsupported device", id[2] ">/fd/2"
-		next
-	}
 	type = vid[id[1]]
 	dev = $4
 	mem = $7
@@ -71,10 +67,6 @@
 		exit "write failed"
 }
 END{
-	if(dev == ""){
-		print "no known devices" >"/fd/2"
-		exit "no known devices"
-	}
 	if(type == "igfx")
 		igfxpwm()
 	else{