Changeset 3013


Ignore:
Timestamp:
Jun 19, 2012, 4:17:19 AM (3 years ago)
Author:
quozl
Message:

OLPC - dev/usb2, revert svn 3011 as it broke production use of USB scanners, reproduced also by me.

Location:
dev/usb2/hcd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • dev/usb2/hcd/device.fth

    r3011 r3013  
    392392\ Executed in root hub node context
    393393: get-str-descriptors  ( -- )
    394    language                                     ( lang )
    395    dup d# 14 dev-desc@ v$-desc-buf get-string to /v$-desc-buf
    396    dup d# 15 dev-desc@ d$-desc-buf get-string to /d$-desc-buf
    397        d# 16 dev-desc@ s$-desc-buf get-string to /s$-desc-buf
     394   language                                     ( lang )
     395   dup dev-desc-buf d# 14 + c@ v$-desc-buf get-string to /v$-desc-buf
     396   dup dev-desc-buf d# 15 + c@ d$-desc-buf get-string to /d$-desc-buf
     397       dev-desc-buf d# 16 + c@ s$-desc-buf get-string to /s$-desc-buf
    398398;
    399399
     
    401401: refresh-desc-bufs  ( dev -- )
    402402   set-target
    403    dev-desc-buf d# 18 get-dev-desc to /dev-desc-buf             \ Refresh dev-desc-buf
    404    cfg-desc-buf     0 get-cfg-desc to /cfg-desc-buf             \ Refresh cfg-desc-buf
     403   dev-desc-buf 12 get-dev-desc to /dev-desc-buf                \ Refresh dev-desc-buf
     404   cfg-desc-buf  0 get-cfg-desc to /cfg-desc-buf                \ Refresh cfg-desc-buf
    405405   get-str-descriptors
    406406;
    407407
    408408\ Executed in root hub node context
    409 : get-initial-descriptors  ( -- )
    410    \ Re-read the full device descriptor to pick up the vendor info
    411    dev-desc-buf d# 18 get-dev-desc  drop                ( )
    412    cfg-desc-buf     0 get-cfg-desc to /cfg-desc-buf     ( )
     409: get-initial-descriptors  ( dev -- )
     410   dev-desc-buf /pipe0 get-dev-desc  if         ( dev )
     411      dev-desc-buf 7 + c@ 0 rot di-maxpayload!  ( )
     412   else                                         ( dev )
     413      drop                                      ( )
     414   then                                         ( )
     415   cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf ( )
    413416;
    414417
    415418\ Executed in hub node context (root hub or subordinate hub) - creates new child nodes via (make-device-node)
    416419: make-device-node  ( port dev -- )
    417    " get-initial-descriptors" my-self $call-method      ( port dev )
     420   dup " get-initial-descriptors" my-self $call-method  ( port dev )
    418421   /cfg-desc-buf 0=  if  2drop  exit  then              ( port dev )
    419422   asso-class?  if  1  else  cfg-desc-buf 4 + c@  then  ( port dev #intf )
     
    441444;
    442445
    443 : get-initial-dev-desc  ( dev -- )
    444    dev-desc-buf d# 18 erase                     ( dev )
    445    dev-desc-buf d# 64 get-dev-desc  0=  if      ( dev )
    446       dev-desc-buf /pipe0 get-dev-desc  0=  if  ( dev )
    447          drop exit
    448       then
    449    then
    450    7 dev-desc@ 0 rot di-maxpayload!             ( )
    451 ;
    452 
    453446\ Executed in the root hub node context
    454447: setup-new-node  ( port speed hub-port hub-dev -- true | port dev xt false )
     
    461454
    462455   0 set-target                         ( port dev )    \ Address it as device 0
    463 
    464    \ Some devices (e.g. Lexar USB-to-SD and at least one USB FLASH drive) fail
    465    \ on set-address unless you first read the device descriptor from address 0.
    466    dup get-initial-dev-desc             ( port dev )
    467 
     456   over reset-port                      ( port dev )    \ Some devices want to be reset here
    468457   dup set-address  if                  ( port dev )    \ Assign it usb addr dev
    469458      ." Retrying with a delay" cr
  • dev/usb2/hcd/ehci/probe.fth

    r3011 r3013  
    88
    99: make-root-hub-node  ( port -- )
     10   \ Some devices (e.g. Lexar USB-to-SD) fail unless you get the cfg desc from device 0 first
    1011   0 set-target \ First address it as device 0  ( port )
    1112   port-speed 0 di-speed!     \ Use high speed for getting the device descriptor
    12    dup reset-port                               ( port )
     13   dev-desc-buf h# 40 get-cfg-desc drop         ( port )
     14
    1315   port-speed                                   ( port speed )
    1416
     
    1719
    1820   \ Execute setup-new-node in root context and make-device-node in hub node context
    19    setup-new-node  if  execute  then            ( )
     21   setup-new-node  if  execute  then    ( )
    2022;
    2123
Note: See TracChangeset for help on using the changeset viewer.