Skip to content
Permalink
Browse files

usb: webusb: Strip 'serial' from names

Since we have remove CDC ACM logic from webusb strip also serial from
function names.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information...
finikorg authored and carlescufi committed Mar 27, 2019
1 parent 3183c10 commit dac83213f41feeea51958bb7388fc9b81ecd74ef
@@ -20,14 +20,13 @@ LOG_MODULE_REGISTER(main);
#include <stdio.h>
#include <string.h>
#include <device.h>
#include <uart.h>
#include <zephyr.h>
#include <misc/byteorder.h>
#include <usb/usb_common.h>
#include <usb/usb_device.h>
#include <usb/bos.h>

#include "webusb_serial.h"
#include "webusb.h"

/* Predefined response to control commands related to MS OS 2.0 descriptors */
static const u8_t msos2_descriptor[] = {
@@ -285,5 +284,5 @@ void main(void)
usb_bos_register_cap((void *)&bos_cap_webusb);
usb_bos_register_cap((void *)&bos_cap_msosv2);

webusb_serial_init();
webusb_init();
}
@@ -44,12 +44,12 @@ LOG_MODULE_DECLARE(main);

#include <zephyr.h>
#include <init.h>
#include <uart.h>
#include <string.h>
#include <misc/byteorder.h>
#include <usb/usb_device.h>
#include <usb/usb_common.h>
#include "webusb_serial.h"

#include "webusb.h"

/* Max packet size for Bulk endpoints */
#define CDC_BULK_EP_MPS 64
@@ -100,7 +100,7 @@ struct dev_common_descriptor {
struct usb_desc_header term_descr;
} __packed;

static struct dev_common_descriptor webusb_serial_usb_description = {
static struct dev_common_descriptor webusb_usb_description = {
/* Device descriptor */
.device_descriptor = {
.bLength = sizeof(struct usb_device_descriptor),
@@ -208,8 +208,8 @@ static struct dev_common_descriptor webusb_serial_usb_description = {
*
* @return 0 on success, negative errno code on fail.
*/
int webusb_serial_custom_handle_req(struct usb_setup_packet *pSetup,
s32_t *len, u8_t **data)
int webusb_custom_handle_req(struct usb_setup_packet *pSetup,
s32_t *len, u8_t **data)
{
LOG_DBG("");

@@ -230,8 +230,8 @@ int webusb_serial_custom_handle_req(struct usb_setup_packet *pSetup,
*
* @return 0 on success, negative errno code on fail.
*/
int webusb_serial_vendor_handle_req(struct usb_setup_packet *pSetup,
s32_t *len, u8_t **data)
int webusb_vendor_handle_req(struct usb_setup_packet *pSetup,
s32_t *len, u8_t **data)
{
/* Call the callback */
if ((req_handlers && req_handlers->vendor_handler) &&
@@ -283,9 +283,9 @@ static void webusb_read_cb(u8_t ep, int size, void *priv)
*
* @return N/A.
*/
static void webusb_serial_dev_status_cb(struct usb_cfg_data *cfg,
enum usb_dc_status_code status,
const u8_t *param)
static void webusb_dev_status_cb(struct usb_cfg_data *cfg,
enum usb_dc_status_code status,
const u8_t *param)
{
ARG_UNUSED(param);
ARG_UNUSED(cfg);
@@ -322,7 +322,7 @@ static void webusb_serial_dev_status_cb(struct usb_cfg_data *cfg,
}

/* Describe EndPoints configuration */
static struct usb_ep_cfg_data webusb_serial_ep_data[] = {
static struct usb_ep_cfg_data webusb_ep_data[] = {
{
.ep_cb = usb_transfer_ep_callback,
.ep_addr = WEBUSB_ENDP_OUT
@@ -334,36 +334,36 @@ static struct usb_ep_cfg_data webusb_serial_ep_data[] = {
};

/* Configuration of the CDC-ACM Device send to the USB Driver */
static struct usb_cfg_data webusb_serial_config = {
.usb_device_description = (u8_t *)&webusb_serial_usb_description,
.cb_usb_status = webusb_serial_dev_status_cb,
static struct usb_cfg_data webusb_config = {
.usb_device_description = (u8_t *)&webusb_usb_description,
.cb_usb_status = webusb_dev_status_cb,
.interface = {
.class_handler = NULL,
.custom_handler = webusb_serial_custom_handle_req,
.vendor_handler = webusb_serial_vendor_handle_req,
.custom_handler = webusb_custom_handle_req,
.vendor_handler = webusb_vendor_handle_req,
.payload_data = NULL,
},
.num_endpoints = ARRAY_SIZE(webusb_serial_ep_data),
.endpoint = webusb_serial_ep_data
.num_endpoints = ARRAY_SIZE(webusb_ep_data),
.endpoint = webusb_ep_data
};

int webusb_serial_init(void)
int webusb_init(void)
{
int ret;

LOG_DBG("");

webusb_serial_config.interface.payload_data = interface_data;
webusb_config.interface.payload_data = interface_data;

/* Initialize the WebUSB driver with the right configuration */
ret = usb_set_config(&webusb_serial_config);
ret = usb_set_config(&webusb_config);
if (ret < 0) {
LOG_ERR("Failed to config USB");
return ret;
}

/* Enable WebUSB driver */
ret = usb_enable(&webusb_serial_config);
ret = usb_enable(&webusb_config);
if (ret < 0) {
LOG_ERR("Failed to enable USB");
return ret;
@@ -69,6 +69,6 @@ struct webusb_req_handlers {
*/
void webusb_register_request_handlers(struct webusb_req_handlers *handlers);

int webusb_serial_init(void);
int webusb_init(void);

#endif /* __WEBUSB_SERIAL_H__ */

0 comments on commit dac8321

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