杨苏立 Yang Su Li wrote: > In order to experiment something I need to pretend that my phone has a > super fast SD card (faster than what is available in the market). So I > want to simulate it through desktop ramdisk (which is basically disk > in memory). And here is basically my plan: > > 1. Get an USB-OTG enabled phone (say Samsung galaxy nexus) > > 2. Connect this phone to a desktop via USB. > > 3. Naturally this phone will have some kind of USB driver running. > > 4. In the desktop I run the File-backed Storage Gadget (FSG), which > make an USB host to be an USB slave, and presents a block device > interface to the host which is backed by a ramdisk. > > 5. In the phone, mount the FSG mass storage just as an ordinary disk. > > Does this plan seem feasible? You are correct in thinking that USB-OTG can be used to accomplish the plan, but unfortunately OTG must be on the non-phone device. The standard desktop USB hardware can not operate as a device, and this is what is neccessary for the phone to mount an emulated USB storage. The key problem is in point 4. The gadget drivers can not work on any USB host, they can only work on USB device controllers and on USB OTG host controllers, where the Linux driver for that device or OTG host controller has enabled gadget drivers to run, which in turn give the hardware a function. (such as storage) > And if this is indeed something possible, do I need to connect the > phone and the desktop through an USB OTG cable (like this: > http://www.amazon.com/T-Flash-Adapter-Samsung-GT-i9100-GT-N7000/dp/B005FUNYSA If the USB OTG host has a Micro-AB connector then yes, this cable is needed to allow a USB device to connect to the OTG host. > and an USB host to host cable (like this: > http://www.amazon.com/Plugable-USB-Easy-Transfer-Cable/dp/B005OTPVMY Note that this cable is a "double device" cable, where each end simulates a storage device, allowing file transfer between two computers. The performance of this cable is probably not amazing. > Or is an ordinary USB to microUSB cable which we usually use to > connect desktop and cellphone suffice? This is guaranteed not to work, because with such a cable the cellphone is unable to operate in host mode. Because of how the cable and connectors are made and connected, with such a cable the phone can only act as a USB device. An important tip is that the connector on the cable determines the communications role (host vs. device). As for how you can solve the problem of creating a very fast USB storage device, which you will then connect to your cellphone - I am not sure what to recommend. Depending on how much storage you will need (megabytes? gigabytes? terabytes?) I would recommend different solutions, because more storage you need, the more complicated the solution will be unfortunately. In theory you can maybe use a Beagle hardware (BeagleBoard-xM, BeagleBone, etc.) to create a RAM-based USB storage device. BUT! I do not know if the USB hardware in the TI OMAP chip will approach maximum theoretical USB throughput in this configuration. It would however be a way to test your idea with low hardware cost. For maximum performance I suggest to design special purpose hardware using a high speed device controller in a chip with a powerful DMA engine and perhaps even built-in SDRAM controller. Otherwise put a memory controller in an FPGA between the DMA engine and the SDRAM. Significantly more work, but will have great performance. //Peter -- 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