Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Getting property page displayed and work in AmCap with UVC firmware

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Getting property page displayed and work in AmCap with UVC firmware
Moderator:
RSKV

Post Reply
Follow this topic



Getting property page displayed and work in AmCap with UVC firmware

jimingwang posted on 02 Feb 2012 4:37 PM PST

1 Forum Post

Hi,

 

I have tried to modify your UVC firmware and have property page (the one lets you adjust brightness, hue, sharpness...etc) displayed and work when running AmCap.exe but I am only able to make property page displayed but all properties scroll bar are grey-out and cannot be adjuested. Any idea what might be the root cause of this issue ? Thanks in advance for any help.

Following is what I have done.

UVCAppEP0Thread_Entry (
        uint32_t input)
{

    uint32_t flag;
    uint16_t readCount;
    CyU3PReturnStatus_t apiRetStatus;

    for (;;)
    {
        /* Check for UVC class request event */
        /* Wait for or get the status of an event flag group */
#if 1
        //Let's get all 32bit into flag
        if (CyU3PEventGet (&glFxUVCEvent, 0xFFFFFFFF, CYU3P_EVENT_OR_CLEAR, &flag,
                CYU3P_WAIT_FOREVER) == CY_U3P_SUCCESS)
#else
        if (CyU3PEventGet (&glFxUVCEvent, (CY_FX_UVC_GET_CUR_EVENT | CY_FX_UVC_SET_CUR_EVENT |
                           CY_FX_UVC_GET_MIN_EVENT | CY_FX_UVC_GET_MAX_EVENT | CY_FX_UVC_GET_DEF_EVENT |
                           CY_FX_UVC_GET_RES_EVENT),
                           CYU3P_EVENT_OR_CLEAR, &flag,
                           CYU3P_WAIT_FOREVER) == CY_U3P_SUCCESS)
#endif
        {
            /* Check for UVC GET_CUR request event */
            if (flag & CY_FX_UVC_GET_CUR_EVENT)
            {
                //APTINA: Is it a videostreaming request?
                if (flag & CY_FX_UVC_VS_EVENT)
                {
                    CyU3PDebugPrint (4, "It's a CY_FX_UVC_VS_EVENT\n");
                    //if (flag & (CY_FX_UVC_VS_PROBE_CONTROL | CY_FX_UVC_VS_COMMIT_CONTROL))
                    //{
                        /* Host requests for Probe Data of 26 bytes */
                        /* Send 26 bytes of Video Probe Control Data over EP0 */
                        /* */
                        apiRetStatus = CyU3PUsbSendEP0Data(CY_FX_UVC_MAX_PROBE_SETTING, (uint8_t *)glProbeCtrl);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                        }
                    //}
                    //APTINA: TODO=> Take care of CY_FX_UVC_VS_CONTROL_UNDEFINED event and other.
                }
                else //It is a video control request !
                {
                    CyU3PDebugPrint (4, "It's GET_CUR - video control request. Flag = 0x%x\n", flag);
                    if (flag & CY_FX_UVC_BRIGHTNESS_CONTROL)
                    {
                        CyU3PDebugPrint (4, "It's a CY_FX_UVC_BRIGHTNESS_CONTROL\n");
                        EP0BUF[0]= (uint8_t)((cur_brightness & 0xff00)>>8);
                        EP0BUF[1]= (uint8_t)(cur_brightness & 0x00ff);
                        apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                        }

                    }
                    if (flag & CY_FX_UVC_SATURATION_CONTROL)
                    {
                           CyU3PDebugPrint (4, "It's a CY_FX_UVC_SATURATION_CONTROL\n");
                        EP0BUF[0]= (uint8_t)((cur_saturation & 0xff00)>>8);
                        EP0BUF[1]= (uint8_t)(cur_saturation & 0x00ff);
                        apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                        }

                    }
                    if (flag & CY_FX_UVC_CONTRAST_CONTROL)
                    {
                           CyU3PDebugPrint (4, "It's a CY_FX_UVC_CONTRAST_CONTROL\n");
                        EP0BUF[0]= (uint8_t)((cur_contrast & 0xff00)>>8);
                        EP0BUF[1]= (uint8_t)(cur_contrast & 0x00ff);
                        apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                        }

                    }
                    if (flag & CY_FX_UVC_GAMMA_CONTROL)
                    {
                           CyU3PDebugPrint (4, "It's a CY_FX_UVC_GAMMA_CONTROL\n");
                        EP0BUF[0]= (uint8_t)((cur_gamma & 0xff00)>>8);
                        EP0BUF[1]= (uint8_t)(cur_gamma & 0x00ff);
                        apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                        }
                    }
                }
            }

            /* Check for UVC SET_CUR request event */
            if (flag & CY_FX_UVC_SET_CUR_EVENT)
            {
                CyU3PDebugPrint (4, "It's SET_CUR - video control request. Flag = 0x%x\n", flag);
                //APTINA: Is it a videostreaming request?
                if (flag & CY_FX_UVC_VS_EVENT)
                {
                    /* Get the UVC Probe/Commit Control data from EP0 */
                    /* Host sends 26 bytes of data on EP0, but in this example, data stored in memory glCommitCtrl is used directly. */
                    /* Commit control data is not interpreted */
                    apiRetStatus = CyU3PUsbGetEP0Data(CY_FX_UVC_MAX_PROBE_SETTING_ALIGNED, glCommitCtrl, &readCount);
                    if (apiRetStatus != CY_U3P_SUCCESS)
                    {
                        /* Error handling */
                        CyU3PDebugPrint (4, "USB EP0 Receive Data Failed, Error Code = %d\n",apiRetStatus);
                    }

                    /* Check the read count */
                    /* Expecting a count of CY_FX_UVC_MAX_PROBE_SETTING bytes */
                    if (readCount != (uint16_t)CY_FX_UVC_MAX_PROBE_SETTING)
                    {
                        /* Error handling */
                        CyU3PDebugPrint (4, "Invalid number of bytes received in SET_CUR Request");
                    }
                }
                else //This is a video control request
                {
                    if (flag & CY_FX_UVC_BRIGHTNESS_CONTROL)
                    {
                        apiRetStatus = CyU3PUsbGetEP0Data(CY_FX_UVC_MAX_PROBE_SETTING_ALIGNED, EP0BUF, &readCount);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Receive Data Failed, Error Code = %d\n",apiRetStatus);
                        }
                        cur_brightness = (uint16_t) EP0BUF[1];
                        SensorWrite2B(0xCC, 0x0A, 0x00, EP0BUF[1]);
                    }
                    if (flag & CY_FX_UVC_SATURATION_CONTROL)
                    {
                        apiRetStatus = CyU3PUsbGetEP0Data(CY_FX_UVC_MAX_PROBE_SETTING_ALIGNED, EP0BUF, &readCount);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Receive Data Failed, Error Code = %d\n",apiRetStatus);
                        }
                        cur_saturation = (((uint16_t) EP0BUF[0])<<8) | ((uint16_t) EP0BUF[1]);
                        SensorWrite2B(0xCC, 0x12, EP0BUF[0], EP0BUF[1]);
                    }
                    if (flag & CY_FX_UVC_CONTRAST_CONTROL)
                    {
                        apiRetStatus = CyU3PUsbGetEP0Data(CY_FX_UVC_MAX_PROBE_SETTING_ALIGNED, EP0BUF, &readCount);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Receive Data Failed, Error Code = %d\n",apiRetStatus);
                        }
                        cur_contrast = (uint16_t) EP0BUF[1];
                        SensorWrite2B(0xCC, 0x0C, 0x00, EP0BUF[1]);
                    }
                    if (flag & CY_FX_UVC_GAMMA_CONTROL)
                    {
                        apiRetStatus = CyU3PUsbGetEP0Data(CY_FX_UVC_MAX_PROBE_SETTING_ALIGNED, EP0BUF, &readCount);
                        if (apiRetStatus != CY_U3P_SUCCESS)
                        {
                            /* Error handling */
                            CyU3PDebugPrint (4, "USB EP0 Receive Data Failed, Error Code = %d\n",apiRetStatus);
                        }
                        cur_gamma = (((uint16_t) EP0BUF[0])<<8) | ((uint16_t) EP0BUF[1]);
                        SensorWrite2B(0xC9, 0x40, EP0BUF[0], EP0BUF[1]);
                    }
                }
            }

        }
        if (flag & CY_FX_UVC_GET_MIN_EVENT)
        {
            CyU3PDebugPrint (4, "It's GET_MIN - video control request. Flag = 0x%x\n", flag);
            if (flag & CY_FX_UVC_BRIGHTNESS_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x00;
                EP0BUF[1]= (uint8_t)0x00;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_SATURATION_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x00;
                EP0BUF[1]= (uint8_t)0x00;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_CONTRAST_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x00;
                EP0BUF[1]= (uint8_t)0x10;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_GAMMA_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x00;
                EP0BUF[1]= (uint8_t)0x64;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }
            }
        }
        if (flag & CY_FX_UVC_GET_MAX_EVENT)
        {
            CyU3PDebugPrint (4, "It's GET_MAX - video control request. Flag = 0x%x\n", flag);
            if (flag & CY_FX_UVC_BRIGHTNESS_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x00;
                EP0BUF[1]= (uint8_t)0xFF;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_SATURATION_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x01;
                EP0BUF[1]= (uint8_t)0x00;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_CONTRAST_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x00;
                EP0BUF[1]= (uint8_t)0x40;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_GAMMA_CONTROL)
            {
                EP0BUF[0]= (uint8_t)0x01;
                EP0BUF[1]= (uint8_t)0x2C;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }
            }
        }
        if (flag & CY_FX_UVC_GET_DEF_EVENT)
        {
            CyU3PDebugPrint (4, "It's GET_DEF - video control request. Flag = 0x%x\n", flag);
            if (flag & CY_FX_UVC_BRIGHTNESS_CONTROL)
            {
                EP0BUF[0]= (uint8_t)((def_brightness & 0xff00)>>8);
                EP0BUF[1]= (uint8_t)(def_brightness & 0x00ff);
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_SATURATION_CONTROL)
            {
                EP0BUF[0]= (uint8_t)((def_saturation & 0xff00)>>8);
                EP0BUF[1]= (uint8_t)(def_saturation & 0x00ff);
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_CONTRAST_CONTROL)
            {
                EP0BUF[0]= (uint8_t)((def_contrast & 0xff00)>>8);
                EP0BUF[1]= (uint8_t)(def_contrast & 0x00ff);
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_GAMMA_CONTROL)
            {
                EP0BUF[0]= (uint8_t)((def_gamma & 0xff00)>>8);
                EP0BUF[1]= (uint8_t)(def_gamma & 0x00ff);
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }
            }
        }
        if (flag & CY_FX_UVC_GET_RES_EVENT)
        {
            CyU3PDebugPrint (4, "It's GET_RES - video control request. Flag = 0x%x\n", flag);
            if (flag & CY_FX_UVC_BRIGHTNESS_CONTROL)
            {
                EP0BUF[0]= 0x00;
                EP0BUF[1]= 0x01;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_SATURATION_CONTROL)
            {
                EP0BUF[0]= 0x00;
                EP0BUF[1]= 0x01;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_CONTRAST_CONTROL)
            {
                EP0BUF[0]= 0x00;
                EP0BUF[1]= 0x01;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }

            }
            if (flag & CY_FX_UVC_GAMMA_CONTROL)
            {
                EP0BUF[0]= 0x00;
                EP0BUF[1]= 0x01;
                apiRetStatus = CyU3PUsbSendEP0Data(2, (uint8_t *)EP0BUF);
                if (apiRetStatus != CY_U3P_SUCCESS)
                {
                    /* Error handling */
                    CyU3PDebugPrint (4, "USB EP0 Send Data Failed, Error Code = %d\n",apiRetStatus);
                }
            }
        }
        /* Relinguish the thread */
        CyU3PThreadRelinquish ();
    }
}
 

 

Thanks,

Jim




Re: Getting property page displayed and work in AmCap with UVC firmware

aasi posted on 02 Feb 2012 09:20 PM PST
Cypress Employee
1073 Forum Posts

Hi Jiming,

This needs some digging into. Please create a tech support case (MyAccount -> MyCases) so that one of our engineers can help you with this.

Regards,

Anand



Re: Getting property page displayed and work in AmCap with UVC firmware

_Gary_ posted on 25 Apr 2012 02:27 AM PST
Senior Member
14 Forum Posts

 Hi Jim,

You have to modify the UVC descriptor also.

Or the page will not work.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.