Hi,

I'm currently using the driver g_file_storage on a gumstix product (see 
http://gumstix.org).

This driver works fine when the option stall=N is set.

However, I encountered a problem when I plug it in a JVC micro HiFi.

With debug mode enabled, g_file_storage prints the following message in 
kernel log:


 g_file_storage gadget: bulk-out, length 31:
      0:  55 53 42 43 03 00 00 00  12 00 00 00 80 00 05 03
     10:  00 00 00 12 00 00 00 10  00 00 00 00 00 00 00
 g_file_storage gadget: non-meaningful CBW: lun = 0, flags = 0x80, cmdlen 5

(see full log at the end of this email)

In the command send by the HiFi equipment, the length of the CBWCB is 
equal to 5,
which makes g_file_storage module reject the message in file_storage.c 
at line 3009 :

        /* Is the CBW meaningful? */
        if (cbw->Lun >= MAX_LUNS || cbw->Flags & ~USB_BULK_IN_FLAG ||
                        cbw->Length < 6 || cbw->Length > MAX_COMMAND_SIZE) {
                DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, "
                                "cmdlen %u\n",
                                cbw->Lun, cbw->Flags, cbw->Length);

I wonder why there is a 6 in here.

Indeed, the BBB Mass-Storage standard specifies:

"""
bCBWCBLength:
   The valid length of the CBWCB in bytes. This defines the valid length 
of the command block. The
   only legal values are 1 through 16 (01h through 10h). All other 
values are reserved.
"""

and if I replaced this 6 by 1, everything works fine.


Thanks,


Samuel Hangouët
Silicom, France


P.S. If you need more details :

For this test, I generated a 4Mo FAT12 backing file following the 
indications written at:
http://www.linux-usb.org/gadget/file_storage.html

Here is the full log :

# modprobe g_file_storage file=backing stall=N
pxa2xx_udc: version 4-May-2005
g_file_storage gadget: File-backed Storage Gadget, version: 28 November 2005
g_file_storage gadget: Number of LUNs=1
g_file_storage gadget-lun0: ro=0, file: /root/backing
# tail -f /var/log/messages
 pxa2xx_udc: version 4-May-2005
 g_file_storage gadget-lun0: open backing file: backing
 g_file_storage gadget: File-backed Storage Gadget, version: 28 November 
2005
 g_file_storage gadget: Number of LUNs=1
 g_file_storage gadget-lun0: ro=0, file: /root/backing
 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=0, buflen=16384
 g_file_storage gadget: I/O thread pid: 268
 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
 g_file_storage gadget: disconnect or port reset
 g_file_storage gadget-lun0: fdatasync -> 0
 g_file_storage gadget: disconnect or port reset
 g_file_storage gadget-lun0: fdatasync -> 0
 g_file_storage gadget: ep0-setup, length 8:
      0:  80 06 00 01 00 00 08 00
 g_file_storage gadget: get device descriptor
 g_file_storage gadget: ep0-in, length 8:
      0:  12 01 00 02 00 00 00 10
 g_file_storage gadget: disconnect or port reset
 g_file_storage gadget-lun0: fdatasync -> 0
g_file_storage gadget: full speed config #1
 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 04 00
 g_file_storage gadget: get configuration descriptor
 g_file_storage gadget: ep0-in, length 4:
      0:  09 02 20 00
 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 04 c0  01 09 04 00 00 02 08 06
     10:  50 05 07 05 81 02 40 00  00 07 05 02 02 40 00 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:  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  38 00 32 00 30 00 34 00
     10:  45 00 36 00 46 00 37 00  36 00
 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 00 00 00 00  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 00 00 00 00  00 00 00 00 00
 g_file_storage gadget: bulk-out, length 31:
      0:  55 53 42 43 01 00 00 00  10 00 00 00 80 00 0c 23
     10:  00 00 00 00 00 00 00 10  00 00 00 00 00 00 00
 g_file_storage gadget: SCSI command: READ FORMAT CAPACITIES;  Dc=10, 
Di=16;  Hc=12, Hi=16
 g_file_storage gadget: bulk-in, length 16:
      0:  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
 g_file_storage gadget: sending phase-error status
 g_file_storage gadget: bulk-in, length 13:
      0:  55 53 42 53 01 00 00 00  10 00 00 00 02
 g_file_storage gadget: bulk-out, length 31:
      0:  55 53 42 43 02 00 00 00  00 00 00 00 80 00 06 00
     10:  00 00 00 00 00 00 00 10  00 00 00 00 00 00 00
 g_file_storage gadget: SCSI command: TEST UNIT READY;  Dc=6, Dn=0;  
Hc=6, Hn=0
 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 02 00 00 00  00 00 00 00 01
 g_file_storage gadget: bulk-out, length 31:
      0:  55 53 42 43 03 00 00 00  12 00 00 00 80 00 05 03
     10:  00 00 00 12 00 00 00 10  00 00 00 00 00 00 00
 g_file_storage gadget: non-meaningful CBW: lun = 0, flags = 0x80, cmdlen 5


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to