9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] usb/kb parsing uninitialized memory
@ 2014-03-28 15:32 erik quanstrom
  0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2014-03-28 15:32 UTC (permalink / raw)
  To: 9fans

i found this playing with one of those usb hid panels.

just tested with the busted apple 2005 keyboard and the newer
flat apple keyboard.  both worked.  (the 2005 keyboard doesn't
work on some h/w still due to the hub controller.)

i'm going to roll this into 9atom today.  unfortunately, since
there is a pending change to usb/kb, i'll have to delay on submitting
this to sources.

/n/dump/2014/0328/sys/src/cmd/usb/kb/kb.c:762,768 - kb.c:762,767
  	d->free = freekdev;
  	kd->in = in;
  	kd->dev = d;
- 	res = -1;
  	kd->ep = openep(d, ep->id);
  	if(kd->ep == nil){
  		fprint(2, "kb: %s: workep: openep %d: %r\n", d->dir, ep->id);
/n/dump/2014/0328/sys/src/cmd/usb/kb/kb.c:782,791 - kb.c:781,792
  				kd->idle = Dwcidle;
  		}
  	}
- 	if(!kd->bootp)
- 		res= setfirstconfig(kd, ep->id, desc, sizeof desc);
- 	if(res > 0)
- 		res = parsereportdesc(&kd->templ, desc, sizeof desc);
+ 	res = -1;
+ 	if(!kd->bootp){
+ 		n = setfirstconfig(kd, ep->id, desc, sizeof desc);
+ 		if(n > 0)
+ 			res = parsereportdesc(&kd->templ, desc, n);
+ 	}
  	/* if we could not set the first config, we give up */
  	if(kd->bootp || res < 0){
  		kd->bootp = 1;

- erik



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-28 15:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28 15:32 [9fans] usb/kb parsing uninitialized memory erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).