Slashdot Mirror


Embedded Linux as Attached USB Storage Device?

dont_drink_the_water asks: "I am currently working on a few projects which will (hopefully) use Embedded Linux to deliver content (mp3 players, web servers, other possibilities). The question is, can Linux act as a USB attached hard drive, so that other machines can simply read/write data on the hard drive by using the USB port? Is anyone currently working on projects like this, and has any software been developed for this purpose?"

20 comments

  1. Linux act as a USB Hard Drive by Bodero · · Score: 2, Funny
    The question is, can Linux act as a USB attached hard drive

    Oh yeah. In fact, you won't believe it, but I've actually got Linux acting as a power supply right now. I couldn't get Linux to act as a SoundBlaster Audigy, however, but I'm still working on it.

    -Bodero

  2. The mine terrapin pruports to do this.... by pwagland · · Score: 3, Informative
    plus a whole lot more... check it out here.

    Note: While they say they are based on linux, they do not appear to of have released the sources anywhere that I can find. They do claim to be making a developers kit, but that is alos hard to find at the moment....

  3. What?! by Anonymous Coward · · Score: 0, Troll

    Me fail english? That's unpossible!

    This question doesn't really make sense as written, does it? No....didn't think so.

    1. Re:What?! by mini+me · · Score: 1

      This question doesn't really make sense as written, does it?

      Not really, but what I think he's trying to say is can a device use Linux as it's host operating system (think portable devices), but when you plug it into another machine via USB it becomes just another USB hard drive.

      And my reply is: Of course you can. As I understand it, Apple's iPod does something like this already. It can operate as a stand-alone unit to play MP3s. But when you plug it in via firewire it becomes a regular hard drive. I've also heard of USB connected MP3 players doing the same thing.

      I don't think however that you'd want to use Linux for this. I would think it'd be best to detect when the USB cable is connected and switch into USB hard drive mode. When it is disconnected then Linux can access the drive again. I see no reason for the operating system to intervene.

      Then again, maybe I'm not understanding the question either?

    2. Re:What?! by t · · Score: 1

      But then wouldn't that imply that the screen or whatever controls that exist would be dead?

  4. Hmm by itwerx · · Score: 3, Interesting

    Why? It would be much cheaper and simpler to simply design an I/O interface to do that (or use any of the generic designs published by most of the big chip houses. E.g. NEC, Motorola, Maxim, etc.)
    Unless you're talking a RAID chassis or something (which be insanely stupid to hang off USB), it isn't much more than serial/parallel conversion/buffering with some voltage matching and a little driver code.
    Using embedded Linux for this would be like converting a laptop into a trip-computer for your bicycle. Major overkill.

    1. Re:Hmm by mlc · · Score: 2
      Yes, if *all* you want to do is I/O, you're right.

      But if my understanding of the question is correct, the poster wants to create an MP3 player or something that might actually have a use for an OS anyway. Once we already have an OS, can we make it behave as a USB non-host device? That seems to be the question.

    2. Re:Hmm by itwerx · · Score: 1

      Understood, but the same answer applies. What the poster is requesting is extreme overkill unless there are far more complex functions which were not mentioned.
      I have worked on a few embedded systems projects myself and have found that, in general, the KISS principle is quite applicable. Especially when somebody else has already done the development legwork for you.
      Everything mentioned in the question is faster and cheaper in ASIC format with perhaps a PIC or two for display and key enterfacing.
      Not until one gets into a system whose future use is uncertain, or the quantity of inputs and outputs exceeds a given number (depending on the ASIC's used) does the flexibility of a true embedded system become worthwhile.
      E.g. a PDA, definitely! A microwave oven, on the other hand, only qualifies because a manufacturer will have many models and it is cheaper to have a single core which can be reprogrammed with different features.

      Just my $.02. :)

  5. Hey man you're right on track by redhotchil · · Score: 1, Funny

    I couldn't imagine a better idea than to run linux on my devices on a computer running linux. Infact, I have linux running on my sound processing unit which talks to my sound card, which also runs linux, which talks to my computer, which also runs linux. Infact, I dont have a single device that ISN'T based on some form of linux. Wow, the world is such a better place now that I run a seperate OS on everything.

    1. Re:Hey man you're right on track by ameoba · · Score: 2

      Of course, with some of the QC problems that've been popping up in the kernel lately, you may find that doing a firmware/driver upgrade causes your speakers to catch on fire or the platters of your HDD to fly across the room, giving your goldfish a buzz cut.

      --
      my sig's at the bottom of the page.
  6. USB slave mode support. by gillham · · Score: 4, Interesting
    The real question is whether Linux supports USB slave mode, rather than just host / master mode. Check this site for an example.

    Basically my understanding of this question is:
    "Can Linux act as a USB slave, and provide a slave or 'target' implementation of the USB Mass Storage Class?"

    In other words, can I build a fancy MP3 box with lots of storage that appears to be a USB hard drive to the host PC, but is really a Linux machine pretending to be "just" a USB hard disk?

    USB slave drivers and an Open Source implementation of the slave side of the USB Mass Storage Class would be cool.

    1. Re:USB slave mode support. by Tower · · Score: 1

      Well, you could create a cable (such as the current PC->PC cables) with a chip to moderate...

      PC Master1 ---- dual-sided endpoint ----- PC master2

      The chip in the middle presents itself as a attached mass storage device to PC Master1 after configuration from PC2... Then it could buffer requests and data, and provide a solution... shouldn't be too hard to do with a little firmware.

      100BTX or Gigabit ethernet would be kinda nice, and a lot faster, too... (and allow a little more platform independance).

      --
      "It's tough to be bilingual when you get hit in the head."
  7. device by dont_drink_the_water · · Score: 2, Informative

    The question is connectivity between different machines and devices...the terapin-mine was a great example. Thanks to those who even attempted to post something useful. The machine does more than just acting as a hard drive, of course, so yes, it will be necessary to have an operating system on it. The question still stands - how can a linux based machine act as a usb master and slave? Are there any existing projects?

  8. Portable Linux device with simple connectivity by osjedi · · Score: 1

    I can't believe all the short sighted hecklers posting sarcastic relpies to this! Are you morons?
    Whether you're talking about a portable mp3 player, a wearable computer, or whatever the embedded application, can't you see the usefullness of being able to plug it into any computer usb port and have instant access to the file system? Here's one scenario: You have this linux-based mp3 player. You take it to work in the morning and plug it into your office pc where winamp accesses your mp3's to play through your pc sound system while you work. At the end of the day you copy the project you have been working on to the mp3 player hard disk. On the way home you stop at a friend's house and let him hear one of the new mp3's you've got. He want's a copy so you plug the player into his pc and copy the file over to his hard drive. He doesn't have broadband so you also leave him the latest 'what's cool' ISO so he can burn a copy (Hey you've got a 5gig drive on this thing, why not cary some cool stuff around) Then you go home and plug the player into your own pc and download the project you brought home from work.

    If you are talking about some other embedded application it could still be very usefull. The nice thing about it would be that you can plug the thing into any pc and have instant access to the files.

    --
    -=-=-=-=- osjedi uses Debian GNU/Linux. -=-=-=-=-
    1. Re:Portable Linux device with simple connectivity by t · · Score: 1
      Thank god that someone here has a clue. I know how to really get the USB zealots going, firewire does this. You can connect two computers together using a firewire cable and get an instant network. heroinewarrior has some code to do this for firewire. It's not identical in functionality but something nonetheless. Macs may or may not be able to do this too.

      t.

  9. Would be nice feature for laptop too by Anonymous Coward · · Score: 0

    This would also be very usefull on a laptop. I would love to be able to plug a USB cable between my laptop and ANY desktop pr laptop pc for instant file access between the two. I can network all my own computers, but what if I want to share something with a friend or classmate? The "my laptop looks to your pc like a USB hard-drive" trick would be slick.

  10. not an open project but... by ripicheep · · Score: 1

    My Hipzip MP3 player from Iomega pretty much fits the bill. It runs on a proprietary os (dadio OS) which is based on eCos, [redhat.com] an embedded OS based on linux. It has updatable firmware and runs the OS on a maverick chip. It also has 40 MB removable media disks.

    While this is a far cry from the 5GB disk proposed somewhere above, the idea however is solid. A handheld device that runs a linux based embedded OS and can plug in as a drive under windows, macOS and probably linux (if I get USB support working).

    If you replaced the Iomega zip drive with a small hard drive, then it would be the device you are talking about.

    As is, the Hipzip allows me to store any file that fits into the 40MB limit.

    --
    "A witty saying proves nothing." -Voltaire
  11. CerfCube - Runs Linux and acts as a USB device by virtigex · · Score: 1

    The CerfCube is a ARM-based development board that can be used for designing USB devices. It runs Linux and has a number I/O capabilities.

  12. 1 solution by Anonymous Coward · · Score: 0

    http://www.softconnex.com/
    not free, hardware specific

  13. Firewire instead of USB easier? by hbackert · · Score: 1

    Some time ago, when I saw an ad about the SanCube I thought "That would be nice to have." and then "That should be possible to make!" especially since Firewire supports multiple masters and it's fast enough to make sense for a (albeit cheap) SAN.

    Having one SAN storage which can me expanded and then you can assign partitions to a certain host just is much more flexible than anything else a standard computer uses. LVM and netblock devices help though.

    Anyway, the point is, while USB has masters and slaves, Firewire does not distinguish between those, so every Firewire card can be host and slave, which makes it much easier from a hardware point of view to do, what the original poster wants to do.

    Now the software is a different thing. While USB is cheap and simple (the master controls and polls the slaves, the slaves just respond), Firewire is much more like SCSI: everyone can start to talk suddenly. Since I am not a device driver programmer, this is too much for me. But then, I am not the one who has to program the device drivers...