forked from PAWPAW-Mirror/lib_xua
Clarified ep_buffer.xc setup stall
Added getter hidIsReportDescriptorPrepared(), allowing more readable logic in the setup phase of ep_buffer.xc
This commit is contained in:
@@ -375,19 +375,13 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
UserHIDInit();
|
UserHIDInit();
|
||||||
{
|
{
|
||||||
int hidReportLength = 0;
|
/* Stall until Report Descriptor has been prepared */
|
||||||
unsigned hidReportId;
|
while (!hidIsReportDescriptorPrepared());
|
||||||
while(0 == hidReportLength) {
|
|
||||||
for( hidReportId = 0U; hidReportId < hidGetReportIdLimit(); ++hidReportId) {
|
|
||||||
hidReportLength = (int) hidGetReportLength(hidReportId);
|
|
||||||
if(0 < hidReportLength) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hidReportLength = (int) UserHIDGetData(hidReportId, g_hidData);
|
/* Get the last report - we don't really care which it is, so long as there's some data we can grab. */
|
||||||
XUD_SetReady_In(ep_hid, g_hidData, hidReportLength);
|
int hidReportLength = (int) UserHIDGetData(hidGetReportIdLimit() - 1, g_hidData);
|
||||||
|
|
||||||
|
XUD_SetReady_In(ep_hid, g_hidData, hidReportLength)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,11 @@ unsigned hidGetNextReportTime( const unsigned id ) {
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned hidIsReportDescriptorPrepared( void )
|
||||||
|
{
|
||||||
|
return s_hidReportDescriptorPrepared;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char* hidGetReportDescriptor( void )
|
unsigned char* hidGetReportDescriptor( void )
|
||||||
{
|
{
|
||||||
unsigned char* retVal = NULL;
|
unsigned char* retVal = NULL;
|
||||||
|
|||||||
@@ -142,6 +142,15 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
void hidClearChangePending( const unsigned id );
|
void hidClearChangePending( const unsigned id );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Indicate if the HID Report descriptor has been prepared
|
||||||
|
*
|
||||||
|
* \returns A Boolean indicating whether the HID Report descriptor has been prepared.
|
||||||
|
* \retval True The HID Report descriptor has been prepared.
|
||||||
|
* \retval False The HID Report has not been prepared.
|
||||||
|
*/
|
||||||
|
unsigned hidIsReportDescriptorPrepared( void );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the HID Report descriptor
|
* @brief Get the HID Report descriptor
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user