Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

USB Communication Device Class(CDC)

144 views
Skip to first unread message

HimaNshu

unread,
Aug 23, 2006, 1:46:31 AM8/23/06
to
Hello Everybody,
I have device which can communicate wth with USB Communication device
class only,
I check on MSDN RNDIS driver has support of CDC so I have include it
with my OS image and connection is working fine. but I dont know how to
communicate from application layer, I want to send some row string data
to my connected USB device.

Can anybody give me the idea about communicating with RNDIS layer over
Communication device class.

Thanks
HimaNshu

Henrik Viklund

unread,
Aug 23, 2006, 2:53:13 AM8/23/06
to
RNDIS conform to CDC spec (sort of) and as you probably know it's
basically a ethernet over usb connection. From a user's point of view
it's just another network connection (one pops up on the device side,
and one on the PC side). You communicate through it just like you would
with any other netowork adapter using TCP/IP and sockets, UDP or
whatever favourite protocol you have.

Henrik Viklund
http://www.addlogic.se

HimaNshu

unread,
Aug 23, 2006, 4:29:11 AM8/23/06
to
Thanks Henrik,
I am new with WinCE platform builder would you help me some more,
I have confusion about TCPIP communication means my Host PC driver has
serial interface over CDC spec on USB port, when I connnect my device
to Host PC, host pc driver adds one serial port to my Host PC and it
can send receive data on that port,
if my device can work only on TCPIP then HOST PC also should comunicate
on TCP not by serial port is it so?

and if data sending and recieving procedure will take care by driver
then is it posible that I can send the data by TCP and the either PC
with get that data on serial port, it seems funy but I want to know is
it possible?

I find out some settings for communication on TCPIP for socket
programming I need IP address and port address is it so.

and if serial interface is not possible then should I have to modify
Serial_Class driver which is used by activeSync as per CDC spec?

here is some registry settings
[HKEY_LOCAL_MACHINE\Comm\RNDISMINI1\Parms\TcpIp]
"EnableDHCP"=dword:1
"DefaultGateway"=""
"UseZeroBroadcast"=dword:0
"IpAddress"="0.0.0.0"
"Subnetmask"="0.0.0.0"

Henrik Viklund

unread,
Aug 23, 2006, 5:08:21 AM8/23/06
to
OK, so now I'm confused. What exactly do you want to achive (big
picture)?

ActiveSync uses a serial class, in other words it uses a usb class that
mimics a serial connection but the transport medium is USB. RNDIS on
the other hand, mimics a network connection but the transport medium is
still USB. You can only have _one_ USB function class active at a time
in your device, in other words you can _not_ use ActiveSync (serial)
and RNDIS (ethernet emulation) at the same time. Now, ActiveSync and
its USB serial class has precedence over the RNDIS class, so the RNDIS
function will not be loaded on your ActiveSync enabled device.

HimaNshu

unread,
Aug 23, 2006, 5:24:16 AM8/23/06
to
Yes, I feel so my reply seems confusing,
let me make clear,
My Host PC has CDC support USB driver which uses usbser.sys dirver and
create COM3: when I connect my device and Host PC communicate on COM3:
only.

Now if I want to communicate with Host PC I need CDC support which is
only in RNDIS driver, but that RNDIS driver works for ethernet
emulation only. and I have to communicate by TCP only from device side
and at Host end it is serial interface.
so my RNDIS driver can work on serial interface like Serial Class? is
possible if not then I have one option only I have to modify serial
class driver for CDC is it?

Thnaks,
HimaNshu

Henrik Viklund

unread,
Aug 23, 2006, 7:00:06 AM8/23/06
to
Still not sure what you're asking here. If you use serial usb class,
both device and host side _must_ use serial class drivers (the
connection will show up as one extra serial port on the device and
host). If you want to use RNDIS both device and host _must_ use RNDIS
class drivers (the connection will show up as one network connection on
the device and host).

Henrik Viklund

unread,
Aug 23, 2006, 7:17:48 AM8/23/06
to
Some additions (hope they don't confuse you too much):
The serial function used by ActiveSync is not meant to be used stand
alone, so while it is possible to set the device up to communicate over
the raw serial connection, it is not advisalbe (licensing issues may
also come into play).

To confuse you a bit more ActiveSync is actually setting up a ppp
connection between the host and the device, so you're actually able to
open a TCP connection to the device that is tunneled via ppp through
the serial transport. There's an (old) article about how to do this
here:
http://www.kbalertz.com/kb_183988.aspx

David Liao (MS)

unread,
Aug 23, 2006, 3:48:54 PM8/23/06
to
Let me try to answer your question.
The CDC is big specification. The USBSer.Sys implements part of them. The
RNDIS does the same. However, the RNDIS and USBSER expose different up level
interface (one is serial another is NDIS-Miniport). Just like RNDIS driver
cannot handle USBSer device, USBSer.sys can not handle RNDIS device either.
So, you have to use USBSer.sys driver to handle USBSer device and RNDIS XP
Host driver to handle the RNDIS device.

Windows CE 5.0 does support both of them, you need configuration device
differently in order to expose this device either RNDIS or USBSer function.

David Liao.

"HimaNshu" <gajjar....@gmail.com> wrote in message
news:1156325056....@m73g2000cwd.googlegroups.com...

HimaNshu

unread,
Aug 23, 2006, 9:10:51 PM8/23/06
to
Hi Henrik,
Its sounds great about activesync. It adds to my knowladge.
But let me clear I want to use RNDIS driver with serial interface at
device end because my existing product on host PC is working with
serial interface with XP USBser.sys which expose one vertual COM port
on host PC and it is suports device which have only CDC USB driver.

so I want expose serial interface at device end not TCP.
As David Liao has told RNDIS expose NDIS-miniport and as well as serial
also.

HimaNshu

unread,
Aug 23, 2006, 9:16:15 PM8/23/06
to
Henrik make me much more clear about RNDIS driver,
but David you are on the track which I want.
David would make some more focuse on USBser.sys with Serial interface
and also at device end RNDIS with serial interaface.

How can I configure RNDIS driver with serial interaface in WinCE.
is there any registry settings or I have to made some change at coding
end.

Henrik Viklund

unread,
Aug 24, 2006, 4:12:56 AM8/24/06
to
I don't know how to be any clearer on this, but what David and I are
trying to convey here is that alltohugh both RNDIS and USB Serial can
be said to fulfill the CDC spec, they are fundamentally different in
their architecture and are incompatible in every single part of their
implementation. If you want to use USB serial on the host side, you
*MUST* use USB serial function on the device side and vice versa.

If you've designed the PC side program to communicate over a USB serial
connection you can NOT use RNDIS on the device!

HimaNshu

unread,
Aug 24, 2006, 4:58:10 AM8/24/06
to
Oh sorry Henrik and David it was my mistek in understanding,
It means Serial_Class can work with CDC spec its great for me,
but previously I have tried with serial class only by changing VID nad
PID in registry but I have check the descritor in usbfndrv.cpp

static USB_DEVICE_DESCRIPTOR g_HighSpeedDeviceDesc = {
sizeof(USB_DEVICE_DESCRIPTOR), // bLength
USB_DEVICE_DESCRIPTOR_TYPE, // bDescriptorType
USB_VERSION, // bcdUSB
0x00, // bDeviceClass
0x00, // bDeviceSubClass
0x00, // bDeviceProtocol
EP0_PACKET_SIZE, // bMaxPacketSize0
0, // idVendor
0, // idProduct
0x0000, // bcdDevice
0x01, // iManufacturer
0x02, // iProduct
0x00, // iSerialNumber
0x01 // bNumConfigurations
};


static USB_DEVICE_DESCRIPTOR g_FullSpeedDeviceDesc = {
sizeof(USB_DEVICE_DESCRIPTOR), // bLength
USB_DEVICE_DESCRIPTOR_TYPE, // bDescriptorType
USB_VERSION, // bcdUSB
0x00, // bDeviceClass
0x00, // bDeviceSubClass
0x00, // bDeviceProtocol
EP0_PACKET_SIZE, // bMaxPacketSize0
0, // idVendor
0, // idProduct
0x0000, // bcdDevice
0x01, // iManufacturer
0x02, // iProduct
0x00, // iSerialNumber
0x01 // bNumConfigurations
};

bDeviceClass perameter is 0x00 but for CDC it should be 0x02 so I was
confuse there and tried for RNDIS because it has 0x02(CDC code) and it
connect to my host successfully.

now if serial class has CDC support then I have tried by changing that
bDeviceClass to 0x02 in usbfndrv.cpp but it is still not connecting
properly, even I check with USB device viewer on my host it shows me
bDeviceClass is 0x02 and also my productID and vendor ID correctly.

so would you please sugest me what chnages I should do which can make
work with my host pc connection with vertual com port.

HimaNshu

unread,
Aug 24, 2006, 5:53:25 AM8/24/06
to
To make more clear my problem I got error
"Device can not start with error code 10."
when I connect my device with serial class driver

would it be any problem at Host end?

HimaNshu

Henrik Viklund

unread,
Aug 24, 2006, 10:00:21 AM8/24/06
to
David, I was under the impression that CE 5 do not fully support the
host side USB modem function driver (usbser.sys), whereas the Windows
Mobile 5 kit comes with an improved/fuller version that do?

Henrik Viklund
http://www.addlogic.se

HimaNshu

unread,
Aug 24, 2006, 8:41:12 PM8/24/06
to
Thanks Henrik would you give me some link by which I come to know
serial class has CDC support,
or any idea to modify serial class as per CDC spec.
David would you give me more detail for serial class with CDC support?

Thnaks in advance.
HimaNshu

David Liao (MS)

unread,
Aug 25, 2006, 3:30:00 PM8/25/06
to
I am under the impression to use Destop's (XP)USBSer.sys driver. I believe
Microsoft do have support Function(Device) side USB Modem driver on WM5.0
which will cause XP to load USBSer.Sys. For CE 5.0, I believe it only
supports Function(Device) ActiveSync Function Driver.

"Henrik Viklund" <henrik....@gmail.com> wrote in message
news:1156428021.2...@m79g2000cwm.googlegroups.com...

David Liao (MS)

unread,
Aug 25, 2006, 3:54:13 PM8/25/06
to
On windows CE USB Function(Device) Controller client driver, the RNDIS is
different from USB Modem Serial Driver. There are two seperated client
drivers. If you have WM5.0, you can switch between those to driver by ether
application or change registry then reboot the device.

By the way, We do provide source code for USB Function(Device) Mode Serial
Driver on WM5.0.

David Liao

"HimaNshu" <gajjar....@gmail.com> wrote in message

news:1156382175.4...@75g2000cwc.googlegroups.com...

David Liao (MS)

unread,
Aug 25, 2006, 4:10:26 PM8/25/06
to
>As David Liao has told RNDIS expose NDIS-miniport and as well as serial
This is not true.
RNDIS only expose NDIS-miniport interface.
USB Mode Serial Driver expose serial interface.


"HimaNshu" <gajjar....@gmail.com> wrote in message

news:1156381851.9...@75g2000cwc.googlegroups.com...

HimaNshu

unread,
Aug 28, 2006, 4:59:02 AM8/28/06
to
Yes David you are right I had misunderstanding by the way which code
you have for serial mode is it same which is in WinCE 5.0 platform
builder
\WINCE500\public\common\oak\drivers\usbfn\class\serial
if not then would you please send me on gajjar....@gmail.com

I got something from my search of two days, some ppl use USBser_Class
that is same dll used in Serial_class serialusbfn.dll to load the
USBser class but somewhat differance in registry only here I have
pasted that registry setting but there is no more information I found
for USBser_class, and I am still getting Code 10 error with this
registry settings

Do I have to do any more changes for USBser_class, means in
usbfndrv.cpp.
Do I have to change descriptor or anything else in code?

here is my device registry settings:
; @CESYSGEN IF CE_MODULES_USBFN
IF BSP_NOUSBFN !
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Usbfn]
"InterfaceType"=dword:0 ; Internal
"Prefix"="UFN"
"Dll"="ms2_usbfn.dll"
"Order"=dword:0
"Priority256"=dword:64
"MemBase"=dword:40600000 ; UDC_BASE_U_VIRTUAL
"MemLen"=dword:1000 ; Needs at least 0xE04. Round up to 1
page.
"Sysintr"=dword:1a
"BusIoctl"=dword:2a0048

"IClass"=multi_sz:"{E2BDC372-598F-4619-BC50-54B3F7848D35}=%b","{6F40791D-300E-44E4-BC38-E0E63CA8375C}=%b"


[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\USBSER_Class]
"Index"=dword:4
"FriendlyName"="USB Cable:"

[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"="USBSER_Class"

[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class]
"Dll"="serialusbfn.dll"
"DeviceName"="USBFNS1:"
"Prefix"="COM"
"DeviceArrayIndex"=dword:1
"Tsp"="Unimodem.dll "
"DeviceType"=dword:0
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
; idVendor must be changed. 045E belongs to Microsoft and is only to be
used for
; prototype devices in your labs. Visit http://www.usb.org to obtain a
vendor id.
; "idVendor"=dword:045E
; "Manufacturer"="Generic Manufacturer (PROTOTYPE--Remember to change
idVendor)"
; "idProduct"=dword:00ce
; "Product"="Generic Serial (PROTOTYPE--Remember to change idVendor)"
; "bcdDevice"=dword:0
"idVendor"=dword:150E
"Manufacturer"="OnoSokki"
"idProduct"=dword:0008
"Product"="Onosokki ChFFT Analyzer"
"bcdDevice"=dword:0


[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\USBSER_Class]
"Dll"=" serialusbfn.dll"
"DeviceName"="USBFNS2:"
"Prefix"="COM"
"DeviceArrayIndex"=dword:0

"IClass"=multi_sz:"{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}","{C375C787-B721-4b8e-B67F-A112D5C0A404}"
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
; idVendor must be changed. 045E belongs to Microsoft and is only to be
used for
; prototype devices in your labs. Visit http://www.usb.org to obtain a
vendor id.
; "idVendor"=dword:045E
; "Manufacturer"="Generic Manufacturer (PROTOTYPE--Remember to change
idVendor)"
; "idProduct"=dword:0079
; "Product"="Generic Serial (PROTOTYPE--Remember to change idVendor)"
; "bcdDevice"=dword:90
"idVendor"=dword:150E
"Manufacturer"="OnoSokki"
"idProduct"=dword:0008
"Product"="Onosokki ChFFT Analyzer"
"bcdDevice"=dword:0
ENDIF
; @CESYSGEN ENDIF CE_MODULES_USBFN

David Liao (MS)

unread,
Aug 28, 2006, 1:56:32 PM8/28/06
to
Yes. the serialusbfn has been extended to support USBSer_Class for WM5.0. So
you either can get code from WIndows CE 6.0 Beta or Windows Mobile 5.0.
Otherwise, you have to change the code to support USBSer_Class
configuration.

David Liao

"HimaNshu" <gajjar....@gmail.com> wrote in message

news:1156755542.2...@i3g2000cwc.googlegroups.com...

HimaNshu

unread,
Aug 28, 2006, 10:08:39 PM8/28/06
to
Hey thats great to hear I can get serialusbfn from Windows CE 6 or WM 5
but I don't have both of them.
Is there any free download for eveluation package of Window CE 6?
Or any updates to update my Window CE 5.0 Platform builder to Windows
Mobile 5.0?

if you have Windows CE 6.0 then would you provide me USBser driver
code, please?

Paul G. Tobey [eMVP]

unread,
Aug 29, 2006, 1:31:01 PM8/29/06
to
No. Windows CE 6 is in beta, but it's not a public beta.

I don't follow the question about updating PB5.0, but you shouldn't expect
to get some update that gives you everything that a Windows Mobile OEM can
include in their device for your general CE5 use, no.

Paul T.

"HimaNshu" <gajjar....@gmail.com> wrote in message

news:1156817319.8...@m79g2000cwm.googlegroups.com...

HimaNshu

unread,
Aug 30, 2006, 9:05:54 PM8/30/06
to
That means I dont have any other option, I have to modify existing
serial class driver into USBser driver.

Dose anybody know which changes I have to make for USBser support in
usbserdvr.cpp?
Descriptor? and which will be more changes?

David Liao (MS)

unread,
Aug 31, 2006, 5:12:57 PM8/31/06
to
Another option is waiting for Windows CE 6.0.

"HimaNshu" <gajjar....@gmail.com> wrote in message
news:1156986354.5...@h48g2000cwc.googlegroups.com...

HimaNshu

unread,
Aug 31, 2006, 8:38:59 PM8/31/06
to
Thank you very much David, Henrik and Paul.

0 new messages