Skip to content
Permalink
Browse files

usb: webusb: Add more log output

Add log prints for special requests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information...
finikorg authored and carlescufi committed Mar 28, 2019
1 parent b0373fb commit f4ff72bbd3464a5ac92db22c524a0159f55863a1
Showing with 11 additions and 1 deletion.
  1. +11 −1 samples/subsys/usb/webusb/src/main.c
@@ -207,6 +207,8 @@ int custom_handle_req(struct usb_setup_packet *pSetup,
*data = (u8_t *)(&msos1_string_descriptor);
*len = sizeof(msos1_string_descriptor);

LOG_DBG("Get MS OS Descriptor v1 string");

return 0;
}

@@ -224,13 +226,15 @@ int custom_handle_req(struct usb_setup_packet *pSetup,
* @return 0 on success, negative errno code on fail.
*/
int vendor_handle_req(struct usb_setup_packet *pSetup,
s32_t *len, u8_t **data)
s32_t *len, u8_t **data)
{
/* Get Allowed origins request */
if (pSetup->bRequest == 0x01 && pSetup->wIndex == 0x01) {
*data = (u8_t *)(&webusb_allowed_origins);
*len = sizeof(webusb_allowed_origins);

LOG_DBG("Get webusb_allowed_origins");

return 0;
} else if (pSetup->bRequest == 0x01 && pSetup->wIndex == 0x02) {
/* Get URL request */
@@ -242,13 +246,17 @@ int vendor_handle_req(struct usb_setup_packet *pSetup,
*data = (u8_t *)(&webusb_origin_url);
*len = sizeof(webusb_origin_url);

LOG_DBG("Get webusb_origin_url");

return 0;
} else if (pSetup->bRequest == 0x02 && pSetup->wIndex == 0x07) {
/* Get MS OS 2.0 Descriptors request */
/* 0x07 means "MS_OS_20_DESCRIPTOR_INDEX" */
*data = (u8_t *)(&msos2_descriptor);
*len = sizeof(msos2_descriptor);

LOG_DBG("Get MS OS Descriptors v2");

return 0;
} else if (pSetup->bRequest == 0x03 && pSetup->wIndex == 0x04) {
/* Get MS OS 1.0 Descriptors request */
@@ -258,6 +266,8 @@ int vendor_handle_req(struct usb_setup_packet *pSetup,
*data = (u8_t *)(&msos1_compatid_descriptor);
*len = sizeof(msos1_compatid_descriptor);

LOG_DBG("Get MS OS Descriptors CompatibeID");

return 0;
}

0 comments on commit f4ff72b

Please sign in to comment.
You can’t perform that action at this time.