Changeset 3015


Ignore:
Timestamp:
Jun 20, 2012, 8:18:56 AM (3 years ago)
Author:
wmb
Message:

Reinstate the USB probing change, but fixed so it works with USB 1.1 devices.

Location:
dev/usb2/hcd
Files:
2 edited

Legend:

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

    r3013 r3015  
    393393: get-str-descriptors  ( -- )
    394394   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
     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
    398398;
    399399
     
    401401: refresh-desc-bufs  ( dev -- )
    402402   set-target
    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
     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
    405405   get-str-descriptors
    406406;
    407407
    408 \ Executed in root hub node context
    409 : get-initial-descriptors  ( dev -- )
     408: get-initial-dev-desc  ( dev -- )
     409   dev-desc-buf d# 18 erase                     ( dev )
     410
     411   \ Until we know the size of the control endpoint, we must be
     412   \ conservative about the transfer size.
    410413   dev-desc-buf /pipe0 get-dev-desc  if         ( dev )
    411       dev-desc-buf 7 + c@ 0 rot di-maxpayload!  ( )
     414      7 dev-desc@                               ( dev maxtransfer )
     415      tuck  0 rot di-maxpayload!                ( maxtransfer )
     416      d# 18 >=  if                              ( )
     417         dev-desc-buf d# 18 get-dev-desc drop   ( )
     418      then                                      ( )
    412419   else                                         ( dev )
    413420      drop                                      ( )
    414421   then                                         ( )
     422;
     423
     424\ Executed in root hub node context
     425: get-initial-descriptors  ( dev -- )
     426   get-initial-dev-desc                         ( )
    415427   cfg-desc-buf 0 get-cfg-desc to /cfg-desc-buf ( )
    416428;
     
    454466
    455467   0 set-target                         ( port dev )    \ Address it as device 0
    456    over reset-port                      ( port dev )    \ Some devices want to be reset here
     468
     469   \ Some devices (e.g. Lexar USB-to-SD and at least one USB FLASH drive) fail
     470   \ on set-address unless you first read the device descriptor from address 0.
     471   \ On other devices, this will fail, but it won't cause problems, and the
     472   \ descriptor will be re-read later by make-device-node
     473   dup get-initial-dev-desc             ( port dev )
     474
     475\  over reset-port                      ( port dev )    \ Some devices want to be reset here
     476
    457477   dup set-address  if                  ( port dev )    \ Assign it usb addr dev
    458478      ." Retrying with a delay" cr
  • dev/usb2/hcd/ehci/probe.fth

    r3013 r3015  
    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
    1110   0 set-target \ First address it as device 0  ( port )
    1211   port-speed 0 di-speed!     \ Use high speed for getting the device descriptor
    13    dev-desc-buf h# 40 get-cfg-desc drop         ( port )
     12
     13   dup reset-port                               ( port )
    1414
    1515   port-speed                                   ( port speed )
Note: See TracChangeset for help on using the changeset viewer.