Serve files over USB

9,138

Solution 1

From the information you've given, I surmise that:

  1. You have a black box device which you can communicate with only by plugging a USB mass storage device into it.
  2. Physically plugging and unplugging a USB drive is not acceptable, you won't have physical access after deployment.

If any of these assumptions is false, you'll have an easier time.

What you're looking for is a way to make a computer appear as a USB storage device. In principle, this shouldn't require much electronics — I think the right gadget could be mass produced for no more than a couple USD plus shipping. But I can't find a reference to the right gadget existing.

Merely using a USB computer-to-computer cable won't do the trick: these simulate an Ethernet network, and the black box doesn't speak Ethernet. And USB-storage-to-LAN converters won't help, they go the wrong way round.

  1. You could design a robot arm that unplugs a USB stick from the black box and plugs it into a computer. Now that the obvious but impractical suggestion has been made...

  2. You could have the gadget designed, and write a driver for it. But this might be out of your price range, especially if you don't need millions of units.

  3. There may be a sophisticated NAS device that can talk to several computers over iSCSI and USB (those last two words are the difficult part).

  4. Some mobile phones and PDAs can act as a USB storage device, and additionally have a GSM, wifi or Ethernet connection. But they often act as storage devices only when switched off, so I don't know if there is one that could be used as a bridge or server.

  5. Here's a discussion about a somewhat similar requirement. The only possible solution it suggests is this USB-storage-to-wifi bridge, which looks like it would be suitable — but it's expensive.

  6. There are USB switches (a.k.a. sharing hubs) that allow you to share a USB device between two computers. You could use one to share a storage device between the black box and a computer. The problem is that they usually require the user to press a button to switch between the two devices — but if you find one where the switch can be controlled remotely, you have a solution.

Solution 2

I think this can be accomplished with a host-to-host USB cable and the Linux usbnet driver. Hardware compatibility and details on how to set this up in Linux are given at: http://www.linux-usb.org/usbnet/

Share:
9,138

Related videos on Youtube

Sam Bisbee
Author by

Sam Bisbee

Updated on September 17, 2022

Comments

  • Sam Bisbee
    Sam Bisbee over 1 year

    I would like to be able to serve a section of my box's file system over USB to another computer. For example, if the files are on box A and I am reading from box B, then B would mount A, see those files, and mount them as a file system device (ie., like a thumb drive).

    Ideally the solution would work for any Linux distro, but I will most likely be running this on Debian variants.

    Please let me know if you need any more info. Cheers.

    • Admin
      Admin over 13 years
      You can't just connect two computers with a USB cable — the USB electrical protocol is not symmetric and requires a computer at one end and a peripheral device at the other end (that's why the plugs aren't the same). Do you already have a specific hardware gadget you want to use? Otherwise Ethernet (or Firewire) would be better adapted, to create a network between the two computers.
    • Admin
      Admin over 13 years
      @Gilles - Thanks for the reply. From your answer, I guess my question is really how to make my computer look and/or act like a peripheral device over its USB connection/hub. What separates a peripheral device and a host machine? Cheers.
  • Sam Bisbee
    Sam Bisbee over 13 years
    Those protocols won't work, because the reader machine isn't networking enabled. The only I/O point that I have to it is USB, which it watches and reads files off of. In the final, non-test environment I won't be able to control the reader machine (I don't even know its software), but it will take my files. Thanks!
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 13 years
    That's Ethernet over USB, which is fine if the device supports it... but I get the impression it doesn't.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 13 years
    If the hardware issue is solved, there's probably a way to put an access lock so that only one side can write at a time and that read accesses get a consistent view. Some solutions will only allow one computer to access the storage anyway. So yes, this is a concern, but not an overwhelming one.
  • Sam Bisbee
    Sam Bisbee over 13 years
    Thank you for your very thoughtful response Gilles. You are correct in your assumptions. The PDA/mobile bridge is a very cool idea that I will have to put some more thought into. The other ideas, which seem to be mostly LAN or robot focused, are out of the question because there is no LAN in the environment. I am going to try putting together some POCs and will report back in a day or two. Thanks again!
  • Sam Bisbee
    Sam Bisbee over 13 years
    @Gilles - You are correct, I do not think the black box speaks Ethernet. That being said, the black box might still pick up and work some magic if it simply detects that there's a USB connection (via the A-to-A cable). Will be finding out in a day or two. Cheers.
  • heyman
    heyman over 13 years
    Well, I guess that at least the devices listed on the driver page should support it...
  • wegrata
    wegrata over 13 years
    It's going to be awfully tough to do this without mounting and unmounting the filesystem on Box A while accessing it on Box B (and vice-versa). Most normal (non-cluster aware) filesystems have every right to assume that the on disk bits they have mounted do not change underneath them. A bunch of in-memory structures will be out of sync. You either need to mount/unmount when switching between A and B, or get the cooperation of (i.e. write a new filesystem) the filesystem driver on Boxes A and B.