tags:

views:

87

answers:

3

I am in the early stages of development of a device requiring USB connectivity. As a minimum the device must appear as a legacy serial port, but it would be useful if it could simultaneously appear as a mass-storage device.

Is this possible, or will the device need to switch between mass-storage and communications-device so that it is only one thing at a time?

[edit]I was probably a bit quick in firing off a question; this suggests that it can indeed be done, using the USB Composite Device Framework. I'd still be interested if anyone has any experience of this and might have some tips or pointers, what platform was used, and what if any third-party tools or stacks they may have used.

+5  A: 

Yes, you can make the same device appear as two (or more) logical devices.

I did this for a project a couple of years ago, but it's been a while now and I've forgotten the details. I think I had mass storage, video capture, and serial port all running simultaneously.

Yes, Composite device sounds familiar. The project I worked on didn't use any third party OS or USB libraries; it was all "bare metal" code for the Freescale i.MX21 CPU. Jan Axelson's USB Complete was invaluable, as was the Packet-Master USB analyser.

Greg Hewgill
Thanks. It seems "USB Composite Device Framework" is what I need, if that triggers your memory? I've edited the question, and am now canvassing experience rather than a yes/no answer.
Clifford
A: 

Yes, this is possible. E.g. I have a Huawei E220 USB stick for UMTS (3G mobile) connectivity which has four interfaces: Two are vendor specific (kernel driver eventually maps them as /dev/ttyUSB{0,1}) and two are mass storage.

I know you can use the two /dev/ttyUSB{0,1} simultanously.

ndim
A: 

You don't have to do anything complicated here, it's just a matter of getting the descriptors right.

Just provide an interface descriptor for each 'function' you want (obviously you'll need all the other descriptors which go with that 'function'), and the OS will sort out all the composite device stuff.

I would suggest if you're going to do any even slightly serious USB development that you get a USB analyser - not only can you analyse your own stuff, but you can also plug in other people's kit and see how they did their descriptors...

Will Dean