Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > FX3 API cannot set OS String Descriptor

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



FX3 API cannot set OS String Descriptor
Moderator:
RSKV

Post Reply
Follow this topic



FX3 API cannot set OS String Descriptor

SandyB posted on 11 May 2012 3:58 AM PST
Senior Member
16 Forum Posts

I need to set the MS OS String Descriptor (index = 0xEE)

This is necessary for WinUSB class driver support on Windows 8.

But a call to CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 0xEE,...)

just fails, returning Error code = 75

I assume this is because the descriptors are hardwired to IDs 0 to 15?

Can we get a fix for this?

Am I going to have similar trouble with OS Feature descriptors?

Thanks

 




Re: FX3 API cannot set OS String Descriptor

aasi posted on 13 May 2012 06:52 AM PST
Cypress Employee
1073 Forum Posts

Yep. You're right.

The error code being returned is CY_U3P_ERROR_BAD_INDEX and is being triggered due to CY_U3P_MAX_STRING_DESC_INDEX in cyu3usb.h. You can see the required description above the #define.

I'll talk our software team and let you know.

Regards,

Anand



Re: FX3 API cannot set OS String Descriptor

kys posted on 14 May 2012 11:50 PM PST
Cypress Employee
7 Forum Posts

Hi,

You are right that the FX3 SDK does not let you set a OS descriptor using the CyU3PUsbSetDesc() API.

However, this does not prevent you from supporting a OS descriptor in your application. You can support do this at the application level by handling the request in your setup callback function. See the below code snippet:

/* Microsoft OS Descriptor. */ const uint8_t CyFxUsbOSDscr[] __attribute__ ((aligned (32))) = {     0x0E, CY_U3P_USB_STRING_DESCR,     'O', 0x00, 'S', 0x00,     ' ', 0x00, 'D', 0x00,     'e', 0x00, 's', 0x00,     'c', 0x00 };  /* Callback to handle the USB setup requests. */ CyBool_t CyFxBulkSrcSinkApplnUSBSetupCB (         uint32_t setupdat0, /* SETUP Data 0 */         uint32_t setupdat1  /* SETUP Data 1 */     ) {     /* Fast enumeration is used. Only requests addressed to the interface, class,      * vendor and unknown control requests are received by this function.      * This application does not support any class or vendor requests. */      uint8_t  bRequest, bReqType;     uint8_t  bType, bTarget;     uint16_t wValue, wIndex, wLength;     CyBool_t isHandled = CyFalse;      /* Decode the fields from the setup request. */     bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK);     bType    = (bReqType & CY_U3P_USB_TYPE_MASK);     bTarget  = (bReqType & CY_U3P_USB_TARGET_MASK);     bRequest = ((setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_POS);     wValue   = ((setupdat0 & CY_U3P_USB_VALUE_MASK)   >> CY_U3P_USB_VALUE_POS);     wIndex   = ((setupdat1 & CY_U3P_USB_INDEX_MASK)   >> CY_U3P_USB_INDEX_POS);     wLength  = ((setupdat1 & CY_U3P_USB_LENGTH_MASK)  >> CY_U3P_USB_LENGTH_POS);      if (bType == CY_U3P_USB_STANDARD_RQT)     {         /* Handle Microsoft OS String Descriptor request. */         if ((bTarget == CY_U3P_USB_TARGET_DEVICE) && (bRequest == CY_U3P_USB_SC_GET_DESCRIPTOR) &&                 (wValue == ((CY_U3P_USB_STRING_DESCR << 8) | 0xEE)))         {             /* Make sure we do not send more data than requested. */             if (wLength > CyFxUsbOSDscr[0])                 wLength = CyFxUsbOSDscr[0];              CyU3PUsbSendEP0Data (wLength, (uint8_t *)CyFxUsbOSDscr);             isHandled = CyTrue;         }          /* Handle other requests below as required. */     }      return isHandled; }   For now, please use the above work-around. API level support for registering a OS descriptor
will be added in a later FX3 SDK release.



Re: FX3 API cannot set OS String Descriptor

kys posted on 14 May 2012 11:52 PM PST
Cypress Employee
7 Forum Posts

The code formatting in the last post does not look good. I am attaching the complete example source code.

Regards,

Karthik



Re: FX3 API cannot set OS String Descriptor

SandyB posted on 14 May 2012 04:06 AM PST
Senior Member
16 Forum Posts

Thanks guys.

I'm travelling now so although I can build OK I can't deploy it right now.

I've picked it up and will give it a shot when I am back in my office next week.

And if I run into any trouble with the other MS specific feature descriptors I'll report back here.



Re: FX3 API cannot set OS String Descriptor

SandyB posted on 28 Jun 2012 10:38 AM PST
Senior Member
16 Forum Posts

I thought I should report back.

I did run into a bit more trouble trying to make a WinUSB class device for Windows 8.

The OS feature Descriptor is fetched as Vendor specific request.   ie   bType == CY_U3P_USB_VENDOR_RQT
but it is still a string descriptor.   ie  bRequest == CY_U3P_USB_SC_GET_DESCRIPTOR and wValue == 0x03EE
I modified the example code for  CyFxBulkSrcSinkApplnUSBSetupCB()  accordingly.

Same goes for the Extended Compat ID OS Feature Descriptor.
That also gets fetched as a Vendor type, with the user-specified (in the OS descriptor) value in bRequest.

 

I think you have to do all this if you want to use WinUSB on Windows 8 because if I try to load my Windows 8 signed inf+cat specifying winusb (as I do on Windows 7 x64) I get an error message from Windows-8 saying "Windows found driver software for your device but encountered an error whil attempting to install it". Unliek Win7 it also would nto even look at my inf file unless I also gave it a matching signed cat file.

Can anyone here using WinUSB confirm this? Do Win7 style WinUSB inf installs relly not work on Win8?

Thanks



Re: FX3 API cannot set OS String Descriptor

SandyB posted on 28 Jun 2012 10:59 AM PST
Senior Member
16 Forum Posts

Hi aasi

also, I cannot build the example code you posted. It looks like it may be for a SDK newer than the one I have.

I have the v1.1 SDK from http://www.cypress.com/?rID=57990

Where can I get a newer SDK?

Error output building with v1.1 is like this:-

../cyfxbulksrcsink.c: In function 'CyFxBulkSrcSinkApplnUSBEventCB':
../cyfxbulksrcsink.c:536:14: error: 'CY_U3P_USB_EVENT_EP0_STAT_CPLT' undeclared (first use in this function)
../cyfxbulksrcsink.c:536:14: note: each undeclared identifier is reported only once for each function it appears in
../cyfxbulksrcsink.c: In function 'BulkSrcSinkAppThread_Entry':
../cyfxbulksrcsink.c:712:17: warning: implicit declaration of function 'CyU3PUsbSendDevNotification'
../cyfxbulksrcsink.c:714:17: warning: implicit declaration of function 'CyU3PUsbDoRemoteWakeup'

 

 



Re: FX3 API cannot set OS String Descriptor

RSKV posted on 28 Jun 2012 06:54 PM PST
Cypress Employee
655 Forum Posts

For latest SDK, please have a look at the last but one post in the below given thread:

http://www.cypress.com/?app=forum&id=167&rID=63875

Regards,

sai krishna.



Re: FX3 API cannot set OS String Descriptor

SandyB posted on 03 Jul 2012 08:50 AM PST
Senior Member
16 Forum Posts

Thanks. I (eventually) have the newer SDK and can build the code OK now.

However it does not seem to work.
So I added a CyU3PDebugPrint to the start of CyFxBulkSrcSinkApplnUSBSetupCB()

It seems that CyFxBulkSrcSinkApplnUSBSetupCB() only gets called once. Just once.

When it is called, bType =0, bTarget =0, bRequest =6, bReqType = 0x80

It does not appear to get called for the MS OS descriptor.

I carefully used regedit to delete

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\------

And Windows thinks it has sent the 0xEE string request OK because afterwards it recreates the registry entry again.

And I can verify this behavior on anotehr (not FX3) device. In that case I see the 0xEE string request just fine. 

Any idea why this code is not seeing any more calls?



Re: FX3 API cannot set OS String Descriptor

SandyB posted on 03 Jul 2012 09:47 AM PST
Senior Member
16 Forum Posts

Oops. Ignore my last two posts. Sorry, I would unpost them if I could.

It seems your original code was correct... I misunderstood the way the FX3 API uses that bType parameter.

This OS descriptor request is indeed a    bType == CY_U3P_USB_STANDARD_RQT

and then the subsequent feature compatid requests are   bType == CY_U3P_USB_VENDOR_RQT

 

With that adjusted it seems to work now, even if I setup the callback with CyTrue as second param.

ie.     CyU3PUsbRegisterSetupCallback(CyFxBulkSrcSinkApplnUSBSetupCB, CyTrue);

 

 



Re: FX3 API cannot set OS String Descriptor

RSKV posted on 04 Jul 2012 02:35 AM PST
Cypress Employee
655 Forum Posts

Good to know that it is working at your end.






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.