shithub: riscv

Download patch

ref: e5bab1dd9fd644ef800d9371a9d0a1b3fb30d59f
parent: 5bf221bab7e76c99014adcaa5749bfef5e09014e
author: cinap_lenrek <cinap_lenrek@localhost>
date: Sun Jul 31 22:01:04 EDT 2011

nusb: put setleds in kbwork

--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -451,6 +451,9 @@
 	if(f->ep->maxpkt < 3 || f->ep->maxpkt > sizeof buf)
 		kbfatal(f, "weird maxpkt");
 
+	if(setleds(f, f->ep->id, 0) < 0)
+		kbfatal(f, "setleds failed");
+
 	f->repeatc = chancreate(sizeof(ulong), 0);
 	if(f->repeatc == nil)
 		kbfatal(f, "chancreate failed");
@@ -541,10 +544,6 @@
 		fprint(2, "kb: %s: opendevdata: %r\n", kd->ep->dir);
 		closedev(kd->ep);
 		kd->ep = nil;
-		return;
-	}
-	if(f == kbdwork && setleds(kd, ep->id, 0) < 0){
-		fprint(2, "kb: %s: setleds: %r\n", d->dir);
 		return;
 	}
 	incref(d);