g_mass_storage emulation of flash drive - difficulties with passing vendor/product ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Apologies for my first post here being a request for help, but after
extensive searching online I've not yet been able to find and answer
and am hopeful the expertise here may be able to help!

I have a Raspberry Pi Zero W that I'm using in OTG/gadget mode. I've
activated dwc2 USB, partitioned and formatted the file that is to be
used as filesystem and loaded g_mass_storage.

It is working fine in Windows - I can connect and see the contents,
add/delete files, eject and reconnect seeing changes fine. I can mount
it in Raspbian to check contents and can also attach it to other
devices and interact with it fine.

However, I've got some devices that are very picky about what USB
devices they will connect to (solely flash drives). The problem is the
OTG mass storage gadget is being identified as "File-Stor Gadget (Rev:
0404)" for device type, which is causing it to be rejected.

I can successfully use a USB flash drive in the target devices and
have scraped the vendor/product ID, etc from this flash drive to see
if I can mimic them via g_mass_storage.

I have adjusted modprobe to the following:

$ sudo modprobe g_mass_storage file=/home/pi/piusb.bin stall=0
removable=1 idVendor=0x0781 idProduct=0x5572 bcdDevice=0x011a
iManufacturer="SanDisk" iProduct="Cruzer Switch"
iSerialNumber="123456789012"

Unfortunately this doesn't seem to have made any difference and it is
still rejected by the target devices.

As far as I can tell the above parameters are getting passed through correctly
$ ls /sys/module/g_mass_storage/parameters/*
/sys/module/g_mass_storage/parameters/bcdDevice
/sys/module/g_mass_storage/parameters/cdrom
/sys/module/g_mass_storage/parameters/file
/sys/module/g_mass_storage/parameters/idProduct
/sys/module/g_mass_storage/parameters/idVendor
/sys/module/g_mass_storage/parameters/iManufacturer
/sys/module/g_mass_storage/parameters/iProduct
/sys/module/g_mass_storage/parameters/iSerialNumber
/sys/module/g_mass_storage/parameters/luns
/sys/module/g_mass_storage/parameters/nofua
/sys/module/g_mass_storage/parameters/removable
/sys/module/g_mass_storage/parameters/ro
/sys/module/g_mass_storage/parameters/stall

$ cat /sys/module/g_mass_storage/parameters/*
282
/home/pi/piusb.bin
21874
1921
SanDisk
Cruzer_Switch
123456789012
0
Y
N

However when connecting to Windows, here's what the USB mass storage
displays - it appears that the iSerialNumber is making it through, but
nothing else is being altered.  My router shows similar issues,
identifying it as "File-Stor Gadget (Rev: 0404)"

USBSTOR\DISK&VEN_LINUX&PROD_FILE-STOR_GADGET&REV_0404\123456789012&0
USBSTOR\DiskLinux___File-Stor_Gadget0404
USBSTOR\DiskLinux___File-Stor_Gadget
USBSTOR\DiskLinux___
USBSTOR\Linux___File-Stor_Gadget0
Linux___File-Stor_Gadget0
USBSTOR\GenDisk
GenDisk

By comparison, here's what SanDisk shows:

USBSTOR\DISK&VEN_SANDISK&PROD_CRUZER_SWITCH&REV_1.26\4C532015741508522393&0
USBSTOR\DiskSanDisk_Cruzer_Switch___1.26
USBSTOR\DiskSanDisk_Cruzer_Switch___
USBSTOR\DiskSanDisk_
USBSTOR\SanDisk_Cruzer_Switch___1
SanDisk_Cruzer_Switch___1
USBSTOR\GenDisk
GenDisk

Any thoughts/suggestions as to how I can get the g_mass_storage module
to replicate the above SanDisk information & thus work with these more
picky devices?

Thanks in advance

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux