Hi, On 12/25/2019 11:02 PM, youling 257 wrote: > This patch caused g_mass_storage not working. > > with this patch, device modprobe g_mass_storage file=/dev/block/mmcblk2p3, > [ 255.255238] udc dwc3.3.auto: registering UDC driver [g_mass_storage] > [ 255.255266] Mass Storage Function, version: 2009/09/11 > [ 255.255362] LUN: removable file: (no medium) > [ 255.255533] lun0: open backing file: /dev/block/mmcblk2p3 > [ 255.255539] LUN: file: /dev/block/mmcblk2p3 > [ 255.255587] Number of LUNs=1 > [ 255.255675] g_mass_storage gadget: adding config #1 'Linux > File-Backed Storage'/0000000034b331d2 > [ 255.255681] g_mass_storage gadget: adding 'Mass Storage > Function'/000000009839a369 to config 'Linux File-Backed > Storage'/0000000034b331d2 > [ 255.256338] g_mass_storage gadget: I/O thread pid: 6312 > [ 255.256396] g_mass_storage gadget: cfg 1/0000000034b331d2 speeds: > super high full > [ 255.256401] g_mass_storage gadget: interface 0 = Mass Storage > Function/000000009839a369 > [ 255.256411] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11 > [ 255.256464] g_mass_storage gadget: userspace failed to provide iSerialNumber > [ 255.256548] g_mass_storage gadget: g_mass_storage ready > [ 255.313503] init: Starting service 'wpa_supplicant'... > [ 255.355209] g_mass_storage gadget: suspend > [ 255.384831] init: Service 'wpa_supplicant' (pid 6314) exited with status 255 > [ 255.384891] init: Service 'wpa_supplicant' (pid 6314) killing any > children in process group > [ 255.662885] g_mass_storage gadget: high-speed config #1: Linux > File-Backed Storage > [ 255.663081] g_mass_storage gadget: set_config: interface 0 (Mass > Storage Function) requested delayed status > [ 255.663089] g_mass_storage gadget: delayed_status count 1 > [ 255.663732] g_mass_storage gadget: usb_composite_setup_continue > [ 255.663743] g_mass_storage gadget: usb_composite_setup_continue: > Completing delayed status > [ 256.681607] g_mass_storage gadget: non-core control reqa1.fe v0000 i0000 l1 > [ 256.681613] g_mass_storage gadget: get max LUN > > host not detect sda, > [49728.458139] usb 1-2.3: new high-speed USB device number 21 using xhci_hcd > [49728.544776] usb-storage 1-2.3:1.0: USB Mass Storage device detected > > [49728.545875] > usb-storage 1-2.3:1.0: Quirks match for vid 0525 pid a4a5: 10000 > [49728.546062] scsi host0: usb-storage 1-2.3:1.0 > > > revert this patch, device modprobe g_mass_storage file=/dev/block/mmcblk2p3 > [ 405.766178] udc dwc3.3.auto: registering UDC driver [g_mass_storage] > [ 405.766225] Mass Storage Function, version: 2009/09/11 > [ 405.766307] LUN: removable file: (no medium) > [ 405.766532] lun0: open backing file: /dev/block/mmcblk2p3 > [ 405.766539] LUN: file: /dev/block/mmcblk2p3 > [ 405.766665] Number of LUNs=1 > [ 405.766736] g_mass_storage gadget: adding config #1 'Linux > File-Backed Storage'/0000000034b331d2 > [ 405.766747] g_mass_storage gadget: adding 'Mass Storage > Function'/00000000cbbcccdc to config 'Linux File-Backed > Storage'/0000000034b331d2 > [ 405.767498] g_mass_storage gadget: I/O thread pid: 6873 > [ 405.767509] g_mass_storage gadget: cfg 1/0000000034b331d2 speeds: > super high full > [ 405.767512] g_mass_storage gadget: interface 0 = Mass Storage > Function/00000000cbbcccdc > [ 405.767519] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11 > [ 405.767587] g_mass_storage gadget: userspace failed to provide iSerialNumber > [ 405.767622] g_mass_storage gadget: g_mass_storage ready > [ 405.866215] g_mass_storage gadget: suspend > [ 406.175951] g_mass_storage gadget: high-speed config #1: Linux > File-Backed Storage > [ 406.176130] g_mass_storage gadget: set_config: interface 0 (Mass > Storage Function) requested delayed status > [ 406.176138] g_mass_storage gadget: delayed_status count 1 > [ 406.176186] g_mass_storage gadget: usb_composite_setup_continue > [ 406.176211] g_mass_storage gadget: usb_composite_setup_continue: > Completing delayed status > [ 407.202507] g_mass_storage gadget: non-core control reqa1.fe v0000 i0000 l1 > [ 407.202512] g_mass_storage gadget: get max LUN > [ 407.203164] SCSI CDB: 12 00 00 00 24 00 > [ 407.203177] g_mass_storage gadget: SCSI command: INQUIRY; Dc=6, > Di=36; Hc=6, Hi=36 > [ 407.205991] SCSI CDB: 00 00 00 00 00 00 > [ 407.206005] g_mass_storage gadget: SCSI command: TEST UNIT READY; > Dc=6, Dn=0; Hc=6, Hn=0 > [ 407.206008] g_mass_storage gadget: sending command-failure status > [ 407.206012] g_mass_storage gadget: sense data: SK x06, ASC x29, > ASCQ x00; info x0 > [ 407.206279] SCSI CDB: 03 00 00 00 12 00 > [ 407.206287] g_mass_storage gadget: SCSI command: REQUEST SENSE; > Dc=6, Di=18; Hc=6, Hi=18 > [ 407.207342] SCSI CDB: 00 00 00 00 00 00 > [ 407.207354] g_mass_storage gadget: SCSI command: TEST UNIT READY; > Dc=6, Dn=0; Hc=6, Hn=0 > [ 407.207633] SCSI CDB: 25 00 00 00 00 00 00 00 00 00 > [ 407.207641] g_mass_storage gadget: SCSI command: READ CAPACITY; > Dc=10, Di=8; Hc=10, Hi=8 > [ 407.208755] SCSI CDB: 1a 00 3f 00 c0 00 > [ 407.208766] g_mass_storage gadget: SCSI command: MODE SENSE(6); > Dc=6, Di=192; Hc=6, Hi=192 > [ 407.208779] g_mass_storage gadget: bulk-in set halt > [ 407.208782] g_mass_storage gadget: delayed bulk-in endpoint halt > [ 407.320644] SCSI CDB: 1a 00 3f 00 c0 00 > [ 407.320662] g_mass_storage gadget: SCSI command: MODE SENSE(6); > Dc=6, Di=192; Hc=6, Hi=192 > [ 407.320674] g_mass_storage gadget: bulk-in set halt > [ 407.320676] g_mass_storage gadget: delayed bulk-in endpoint halt > [ 407.440335] SCSI CDB: 00 00 00 00 00 00 > > host can detect sda, > [49878.915966] usb 1-2.3: new high-speed USB device number 23 using xhci_hcd > [49878.999260] usb-storage 1-2.3:1.0: USB Mass Storage device detected > > [49879.001165] > usb-storage 1-2.3:1.0: Quirks match for vid 0525 pid a4a5: 10000 > [49879.001676] scsi host0: usb-storage 1-2.3:1.0 > > [49880.026002] scsi > 0:0:0:0: Direct-Access Linux File-Stor Gadget 0503 PQ: 0 ANSI: > 2 > [49880.027243] scsi 0:0:0:0: Attached scsi generic sg0 type 0 > > [49880.028852] sd > 0:0:0:0: Power-on or device reset occurred > [49880.030081] sd 0:0:0:0: [sda] 10485760 512-byte logical blocks: > (5.37 GB/5.00 GiB) > [49880.142046] sd > 0:0:0:0: [sda] Write Protect is off > [49880.142186] sd 0:0:0:0: [sda] Mode Sense: 0f 00 00 00 > > [49880.253720] sd > 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't > support DPO or FUA > [49880.500337] audit: type=1400 audit(1577294060.839:15853): avc: > denied { noatsecure } for pid=9278 comm="sh" scontext=u:r:vold:s0 > tcontext=u:r:sgdisk:s0 tclass=process permissive=1 [49880.596496] > sd 0:0:0:0: [sda] Attached SCSI disk > We need https://patchwork.kernel.org/patch/11292087/ fix for usb: dwc3: gadget: simplify IOC handling patch to make g_mass_storage to work. Thanks & Regards, Tejas Joglekar