samples/subsys/usb/webusb/src/webusb_serial.c
/**
 * @brief Manipulate line control for UART.
 *
 * @param dev WebUSB Serial device struct
 * @param ctrl The line control to be manipulated
 * @param val Value to set the line control
 *
 * @return 0 if successful, failed otherwise.
 */
@brief Manipulate line control for UART.
@param dev WebUSB Serial device struct
@param ctrl The line control to be manipulated
@param val Value to set the line control

@return 0 if successful, failed otherwise.
@brief Manipulate line control for UART . @param dev WebUSB Serial device struct @param ctrl The line control to be manipulated @param val Value to set the line control @return 0 if successful failed otherwise .
static int webusb_serial_line_ctrl_set(struct device *dev,
		u32_t ctrl, u32_t val)
{
	struct webusb_serial_dev_data_t * const dev_data = DEV_DATA(dev);
	switch (ctrl) {
	case LINE_CTRL_BAUD_RATE:
		webusb_serial_baudrate_set(dev, val);
		return 0;
	case LINE_CTRL_DCD:
		dev_data->serial_state &= ~CDC_CONTROL_SERIAL_STATE_DCD;
		if (val)
			dev_data->serial_state |= CDC_CONTROL_SERIAL_STATE_DCD;
		webusb_serial_send_notification(dev,
		    CDC_CONTROL_SERIAL_STATE_DCD);
		return 0;
	case LINE_CTRL_DSR:
		dev_data->serial_state &= ~CDC_CONTROL_SERIAL_STATE_DSR;
		if (val)
			dev_data->serial_state |= CDC_CONTROL_SERIAL_STATE_DSR;
		webusb_serial_send_notification(dev, dev_data->serial_state);
		return 0;
	default:
		return -ENODEV;
	}
	return -ENOTSUP;
}
static int webusb_serial_line_ctrl_set ( struct device * dev , u32_t ctrl , u32_t val ) { struct webusb_serial_dev_data_t * const dev_data = DEV_DATA ( dev ) ; switch ( ctrl ) { case LINE_CTRL_BAUD_RATE : webusb_serial_baudrate_set ( dev , val ) ; return 0 ; case LINE_CTRL_DCD : dev_data -> serial_state &= ~ CDC_CONTROL_SERIAL_STATE_DCD ; if ( val ) dev_data -> serial_state |= CDC_CONTROL_SERIAL_STATE_DCD ; webusb_serial_send_notification ( dev , CDC_CONTROL_SERIAL_STATE_DCD ) ; return 0 ; case LINE_CTRL_DSR : dev_data -> serial_state &= ~ CDC_CONTROL_SERIAL_STATE_DSR ; if ( val ) dev_data -> serial_state |= CDC_CONTROL_SERIAL_STATE_DSR ; webusb_serial_send_notification ( dev , dev_data -> serial_state ) ; return 0 ; default : return - ENODEV ; } return - ENOTSUP ; }
@brief Manipulate line control for UART.
@brief Manipulate line control for UART .