subsys/usb/usb_device.c
/*
 * @brief handle a request by calling one of the installed request handlers
 *
 * Local function to handle a request by calling one of the installed request
 * handlers. In case of data going from host to device, the data is at *ppbData.
 * In case of data going from device to host, the handler can either choose to
 * write its data at *ppbData or update the data pointer.
 *
 * @param [in]     setup The setup packet
 * @param [in,out] len   Pointer to data length
 * @param [in,out] data  Data buffer
 *
 * @return true if the request was handles successfully
 */
@brief handle a request by calling one of the installed request handlers
Local function to handle a request by calling one of the installed request
handlers. In case of data going from host to device, the data is at *ppbData.
In case of data going from device to host, the handler can either choose to
write its data at *ppbData or update the data pointer.

@param [in]     setup The setup packet
@param [in,out] len   Pointer to data length
@param [in,out] data  Data buffer

@return true if the request was handles successfully
@brief handle a request by calling one of the installed request handlers Local function to handle a request by calling one of the installed request handlers . In case of data going from host to device the data is at * ppbData . In case of data going from device to host the handler can either choose to write its data at * ppbData or update the data pointer . @param [ in ] setup The setup packet @param [ in out ] len Pointer to data length @param [ in out ] data Data buffer @return true if the request was handles successfully
static bool usb_handle_request(struct usb_setup_packet *setup,
		s32_t *len, u8_t **data)
{
	u32_t type = REQTYPE_GET_TYPE(setup->bmRequestType);
	usb_request_handler handler = usb_dev.req_handlers[type];
	SYS_LOG_DBG("** %d **\n", type);
	if (type >= MAX_NUM_REQ_HANDLERS) {
		SYS_LOG_DBG("Error Incorrect iType %d\n", type);
		return false;
	}
	if (handler == NULL) {
		SYS_LOG_DBG("No handler for reqtype %d\n", type);
		return false;
	}
	if ((*handler)(setup, len, data) < 0) {
		SYS_LOG_DBG("Handler Error %d\n", type);
		usb_print_setup(setup);
		return false;
	}
	return true;
}
static bool usb_handle_request ( struct usb_setup_packet * setup , s32_t * len , u8_t * * data ) { u32_t type = REQTYPE_GET_TYPE ( setup -> bmRequestType ) ; usb_request_handler handler = usb_dev . req_handlers [ type ] ; SYS_LOG_DBG ( " \n " , type ) ; if ( type >= MAX_NUM_REQ_HANDLERS ) { SYS_LOG_DBG ( " \n " , type ) ; return false ; } if ( handler == NULL ) { SYS_LOG_DBG ( " \n " , type ) ; return false ; } if ( ( * handler ) ( setup , len , data ) < 0 ) { SYS_LOG_DBG ( " \n " , type ) ; usb_print_setup ( setup ) ; return false ; } return true ; }
@brief handle a request by calling one of the installed request handlers
 Local function to handle a request by calling one of the installed request
 handlers.
@brief handle a request by calling one of the installed request handlers Local function to handle a request by calling one of the installed request handlers .