Author Topic: MSC device works in Linux. Gives Error 10 in Windows.  (Read 5327 times)

mm7

  • Member
  • ***
  • Posts: 4
MSC device works in Linux. Gives Error 10 in Windows.
« on: February 19, 2018, 05:05:15 pm »
Hi everybody!

I am working on MSC bulk only device that will run on ARM SAMD21 SOC (Adafruit Feather M0).
I use USB stack from Arduino, using pluggableUSB class. I've implemented MSC and SCSI layers.
All looks quite good in Linux. It is Full Speed, not High, but it works. I plug the device, drivers detect it and create block device, which I can mount as FAT32.
However this does not happen in Windows. I tried Win2008, Win7, Win10. All same.
Error is 10 CM_PROB_FAIL_START. I've reinstalled driver (standard USBSTOR.SYS) but it does not load. Windows detects the device as Mass Storage Device, but shows as invalid.

I've captured USB traffic in Linux using Wireshark while the USB device is passed into Windows VM.
I've captured USB traffic of my device and a working USB flash drive. The latter works.
Messages are pretty much identical to the point where USBMS protocol should kick in.
For the good drive Windows proceeds with GET MAX LUN and further. For my drive it does not.
Last request is "GET DESCRIPTOR Request CONFIGURATION" after that all conversations stop.
However it does this couple of times, starts from "GET DESCRIPTOR Request DEVICE", then GET DESCRIPTOR Request CONFIGURATION, then gets vendor strings.... but then it stops.

My descriptors look identical with the good drive's ones, except vendor/product/serial numbers.

One more difference, the good drive uses High speed, mine is Full speed.
But both are USB 2.0. I tried to set USB 1.10 in descriptor - does not help.

Please give me some hint how to please Windows.






« Last Edit: February 19, 2018, 05:47:21 pm by mm7 »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: MSC device works in Linux. Gives Error 10 in Windows.
« Reply #1 on: February 19, 2018, 10:35:45 pm »
wMaxPacketSize for full speed bulk should be 64.

mm7

  • Member
  • ***
  • Posts: 4
Re: MSC device works in Linux. Gives Error 10 in Windows.
« Reply #2 on: February 19, 2018, 11:54:10 pm »
Thanks Jan!

also I've found at usb.org great tool "USB 2 CV". It checks everything.
It has found that somehow string descriptors are not good. Though they are recognized by Linux.
Not sure what is wrong with them. To me they look OK. Unicode, length is correct, char size * 2 + 2. Serial number is hex.


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: MSC device works in Linux. Gives Error 10 in Windows.
« Reply #3 on: February 20, 2018, 09:49:51 am »
For mass-storage devices, the serial number must have at least 12 characters and must contain only characters in the range 0–9 (0030h–0039h) and A–F (0041h–0046h). Note that lower-case text, hyphens, and many other characters are not allowed. The last 12 characters must be different from the last 12 characters
of the serial number of any device with the same values in the idVendor and idProduct fields in the device descriptor.

from USB Complete
http://janaxelson.com/usbc.htm

mm7

  • Member
  • ***
  • Posts: 4
Re: MSC device works in Linux. Gives Error 10 in Windows.
« Reply #4 on: February 20, 2018, 04:11:56 pm »
Jan thanks again,

I knew about "hex" char only requirements, did not know about 12 chars.

my Serial# is 4E75E52D504D, 12 Unicode chars, payload is 2+24 bytes length (len, type, text)
here is dump of what was captured by WireShark.
Code: [Select]
0000   1a 03 34 00 45 00 37 00 35 00 45 00 35 00 32 00  ..4.E.7.5.E.5.2.
0010   44 00 35 00 30 00 34 00 44 00                    D.5.0.4.D.

Previously I also tried longer, 16 and more chars. It did not work. I'll try again.

mm7

  • Member
  • ***
  • Posts: 4
Re: MSC device works in Linux. Gives Error 10 in Windows.
« Reply #5 on: February 20, 2018, 08:02:10 pm »
Yes, setting wMaxPacketSize to 64 helped! Thank you Jan, good catch!
After fixing this the strings appeared. It was nothing wrong with the strings and serial#.
It just failed before, at endpoints, but it was complaining on serial#. :o

I am moving further with tests. Chapter 9 compliency is good now.
Working on MSC tests....

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: MSC device works in Linux. Gives Error 10 in Windows.
« Reply #6 on: February 20, 2018, 08:27:43 pm »
Glad to hear it's working, thanks for reporting back.