help with reading data from a set features report.

5 views
Skip to first unread message

ulao

unread,
Sep 13, 2021, 9:38:15 PMSep 13
to LUFA Library Support List
I have some code here that works unless I use Endpoint_Read_Control_Stream_LE

See the comment line, if I uncomment that line me debug never shows up. Its like the line is stalling my code. With the line commented out like I have it I get

debug1 4 (expect as that is the report length)
debug2 garbage data (expected)


case HID_REQ_SetReport:    
        if (  USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
        {
            Endpoint_ClearStatusStage();
            Endpoint_ClearSETUP();

            if ( ReportType == FEATURE )
            {
                if (ReportID == CREATE_NEW_EFFECT_REPORT )
                {
                

                    uint16_t ValueLength = USB_ControlRequest.wLength;
                    uint8_t  Value[ValueLength];
                
                    // Endpoint_Read_Control_Stream_LE(Value, ValueLength);// Read the report data from the control endpoint
                    degub1 = ValueLength;
                    debug2 =  Value[ 0 ];

                
                    //ffb.currentEffect = data[0];
                }
            }
            
            if ( ReportType == INPUT )
            {
                if ( (XINPUT() && ReportID == MAIN_REPORT )
                {
                    Endpoint_Read_Control_Stream_LE &reportBufferX ,  sizeof(reportBufferX) ); //xinput in data, I think this is for rumble and leds.
                }
            }
            //output is handled in hid_task

            Endpoint_ClearIN();
        }           

ulao

unread,
Sep 14, 2021, 8:15:52 AMSep 14
to LUFA Library Support List
II guess I needed to wait for the data ?

/* Wait until the LED report has been sent by the host */
                while (!(Endpoint_IsOUTReceived()))
                {
 
                }
Reply all
Reply to author
Forward
0 new messages