From: hectorhg on
Hi there,

I'm trying to programme a USB to behave like a mass storage device and a
network unit (rndis) as the same time (only one usb port), i mean, when i
plug it to a windows PC i would like to see two new devices plugged. The
only way i've found is to show the usb like a hub with virtual units
connected to it, all handled by software. Does anyone knows another way?

Thank you!!


From: John Speth on
> I'm trying to programme a USB to behave like a mass storage device and a
> network unit (rndis) as the same time (only one usb port), i mean, when i
> plug it to a windows PC i would like to see two new devices plugged. The
> only way i've found is to show the usb like a hub with virtual units
> connected to it, all handled by software. Does anyone knows another way?

Isn't it simply a matter of enumerating with two configurations, each of
which enumerates to the two devices you described?

JJS


From: Arlet Ottens on
John Speth wrote:

>> I'm trying to programme a USB to behave like a mass storage device and a
>> network unit (rndis) as the same time (only one usb port), i mean, when i
>> plug it to a windows PC i would like to see two new devices plugged. The
>> only way i've found is to show the usb like a hub with virtual units
>> connected to it, all handled by software. Does anyone knows another way?
>
> Isn't it simply a matter of enumerating with two configurations, each of
> which enumerates to the two devices you described?

It is possible to have multiple configurations, but the host selects
only one of them to be active at any given time.

According to USB spec 2.0, section 5.2.3:

"Multiple functions may be packaged together in what appears to be a
single physical device. For example, a keyboard and a trackball might be
combined in a single package. Inside the package, the individual
functions are permanently attached to a hub and it is the internal hub
that is connected to the USB. When multiple functions are combined with
a hub in a single package, they are referred to as a compound device."


From: Andrew Jackson on
> I'm trying to programme a USB to behave like a mass storage device and a
> network unit (rndis) as the same time (only one usb port), i mean, when i
> plug it to a windows PC i would like to see two new devices plugged. The
> only way i've found is to show the usb like a hub with virtual units
> connected to it, all handled by software. Does anyone knows another way?

You need to present your USB device as a composite device, that is your
(USB) configuration exposes the mass storage and RNDIS interface
descriptors. So:

Configuration
/ | \
| | |
I/F MSC I/F CDC Control I/C CDC Data

A hub with a device (permanently) attached to one of its ports is a
compound device.

Andrew
From: hectorhg on
I think a cannot use two configurations, because in order to use rndis a
have to select a device descriptor, and for masss storage another one,
that's why i thought it wasn´t possible. How do i present my device as a
composite device? i couldn't find any device descriptor for that although i
have read something about them ( maybe i have skipped it by error....).

Thanks to all of you!!!!


>> I'm trying to programme a USB to behave like a mass storage device
and a
>> network unit (rndis) as the same time (only one usb port), i mean, when
i
>> plug it to a windows PC i would like to see two new devices plugged.
The
>> only way i've found is to show the usb like a hub with virtual units
>> connected to it, all handled by software. Does anyone knows another
way?
>
>You need to present your USB device as a composite device, that is your
>(USB) configuration exposes the mass storage and RNDIS interface
>descriptors. So:
>
> Configuration
> / | \
> | | |
> I/F MSC I/F CDC Control I/C CDC Data
>
>A hub with a device (permanently) attached to one of its ports is a
>compound device.
>
> Andrew
>