per review
This commit is contained in:
parent
86ff5651ad
commit
2eed58d096
|
@ -255,20 +255,26 @@ bool netd_control_request(uint8_t rhport, tusb_control_request_t const * request
|
||||||
switch ( request->bRequest )
|
switch ( request->bRequest )
|
||||||
{
|
{
|
||||||
case TUSB_REQ_GET_INTERFACE:
|
case TUSB_REQ_GET_INTERFACE:
|
||||||
|
{
|
||||||
|
uint8_t const req_itfnum = (uint8_t) request->wIndex;
|
||||||
|
TU_VERIFY(_netd_itf.itf_num+1 == req_itfnum);
|
||||||
|
|
||||||
tud_control_xfer(rhport, request, &_netd_itf.itf_data_alt, 1);
|
tud_control_xfer(rhport, request, &_netd_itf.itf_data_alt, 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TUSB_REQ_SET_INTERFACE:
|
case TUSB_REQ_SET_INTERFACE:
|
||||||
{
|
{
|
||||||
uint8_t const req_itfnum = (uint8_t) request->wIndex;
|
uint8_t const req_itfnum = (uint8_t) request->wIndex;
|
||||||
|
uint8_t const req_alt = (uint8_t) request->wValue;
|
||||||
|
|
||||||
// Request to enable/disable network activities on ACM-ECM only
|
// Only valid for Data Interface with Alternate is either 0 or 1
|
||||||
TU_ASSERT(_netd_itf.ecm_mode);
|
TU_VERIFY(_netd_itf.itf_num+1 == req_itfnum && req_alt < 2);
|
||||||
|
|
||||||
// Only valid for Data Interface
|
// ACM-ECM only: qequest to enable/disable network activities
|
||||||
TU_ASSERT(_netd_itf.itf_num+1 == req_itfnum);
|
TU_VERIFY(_netd_itf.ecm_mode);
|
||||||
|
|
||||||
_netd_itf.itf_data_alt = (uint8_t) request->wValue;
|
_netd_itf.itf_data_alt = req_alt;
|
||||||
|
|
||||||
if ( _netd_itf.itf_data_alt )
|
if ( _netd_itf.itf_data_alt )
|
||||||
{
|
{
|
||||||
|
|
|
@ -575,8 +575,8 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
|
||||||
// notable requests are: GET HID REPORT DESCRIPTOR, SET_INTERFACE, GET_INTERFACE
|
// notable requests are: GET HID REPORT DESCRIPTOR, SET_INTERFACE, GET_INTERFACE
|
||||||
if ( !invoke_class_control(rhport, drvid, p_request) )
|
if ( !invoke_class_control(rhport, drvid, p_request) )
|
||||||
{
|
{
|
||||||
// For STD GET_INTERFACE even if class driver doesn't support alternate setting
|
// For GET_INTERFACE, it is mandatory to respond even if the class
|
||||||
// It is still mandatory to response with value of zero
|
// driver doesn't use alternate settings.
|
||||||
TU_VERIFY( TUSB_REQ_TYPE_STANDARD == p_request->bmRequestType_bit.type &&
|
TU_VERIFY( TUSB_REQ_TYPE_STANDARD == p_request->bmRequestType_bit.type &&
|
||||||
TUSB_REQ_GET_INTERFACE == p_request->bRequest);
|
TUSB_REQ_GET_INTERFACE == p_request->bRequest);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue