Hi, Thanks a lot for the detailed and insightful answer. That's exactly what I am looking for. I do have some comments/further questions inline though. Suli On Mon, Oct 8, 2012 at 4:02 PM, Peter Stuge <peter@xxxxxxxx> wrote: > 杨苏立 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) That is something I was worrying about. In this case, is there some hardware I can by to turn my desktop into an USB device or USB OTG device? Preferably this hardware should use my desktop's memory to back-up its storage. But I can settle for SSD/HDD disk too, because they are significantly faster than SD cards. > > >> 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. I assume another solution would be directly attach an SSD to the cellphone, in which case USB transmission/SATA-USB conversion is supposed to be the bottleneck, as I couldn't find any phone/tablets which support USB 3.0. Do you guys have any comments on the performance of such a solution? > > >> 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. If I understand it correctly, I could use the phone as a host using this cable? And its performance will suffer because it will have to transform every master command into a slave command? > > >> 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. The goal is to simulate cellphone storage. So I think 8/10GB to 32/64GB would be reasonable here. If that's possible, I can settle for less than 5GB too. And hopefully the solution would be software based/light weighted, as unfortunately I don't have too much hardware programming experience. > > 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. So if I understand it right, Beagle board is something which could operate as an USB device, and which I could also insert large DRAM cards? How hard is it to run a Linux on such a borad then? If I can easily run LInux, then this solution really seem appealing then. Do you have any recommendation on specific Beagle board? > > 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. As for this solution, how much development effort would you estimate? I could probably devote one week to setup such a thing, but if it will require more than two weeks' of work, then it probably doesn't worth it anyway. Thanks again! Suli > > > //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 -- Suli Yang Department of Physics University of Wisconsin Madison 4257 Chamberlin Hall Madison WI 53703 -- 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