How to add endpoint to a vendor specific interface in CX3.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
mapper
Level 1
Level 1
5 questions asked 10 sign-ins 5 replies posted

Hello,

 

I'm working my way through how the UVC descriptor structure works, so I will be thrilled to get details on the solution. 

 

I'm trying to create a vendor specific interface. I have followed this https://community.infineon.com/t5/Knowledge-Base-Articles/Vendor-Interface-in-UVC-KBA218335/ta-p/247... and I was successful to create the interface:

 

$usb-devices

T: Bus=04 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 17 Spd=5000 MxCh= 0
😧 Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 1
P: Vendor=04b4 ProdID=00c3 Rev=00.00
S: Manufacturer=Cypress
S: Product=CX3-UVC
C: #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=96mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo
I: If#= 1 Alt= 0 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
I: If#= 2 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=00 Prot=00 Driver=usbfs

 

In Ubuntu, I'm using a python application to send commands to this vendor specific interface. My application can also see this interface, as can be seen in the output below:

INTERFACE 2: Vendor Specific ===========================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x2
bAlternateSetting : 0x0
bNumEndpoints : 0x0
bInterfaceClass : 0xff Vendor Specific
bInterfaceSubClass : 0x0
bInterfaceProtocol : 0x0
iInterface : 0x0

 

But I can't write anything to this interface, as it doesn't have an endpoint. I tried simply increasing the number of endpoints in the interface descriptor:

0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface descriptor type */
0x02, /* Interface number */
0x00, /* Alternate setting number */
0x01, /* Number of end points */
0xFF, /* Interface class */
0x00, /* Interface sub class */
0x00, /* Interface protocol code */
0x00 /* Interface descriptor string index */
 
This doesn't work. I believe I need to add the endpoint descriptor as well. I don't understand the structure, could you help describe how to add the endpoint to this specific vendor-specific interface that I have added?
 
I appreciate any help,
 
Kind regards,
Renato

 

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello Renato,

You can refer to the firmware in AN75779 (An75779.zip) which has a provision to add vendor interface to UVC device by enabling USB_DEBUG_INTERFACE macro.

 

 ,
        0x09,                           /* Descriptor size */
        CY_U3P_USB_INTRFC_DESCR,        /* Interface Descriptor type */
        0x02,                           /* Interface number */
        0x00,                           /* Alternate setting number */
        0x02,                           /* Number of end points */
        0xFF,                           /* Interface class */
        0x00,                           /* Interface sub class */
        0x00,                           /* Interface protocol code */
        0x00,                           /* Interface descriptor string index */

        /* Endpoint descriptor for producer EP */
        0x07,                           /* Descriptor size */
        CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
        CY_FX_EP_DEBUG_CMD,             /* Endpoint address and description */
        CY_U3P_USB_EP_BULK,             /* Bulk endpoint type */
        0x00,0x04,                      /* Max packet size = 1024 bytes */
        0x00,                           /* Servicing interval for data transfers : 0 for bulk */
    
        /* Super speed endpoint companion descriptor for producer EP */
        0x06,                           /* Descriptor size */
        CY_U3P_SS_EP_COMPN_DESCR,       /* SS endpoint companion descriptor type */
        0,                              /* No burst support. */
        0x00,                           /* Max streams for bulk EP = 0 (No streams) */
        0x00,0x00,                      /* Service interval for the EP : 0 for bulk */
    
        /* Endpoint descriptor for consumer EP */
        0x07,                           /* Descriptor size */
        CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
        CY_FX_EP_DEBUG_RSP,             /* Endpoint address and description */
        CY_U3P_USB_EP_BULK,             /* Bulk endpoint type */
        0x00,0x04,                      /* Max packet size = 1024 bytes */
        0x00,                           /* Servicing interval for data transfers : 0 for Bulk */
    
        /* Super speed endpoint companion descriptor for consumer EP */
        0x06,                           /* Descriptor size */
        CY_U3P_SS_EP_COMPN_DESCR,       /* SS endpoint companion descriptor type */
        0,                              /* No burst support. */
        0x00,                           /* Max streams for bulk EP = 0 (No streams) */
        0x00,0x00                       /* Service interval for the EP : 0 for bulk */

 

 

Please note that modifying  /* Length of this descriptor and all sub descriptors*/  will be important after adding endpoint descriptors to the structure.

Please track the changes done to the AN75779 after enabling USB_DEBUG_INTERFACE to understand the changes needed to add an endpoint to an interface.

Regards,
Rashi

View solution in original post

0 Likes
2 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello Renato,

You can refer to the firmware in AN75779 (An75779.zip) which has a provision to add vendor interface to UVC device by enabling USB_DEBUG_INTERFACE macro.

 

 ,
        0x09,                           /* Descriptor size */
        CY_U3P_USB_INTRFC_DESCR,        /* Interface Descriptor type */
        0x02,                           /* Interface number */
        0x00,                           /* Alternate setting number */
        0x02,                           /* Number of end points */
        0xFF,                           /* Interface class */
        0x00,                           /* Interface sub class */
        0x00,                           /* Interface protocol code */
        0x00,                           /* Interface descriptor string index */

        /* Endpoint descriptor for producer EP */
        0x07,                           /* Descriptor size */
        CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
        CY_FX_EP_DEBUG_CMD,             /* Endpoint address and description */
        CY_U3P_USB_EP_BULK,             /* Bulk endpoint type */
        0x00,0x04,                      /* Max packet size = 1024 bytes */
        0x00,                           /* Servicing interval for data transfers : 0 for bulk */
    
        /* Super speed endpoint companion descriptor for producer EP */
        0x06,                           /* Descriptor size */
        CY_U3P_SS_EP_COMPN_DESCR,       /* SS endpoint companion descriptor type */
        0,                              /* No burst support. */
        0x00,                           /* Max streams for bulk EP = 0 (No streams) */
        0x00,0x00,                      /* Service interval for the EP : 0 for bulk */
    
        /* Endpoint descriptor for consumer EP */
        0x07,                           /* Descriptor size */
        CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
        CY_FX_EP_DEBUG_RSP,             /* Endpoint address and description */
        CY_U3P_USB_EP_BULK,             /* Bulk endpoint type */
        0x00,0x04,                      /* Max packet size = 1024 bytes */
        0x00,                           /* Servicing interval for data transfers : 0 for Bulk */
    
        /* Super speed endpoint companion descriptor for consumer EP */
        0x06,                           /* Descriptor size */
        CY_U3P_SS_EP_COMPN_DESCR,       /* SS endpoint companion descriptor type */
        0,                              /* No burst support. */
        0x00,                           /* Max streams for bulk EP = 0 (No streams) */
        0x00,0x00                       /* Service interval for the EP : 0 for bulk */

 

 

Please note that modifying  /* Length of this descriptor and all sub descriptors*/  will be important after adding endpoint descriptors to the structure.

Please track the changes done to the AN75779 after enabling USB_DEBUG_INTERFACE to understand the changes needed to add an endpoint to an interface.

Regards,
Rashi
0 Likes

Hello Rashi,

 

Thank you for the answer. 

 

Indeed, I was missing a few steps to make it work. After adding the DMA channels and following the steps in AN75779, I was able to implement the vendor-specific command successfully.

 

Best regards, 

Renato

0 Likes