2

Is there a product that can be plugged into a computer and appear as a USB flash drive, while in reality it is also say a Samba / FTP server? Along the lines of the Eye-Fi card (www.eye.fi), but wired and more configurable. It could also be a special data-transfer cable allowing one connect a complete separate networked computer. The targeted computer must only see a USB stick, no special drivers, no network configuration changes must be required on this computer.

Clarification_001: The targeted computer (or embedded device) must be able to write to this USB “stick”. However it would be ok if the data were visible on the network with some delay, say few minutes. This magic stick could copy between the flash & network in batch mode, every few minutes. BTW: My immediate need is to harvest logs from hard-to-network embedded device.

Clarification_002: Further research brought me to devices called "USB Bus/Protocol Analyzers".
like: http://www.ellisys.com/products/usbex200/index.php These would probably do the job. They are expensive ($800-$3000++). Internally, they must duplicate the USB data, I infer that the device I am looking for should cost under $500.

TIA, Radim

Radim Cernej
  • 443
  • 3
  • 12
  • That's an interesting concept. +1 – Matt Simmons Jun 19 '09 at 01:29
  • That's a new one to me. I doubt anything of the like exists. I think you've got an idea for a product. USB memory sticks are block devices and you're talking about connecting to exported filesystems (not block devices), so there's an impedence mismatch there. Your hypothetical device could make calls in / out of a large file that, if loopback mounted (to use the Linux terminology) has a filesystem inside it. Kind of a mind-bending idea for a device. Get somebody to develop it... I could see using it in digital picture frames. (BTW: The Eye-Fi doesn't work like you think it does.) – Evan Anderson Jun 19 '09 at 01:35
  • I like that you're trying to hack some device to do something it wasn't designed for-- turning some data logger into a networked data logger, or something of that ilk. You're going to need hardware hacking to get this done, but it would be an awesome product if you did get somebody to build one. – Evan Anderson Jun 19 '09 at 02:42
  • Just to clarify, you want what is written to the USB device to also be written to a share or FTP site? You do *not* want a USB device that is, itself, a Samba server or FTP server, correct? – Kevin Kuphal Jun 19 '09 at 03:08
  • @radim: Put me on a list to notify if you get this thing rolling as a product. I'd love to be a beta tester, etc. This thing sounds like a really fun idea. – Evan Anderson Jun 23 '09 at 15:00

2 Answers2

2

You got me interested in this one. I can't find you an "off the shelf" solution, but I've got a lead on hardware and a rough idea of an implementation. (The pricing might be outside what you're looking for, but you might be able to get a quantity deal if this is for a real production device.)

The PLX NET2280 USB controller chip supported target mode. It's been replaced with the NET2282, and you can find more about it here: http://www.plxtech.com/2282

The Linux "USB Gadget" API supports this controller. There's a "rapid development kit" available with the controller on a PCI card all ready to go.

Assuming that the device you're trying to talk to is using the FAT filesystem (lowest common denominator for embedded devices using USB storage, typically), you could implement a virtual FAT volume and access it with a loopback mount on a Linux machine when it's not in use by the USB host. Since FAT isn't a multi-writer filesystem, you're going to have to implement some kind of protocol to handle contention between the host and the target. I'd export a file as the FAT volume to the USB host, and watch for write access to the volume becoming quiescent for a period of time, at which point I'd swoop in and make changes.

There's a good chance your target is caching (or, at the very least, assuming that the state of the USB storage isn't going to change out from under it). A possible "out" for that is as follows: If the host you're plugging into doesn't have a problem with the target "disappearing" and "reappearing" you could "unplug" during a quiescent period as described above, then immediately "plug in" with a new empty filesystem all ready to go.

If this is meant for general purpose use with any USB host you'll always have compatibility problems with some devices who don't expect anything to be on the USB target other than dumb storage. (It'd be interesting to see how the Eye-Fi gets around this.) OTOH, if you're doing this for a single-purpose use you could probably get pretty intimate with the host device's code and figure out how best to interact with it.

What a fun idea. Not really a "Server Fault" thing, per se, but fun nonetheless! To get this going, I think you're going to need some hardcore USB hackers who are familiar with working in the embedded space.

Evan Anderson
  • 141,881
  • 20
  • 196
  • 331
  • Could Nokia N810 give me the hardware I need? It has a USB-slave-port, it runs linux. I am a software engineer (a physicist by education), I would definitely welcome off-the-shelf hardware. – Radim Cernej Jul 08 '09 at 20:29
  • I wondered, while I was posting that, about some of these PDA's and other devices have USB target capabilities. I can't really say anything re: the Nokia N810 in terms of personal experience since I've never even seen one, but the specs lead me to believe that it *looks* like it would do what you need. – Evan Anderson Jul 08 '09 at 21:07
1

Yes - this should be quite possible, as long as you have no requirement to see the same storage on the computer as you do on the network.

If you do want to see the same thing, such a configuration would require some sort of multimount filesystem. You're trying to export the same data both via a network filesystem protocol and block level.

You might be able to get away with it (more or less) if the storage device only allowed the computer to mount its storage read-only. It would work most of the time :)

MikeyB
  • 39,291
  • 10
  • 105
  • 189
  • 1
    I'd like to hear how you're going to plug into a host USB port to simulate being the "thumb drive" part of the equation using off the shelf hardware. Everything else you said basically makes sense, but I don't know of easily available interfaces to allow a PC to act as a USB device to be plugged into a USB host. It sure would be neat, though. (Personally, I'd implement that thing that some MacOS did where the whole machine could act like a firewire disk drive. That was fairly sweet-- ya' know-- for being from Apple.) – Evan Anderson Jun 19 '09 at 02:40
  • I figured the thumb drive requirement. What I'd like to know is how is this useful. Why not just plug in an external drive or a HDD enclosure. Are we short of such external storage and have lots of spare machines running? (we should probably move this conversation to serverfault at least). – nik Jun 19 '09 at 02:46
  • The poster's "need" is a hack. It's actually very similiar to the hack that the Eye-Fi does. – Evan Anderson Jun 19 '09 at 02:49
  • Is this the product of interest? http://www.ferret.com.au/c/Glyn-High-Tech-Distribution/Embedded-web-server-and-ethernet-gateway-with-USB-file-storage-development-kit-from-Glyn-n732874 – nik Jun 19 '09 at 02:50
  • @nik (myself), for some reason i thought i was answering on SO! sorry for that distracting last comment. – nik Jun 19 '09 at 02:52
  • @Evan: That would be pretty cool... I can see some nifty uses for a piece of hardware or driver that appeared as a USB target, but you would control what appeared from Linux. Kind of like ietd or the FC equivalent (i.e. whatever IBM uses in SVC) – MikeyB Jun 19 '09 at 16:10