samples/subsys/usb/webusb/src/webusb_serial.c
/**
 * @brief Send serial line state notification to the Host
 *
 * This routine sends asynchronous notification of UART status
 * on the interrupt endpoint
 *
 * @param dev WebUSB Serial device struct.
 * @param ep_status Endpoint status code.
 *
 * @return 0 if successful, failed otherwise.
 */
@brief Send serial line state notification to the Host
This routine sends asynchronous notification of UART status
on the interrupt endpoint

@param dev WebUSB Serial device struct.
@param ep_status Endpoint status code.

@return 0 if successful, failed otherwise.
@brief Send serial line state notification to the Host This routine sends asynchronous notification of UART status on the interrupt endpoint @param dev WebUSB Serial device struct . @param ep_status Endpoint status code . @return 0 if successful failed otherwise .
static int webusb_serial_send_notification(struct device *dev,
		u16_t serial_state)
{
	struct webusb_serial_dev_data_t * const dev_data = DEV_DATA(dev);
	struct cdc_acm_notification notification;
	u32_t cnt = 0;
	notification.bmRequestType = 0xA1;
	notification.bNotificationType = 0x20;
	notification.wValue = 0;
	notification.wIndex = 0;
	notification.wLength = sys_cpu_to_le16(sizeof(serial_state));
	notification.data = sys_cpu_to_le16(serial_state);
	dev_data->notification_sent = 0;
	usb_write(CDC_ENDP_INT, (const u8_t *)&notification,
	    sizeof(notification), NULL);
	while (!((volatile u8_t)dev_data->notification_sent)) {
		k_busy_wait(1);
		if (++cnt > CDC_CONTROL_SERIAL_STATE_TIMEOUT_US) {
			SYS_LOG_DBG("WebUSB notification timeout!");
			return -EIO;
		}
	}
	return 0;
}
static int webusb_serial_send_notification ( struct device * dev , u16_t serial_state ) { struct webusb_serial_dev_data_t * const dev_data = DEV_DATA ( dev ) ; struct cdc_acm_notification notification ; u32_t cnt = 0 ; notification . bmRequestType = 0xA1 ; notification . bNotificationType = 0x20 ; notification . wValue = 0 ; notification . wIndex = 0 ; notification . wLength = sys_cpu_to_le16 ( sizeof ( serial_state ) ) ; notification . data = sys_cpu_to_le16 ( serial_state ) ; dev_data -> notification_sent = 0 ; usb_write ( CDC_ENDP_INT , ( const u8_t * ) & notification , sizeof ( notification ) , NULL ) ; while ( ! ( ( volatile u8_t ) dev_data -> notification_sent ) ) { k_busy_wait ( 1 ) ; if ( ++ cnt > CDC_CONTROL_SERIAL_STATE_TIMEOUT_US ) { SYS_LOG_DBG ( " " ) ; return - EIO ; } } return 0 ; }
@brief Send serial line state notification to the Host
 This routine sends asynchronous notification of UART status
 on the interrupt endpoint
@brief Send serial line state notification to the Host This routine sends asynchronous notification of UART status on the interrupt endpoint
/* Wait for notification to be sent */