Hi all!

And Happy New Year to everyone!

3 days ago I faced the problem which I could not solve using Google.

Currently I work on board with PXA255, kernel 2.6.10, and I need the ability to 
access the
board through USB from both Linux and Windows hosts.
I built the kernel with USB Gadget support for PXA2xx (in kernel) and 
File-backed Storage Gadget (as a module).

Then I created the storage file on the partition with YAFFS (mounted to /app).
# dd if=/dev/zero of=/app/file_storage bs=1k count=10000

# insmod g_file_storage.ko file=/app/file_storage

Next I connected my board to the Linux host and created the DOS partition with 
'fdisk /dev/uba' command.
Due to mkdosfs does not work with USB directly (it failed with " unable to get 
drive geometry for '/dev/uba1' "),
I did following:
# cat /dev/uba1 > tmp_file
# mkdosfs tmp_file
# cat tmp_file > /dev/uba1

# mount -t msdos /dev/uba1 /mnt/usb

After that my board works fine as a mass storage device with Linux host.

But I have problem with connecting to Windows hosts (I tryed to connect my 
board to the host with
Windows XP Pro SP1).
After plugin the cable I can see many messages in the board console:
........
udc: USB reset
udc: USB reset
g_file_storage gadget: full speed config #1
udc: USB reset
udc: USB reset
g_file_storage gadget: full speed config #1
... and so on.

Sometimes, after about 3...5 minutes of waiting, it connects and WinXP opens a 
folder with the flash contens, sometimes not.
But all this time WinXP shows that Flash Mass Storage device driver works 
correctly.

I enabled debugging info in file_storage.c and here is the output of dmesg 
during the Windows connection:

---------------------------------------------------------------------------------
g_file_storage gadget-lun0: open backing file: /app/file_storage
g_file_storage gadget: File-backed Storage Gadget, version: 20 October 2004
g_file_storage gadget: Number of LUNs=1
g_file_storage gadget-lun0: ro=0, file: /app/file_storage
g_file_storage gadget: transport=Bulk-only (x50)
g_file_storage gadget: protocol=Transparent SCSI (x06)
g_file_storage gadget: VendorID=x0525, ProductID=xa4a5, Release=x0303
g_file_storage gadget: removable=0, stall=1, buflen=16384
g_file_storage gadget: I/O thread pid: 72
udc: USB reset
g_file_storage gadget: resume
g_file_storage gadget: suspend
g_file_storage gadget: resume
g_file_storage gadget: disconnect or port reset
g_file_storage gadget-lun0: fdatasync -> 0
udc: USB reset
g_file_storage gadget: suspend
g_file_storage gadget: resume
g_file_storage gadget: disconnect or port reset
g_file_storage gadget-lun0: fdatasync -> 0
udc: USB reset
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 01 00 00 40 00
g_file_storage gadget: get device descriptor
g_file_storage gadget: ep0-in, length 18:
   0:  12 01 00 02 00 00 00 10  25 05 a5 a4 03 03 01 02
  10:  03 01
g_file_storage gadget: disconnect or port reset
g_file_storage gadget-lun0: fdatasync -> 0
udc: USB reset
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 01 00 00 12 00
g_file_storage gadget: get device descriptor
g_file_storage gadget: ep0-in, length 18:
   0:  12 01 00 02 00 00 00 10  25 05 a5 a4 03 03 01 02
  10:  03 01
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 02 00 00 09 00
g_file_storage gadget: get configuration descriptor
g_file_storage gadget: ep0-in, length 9:
   0:  09 02 20 00 01 01 00 c0  01
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 03 00 00 ff 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 4:
   0:  04 03 09 04
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 03 03 09 04 ff 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 26:
   0:  1a 03 33 00 32 00 33 00  30 00 32 00 30 00 34 00
  10:  46 00 36 00 33 00 37 00  34 00
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 02 00 00 ff 00
g_file_storage gadget: get configuration descriptor
g_file_storage gadget: ep0-in, length 32:
   0:  09 02 20 00 01 01 00 c0  01 09 04 00 00 02 08 06
  10:  50 00 07 05 81 02 40 00  00 07 05 02 02 40 00 00
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 06 00 00 0a 00
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 03 00 00 ff 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 4:
   0:  04 03 09 04
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 02 03 09 04 ff 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 54:
   0:  36 03 46 00 69 00 6c 00  65 00 2d 00 62 00 61 00
  10:  63 00 6b 00 65 00 64 00  20 00 53 00 74 00 6f 00
  20:  72 00 61 00 67 00 65 00  20 00 47 00 61 00 64 00
  30:  67 00 65 00 74 00
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 03 00 00 ff 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 4:
   0:  04 03 09 04
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 02 03 09 04 ff 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 54:
   0:  36 03 46 00 69 00 6c 00  65 00 2d 00 62 00 61 00
  10:  63 00 6b 00 65 00 64 00  20 00 53 00 74 00 6f 00
  20:  72 00 61 00 67 00 65 00  20 00 47 00 61 00 64 00
  30:  67 00 65 00 74 00
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 01 00 00 12 00
g_file_storage gadget: get device descriptor
g_file_storage gadget: ep0-in, length 18:
   0:  12 01 00 02 00 00 00 10  25 05 a5 a4 03 03 01 02
  10:  03 01
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 02 00 00 09 00
g_file_storage gadget: get configuration descriptor
g_file_storage gadget: ep0-in, length 9:
   0:  09 02 20 00 01 01 00 c0  01
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 02 00 00 20 00
g_file_storage gadget: get configuration descriptor
g_file_storage gadget: ep0-in, length 32:
   0:  09 02 20 00 01 01 00 c0  01 09 04 00 00 02 08 06
  10:  50 00 07 05 81 02 40 00  00 07 05 02 02 40 00 00
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 03 00 00 02 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 2:
   0:  04 03
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 00 03 00 00 04 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 4:
   0:  04 03 09 04
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 03 03 09 04 02 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 2:
   0:  1a 03
g_file_storage gadget: ep0-setup, length 8:
   0:  80 06 03 03 09 04 1a 00
g_file_storage gadget: get string descriptor
g_file_storage gadget: ep0-in, length 26:
   0:  1a 03 33 00 32 00 33 00  30 00 32 00 30 00 34 00
  10:  46 00 36 00 33 00 37 00  34 00
g_file_storage gadget: ep0-setup, length 8:
   0:  00 09 01 00 00 00 00 00
g_file_storage gadget: set configuration
g_file_storage gadget: set interface 0
g_file_storage gadget: full speed config #1
g_file_storage gadget: ep0-setup, length 8:
   0:  a1 fe 00 00 00 00 01 00
g_file_storage gadget: get max LUN
g_file_storage gadget: ep0-in, length 1:
   0:  00
g_file_storage gadget: bulk-out, length 31:
   0:  55 53 42 43 a0 a1 59 81  24 00 00 00 80 00 06 12
  10:  00 00 00 24 00 00 00 00  00 00 00 00 00 00 00
g_file_storage gadget: SCSI command: INQUIRY;  Dc=6, Di=36;  Hc=6, Hi=36
g_file_storage gadget: bulk-in, length 36:
   0:  00 00 02 02 1f 00 00 00  4c 69 6e 75 78 20 20 20
  10:  46 69 6c 65 2d 53 74 6f  72 20 47 61 64 67 65 74
  20:  30 33 30 33
g_file_storage gadget: bulk-in, length 13:
   0:  55 53 42 53 a0 a1 59 81  00 00 00 00 00
g_file_storage gadget: bulk-out, length 31:
   0:  55 53 42 43 a0 a1 59 81  fc 00 00 00 80 00 0a 23
  10:  00 00 00 00 00 00 00 fc  00 00 00 00 00 00 00
g_file_storage gadget: SCSI command: READ FORMAT CAPACITIES;  Dc=10, Di=252;  
Hc=10, Hi=252
g_file_storage gadget: bulk-in, length 0:
g_file_storage gadget: bulk-in set halt
g_file_storage gadget: sending command-failure status
g_file_storage gadget:   sense data: SK x06, ASC x29, ASCQ x00;  info x0
g_file_storage gadget: bulk-in, length 13:
   0:  55 53 42 53 a0 a1 59 81  fc 00 00 00 01
---------------------------------------------------------------------------

Unfortunately, this output makes just a little sence for me because I'm a 
newcomer in USB :(

Could somebody be so kind to point me what I did wrong?

Thanks in advance!

Vlad Trukhin



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to