samples/subsys/usb/dfu/src/usb_dfu.c
/**
 * @brief Custom handler for standard ('chapter 9') requests
 *        in order to catch the SET_INTERFACE request and
 *        extract the interface alternate setting
 *
 * @param pSetup    Information about the request to execute.
 * @param len       Size of the buffer.
 * @param data      Buffer containing the request result.
 *
 * @return  0 if SET_INTERFACE request, -ENOTSUP otherwise.
 */
@brief Custom handler for standard ('chapter 9') requests
in order to catch the SET_INTERFACE request and
extract the interface alternate setting

@param pSetup    Information about the request to execute.
@param len       Size of the buffer.
@param data      Buffer containing the request result.

@return  0 if SET_INTERFACE request, -ENOTSUP otherwise.
@brief Custom handler for standard ( ' chapter 9 ' ) requests in order to catch the SET_INTERFACE request and extract the interface alternate setting @param pSetup Information about the request to execute . @param len Size of the buffer . @param data Buffer containing the request result . @return 0 if SET_INTERFACE request - ENOTSUP otherwise .
static int dfu_custom_handle_req(struct usb_setup_packet *pSetup,
		s32_t *data_len, u8_t **data)
{
	ARG_UNUSED(data);
	if (REQTYPE_GET_RECIP(pSetup->bmRequestType) ==
	    REQTYPE_RECIP_INTERFACE) {
		if (pSetup->bRequest == REQ_SET_INTERFACE) {
			SYS_LOG_DBG("DFU alternate setting %d", pSetup->wValue);
			if (pSetup->wValue >= DFU_MODE_ALTERNATE_SETTINGS) {
				SYS_LOG_DBG("Invalid DFU alternate setting (%d)",
				    pSetup->wValue);
			} else {
				dfu_data.alt_setting = pSetup->wValue;
			}
			*data_len = 0;
			return 0;
		}
	}
	return -ENOTSUP;
}
static int dfu_custom_handle_req ( struct usb_setup_packet * pSetup , s32_t * data_len , u8_t * * data ) { ARG_UNUSED ( data ) ; if ( REQTYPE_GET_RECIP ( pSetup -> bmRequestType ) == REQTYPE_RECIP_INTERFACE ) { if ( pSetup -> bRequest == REQ_SET_INTERFACE ) { SYS_LOG_DBG ( " " , pSetup -> wValue ) ; if ( pSetup -> wValue >= DFU_MODE_ALTERNATE_SETTINGS ) { SYS_LOG_DBG ( " " , pSetup -> wValue ) ; } else { dfu_data . alt_setting = pSetup -> wValue ; } * data_len = 0 ; return 0 ; } } return - ENOTSUP ; }
@brief Custom handler for standard ('chapter 9') requests
        in order to catch the SET_INTERFACE request and
        extract the interface alternate setting
@brief Custom handler for standard ( ' chapter 9 ' ) requests in order to catch the SET_INTERFACE request and extract the interface alternate setting
/* Not handled by us */