[openfirmware] r1674 - in dev/usb2: device device/keyboard device/net device/serial device/storage device/userial device/wlan hcd
svn at openfirmware.info
svn at openfirmware.info
Thu Jan 14 07:27:28 CET 2010
Author: wmb
Date: 2010-01-14 07:27:28 +0100 (Thu, 14 Jan 2010)
New Revision: 1674
Modified:
dev/usb2/device/common.fth
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/usb8388.fth
dev/usb2/hcd/dev-info.fth
dev/usb2/hcd/device.fth
Log:
OLPC trac 9969 - comment:5 - fixed regression that happens when you remove
and reinstert a USB device.
Modified: dev/usb2/device/common.fth
===================================================================
--- dev/usb2/device/common.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/device/common.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -36,8 +36,11 @@
get-my-property if 0 else decode-int nip nip then
;
+\ This needs to be called every time that the device could have changed
+: set-device ( -- ) " assigned-address" get-int-property to device ;
+
: init ( -- )
- " assigned-address" get-int-property to device
+ set-device
" configuration#" get-int-property to configuration
" bulk-in-pipe" get-int-property to bulk-in-pipe
" bulk-out-pipe" get-int-property to bulk-out-pipe
Modified: dev/usb2/device/keyboard/kbd.fth
===================================================================
--- dev/usb2/device/keyboard/kbd.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/device/keyboard/kbd.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -327,6 +327,7 @@
\ kbd-buf and led-buf must have been allocated
: setup-hardware? ( -- error? )
+ set-device
device set-target
" reset?" $call-parent if
configuration set-config if
Modified: dev/usb2/device/net/ethernet.fth
===================================================================
--- dev/usb2/device/net/ethernet.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/device/net/ethernet.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -223,6 +223,7 @@
: open ( -- ok? )
parse-args
+ set-device
device set-target
opencount @ 0= if
@@ -248,12 +249,6 @@
headers
-: init ( -- )
- init
- device set-target
- configuration set-config if ." Failed to set ethernet configuration" cr then
-;
-
init
\ LICENSE_BEGIN
Modified: dev/usb2/device/serial/uart.fth
===================================================================
--- dev/usb2/device/serial/uart.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/device/serial/uart.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -52,6 +52,7 @@
: write ( adr len -- actual ) dup if write-bytes else nip then ;
: open ( -- flag )
+ set-device
device set-target
refcount @ 0= if
@@ -88,8 +89,6 @@
: init ( -- )
init
init-buf
- device set-target
- configuration set-config if ." Failed set serial port configuration" cr then
init-hook
free-buf
;
Modified: dev/usb2/device/storage/scsi.fth
===================================================================
--- dev/usb2/device/storage/scsi.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/device/storage/scsi.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -79,7 +79,6 @@
init-execute-command
alloc-bulk
device set-target
- configuration set-config if ." Failed to set storage configuration" cr then
get-max-lun
free-bulk
;
@@ -182,6 +181,7 @@
: set-address ( lun -- )
0 max max-lun min to lun
+ set-device \ The device number may have changed if we recycled the node
device set-target
" reset?" $call-parent if
configuration set-config if
Modified: dev/usb2/device/userial/userial.fth
===================================================================
--- dev/usb2/device/userial/userial.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/device/userial/userial.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -17,6 +17,7 @@
;
: open ( -- flag )
+ set-device
device set-target
" reset?" $call-parent if
configuration set-config if
Modified: dev/usb2/device/wlan/usb8388.fth
===================================================================
--- dev/usb2/device/wlan/usb8388.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/device/wlan/usb8388.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -58,7 +58,7 @@
: end-out-ring ( -- ) " end-out-ring" $call-parent ;
-: set-parent-channel ( -- ) device set-target ;
+: set-parent-channel ( -- ) set-device device set-target ;
: setup-bus-io ( /inbuf /outbuf -- error? )
4 bulk-out-pipe " begin-out-ring" $call-parent ( /inbuf )
@@ -77,9 +77,6 @@
" vendor-id" property-or-abort to vid
" device-id" property-or-abort to pid
set-parent-channel
- configuration set-config if
- ." Failed to set USB configuration for wireless" cr
- then
;
init
Modified: dev/usb2/hcd/dev-info.fth
===================================================================
--- dev/usb2/hcd/dev-info.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/hcd/dev-info.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -41,6 +41,10 @@
: di-hub@ ( idx -- hub ) 'di >di-hub c@ ;
: di-port! ( port idx -- ) 'di >di-port c! ;
: di-port@ ( idx -- port ) 'di >di-port c@ ;
+: di-is-reset ( idx -- )
+ 'di >di-reset ( adr )
+ 0 swap c!
+;
: di-reset? ( idx -- flag )
'di >di-reset ( adr )
dup c@ 0= ( adr reset? )
Modified: dev/usb2/hcd/device.fth
===================================================================
--- dev/usb2/hcd/device.fth 2010-01-14 04:55:17 UTC (rev 1673)
+++ dev/usb2/hcd/device.fth 2010-01-14 06:27:28 UTC (rev 1674)
@@ -244,6 +244,7 @@
dup c@ over + swap 4 + c@ ( dev adr' #endpoints )
swap ENDPOINT find-desc ( dev #endpoints adr' )
swap 0 ?do ( dev adr' )
+ over di-is-reset ( dev adr )
dup 4 + le-w@ ( dev adr size )
over 2 + c@ h# f and ( dev adr size pipe )
3 pick di-maxpayload! ( dev adr )
More information about the openfirmware
mailing list