samples/subsys/usb/webusb/src/main.c
/**
 * @brief Handler called for WebUSB vendor specific commands.
 *
 * @param pSetup    Information about the request to execute.
 * @param len       Size of the buffer.
 * @param data      Buffer containing the request result.
 *
 * @return  0 on success, negative errno code on fail.
 */
@brief Handler called for WebUSB vendor specific commands.
@param pSetup    Information about the request to execute.
@param len       Size of the buffer.
@param data      Buffer containing the request result.

@return  0 on success, negative errno code on fail.
@brief Handler called for WebUSB vendor specific commands . @param pSetup Information about the request to execute . @param len Size of the buffer . @param data Buffer containing the request result . @return 0 on success negative errno code on fail .
int vendor_handle_req(struct usb_setup_packet *pSetup,
		s32_t *len, u8_t **data)
{
	if (pSetup->bRequest == 0x01 && pSetup->wIndex == 0x01) {
		*data = (u8_t *)(&webusb_allowed_origins);
		*len = sizeof(webusb_allowed_origins);
		return 0;
	} else if (pSetup->bRequest == 0x01 && pSetup->wIndex == 0x02) {
		u8_t index = GET_DESC_INDEX(pSetup->wValue);
		if (index == 0 || index > NUMBER_OF_ALLOWED_ORIGINS)
			return -ENOTSUP;
		*data = (u8_t *)(&webusb_origin_url);
		*len = sizeof(webusb_origin_url);
		return 0;
	}
	return -ENOTSUP;
}
int vendor_handle_req ( struct usb_setup_packet * pSetup , s32_t * len , u8_t * * data ) { if ( pSetup -> bRequest == 0x01 && pSetup -> wIndex == 0x01 ) { * data = ( u8_t * ) ( & webusb_allowed_origins ) ; * len = sizeof ( webusb_allowed_origins ) ; return 0 ; } else if ( pSetup -> bRequest == 0x01 && pSetup -> wIndex == 0x02 ) { u8_t index = GET_DESC_INDEX ( pSetup -> wValue ) ; if ( index == 0 || index > NUMBER_OF_ALLOWED_ORIGINS ) return - ENOTSUP ; * data = ( u8_t * ) ( & webusb_origin_url ) ; * len = sizeof ( webusb_origin_url ) ; return 0 ; } return - ENOTSUP ; }
@brief Handler called for WebUSB vendor specific commands.
@brief Handler called for WebUSB vendor specific commands .
/* Get Allowed origins request */ /* Get URL request */