[openfirmware] r1659 - in dev/usb2/device: keyboard net serial storage userial wlan

svn at openfirmware.info svn at openfirmware.info
Mon Jan 11 09:06:24 CET 2010


Author: wmb
Date: 2010-01-11 09:06:23 +0100 (Mon, 11 Jan 2010)
New Revision: 1659

Modified:
   dev/usb2/device/keyboard/kbd.fth
   dev/usb2/device/net/ethernet.fth
   dev/usb2/device/serial/uart.fth
   dev/usb2/device/storage/scsi.fth
   dev/usb2/device/userial/userial.fth
   dev/usb2/device/wlan/wlan.fth
Log:
OLPC trac 9969 - guarded "configuration set-config" with " reset?" $call-parent
for all devices.  It turns out that if you do set-config unnecessarily for devices
where the configuration has already been set, it sometimes fails, and often
triggers the problem described in #9423.


Modified: dev/usb2/device/keyboard/kbd.fth
===================================================================
--- dev/usb2/device/keyboard/kbd.fth	2010-01-10 10:50:45 UTC (rev 1658)
+++ dev/usb2/device/keyboard/kbd.fth	2010-01-11 08:06:23 UTC (rev 1659)
@@ -326,14 +326,20 @@
 ;
 
 \ kbd-buf and led-buf must have been allocated
-: setup-hardware  ( -- )
+: setup-hardware?  ( -- error? )
    device set-target
-   configuration set-config  if  ." Failed to set USB keyboard configuration" cr  then
+   " reset?" $call-parent  if
+      configuration set-config  if
+         ." Failed to set USB keyboard configuration" cr
+         true exit
+      then
+   then
    set-boot-protocol         if  ." Failed to set USB keyboard boot protocol" cr  then
    \ Some USB keyboards don't implement set-idle properly, and it's not critical,
    \ so we suppress the message to avoid confusing the user
    idle-rate set-idle   drop  \  if  ." Failed to set USB keyboard idle" cr  then
    0 set-leds
+   false
 ;
 
 
@@ -362,7 +368,10 @@
 : open  ( -- flag )
    kbd-refcount @  if  1 +refcnt true exit  then
    init-kbd-buf
-   setup-hardware
+   setup-hardware?  if
+      free-kbd-buf
+      false exit
+   then
    noop					\ Add noop so I can patch it before open
    normal-op?  if
       unlock

Modified: dev/usb2/device/net/ethernet.fth
===================================================================
--- dev/usb2/device/net/ethernet.fth	2010-01-10 10:50:45 UTC (rev 1658)
+++ dev/usb2/device/net/ethernet.fth	2010-01-11 08:06:23 UTC (rev 1659)
@@ -211,13 +211,15 @@
 : open  ( -- ok? )
    my-args  " debug" $=  if  debug-on  then
    device set-target
-   configuration set-config  if
-      ." Failed to set configuration" cr
-      false exit
-   then
 
    opencount @ 0=  if
-      " reset?" $call-parent  if  init-nic  then
+      " reset?" $call-parent  if
+         configuration set-config  if
+            ." Failed to set configuration" cr
+            false exit
+         then
+         init-nic
+      then
 
       first-open?  if
          false to first-open?

Modified: dev/usb2/device/serial/uart.fth
===================================================================
--- dev/usb2/device/serial/uart.fth	2010-01-10 10:50:45 UTC (rev 1658)
+++ dev/usb2/device/serial/uart.fth	2010-01-11 08:06:23 UTC (rev 1659)
@@ -54,6 +54,14 @@
 : open  ( -- flag )
    device set-target
    refcount @ 0=  if
+
+      " reset?" $call-parent  if
+         configuration set-config  if
+            ." Failed set serial port configuration" cr
+            false exit
+         then
+      then
+
       init-buf
       inituart rts-dtr-on
    then

Modified: dev/usb2/device/storage/scsi.fth
===================================================================
--- dev/usb2/device/storage/scsi.fth	2010-01-10 10:50:45 UTC (rev 1658)
+++ dev/usb2/device/storage/scsi.fth	2010-01-11 08:06:23 UTC (rev 1659)
@@ -183,8 +183,10 @@
 : set-address  ( lun -- )
    0 max max-lun min  to lun
    device set-target
-   configuration set-config  if
-      ." USB storage scsi layer: Failed to set configuration" cr
+   " reset?" $call-parent  if
+      configuration set-config  if
+         ." USB storage scsi layer: Failed to set configuration" cr
+      then
    then
 ;
 : set-timeout  ( n -- )  bulk-timeout max set-bulk-in-timeout  ;

Modified: dev/usb2/device/userial/userial.fth
===================================================================
--- dev/usb2/device/userial/userial.fth	2010-01-10 10:50:45 UTC (rev 1658)
+++ dev/usb2/device/userial/userial.fth	2010-01-11 08:06:23 UTC (rev 1659)
@@ -18,9 +18,11 @@
 
 : open  ( -- flag )
    device set-target
-   configuration set-config  if
-      ." userial: set-config failed" cr
-      false exit
+   " reset?" $call-parent  if
+      configuration set-config  if
+         ." userial: set-config failed" cr
+         false exit
+      then
    then
    alloc-buffers
    inbuf h# 10 bulk-in-pipe begin-bulk-in

Modified: dev/usb2/device/wlan/wlan.fth
===================================================================
--- dev/usb2/device/wlan/wlan.fth	2010-01-10 10:50:45 UTC (rev 1658)
+++ dev/usb2/device/wlan/wlan.fth	2010-01-11 08:06:23 UTC (rev 1659)
@@ -68,6 +68,12 @@
    my-args parse-args
    set-parent-channel
    opencount @ 0=  if
+      " reset?" $call-parent  if
+         configuration set-config  if
+            ." Failed to set USB configuration for wireless" cr
+            false exit
+         then
+      then
       init-buf
       /inbuf /outbuf setup-bus-io  if  free-buf false exit  then
       ?load-fw  if  release-bus-resources free-buf false exit  then




More information about the openfirmware mailing list