17

I am looking for a way to have the Pi act as a USB client and masquerade as a flash drive.

I have seen lots of suggestions, however most of them are old (1+ years) by now and vague/incomplete - I would like to ask for a refresh as to what worked, what didn't, etc.

There are also numerous suggestions to use the Pi as a NAS type device instead. This will not work for my purposes, since I have a "dumb" host that can only accept flash drives (and I want to use the Pi to make it "smarter")

summary of suggestions that I have seen already:

  1. emulate a USB client via the GPIO pins
  2. emulate a serial connection via GPIO, then use existing cables to go from serial to USB
  3. using a model A, use software to convince the pi to act like a client
  4. using a host-to-host USB cable (not sure I have seen any that support linux..)

could anyone explain more in-depth some of those proposed solutions?

P.S. - I do not need nor expect high performance out of this configuration, USB 1.1 speeds would be sufficient .

edit: I would also be interested in any alternatives that could provide this functionality, however I have not yet seen any "smart" usb sticks or android-on-a-stick variants that can.

3
  • 1
    There are definitely cables that linux supports; this is part of the goal with the usbnet driver. They have a page mentioning some; it looks out of date so there may be more now. Before you buy anything check around.
    – goldilocks
    Dec 5, 2014 at 18:05
  • Some remarks specific to the model A about this here
    – goldilocks
    Dec 5, 2014 at 18:07
  • You might also find such projects like usbip : stackoverflow.com/a/19689740/544721 or linux-usb.org/gadget useful in assembling solution. Dec 16, 2015 at 19:35

2 Answers 2

7

You would be in luck if the USB ports on the PI were OTG and not USB Host.

Maybe you should consider some other device as none of the solutions you have been suggested may be practical:

emulate a USB client via the GPIO pins: In theory it is possible to emulate USB using bit-banging the pins. This may cause a pretty big software overhead in terms of software development. The solution will be relatively hard to implement. In theory is is possible but you need to do the cost/benefit analysis.

emulate a serial connection via GPIO, then use existing cables to go from serial to USB: This solution will not serve your purpose as you (rather your DUMB Host) would want a "Mass Storage Device" emulation (device type 0x08) and not a "Communications and CDC Control" (device type 0x02) device emulation.

using a model A, use software to convince the pi to act like a client: Unclear what you have been suggested

using a host-to-host USB cable (not sure I have seen any that support linux..): In this case both devices will see a Mass Storage device connected to their host controller. Using this method, your Raspberry pi will show up as a Mass storage device exporting your SD card based storage. With this solution you may want to consider what type of storage would you like to export to the DUMB host. Your DUMB host may not export itself as a Mass Storage device. At this point you will have other USB options other than Raspberry Pi.

4
  • What sorts of other devices would you recommend? (I am hoping for something with wifi and the ability to run dropbox or bittorent sync or something similar) Dec 5, 2014 at 3:43
  • Your needs regarding servicing the DUMB host are pretty unclear. More clarity is required. Dec 5, 2014 at 3:44
  • 2
    OK, today I have a flash drive in my car that plays mp3's - whenever I want to change the music on it, I have to physically move the flash drive - I would like to just have a device sync with something on my desktop, and present a USB interface for the car - also, the USB port on the model A Pi is an OTG chip (and on the model B, but the ethernet port disables that functionality) - source Dec 5, 2014 at 3:48
  • Let's move to chat (Bakery) so that we don't clutter the post with comments :-) Dec 5, 2014 at 3:52
3

There is now a Pi zero variant, which can do what I wanted, and Adafruit made a tutorial for it:

https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/overview

The official name for this seems to be "usb gadget system", and simply requires an OTG cable.

I haven't been able to test this, as Pi zero's are out of stock pretty much everywhere, but I do think that this is currently the best route

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.