Author Topic: Is it possible to have a usb composite device made up of cdc and vendor spec?  (Read 11723 times)

phamtv

  • Member
  • ***
  • Posts: 6
I am trying to develop a composite device made up of a cdc class and a vendor specific class.  Is this possible?  I am able to get them to work individually but am having a hard time merging the two together.  What ends up happening is that I get 3 other devices under the device manager.  I can assign my vendor specific interface to its driver.  However, I cannot assign the cdc class made up of the two interface to the cdc driver I used previously (when the cdc class was tested separately).  Any suggestion of feedback is greatly appreciated!


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research

phamtv

  • Member
  • ***
  • Posts: 6
Hi Jan,

The link under Composite CDC device is broken.  Can you elaborate on the fix?

- Tien

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Both links worked for me. Search on the article ID if you still have a problem.

Jan

phamtv

  • Member
  • ***
  • Posts: 6
Hi Jan,

It looks like the hotfixes is used for Window XP, but I am running on Windows 7.  I am able to use the IAD descriptor and get my device to enumerate with 2 device but the CDC class is scanned in the system as an Imaging Device.  Can you take a look at my descriptor as follow and shed some light?  My goal is to get my usb device to support CDC + vendor specific class.  Thank you!

uint8_t device_descriptor[] = {
  0x12,                  /* bLength = 18                     */
  0x01,                  /* bDescriptorType = Device (1)     */
  0x10, 0x01,            /* bcdUSB(L/H) USB spec rev (BCD)   */
  0xEF,                  /* bDeviceClass = Generic Class    */
  0x02,                  /* bDeviceSubClass                  */
  0x01,                  /* bDeviceProtocol                  */
  0x40,                  /* bMaxPacketSize0 is 64 bytes      */
  0x6A, 0x0B,            /* idVendor(L/H)  -- 0x0B6A*/
  0x78, 0x56,            /* idProduct(L/H) -- 4401           */
  0x00, 0x01,            /* bcdDevice -- 01.00               */
  0x01,                  /* iManufacturer Descriptor ID      */
  0x02,                  /* iProduct Descriptor ID           */
  0x00,                  /* iSerialNumber = (0) No string    */
  0x01                   /* bNumConfigurations               */
};

uint8_t config_descriptor[] = {
  0x09,                  /*  bLength = 9                     */
  0x02,                  /*  bDescriptorType = Config (2)    */
  0x54, 0x00,            /*  wTotalLength(L/H)               */
  0x03,                  /*  bNumInterfaces                  */
  0x01,                  /*  bConfigValue                    */
  0x00,                  /*  iConfiguration                  */
  0xc0,                  /*  bmAttributes (self-powered, no remote wakeup) */
  0x01,                  /*  MaxPower is 2ma (units are 2ma/bit) */
 
  /* IAD - Interface Association Descriptor */
 
  0x08,                  /*  bLength                         */
  0x0B,                  /*  bDescriptorType                 */
  0x00,                  /*  bFirstInterface                 */
  0x02,                  /*  bInterfaceCount                 */
  0x02,                  /*  bFunctionClass - Com Class                 */
  0x00,                  /*  bFunctionSubClass               */
  0x00,                  /*  bFunctionProtocol               */
  0x00,                  /*  iFunction                       */

  /*  First Interface Descriptor For Comm Class Interface */
 
  0x09,                  /*  bLength = 9                     */
  0x04,                  /*  bDescriptorType = Interface (4) */
  0x00,                  /*  bInterfaceNumber                */
  0x00,                  /*  bAlternateSetting               */
  0x01,                  /*  bNumEndpoints (one for OUT)     */
  0x02,                  /*  bInterfaceClass = Communications Interface Class (2) */
  0x02,                  /*  bInterfaceSubClass = Abstract Control Model (2) */
  0x01,                  /*  bInterfaceProtocol = Common "AT" commands (1), */
                         /*   no class specific protocol (0)                */
  0x00,                  /*  iInterface                      */
 
  /*  Header Functional Descriptor */
 
  0x05,                  /*  bFunctionalLength = 5           */
  0x24,                  /*  bDescriptorType                 */
  0x00,                  /*  bDescriptorSubtype              */
  0x10, 0x01,            /*  bcdCDC                          */
 
  /*  Call Management Descriptor */
 
  0x05,                  /*  bFunctionalLength = 5           */
  0x24,                  /*  bDescriptorType                 */
  0x01,                  /*  bDescriptorSubtype              */
  0x03,                  /*  bmCapabilities = Device handles call management itself (0x01), */
                         /*    management over data class (0x02)                            */
  0x01,                  /*  bmDataInterface                 */
 
  /*  Abstract Control Management Functional Descriptor */
 
  0x04,                  /*  bFunctionalLength = 4           */
  0x24,                  /*  bDescriptorType                 */
  0x02,                  /*  bDescriptorSubtype              */
  0x02,                  /*  bmCapabilities                  */
 
  /*  Union Functional Descriptor */
 
  0x05,                  /*  bFunctionalLength = 5           */
  0x24,                  /*  bDescriptorType                 */
  0x06,                  /*  bDescriptorSubtype              */
  0x00,                  /*  bmMasterInterface               */
  0x01,                  /*  bmSlaveInterface0               */
 
  /*  IN Endpoint 3 (Descriptor #1) */
 
  0x07,                 /*  bLength                          */
  0x05,                 /*  bDescriptorType (Endpoint)       */
  0x83,                 /*  bEndpointAddress (EP3-IN)        */
  0x03,                 /*  bmAttributes (interrupt)         */
  0x40, 0x00,           /*  wMaxPacketSize(L/H) (64)         */
  0xff,                 /*  bInterval (255 milliseconds)     */
   
  /*  Second Interface Descriptor For Data Interface */
 
  0x09,                 /*  bLength                          */
  0x04,                 /*  bDescriptorType (Interface)      */
  0x01,                 /*  bInterfaceNumber                 */
  0x00,                 /*  bAlternateSetting                */
  0x02,                 /*  bNumEndpoints                    */
  0x0a,                 /*  bInterfaceClass = Data Interface (10) */
  0x00,                 /*  bInterfaceSubClass = none (0)    */
  0x00,                 /*  bInterfaceProtocol = No class specific protocol (0) */
  0x00,                 /*  biInterface = No Text String (0) */
 
  /*  OUT Endpoint 1 (Descriptor #2) */
 
  0x07,                 /*  bLength                          */
  0x05,                 /*  bDescriptorType (Endpoint)       */
  0x01,                 /*  bEndpointAddress (EP1-OUT)       */
  0x02,                 /*  bmAttributes (bulk)              */
  0x40, 0x00,           /*  wMaxPacketSize(L/H) (64)         */
  0x00,                 /*  bInterval (N/A)                  */
 
  /*  IN Endpoint 2 (Descriptor #3) */
 
  0x07,                 /*  bLength                          */
  0x05,                 /*  bDescriptorType (Endpoint)       */
  0x82,                 /*  bEndpointAddress (EP2-IN)        */
  0x02,                 /*  bmAttributes (bulk)              */
  0x40, 0x00,           /*  wMaxPacketSize(L/H) (64)         */
  0x00,                 /*  bInterval (N/A)                  */
 
    /*  Third interface - Vendor Specific -
  (Serial communication via endpoint 0) */
 
  0x09,                  /*  bLength = 9                     */
  0x04,                  /*  bDescriptorType = Interface (4) */
  0x02,                  /*  bInterfaceNumber                */
  0x00,                  /*  bAlternateSetting               */
  0x00,                  /*  bNumEndpoints (one for OUT)     */
  0xFF,                  /*  bInterfaceClass = Vendor Specific */
  0xFF,                  /*  bInterfaceSubClass = Abstract Control Model (2) */
  0xFF,                  /*  bInterfaceProtocol = Common "AT" commands (1), */
                         /*   no class specific protocol (0)                */
  0x00                   /*  iInterface                      */

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Use these values in the IAD as well as the interface descriptor:

0x02,                  /*  bInterfaceClass = Communications Interface Class (2) */
0x02,                  /*  bInterfaceSubClass = Abstract Control Model (2) */
0x01,                  /*  bInterfaceProtocol = Common "AT" commands (1), */

Jan

phamtv

  • Member
  • ***
  • Posts: 6
thank you Jan.  I was able to get it to work!  Your support is greatly appreciated!!!