Do I need to write my own host side USB driver for a CDC device Do I need to write my own host side USB driver for a CDC device windows windows

Do I need to write my own host side USB driver for a CDC device


You need to write a .inf file for Windows that ties up your device VID and PID with the system usbser.sys. Mine looks like this (Replace YourCompany as necessary, put in your VID and PID (in hex), and change the DriverVer line to whatever date and version you want):

; -----------------------------------------------------------------------------; XP/2000 USB Comms Port Setup; -----------------------------------------------------------------------------[Version] DriverVer=12/03/2008,1.0.0000.0000Signature="$Windows NT$"Class=Ports ClassGUID={4d36e978-e325-11ce-bfc1-08002be10318} Provider=%YourCompany% [DestinationDirs]DefaultDestDir=10,system32\driversDriverCopyFiles=12[ControlFlags]ExcludeFromSelect = *[Manufacturer] %YourCOmpany%=YourCompanySerialPort [YourCompanySerialPort] %YourCompanyUSBSerialPort%=YOURCOMPANYUSB,USB\VID_1234&PID_ABCD; ; Win 2000/XP;[YOURCOMPANYUSB]Include=mdmcpq.infCopyFiles=FakeModemCopyFileSection[YOURCOMPANYUSB.HW] AddReg=YOURCOMPANYUSBAddReg.HW [YOURCOMPANYUSBAddReg.HW] HKR,,DevLoader,0,*ntkern HKR,,NTMPDriver,,"usbser.sys" [YOURCOMPANYUSB.Services] AddService=usbser, 0x00000002, FuncDrv_Service_Inst [FuncDrv_Service_Inst] DisplayName=%USBFilterString% ServiceType= 1 StartType = 3 ErrorControl = 0 ServiceBinary = %12%\usbser.sys [Strings] YourCompany="YourCompany" YourCompanySerialPort="Your Company USB Serial Port" USBFilterString = "USB Serial Service"

Note this works with 32 bit OSs only. It also works with Vista although the file header doesn't say so!

Be aware that some versions of usbser.sys have significant problems, including bluescreening, for example when transferring packets that are exact multiples of 64 bytes. If you're using XP SP2 or previous then install hotfix KB943198. XP SP3 and Vista are fine.

For the Mac you simply need to report your device class correctly and the driver scan picks up the correct drivers. (Windows ignores the device class which is why you need to supply the .inf file).

EDIT: Sorry, I should have been clearer. This will not fail to enumerate if it can't draw the full load - I'm not sure that's possible.


You are correct on the driver question. When the device is plugged in and goes through the enumeration process it is required to stay < 100mA. The host will interrogate and determine the configuration(s). If there are more than one which support different power levels, then the driver will need to decide to select the appropriate configuration. If there is only high-power and it is not available, then it will not enumerate the device. In general, the standard driver doing CDC wouldn't be aware of the different device level configurations that would possible and so would require some degree of customization to handle them.


I am not sure about power question but ther is pleanty CDC drivers (or I think there is) so you could use one. For the power question, the solution with many configuration is probably good one, I have never encountered this in work (I have USB analyzer) but at home sometimes when I have 3 or more different devices that requires power from USB I got failed enumeration. I supose this is operating system choice if it can't supply power to new device it cut's it off (sensible choice as it can't power it). This is my gues rather checking USB standart.