亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hso.c

?? linux系統下3G模塊USB串口驅動程序源代碼最新版本
?? C
?? 第 1 頁 / 共 5 頁
字號:
		return;	}	/* log status, but don't act on it, we don't need to resubmit anything	 * anyhow */	if (status)		log_usb_status(status, __func__);#ifdef CONFIG_HSO_AUTOPM	hso_put_activity(odev->parent);#endif	/* Tell the network interface we are ready for another frame */	netif_wake_queue(odev->net);}/* called by kernel when we need to transmit a packet */static int hso_net_start_xmit(struct sk_buff *skb, struct net_device *net){	struct hso_net *odev = netdev_priv(net);	int result;	/* Tell the kernel, "No more frames 'til we are done with this one." */	netif_stop_queue(net);#ifdef CONFIG_HSO_AUTOPM	if (hso_get_activity(odev->parent) == -EAGAIN) {		odev->skb_tx_buf = skb;		return 0;	}#endif	/* log if asked */	DUMP1(skb->data, skb->len);	/* Copy it from kernel memory to OUR memory */	memcpy(odev->mux_bulk_tx_buf, skb->data, skb->len);	D1("len: %d/%d", skb->len, MUX_BULK_TX_BUF_SIZE);	/* Fill in the URB for shipping it out. */	usb_fill_bulk_urb(odev->mux_bulk_tx_urb,			  odev->parent->usb,			  usb_sndbulkpipe(odev->parent->usb,					  odev->out_endp->					  bEndpointAddress & 0x7F),			  odev->mux_bulk_tx_buf, skb->len, write_bulk_callback,			  odev);	/* Deal with the Zero Length packet problem, I hope */	odev->mux_bulk_tx_urb->transfer_flags |= URB_ZERO_PACKET;	/* Send the URB on its merry way. */	result = usb_submit_urb(odev->mux_bulk_tx_urb, GFP_ATOMIC);	if (result) {		dev_warn(&odev->parent->interface->dev,			"failed mux_bulk_tx_urb %d\n", result);		STATS(net).tx_errors++;		netif_start_queue(net);	} else {		STATS(net).tx_packets++;		STATS(net).tx_bytes += skb->len;		/* And tell the kernel when the last transmit started. */		net->trans_start = jiffies;	}	dev_kfree_skb(skb);	/* we're done */	return result;}static void hso_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info){	struct hso_net *odev = netdev_priv(net);	strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN);	strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);	usb_make_path(odev->parent->usb, info->bus_info, sizeof info->bus_info);}static struct ethtool_ops ops = {	.get_drvinfo = hso_get_drvinfo,	.get_link = ethtool_op_get_link};/*============================================================================= *	function:	hso_net_ioctl *	purpose: *============================================================================= */static int hso_net_ioctl(struct net_device *net, struct ifreq *rq, int cmd){	struct hso_net *odev = netdev_priv(net);	u32 usercmd = 0;	char tmp[40];	switch (cmd) {	case SIOCDEVPRIVATE + 1: /* Chose this one because */		/* SIOCDEVPRIVATE used somewhere else in this code. */		/* return the number of sent bytes */		D5("Transmitted: %lu", STATS(net).tx_bytes);		rq->ifr_ifru.ifru_ivalue = STATS(net).tx_bytes;		return 0;	case SIOCETHTOOL:		/* net specific */		if (copy_from_user(&usercmd, rq->ifr_data, sizeof(usercmd)))			return -EFAULT;		switch (usercmd) {		case ETHTOOL_GDRVINFO: {			/* get driver info */			struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };			strncpy(info.driver, driver_name, ETHTOOL_BUSINFO_LEN);			strncpy(info.version, DRIVER_VERSION,				ETHTOOL_BUSINFO_LEN);			sprintf(tmp, "usb%d:%d",				odev->parent->usb->bus->busnum,				odev->parent->usb->devnum);			strncpy(info.bus_info, tmp, ETHTOOL_BUSINFO_LEN);			sprintf(tmp, "%s ", driver_name);			strncpy(info.fw_version, tmp, ETHTOOL_BUSINFO_LEN);			if (copy_to_user(rq->ifr_data, &info, sizeof(info)))				return -EFAULT;			return 0;		}		case ETHTOOL_GLINK: {			/* get link status */			struct ethtool_value edata = { ETHTOOL_GLINK };			edata.data = netif_carrier_ok(net);			if (copy_to_user(rq->ifr_data, &edata, sizeof(edata)))				return -EFAULT;			return 0;		}		default: {			netdev_warn(net, "Got unsupported ioctl: %x\n",				    usercmd);			return -EOPNOTSUPP;                        /* the ethtool user space tool */			/*relies on this */		}		}	default:		return -ENOTTY;	/* per ioctl man page */	}}/*============================================================================= *	function:	hso_net_get_stats *	purpose:	 *============================================================================= */#if (!NETDEVICE_HAS_STATS)static struct net_device_stats *hso_net_get_stats(struct net_device *net){	return &((struct hso_net *) netdev_priv(net))->stats;}#endif/* called when a packet did not ack after watchdogtimeout */static void hso_net_tx_timeout(struct net_device *net){	struct hso_net *odev = netdev_priv(net);	if (!odev)		return;	/* Tell syslog we are hosed. */	netdev_warn(net, "Tx timed out.\n");	/* Tear the waiting frame off the list */	if (odev->mux_bulk_tx_urb	    && (odev->mux_bulk_tx_urb->status == -EINPROGRESS))		safe_usb_unlink_urb(odev->mux_bulk_tx_urb);	/* Update statistics */	STATS(net).tx_errors++;}/* make a real packet from the received USB buffer */static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,			unsigned int count, unsigned char is_eop){	unsigned short temp_bytes;	unsigned short buffer_offset = 0;	unsigned short frame_len;	unsigned char *tmp_rx_buf;	/* log if needed */	D1("Rx %d bytes", count);	DUMP(ip_pkt, min(128, (int)count));	while (count) {		switch (odev->rx_parse_state) {		case WAIT_IP:			/* waiting for IP header. */			/* wanted bytes - size of ip header */			temp_bytes =			    (count <			     odev->rx_buf_missing) ? count : odev->			    rx_buf_missing;			memcpy(((unsigned char *)(&odev->rx_ip_hdr)) +			       odev->rx_buf_size, ip_pkt + buffer_offset,			       temp_bytes);			odev->rx_buf_size += temp_bytes;			buffer_offset += temp_bytes;			odev->rx_buf_missing -= temp_bytes;			count -= temp_bytes;			if (!odev->rx_buf_missing) {				/* header is complete allocate an sk_buffer and				 * continue to WAIT_DATA */				frame_len = ntohs(odev->rx_ip_hdr.tot_len);				if ((frame_len > DEFAULT_MRU) ||				    (frame_len < sizeof(struct iphdr))) {					netdev_err(odev->net,						"Invalid frame (%d) length\n",						frame_len);					odev->rx_parse_state = WAIT_SYNC;					continue;				}				/* Allocate an sk_buff */				odev->skb_rx_buf = dev_alloc_skb(frame_len);				if (!odev->skb_rx_buf) {					/* We got no receive buffer. */					D1("could not allocate memory");					odev->rx_parse_state = WAIT_SYNC;					return;				}				/* Here's where it came from */				odev->skb_rx_buf->dev = odev->net;				/* Copy what we got so far. make room for iphdr				 * after tail. */				tmp_rx_buf =				    skb_put(odev->skb_rx_buf,					    sizeof(struct iphdr));				memcpy(tmp_rx_buf, (char *)&(odev->rx_ip_hdr),				       sizeof(struct iphdr));				/* ETH_HLEN */				odev->rx_buf_size = sizeof(struct iphdr);				/* Filip actually use .tot_len */				odev->rx_buf_missing =				    frame_len - sizeof(struct iphdr);				odev->rx_parse_state = WAIT_DATA;			}			break;		case WAIT_DATA:			temp_bytes = (count < odev->rx_buf_missing)					? count : odev->rx_buf_missing;			/* Copy the rest of the bytes that are left in the			 * buffer into the waiting sk_buf. */			/* Make room for temp_bytes after tail. */			tmp_rx_buf = skb_put(odev->skb_rx_buf, temp_bytes);			memcpy(tmp_rx_buf, ip_pkt + buffer_offset, temp_bytes);			odev->rx_buf_missing -= temp_bytes;			count -= temp_bytes;			buffer_offset += temp_bytes;			odev->rx_buf_size += temp_bytes;			if (!odev->rx_buf_missing) {				/* Packet is complete. Inject into stack. */				/* We have IP packet here */				odev->skb_rx_buf->protocol =						__constant_htons(ETH_P_IP);				/* don't check it */				odev->skb_rx_buf->ip_summed =					CHECKSUM_UNNECESSARY;				skb_reset_mac_header(odev->skb_rx_buf);				/* Ship it off to the kernel */				netif_rx(odev->skb_rx_buf);				/* No longer our buffer. */				odev->skb_rx_buf = NULL;				/* update out statistics */				STATS(odev->net).rx_packets++;				STATS(odev->net).rx_bytes += odev->rx_buf_size;				odev->rx_buf_size = 0;				odev->rx_buf_missing = sizeof(struct iphdr);				odev->rx_parse_state = WAIT_IP;			}			break;		case WAIT_SYNC:			D1(" W_S");			count = 0;			break;		default:			D1(" ");			count--;			break;		}	}	/* Recovery mechanism for WAIT_SYNC state. */	if (is_eop) {		if (odev->rx_parse_state == WAIT_SYNC) {			odev->rx_parse_state = WAIT_IP;			odev->rx_buf_size = 0;			odev->rx_buf_missing = sizeof(struct iphdr);		}	}}/* Moving data from usb to kernel (in interrupt state) */static void read_bulk_callback(CALLBACK_ARGS){	struct hso_net *odev = urb->context;	struct net_device *net;	int result;	int status = urb->status;	/* is al ok?  (Filip: Who's Al ?) */	if (status) {		log_usb_status(status, __func__);		return;	}	/* Sanity check */	if (!odev || !test_bit(HSO_NET_RUNNING, &odev->flags)) {		D1("BULK IN callback but driver is not active!");		return;	}#ifdef CONFIG_HSO_AUTOPM	usb_mark_last_busy(urb->dev);#endif	net = odev->net;	if (!netif_device_present(net)) {		/* Somebody killed our network interface... */		return;	}	if (odev->parent->port_spec & HSO_INFO_CRC_BUG) {		u32 rest;		u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };		rest = urb->actual_length % odev->in_endp->wMaxPacketSize;		if (((rest == 5) || (rest == 6))		    && !memcmp(((u8 *) urb->transfer_buffer) +			       urb->actual_length - 4, crc_check, 4)) {			urb->actual_length -= 4;		}	}	/* do we even have a packet? */	if (urb->actual_length) {		/* Handle the IP stream, add header and push it onto network		 * stack if the packet is complete. */		spin_lock(&odev->net_lock);		packetizeRx(odev, urb->transfer_buffer, urb->actual_length,			    (urb->transfer_buffer_length >			     urb->actual_length) ? 1 : 0);		spin_unlock(&odev->net_lock);	}	/* We are done with this URB, resubmit it. Prep the USB to wait for	 * another frame. Reuse same as received. */	usb_fill_bulk_urb(urb,			  odev->parent->usb,			  usb_rcvbulkpipe(odev->parent->usb,					  odev->in_endp->					  bEndpointAddress & 0x7F),			  urb->transfer_buffer, MUX_BULK_RX_BUF_SIZE,			  read_bulk_callback, odev);	/* Give this to the USB subsystem so it can tell us when more data	 * arrives. */	result = usb_submit_urb(urb, GFP_ATOMIC);	if (result)		dev_warn(&odev->parent->interface->dev,			 "%s failed submit mux_bulk_rx_urb %d\n", __func__,			 result);}/* Serial driver functions */static void _hso_serial_set_termios(struct tty_struct *tty,				    struct TERMIOS *old){	struct hso_serial *serial = get_serial_by_tty(tty);	struct TERMIOS *termios;	if ((!tty) || (!tty->termios) || (!serial)) {		printk(KERN_ERR "%s: no tty structures", __func__);		return;	}	D4("port %d", serial->minor);	/*	 * The default requirements for this device are:	 */	termios = tty->termios;	termios->c_iflag &=		~(IGNBRK	/* disable ignore break */		| BRKINT	/* disable break causes interrupt */		| PARMRK	/* disable mark parity errors */		| ISTRIP	/* disable clear high bit of input characters */		| INLCR		/* disable translate NL to CR */		| IGNCR		/* disable ignore CR */		| ICRNL		/* disable translate CR to NL */		| IXON);	/* disable enable XON/XOFF flow control */	/* disable postprocess output characters */	termios->c_oflag &= ~OPOST;	termios->c_lflag &=		~(ECHO		/* disable echo input characters */		| ECHONL	/* disable echo new line */		| ICANON	/* disable erase, kill, werase, and rprnt				   special characters */		| ISIG		/* disable interrupt, quit, and suspend special				   characters */		| IEXTEN);	/* disable non-POSIX special characters */	termios->c_cflag &=		~(CSIZE		/* no size */		| PARENB	/* disable parity bit */		| CBAUD		/* clear current baud rate */		| CBAUDEX);	/* clear current buad rate */	termios->c_cflag |= CS8;	/* character size 8 bits */#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26))	/* baud rate 115200 */	tty_encode_baud_rate(serial->tty, 115200, 115200);#endif	/*	 * Force low_latency on; otherwise the pushes are scheduled;	 * this is bad as it opens up the possibility of dropping bytes	 * on the floor.  We don't want to drop bytes on the floor. :)	 */	serial->tty->low_latency = 1;#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26))	serial->tty->termios->c_cflag |= B115200; /* baud rate 115200 */	serial->tty->ldisc.set_termios(serial->tty, NULL);#endif	return;}static void hso_resubmit_rx_bulk_urb(struct hso_serial *serial, struct urb *urb){	int result;#ifdef CONFIG_HSO_AUTOPM	usb_mark_last_busy(urb->dev);#endif	/* We are done with this URB, resubmit it. Prep the USB to wait for	 * another frame */	usb_fill_bulk_urb(urb, serial->parent->usb,			  usb_rcvbulkpipe(serial->parent->usb,					  serial->in_endp->					  bEndpointAddress & 0x7F),			  urb->transfer_buffer, serial->rx_data_length,			  hso_std_serial_read_bulk_callback, serial);	/* Give this to the USB subsystem so it can tell us when more data	 * arrives. */	result = usb_submit_urb(urb, GFP_ATOMIC);	if (result) {		dev_err(&urb->dev->dev, "%s failed submit serial rx_urb %d\n",			__func__, result);	}}static void put_rxbuf_data_and_resubmit_bulk_urb(struct hso_serial *serial){	int count;	struct urb *curr_urb;	while (serial->rx_urb_filled[serial->curr_rx_urb_idx]) {		curr_urb = serial->rx_urb[serial->curr_rx_urb_idx];		count = put_rxbuf_data(curr_urb, serial);		if (count == -1)			return;		if (count == 0) {			serial->curr_rx_urb_idx++;			if (serial->curr_rx_urb_idx >= serial->num_rx_urbs)				serial->curr_rx_urb_idx = 0;			hso_resubmit_rx_bulk_urb(serial, curr_urb);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
制服丝袜国产精品| 欧美精品一区视频| 欧美一级精品大片| 国产精品素人一区二区| 亚洲成人三级小说| 成人美女视频在线观看18| 在线一区二区三区四区五区| xnxx国产精品| 日韩在线观看一区二区| 99精品欧美一区| 久久亚洲一区二区三区四区| 亚洲一区二区精品久久av| 国产v日产∨综合v精品视频| 91精品国产一区二区人妖| 自拍偷拍亚洲综合| 不卡电影免费在线播放一区| 精品免费视频.| 午夜av一区二区三区| 91一区在线观看| 日本一区二区动态图| 免费美女久久99| 欧美性一二三区| 亚洲精品久久7777| 91黄色激情网站| 亚洲日本在线a| 色综合久久综合网| 亚洲女人的天堂| 91在线观看地址| 亚洲三级在线免费观看| www.欧美日韩| 亚洲日本在线天堂| 在线中文字幕一区| 一区二区三区精品在线观看| 91一区一区三区| 一区二区成人在线观看| 在线一区二区三区四区| 午夜久久电影网| 3d动漫精品啪啪一区二区竹菊| 亚洲成人先锋电影| 日韩一区二区三区观看| 久久99精品久久久久久国产越南| 欧美一区二区免费| 韩国成人精品a∨在线观看| 26uuu久久综合| 成人精品一区二区三区四区| 国产精品传媒视频| 欧美综合久久久| 婷婷综合在线观看| 日韩久久久久久| 国产成人av在线影院| 国产精品高清亚洲| 欧美视频一区二区三区| 日韩在线一区二区三区| 精品成a人在线观看| 成人精品免费看| 一区二区三区色| 欧美电影免费观看高清完整版在线观看| 久久精工是国产品牌吗| 国产日韩欧美高清| 在线观看免费视频综合| 另类小说欧美激情| 国产精品白丝在线| 欧美二区在线观看| 懂色中文一区二区在线播放| 一区二区三区视频在线观看| 日韩一区二区三区在线| www.日韩在线| 蜜桃一区二区三区在线观看| 国产精品私人自拍| 欧美一级搡bbbb搡bbbb| av欧美精品.com| 男女男精品视频网| 亚洲女与黑人做爰| 久久久久久久久久久久久久久99| 一本大道久久a久久综合婷婷| 久久精品国产亚洲aⅴ| ●精品国产综合乱码久久久久| 欧美精品在线视频| 99久久久精品| 激情国产一区二区| 香蕉av福利精品导航| 中文字幕欧美三区| 91精品国产高清一区二区三区蜜臀| 国产宾馆实践打屁股91| 天堂久久久久va久久久久| 国产精品久久久久久久第一福利 | 中文字幕在线观看不卡视频| 91麻豆精品国产自产在线| 成人三级在线视频| 极品销魂美女一区二区三区| 亚洲在线视频网站| 成人免费在线视频观看| 久久久天堂av| 精品国产电影一区二区| 欧美日韩成人综合在线一区二区| av激情亚洲男人天堂| 国产一区二区三区精品视频| 日韩和欧美一区二区三区| 亚洲六月丁香色婷婷综合久久| 国产日韩欧美电影| 欧美精品一区二区蜜臀亚洲| 欧美一级久久久久久久大片| 欧美日韩高清一区二区| 在线视频欧美区| 97超碰欧美中文字幕| 成人高清视频在线| 国产精品原创巨作av| 激情国产一区二区| 国产一区二区在线观看视频| 黑人精品欧美一区二区蜜桃| 久久国产尿小便嘘嘘| 全国精品久久少妇| 老汉av免费一区二区三区| 日韩国产精品久久| 免费在线观看一区二区三区| 午夜视频在线观看一区| 亚洲成人免费在线观看| 午夜精品一区二区三区免费视频| 天天综合天天做天天综合| 性欧美大战久久久久久久久| 亚洲一区二区在线免费观看视频| 亚洲成人精品一区二区| 日本不卡视频一二三区| 欧美a一区二区| 九九九精品视频| 粉嫩aⅴ一区二区三区四区五区| 成人美女在线观看| 在线免费观看不卡av| 欧美无人高清视频在线观看| 欧美精品一卡两卡| 欧美精品一区二区三区蜜桃视频| 久久九九久久九九| 亚洲欧美在线另类| 午夜精品一区在线观看| 极品尤物av久久免费看| 成人免费观看视频| 欧美视频中文字幕| 精品精品国产高清a毛片牛牛| 精品国产免费一区二区三区香蕉| 欧美国产成人在线| 亚洲va欧美va天堂v国产综合| 日韩国产精品久久| 成人91在线观看| 欧美精品第1页| 国产亚洲精品资源在线26u| 亚洲人成伊人成综合网小说| 丝袜国产日韩另类美女| 国产mv日韩mv欧美| 欧美日韩精品免费观看视频| 久久综合九色欧美综合狠狠| 亚洲少妇中出一区| 国产又粗又猛又爽又黄91精品| 色婷婷综合五月| 久久综合成人精品亚洲另类欧美| 亚洲男帅同性gay1069| 狠狠色综合日日| 欧美午夜影院一区| 国产精品无遮挡| 青青草国产成人99久久| 一本一本久久a久久精品综合麻豆| 日韩一级完整毛片| 一区二区三区加勒比av| 国产九九视频一区二区三区| 在线播放中文一区| 1024成人网| 国产精品一卡二| 欧美一级久久久| 亚洲.国产.中文慕字在线| 北岛玲一区二区三区四区| 日韩一区二区三免费高清| 一卡二卡三卡日韩欧美| 成人h动漫精品一区二| 精品91自产拍在线观看一区| 亚洲午夜久久久久久久久电影网| 高清视频一区二区| 欧美tickling网站挠脚心| 午夜精品久久久久久| 91碰在线视频| 国产精品午夜电影| 高清在线成人网| 久久久精品影视| 麻豆91小视频| 欧美tickle裸体挠脚心vk| 婷婷亚洲久悠悠色悠在线播放 | 国产寡妇亲子伦一区二区| 这里只有精品视频在线观看| 亚洲精品乱码久久久久久日本蜜臀| 国产一区二区三区在线观看免费视频| 欧美日韩日日夜夜| 亚洲v日本v欧美v久久精品| 91久久精品国产91性色tv| 亚洲人精品午夜| 色综合久久中文字幕综合网| 国产精品电影一区二区三区| 99在线精品免费| 成人欧美一区二区三区黑人麻豆 | 国产高清精品在线| 国产日韩欧美综合一区| 国产精品一级片| 国产精品欧美久久久久一区二区|