Re: When will MS fix the WinCE USB Mass Storage Problems?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,
I fixed antother 6 keys.
The length field (byte 4) of the SCSIModeSense6 command was 0.
All other keys accept (or ignore) this, but not Sony & Freecom.

In another posting it was suggested to put in :
bCDB[4] = sizeof(bDataBlock)
But since this results in 0x200, it will result in a 0-byte !
So I replaced it with :
bCDB[4] = 0xFF
And it works.

Now only 3.8% of my keys donot work. (originally 40-50%)

Greetings,
Rob.








"Rob" wrote:

Hi all,

Actually retrying GetSenseData is useless, since it returns error-status of
the last command. (sortof like GetLastError() )
The second try will always return success.

In SCSIGetSenseData under SENSE_UNIT_ATTENTION , some keys reported
SENSE_NOT_READY : Unhandled ASC:0x3A ...
This 3A is the code for ASC_MEDIUM_NOT_PRESENT which needs to be handled in
this switch statement by the following lines :

pDevice->Flags.MediumPresent = FALSE;
pDevice->Flags.MediumChanged = TRUE;
pDevice->MediumType = SCSI_MEDIUM_UNKNOWN;
memset(&pDevice->DiskInfo, 0, sizeof(DISK_INFO) );
dwErr = DISK_REMOVED_ERROR;

This results in TestUnitReady retrying the operation.
I think the spec does not say that this is a valid response to this command,
but some keys still report it.

I now have only a few keys (out of 50) left that are not mounted ok.
These keys all have the same problem.
After TestUnitReady has returned OK ( after 1 retry, because sense reported
ASC_MEDIA_CHANGED once), The disk starts the mounting.
The command ScsiModeSense6() then times out.
Strangely enough, when my (cheapo rubbish) USB analyzer is aquiring, these
keys mount ok. That leads me to believe it is a timing or impedance issue.
Any tips on this timeout are welcome.
I especially like to know why this could occur, do I need to issue other
commands inbetween, or check some other status ? or start/stop/reset the
device first ?
Isn't is so that when TestUnitReady says the device is ready, any other
command can be issued ?

Greetings,
Rob van den Bergh



"Rob" wrote:

Hi,
In the mean time I got about 50% of my non-working USB keys working.

It appears that most problems are caused by communicating to the keys before
they are "alive" enough, after insertion.
TEST : insert the key just 1mm so only power-leads connect, after 1 sec,
insert it completely. I have at least 1 key for which it works in that case,
and not when I insert it in 1 go. This suggests to me that the powerup of the
key has something to do with it.

I see that commands are sent to the key before "mediumpresent" is set from
the MediaChangeThread, this seems unlogical. (only the thread should poll for
precence)

I changed the following things:

- There is a BUG in disk.c :
memset((PVOID)&pDevice->DiskInfo, sizeof(DISK_INFO), 0);
The last 2 parms are switched.

- GetMediumInfo() : return immediately when !MediumPresent
It will probably fail anyway, some devices donot recover nicely from this.

- SCSITestUnitReady :
Retry GetSenseData a few times, when it fails, Sleep(50)
When error is ERROR_GEN_FAILURE, call ScsiGetSensData()

The remaining keys have 2 problems:
- 1 group returns ASC_MEDIA_CHANGED for the ACS code in ScsiGetSenseData.
I have some keys that also do this, but are still mounted ok. But I have
about 7 that donot. Also I see the line : Unhandled ASC 0x3A. I looked it up
in the USB spec, and it is indeed an undefined response for sensedata. Does
anyone know what it means ?

- 2nd group has failures in deviceconfig. I have not looked into this yet.

Comments, Corrections and suggestions are welcome...

Greetings,
Rob.





"Rob" wrote:

Hi,
I have tested about 40 USB-Keys.
I found that about 50% is not working properly.
This seems unrelated to brand or size.
Probably it is linked to the controller-chip used,
But I have not broken the key-casings open (yet).
Keys that look exactly the same , but differrent in size might behave
differently.
Differrent Keys from the same brand behave differently.

I basically see 2 types of failures.
See the tracings at the end of this posting case1 , an case 2.

Case1:
The attachdevice works OK, the DSKx: device is present.
but then : Usbdisk6!ScsiUnitAttention> TEST UNIT READY failed(20)

Case2:
Attachdevice fails, the sequence of state-transitions there, fails.
Somewhere in ResetAndEnablePort() a bad status is returned.
Some keys fail a couple of steps sooner or later.

The failure of USB-keys seems so similar that I expect someone to have fixed
this already. I think that someone with indepth knowledge of USB devices
would immediatly be able to figure out what goes wrong here.
The USB-key suppliers have not been much help sofar.

Since the driver code is not very simple, I think it might take a lot of
time to understand it in detail. I hope that someone can give me some tips
on where to look or what is is that is going wrong.

Greetings,
Rob.

TRACINGS CASE1 (slightly modified driver) :

1138462 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::HubStatusChangeThread -
port 6, change = 0x0001, status = 0x0501
1138657 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::HubStatusChangeThread -
device attached on port 6
1138657 PID:4bb7c65e TID:2b9b5cfa +CHub(Root tier 0)::AttachDevice - port =
6, fIsLowSpeed = 0
1138657 PID:4bb7c65e TID:2b9b5cfa *** port=6 _hub=3C79A0 currvalue of
m_sAttachedPort=6***
1138657 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_OPENING_ENDPOINT0_PIPE, failures = 0
1138657 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_USING_ADDRESS0, failures = 0
1138657 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_RESET_AND_ENABLE_PORT, failures = 0
1138730 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR_TEST, failures = 0
1138731 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_SET_ADDRESS, failures = 0
1138732 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_LEAVE_ADDRESS0, failures = 0
1138743 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_INITIAL_DEVICE_DESCRIPTOR, failures = 0
1138744 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR, failures = 0
1138745 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SETUP_CONFIGURATION_DESCRIPTOR_ARRAY, failures = 0
1138745 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_INITIAL_CONFIG_DESCRIPTOR, failures = 0
1138746 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_CONFIG_DESCRIPTOR, failures = 0
1138747 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_DETERMINE_CONFIG_TO_CHOOSE, failures = 0
1138747 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - Select
Configuration 0 on DEVICE_CONFIG_STATUS_DETERMINE_CONFIG_TO_CHOOSE step
1138747 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_SET_CONFIG, failures = 0
1138748 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_CREATE_NEW_FUNCTION, failures = 0
1138748 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_INSERT_NEW_DEVICE_INTO_UPSTREAM_HUB_PORT_ARRAY, failures
= 0
1138748 PID:4bb7c65e TID:2b9b5cfa CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SIGNAL_NEW_DEVICE_ENTER_OPERATIONAL_STATE, failures = 0
1138751 PID:4bb7c65e TID:2b9b5cfa +USBD:OpenPipe, EP: 0x81, MaxPkt: 512,
Type: Bulk
1138751 PID:4bb7c65e TID:2b9b5cfa Endpoint=2 EPA=81
1138751 PID:4bb7c65e TID:2b9b5cfa -USBD:OpenPipe success, hPipe = 3ED760
1138751 PID:4bb7c65e TID:2b9b5cfa +USBD:OpenPipe, EP: 0x2, MaxPkt: 512,
Type: Bulk
1138751 PID:4bb7c65e TID:2b9b5cfa Endpoint=2 EPA=2
1138751 PID:4bb7c65e TID:2b9b5cfa -USBD:OpenPipe success, hPipe = 3ED850
1138752 PID:4bb7c65e TID:2b9b5cfa USBDISK6>DiskAttach USBTransport=3ED670
1138752 PID:4bb7c65e TID:2b9b5cfa
ActivePath:Drivers\USB\ClientDrivers\Mass_Storage_Class\6
1138752 PID:4bb7c65e TID:2b9b5cfa Activate attached Device=50AFA0
1138753 PID:4bb7c65e TID:2b9b5cfa USBDISK6>DSK_Init(845E704) device=50AFA0
path=Drivers\Active\84
1138754 PID:4bb7c65e TID:2b9b5cfa Command Block Status: Command Failed
1138757 PID:4bb7c65e TID:2b9b5cfa ScsiGetSenseData - SenseKey:0x6 ASC:0x28
ASCQ:0x0
1138757 PID:4bb7c65e TID:2b9b5cfa SENSE_UNIT_ATTENTION : ASC_MEDIA_CHANGED
1138757 PID:4bb7c65e TID:2b9b5cfa ScsiTestUnitReady ERROR:20
1138757 PID:4bb7c65e TID:2b9b5cfa Usbdisk6!ScsiUnitAttention> TEST UNIT
READY failed(20)
1143782 PID:4bb7c65e TID:2b9b5cfa BOT_DataTransfer warning(6.7.2.3,
RequestLength:8 TransferLength:0 Err:1460 UsbErr:0x0, dwTimeout:5000)

CASE 2 :
2279138 PID:4bb7c65e TID:2ba0e0da !!!Warning!!! Setting resume/suspend/reset
bits of USBCMD
2279510 PID:4bb7c65e TID:2ba0e0da CHub(Root tier 0):: ResumeNotification(0) !
2279510 PID:4bb7c65e TID:2ba0e0da CHub(Root tier 0):: ResumeNotification(0) !
2279611 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::HubStatusChangeThread -
port 2, change = 0x0001, status = 0x0101
2279712 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::HubStatusChangeThread -
device attached on port 2
2279712 PID:4bb7c65e TID:cba0bfae +CHub(Root tier 0)::AttachDevice - port =
2, fIsLowSpeed = 0
2279712 PID:4bb7c65e TID:cba0bfae **** port=2 ****
2279712 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_OPENING_ENDPOINT0_PIPE, failures = 0
2279712 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_USING_ADDRESS0, failures = 0
2279712 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_RESET_AND_ENABLE_PORT, failures = 0
2279774 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR_TEST, failures = 0
2279775 PID:4bb7c65e TID:ba0eef6 CQueuedPipe(Control)::CheckForDoneTransfers
- failure on TD 0x3458a0, address = 0, endpoint = 0, errorCounter = 0, status
field = 0x22
2279775 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - failure
3 on DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR_TEST step
2279775 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_RESET_AND_ENABLE_PORT, failures = 1
2279837 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR_TEST, failures = 1
2279838 PID:4bb7c65e TID:ba0eef6 CQueuedPipe(Control)::CheckForDoneTransfers
- failure on TD 0x3458a0, address = 0, endpoint = 0, errorCounter = 0, status
field = 0x22
2279838 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - failure
3 on DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR_TEST step
2279838 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_RESET_AND_ENABLE_PORT, failures = 2
2279900 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR_TEST, failures = 2
2279901 PID:4bb7c65e TID:ba0eef6 CQueuedPipe(Control)::CheckForDoneTransfers
- failure on TD 0x3458a0, address = 0, endpoint = 0, errorCounter = 0, status
field = 0x22
2279901 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - failure
3 on DEVICE_CONFIG_STATUS_SCHEDULING_GET_DEVICE_DESCRIPTOR_TEST step
2279901 PID:4bb7c65e TID:cba0bfae CHub(Root tier 0)::AttachDevice - status =
DEVICE_CONFIG_STATUS_FAILED, failures = 3
2279914 PID:4bb7c65e TID:cba0bfae -CHub(Root tier 0)::AttachDevice - port =
2, fIsLowSpeed = 0, address = 1
2280015 PID:4bb7c65e TID:cba0bfae !!!Warning!!! Setting resume/suspend/reset
bits of USBCMD





"winceuser" wrote:

Hear, Hear! I have not seen any QFE's addressing this issue, only
mention of them.
I too would be interested in either a "public" (besides the couple of
postings here) or a "commercial" solution since I have a 5.0 product
with USB drive support to ship in the next quarter.

Here is my list of working devices:

Sandisk CRUZER micro 128MB
Viking 128MB USB 2.0 Drive
Kingston 32 MB

Seems like anything over 128 MB typically does not work. And
unfortunatelly most of the 128MB are no longer available from the major
USB Drive manufacturers.


.



Relevant Pages

  • bringing ee up to date
    ... -is a simple screen oriented text editor. ... +.\" To format this reference page, use the command: ... -Turn off display of information window at top of terminal. ... -.Ss "Control keys" ...
    (freebsd-hackers)
  • Re: Great SWT Program
    ... the keys standard with those keyboards are; ... I've had occasion to use xfig to make diagrams for inclusion in LaTeX ... Yours I assume includes a command name at least as long as ...
    (comp.lang.java.programmer)
  • Re: When will MS fix the WinCE USB Mass Storage Problems?
    ... In SCSIGetSenseData under SENSE_UNIT_ATTENTION, some keys reported ... I think the spec does not say that this is a valid response to this command, ... In the mean time I got about 50% of my non-working USB keys working. ... Attachdevice fails, the sequence of state-transitions there, fails. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: When will MS fix the WinCE USB Mass Storage Problems?
    ... In the mean time I got about 50% of my non-working USB keys working. ... Differrent Keys from the same brand behave differently. ... Attachdevice fails, the sequence of state-transitions there, fails. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: When will MS fix the WinCE USB Mass Storage Problems?
    ... All other keys accept this, ... I think the spec does not say that this is a valid response to this command, ... Strangely enough, when my USB analyzer is aquiring, these ... Attachdevice fails, the sequence of state-transitions there, fails. ...
    (microsoft.public.windowsce.platbuilder)