您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tty_insert_flip_string函数代码示例

51自学网 2021-06-03 09:00:25
  C++
这篇教程C++ tty_insert_flip_string函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tty_insert_flip_string函数的典型用法代码示例。如果您正苦于以下问题:C++ tty_insert_flip_string函数的具体用法?C++ tty_insert_flip_string怎么用?C++ tty_insert_flip_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tty_insert_flip_string函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: acm_process_read_urb

static void acm_process_read_urb(struct acm *acm, struct urb *urb){	struct tty_struct *tty;	if (!urb->actual_length)		return;	tty = tty_port_tty_get(&acm->port);	if (!tty)		return;	tty_insert_flip_string(tty, urb->transfer_buffer, urb->actual_length);	tty_flip_buffer_push(tty);	tty_kref_put(tty);}
开发者ID:Emineminero,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:16,


示例2: gigaset_if_receive

/** * gigaset_if_receive() - pass a received block of data to the tty device * @cs:		device descriptor structure. * @buffer:	received data. * @len:	number of bytes received. * * Called by asyncdata/isocdata if a block of data received from the * device must be sent to userspace through the ttyG* device. */void gigaset_if_receive(struct cardstate *cs,			unsigned char *buffer, size_t len){	unsigned long flags;	struct tty_struct *tty;	spin_lock_irqsave(&cs->lock, flags);	tty = cs->tty;	if (tty == NULL)		gig_dbg(DEBUG_ANY, "receive on closed device");	else {		tty_insert_flip_string(tty, buffer, len);		tty_flip_buffer_push(tty);	}	spin_unlock_irqrestore(&cs->lock, flags);}
开发者ID:Scorpiion,项目名称:Renux_cross_eglibc,代码行数:25,


示例3: pty_write

static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c){    struct tty_struct *to = tty->link;    if (tty->stopped)        return 0;    if (c > 0) {        /* Stuff the data into the input queue of the other end */        c = tty_insert_flip_string(to->port, buf, c);        /* And shovel */        if (c)            tty_flip_buffer_push(to->port);    }    return c;}
开发者ID:royceniu,项目名称:RP2_MPTCP,代码行数:16,


示例4: kobil_read_int_callback

static void kobil_read_int_callback(struct urb *urb){    int result;    struct usb_serial_port *port = urb->context;    struct tty_struct *tty;    unsigned char *data = urb->transfer_buffer;    int status = urb->status;    /*	char *dbg_data; */    dbg("%s - port %d", __func__, port->number);    if (status) {        dbg("%s - port %d Read int status not zero: %d",            __func__, port->number, status);        return;    }    tty = tty_port_tty_get(&port->port);    if (urb->actual_length) {        /* BEGIN DEBUG */        /*          dbg_data = kzalloc((3 *  purb->actual_length + 10)        				* sizeof(char), GFP_KERNEL);          if (! dbg_data) {        	  return;          }          for (i = 0; i < purb->actual_length; i++) {        	  sprintf(dbg_data +3*i, "%02X ", data[i]);          }          dbg(" <-- %s", dbg_data);          kfree(dbg_data);        */        /* END DEBUG */        tty_buffer_request_room(tty, urb->actual_length);        tty_insert_flip_string(tty, data, urb->actual_length);        tty_flip_buffer_push(tty);    }    tty_kref_put(tty);    /* someone sets the dev to 0 if the close method has been called */    port->interrupt_in_urb->dev = port->serial->dev;    result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);    dbg("%s - port %d Send read URB returns: %i",        __func__, port->number, result);}
开发者ID:KroMignon,项目名称:linux-emcraft,代码行数:47,


示例5: receive_chars_read

static int receive_chars_read(struct uart_port *port, struct tty_struct *tty){	int saw_console_brk = 0;	int limit = 10000;	while (limit-- > 0) {		unsigned long ra = __pa(con_read_page);		unsigned long bytes_read, i;		long stat = sun4v_con_read(ra, PAGE_SIZE, &bytes_read);		if (stat != HV_EOK) {			bytes_read = 0;			if (stat == CON_BREAK) {				if (uart_handle_break(port))					continue;				saw_console_brk = 1;				*con_read_page = 0;				bytes_read = 1;			} else if (stat == CON_HUP) {				hung_up = 1;				uart_handle_dcd_change(port, 0);				continue;			} else {				/* HV_EWOULDBLOCK, etc.  */				break;			}		}		if (hung_up) {			hung_up = 0;			uart_handle_dcd_change(port, 1);		}		for (i = 0; i < bytes_read; i++)			uart_handle_sysrq_char(port, con_read_page[i]);		if (tty == NULL)			continue;		port->icount.rx += bytes_read;		tty_insert_flip_string(tty, con_read_page, bytes_read);	}	return saw_console_brk;}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:47,


示例6: flush_and_resubmit_read_urb

/* Push data to tty layer and resubmit the bulk read URB */static void flush_and_resubmit_read_urb(struct usb_serial_port *port){	struct urb *urb = port->read_urb;	struct tty_struct *tty = port->port.tty;	int room;	/* Push data to tty */	if (tty && urb->actual_length) {		room = tty_buffer_request_room(tty, urb->actual_length);		if (room) {			tty_insert_flip_string(tty, urb->transfer_buffer, room);			tty_flip_buffer_push(tty);		}	}	resubmit_read_urb(port, GFP_ATOMIC);}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:18,


示例7: safe_read_bulk_callback

static void safe_read_bulk_callback(struct urb *urb){	struct usb_serial_port *port =  urb->context;	unsigned char *data = urb->transfer_buffer;	unsigned char length = urb->actual_length;	int result;	int status = urb->status;	dbg("%s", __func__);	if (status) {		dbg("%s - nonzero read bulk status received: %d",		    __func__, status);		return;	}	dbg("safe_read_bulk_callback length: %d",					port->read_urb->actual_length);#ifdef ECHO_RCV	{		int i;		unsigned char *cp = port->read_urb->transfer_buffer;		for (i = 0; i < port->read_urb->actual_length; i++) {			if ((i % 32) == 0)				printk("/nru[%02x] ", i);			printk("%02x ", *cp++);		}		printk("/n");	}#endif	if (safe) {		__u16 fcs;		fcs = fcs_compute10(data, length, CRC10_INITFCS);		if (!fcs) {			int actual_length = data[length - 2] >> 2;			if (actual_length <= (length - 2)) {				info("%s - actual: %d", __func__,							actual_length);				tty_insert_flip_string(port->port.tty,							data, actual_length);				tty_flip_buffer_push(port->port.tty);			} else {				err("%s - inconsistent lengths %d:%d",					__func__, actual_length, length);			}		} else {
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:46,


示例8: aircable_process_packet

static int aircable_process_packet(struct tty_struct *tty,                                   struct usb_serial_port *port, int has_headers,                                   char *packet, int len){    if (has_headers) {        len -= HCI_HEADER_LENGTH;        packet += HCI_HEADER_LENGTH;    }    if (len <= 0) {        dev_dbg(&port->dev, "%s - malformed packet/n", __func__);        return 0;    }    tty_insert_flip_string(tty, packet, len);    return len;}
开发者ID:kennethlyn,项目名称:parallella-lcd-linux,代码行数:17,


示例9: empeg_read_bulk_callback

static void empeg_read_bulk_callback (struct urb *urb){	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;	struct tty_struct *tty;	unsigned char *data = urb->transfer_buffer;	int result;	int status = urb->status;	dbg("%s - port %d", __FUNCTION__, port->number);	if (status) {		dbg("%s - nonzero read bulk status received: %d",		    __FUNCTION__, status);		return;	}	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);	tty = port->tty;	if (urb->actual_length) {		tty_buffer_request_room(tty, urb->actual_length);		tty_insert_flip_string(tty, data, urb->actual_length);		tty_flip_buffer_push(tty);		bytes_in += urb->actual_length;	}	/* Continue trying to always read  */	usb_fill_bulk_urb(		port->read_urb,		port->serial->dev, 		usb_rcvbulkpipe(port->serial->dev,			port->bulk_in_endpointAddress),		port->read_urb->transfer_buffer,		port->read_urb->transfer_buffer_length,		empeg_read_bulk_callback,		port);	result = usb_submit_urb(port->read_urb, GFP_ATOMIC);	if (result)		dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d/n", __FUNCTION__, result);	return;}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:46,


示例10: serial_omap_rxdma_poll

static void serial_omap_rxdma_poll(unsigned long uart_no){	struct uart_omap_port *up = ui[uart_no];	unsigned int curr_dma_pos, curr_transmitted_size;	int ret = 0;	curr_dma_pos = omap_get_dma_dst_pos(up->uart_dma.rx_dma_channel);	if ((curr_dma_pos == up->uart_dma.prev_rx_dma_pos) ||			     (curr_dma_pos == 0)) {		if (jiffies_to_msecs(jiffies - up->port_activity) <						up->uart_dma.rx_timeout) {			mod_timer(&up->uart_dma.rx_timer, jiffies +				usecs_to_jiffies(up->uart_dma.rx_poll_rate));		} else {			serial_omap_stop_rxdma(up);			up->ier |= (UART_IER_RDI | UART_IER_RLSI);			serial_out(up, UART_IER, up->ier);		}		return;	}	curr_transmitted_size = curr_dma_pos -					up->uart_dma.prev_rx_dma_pos;	up->port.icount.rx += curr_transmitted_size;	tty_insert_flip_string(up->port.state->port.tty,			up->uart_dma.rx_buf +			(up->uart_dma.prev_rx_dma_pos -			up->uart_dma.rx_buf_dma_phys),			curr_transmitted_size);	tty_flip_buffer_push(up->port.state->port.tty);	up->uart_dma.prev_rx_dma_pos = curr_dma_pos;	if (up->uart_dma.rx_buf_size +			up->uart_dma.rx_buf_dma_phys == curr_dma_pos) {		ret = serial_omap_start_rxdma(up);		if (ret < 0) {			serial_omap_stop_rxdma(up);			up->ier |= (UART_IER_RDI | UART_IER_RLSI);			serial_out(up, UART_IER, up->ier);		}	} else  {		mod_timer(&up->uart_dma.rx_timer, jiffies +			usecs_to_jiffies(up->uart_dma.rx_poll_rate));	}	up->port_activity = jiffies;}
开发者ID:mjduddin,项目名称:B14CKB1RD_kernel_m8,代码行数:45,


示例11: pxa_uart_receive_dma_cb

static void pxa_uart_receive_dma_cb(void *data){	unsigned long flags;	struct uart_pxa_port *up = (struct uart_pxa_port *)data;	struct uart_pxa_dma *pxa_dma = &up->uart_dma;	struct tty_port *port = &up->port.state->port;	unsigned int count;	unsigned char *tmp = pxa_dma->rxdma_addr;	struct dma_tx_state dma_state;	if (!mod_timer(&up->pxa_timer, jiffies + PXA_TIMER_TIMEOUT))		pm_qos_update_request(&up->qos_idle[PXA_UART_RX],				      up->lpm_qos);	dmaengine_tx_status(pxa_dma->rxdma_chan, pxa_dma->rx_cookie,			    &dma_state);	count = DMA_BLOCK - dma_state.residue;	if (up->port.sysrq) {		while (count > 0) {			if (!uart_handle_sysrq_char(&up->port, *tmp)) {				tty_insert_flip_char(port, *tmp, TTY_NORMAL);				up->port.icount.rx++;			}			tmp++;			count--;		}	} else {		tty_insert_flip_string(port, tmp, count);		up->port.icount.rx += count;	}	tty_flip_buffer_push(port);	spin_lock_irqsave(&up->port.lock, flags);	/*	 * DMA_RUNNING flag should be clear only after	 * all dma interface operation completed	 */	pxa_dma->dma_status &= ~RX_DMA_RUNNING;	spin_unlock_irqrestore(&up->port.lock, flags);	if (pxa_dma->rx_stop)		return;	pxa_uart_receive_dma_start(up);	return;}
开发者ID:GalaxyTab4,项目名称:maxicm_kernel_samsung_degaswifi,代码行数:45,


示例12: __dma_rx_complete

static void __dma_rx_complete(void *param){	struct uart_8250_port	*p = param;	struct uart_8250_dma	*dma = p->dma;	struct tty_port		*tty_port = &p->port.state->port;	struct dma_tx_state	state;	int			count;	dma->rx_running = 0;	dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);	count = dma->rx_size - state.residue;	tty_insert_flip_string(tty_port, dma->rx_buf, count);	p->port.icount.rx += count;	tty_flip_buffer_push(tty_port);}
开发者ID:Announcement,项目名称:linux,代码行数:18,


示例13: kobil_read_int_callback

static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs){	int result;	struct usb_serial_port *port = (struct usb_serial_port *) purb->context;	struct tty_struct *tty;	unsigned char *data = purb->transfer_buffer;//	char *dbg_data;	dbg("%s - port %d", __FUNCTION__, port->number);	if (purb->status) {		dbg("%s - port %d Read int status not zero: %d", __FUNCTION__, port->number, purb->status);		return;	}		tty = port->tty; 	if (purb->actual_length) {				// BEGIN DEBUG		/*		  dbg_data = (unsigned char *) kmalloc((3 *  purb->actual_length + 10) * sizeof(char), GFP_KERNEL);		  if (! dbg_data) {		  return;		  }		  memset(dbg_data, 0, (3 *  purb->actual_length + 10));		  for (i = 0; i < purb->actual_length; i++) { 		  sprintf(dbg_data +3*i, "%02X ", data[i]); 		  }		  dbg(" <-- %s", dbg_data );		  kfree(dbg_data);		*/		// END DEBUG		tty_buffer_request_room(tty, purb->actual_length);		tty_insert_flip_string(tty, data, purb->actual_length);		tty_flip_buffer_push(tty);	}	// someone sets the dev to 0 if the close method has been called	port->interrupt_in_urb->dev = port->serial->dev;	result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC ); 	dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);}
开发者ID:ena30,项目名称:snake-os,代码行数:44,


示例14: cyberjack_read_bulk_callback

static void cyberjack_read_bulk_callback(struct urb *urb){	struct usb_serial_port *port = urb->context;	struct cyberjack_private *priv = usb_get_serial_port_data(port);	struct device *dev = &port->dev;	unsigned char *data = urb->transfer_buffer;	short todo;	int result;	int status = urb->status;	usb_serial_debug_data(dev, __func__, urb->actual_length, data);	if (status) {		dev_dbg(dev, "%s - nonzero read bulk status received: %d/n",			__func__, status);		return;	}	if (urb->actual_length) {		tty_insert_flip_string(&port->port, data, urb->actual_length);		tty_flip_buffer_push(&port->port);	}	spin_lock(&priv->lock);	/* Reduce urbs to do by one. */	priv->rdtodo -= urb->actual_length;	/* Just to be sure */	if (priv->rdtodo < 0)		priv->rdtodo = 0;	todo = priv->rdtodo;	spin_unlock(&priv->lock);	dev_dbg(dev, "%s - rdtodo: %d/n", __func__, todo);	/* Continue to read if we have still urbs to do. */	if (todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/) {		result = usb_submit_urb(port->read_urb, GFP_ATOMIC);		if (result)			dev_err(dev, "%s - failed resubmitting read urb, error %d/n",				__func__, result);		dev_dbg(dev, "%s - usb_submit_urb(read urb)/n", __func__);	}}
开发者ID:AshishNamdev,项目名称:linux,代码行数:44,


示例15: kobil_read_int_callback

static void kobil_read_int_callback(struct urb *urb){	int result;	struct usb_serial_port *port = urb->context;	struct tty_struct *tty;	unsigned char *data = urb->transfer_buffer;	int status = urb->status;/*                 */	dbg("%s - port %d", __func__, port->number);	if (status) {		dbg("%s - port %d Read int status not zero: %d",		    __func__, port->number, status);		return;	}	tty = tty_port_tty_get(&port->port);	if (tty && urb->actual_length) {		/*             */		/*                                                                                                                                                                                                                                                                                   */		/*           */		tty_insert_flip_string(tty, data, urb->actual_length);		tty_flip_buffer_push(tty);	}	tty_kref_put(tty);	result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);	dbg("%s - port %d Send read URB returns: %i",			__func__, port->number, result);}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:44,


示例16: navman_read_int_callback

static void navman_read_int_callback(struct urb *urb){	struct usb_serial_port *port = urb->context;	unsigned char *data = urb->transfer_buffer;	struct tty_struct *tty;	int status = urb->status;	int result;	switch (status) {	case 0:		/* success */		break;	case -ECONNRESET:	case -ENOENT:	case -ESHUTDOWN:		/* this urb is terminated, clean up */		dbg("%s - urb shutting down with status: %d",		    __func__, status);		return;	default:		dbg("%s - nonzero urb status received: %d",		    __func__, status);		goto exit;	}	usb_serial_debug_data(debug, &port->dev, __func__,			      urb->actual_length, data);	tty = tty_port_tty_get(&port->port);	if (tty && urb->actual_length) {		tty_buffer_request_room(tty, urb->actual_length);		tty_insert_flip_string(tty, data, urb->actual_length);		tty_flip_buffer_push(tty);	}	tty_kref_put(tty);exit:	result = usb_submit_urb(urb, GFP_ATOMIC);	if (result)		dev_err(&urb->dev->dev,			"%s - Error %d submitting interrupt urb/n",			__func__, result);}
开发者ID:ArthySundaram,项目名称:firstrepo,代码行数:43,


示例17: pty_write

static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c){	struct tty_struct *to = tty->link;	if (tty->stopped || tty->peer_stops) {		return 0;	}	if (c > 0) {		/* Stuff the data into the input queue of the other end */		c = tty_insert_flip_string(to, buf, c);		/* And shovel */		if (c) {			tty_flip_buffer_push(to);			tty_wakeup(tty);		}	}	return c;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:19,


示例18: tty_push

static int tty_push(struct tty_struct *tty, u8 *buf, int len){	int sent = 0;	FUNC_ENTER();	while (sent < len) {		int count = tty_insert_flip_string(			tty, buf + sent, len - sent);		if (count != (len - sent)) {			mux_print(MSG_WARNING,				"written size %d is not wanted %d/n",				count, len - sent);		}		sent += count;		/* tty_flip_buffer_push(tty); */	}	tty_flip_buffer_push(tty);	FUNC_EXIT();	return sent;}
开发者ID:STS-Dev-Team,项目名称:kernel_mapphone_kexec,代码行数:19,


示例19: pty_write

static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c){	struct tty_struct *to = tty->link;	unsigned long flags;	if (tty->stopped)		return 0;	if (c > 0) {		spin_lock_irqsave(&to->port->lock, flags);		/* Stuff the data into the input queue of the other end */		c = tty_insert_flip_string(to->port, buf, c);		/* And shovel */		if (c)			tty_flip_buffer_push(to->port);		spin_unlock_irqrestore(&to->port->lock, flags);	}	return c;}
开发者ID:Lyude,项目名称:linux,代码行数:19,


示例20: omninet_read_bulk_callback

static void omninet_read_bulk_callback(struct urb *urb){	struct usb_serial_port 	*port 	= urb->context;	unsigned char 		*data 	= urb->transfer_buffer;	struct omninet_header 	*header = (struct omninet_header *) &data[0];	int status = urb->status;	int result;	int i;	dbg("%s - port %d", __func__, port->number);	if (status) {		dbg("%s - nonzero read bulk status received: %d",		    __func__, status);		return;	}	if (debug && header->oh_xxx != 0x30) {		if (urb->actual_length) {			printk(KERN_DEBUG "%s: omninet_read %d: ",			       __FILE__, header->oh_len);			for (i = 0; i < (header->oh_len +						OMNINET_HEADERLEN); i++)				printk("%.2x ", data[i]);			printk("/n");		}	}	if (urb->actual_length && header->oh_len) {		struct tty_struct *tty = tty_port_tty_get(&port->port);		tty_insert_flip_string(tty, data + OMNINET_DATAOFFSET,							header->oh_len);		tty_flip_buffer_push(tty);		tty_kref_put(tty);	}	/* Continue trying to always read  */	result = usb_submit_urb(urb, GFP_ATOMIC);	if (result)		dev_err(&port->dev,			"%s - failed resubmitting read urb, error %d/n",			__func__, result);}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:43,


示例21: mts_stop_ready_complete

int mts_stop_ready_complete(void){	int num_push = 0, total_push = 0;	int left = strlen(stop_push);	struct mts_tty *mts_tty_drv = mts_tty;	if (mts_tty_drv == NULL)  {		return -1;	}	//num_push = tty_insert_flip_string(mts_tty_drv->tty_struct,	num_push = tty_insert_flip_string(mts_tty_drv->mts_tty_port,			stop_push + total_push, left);	total_push += num_push;	left -= num_push;	//tty_flip_buffer_push(mts_tty_drv->tty_struct);	tty_flip_buffer_push(mts_tty_drv->mts_tty_port);	printk("%s/n", __func__);	return 0;}
开发者ID:T-Macgnolia,项目名称:android_kernel_lge_g4stylus-stock,代码行数:20,


示例22: spi_tty_handle_data

static void spi_tty_handle_data(void *context, u8 *buf, u32 count){	int cnt, crc, len;	struct spi_tty_s *spi_tty;	spi_msg_header header;	SPI_IPC_INFO("%s, context=%p, buf=%p, count=%d/n", __func__, context, buf, count);	if (!context || !buf || !count) {		pr_err("%s - Invalid param!/n", __func__);		return;	}	spi_ipc_buf_dump("rx header: ", buf, SPI_MSG_HEADER_LEN);	spi_tty = (struct spi_tty_s *) context;	spi_msg_get_header(buf, &header);	crc = spi_msg_cal_crc(&header);	// validate data	if (header.type != 1 || header.len > SPI_MTU || header.fcs != crc) {		pr_err("Invalid data receicved!/n");		return;	}	if (spi_tty->open_count > 0 && header.len > 0) {		len = header.len;		spi_ipc_buf_dump_ascii("rx data: ", buf+SPI_MSG_HEADER_LEN, (len>16?16:len));		SPI_IPC_INFO("insert data to tty/n");		buf += SPI_MSG_HEADER_LEN;		do {			cnt = tty_buffer_request_room(spi_tty->tty, len);			if (cnt == 0)				break;			cnt = tty_insert_flip_string(spi_tty->tty, buf, cnt);			tty_flip_buffer_push(spi_tty->tty);			len -= cnt;			buf += cnt;		}while(len > 0);	}}
开发者ID:Atrix-Dev-Team,项目名称:kernel-MB860,代码行数:41,


示例23: receive_chars

static intreceive_chars(struct uart_max3110 *max, unsigned short *str, int len){	struct uart_port *port = &max->port;	struct tty_port *tport;	char buf[M3110_RX_FIFO_DEPTH];	int r, w, usable;	/* If uart is not opened, just return */	if (!port->state)		return 0;	tport = &port->state->port;	for (r = 0, w = 0; r < len; r++) {		if (str[r] & MAX3110_BREAK &&		    uart_handle_break(port))			continue;		if (str[r] & MAX3110_READ_DATA_AVAILABLE) {			if (uart_handle_sysrq_char(port, str[r] & 0xff))				continue;			buf[w++] = str[r] & 0xff;		}	}	if (!w)		return 0;	for (r = 0; w; r += usable, w -= usable) {		usable = tty_buffer_request_room(tport, w);		if (usable) {			tty_insert_flip_string(tport, buf + r, usable);			port->icount.rx += usable;		}	}	tty_flip_buffer_push(tport);	return r;}
开发者ID:BitOBSessiOn,项目名称:android_kernel_asus_P01M,代码行数:41,


示例24: tty0tty_write

static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer, int count){	struct tty0tty_serial *tty0tty = tty->driver_data;	int retval = -EINVAL;	struct tty_struct  *ttyx = NULL;	        if (!tty0tty)		return -ENODEV;	down(&tty0tty->sem);	if (!tty0tty->open_count)		/* port was not opened */		goto exit;        if( (tty0tty->tty->index % 2) == 0)        {          if(tty0tty_table[tty0tty->tty->index+1] != NULL) 	   if (tty0tty_table[tty0tty->tty->index+1]->open_count > 0)             ttyx=tty0tty_table[tty0tty->tty->index+1]->tty;        }        else        {         if(tty0tty_table[tty0tty->tty->index-1] != NULL) 	   if (tty0tty_table[tty0tty->tty->index-1]->open_count > 0)             ttyx=tty0tty_table[tty0tty->tty->index-1]->tty;        } //        tty->low_latency=1;        if(ttyx != NULL)        {          tty_insert_flip_string(ttyx, buffer, count);          tty_flip_buffer_push(ttyx);	  retval=count;        } 		exit:	up(&tty0tty->sem);	return retval;}
开发者ID:davidLin7692,项目名称:pymodbus,代码行数:41,



注:本文中的tty_insert_flip_string函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tty_kref_get函数代码示例
C++ tty_init函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。