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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? stub_rx.c

?? linux virtual usb host source
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * $Id: stub_rx.c 66 2008-04-20 13:19:42Z hirofuchi $ * * Copyright (C) 2003-2008 Takahiro Hirofuchi * * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */#include "usbip_common.h"#include "stub.h"static int is_clear_halt_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	req = (struct usb_ctrlrequest *) urb->setup_packet;	 return (req->bRequest == USB_REQ_CLEAR_FEATURE) &&		 (req->bRequestType == USB_RECIP_ENDPOINT) &&		 (req->wValue == USB_ENDPOINT_HALT);}static int is_set_interface_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	req = (struct usb_ctrlrequest *) urb->setup_packet;	return (req->bRequest == USB_REQ_SET_INTERFACE) &&		   (req->bRequestType == USB_RECIP_INTERFACE);}static int is_set_configuration_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	req = (struct usb_ctrlrequest *) urb->setup_packet;	return (req->bRequest == USB_REQ_SET_CONFIGURATION) &&		   (req->bRequestType == USB_RECIP_DEVICE);}#if 0static int is_reset_device_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	__u16 value;	__u16 index;	req = (struct usb_ctrlrequest *) urb->setup_packet;	value = le16_to_cpu(req->wValue);	index = le16_to_cpu(req->wIndex);	if ((req->bRequest == USB_REQ_SET_FEATURE) &&	    	(req->bRequestType == USB_RT_PORT) &&		(value = USB_PORT_FEAT_RESET)) {		dbg_stub_rx("reset_device_cmd, port %u\n", index);		return 1;	} else 		return 0;}#endifstatic int tweak_clear_halt_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	int target_endp;	int target_dir;	int target_pipe;	int ret;	req = (struct usb_ctrlrequest *) urb->setup_packet;	/*	 * The stalled endpoint is specified in the wIndex value. The endpoint	 * of the urb is the target of this clear_halt request (i.e., control	 * endpoint).	 */	target_endp = le16_to_cpu(req->wIndex) & 0x000f;	/* the stalled endpoint direction is IN or OUT?. USB_DIR_IN is 0x80. */	target_dir = le16_to_cpu(req->wIndex) & 0x0080;	if (target_dir)		target_pipe = usb_rcvctrlpipe(urb->dev, target_endp);	else		target_pipe = usb_sndctrlpipe(urb->dev, target_endp);	ret = usb_clear_halt(urb->dev, target_pipe);	if (ret < 0)		uinfo("clear_halt error: devnum %d endp %d, %d\n",				urb->dev->devnum, target_endp, ret);	else		uinfo("clear_halt done: devnum %d endp %d\n",				urb->dev->devnum, target_endp);	return ret;}static int tweak_set_interface_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	__u16 alternate;	__u16 interface;	int ret;	req = (struct usb_ctrlrequest *) urb->setup_packet;	alternate = le16_to_cpu(req->wValue);	interface = le16_to_cpu(req->wIndex);	dbg_stub_rx("set_interface: inf %u alt %u\n", interface, alternate);	ret = usb_set_interface(urb->dev, interface, alternate);	if (ret < 0)		uinfo("set_interface error: inf %u alt %u, %d\n",				interface, alternate, ret);	else		uinfo("set_interface done: inf %u alt %u\n", interface, alternate);	return ret;}static int tweak_set_configuration_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	__u16 config;	req = (struct usb_ctrlrequest *) urb->setup_packet;	config = le16_to_cpu(req->wValue);	/*	 * I have never seen a multi-config device. Very rare.	 * For most devices, this will be called to choose a default	 * configuration only once in an initialization phase.	 *	 * set_configuration may change a device configuration and its device	 * drivers will be unbound and assigned for a new device configuration.	 * This means this usbip driver will be also unbound when called, then	 * eventually reassigned to the device as far as driver matching	 * condition is kept.	 *	 * Unfortunatelly, an existing usbip connection will be dropped	 * due to this driver unbinding. So, skip here.	 * A user may need to set a special configuration value before	 * exporting the device.	 */	uinfo("set_configuration (%d) to %s\n", config, urb->dev->dev.bus_id);	uinfo("but, skip!\n");#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)	return 0;	//return usb_driver_set_configuration(urb->dev, config);#else	//uinfo("no support of set_config in 2.6.18\n");	return 0;#endif}#if 0static int tweak_reset_device_cmd(struct urb *urb){	struct usb_ctrlrequest *req;	__u16 value;	__u16 index;	int ret;	req = (struct usb_ctrlrequest *) urb->setup_packet;	value = le16_to_cpu(req->wValue);	index = le16_to_cpu(req->wIndex);	uinfo("reset_device (port %d) to %s\n", index, urb->dev->dev.bus_id);	/* all interfaces should be owned by usbip driver, so just reset it. */	ret = usb_lock_device_for_reset(urb->dev, NULL);	if (ret < 0) {		uerr("lock for reset\n");		return ret;	}	/* try to reset the device */	ret = usb_reset_composite_device(urb->dev, NULL);	if (ret < 0)		uerr("device reset\n");	usb_unlock_device(urb->dev);	return ret;}#endif/* * clear_halt, set_interface, and set_configuration require special tricks. */static void tweak_special_requests(struct urb *urb){	if (!urb || !urb->setup_packet)		return;	if (usb_pipetype(urb->pipe) != PIPE_CONTROL)		return;	if (is_clear_halt_cmd(urb))		/* tweak clear_halt */		 tweak_clear_halt_cmd(urb);	else if (is_set_interface_cmd(urb))		/* tweak set_interface */		tweak_set_interface_cmd(urb);	else if (is_set_configuration_cmd(urb))		/* tweak set_configuration */		tweak_set_configuration_cmd(urb);#if 0	else if (is_reset_device_cmd(urb))		tweak_reset_device_cmd(urb);#endif	else		dbg_stub_rx("no need to tweak\n");}/* * stub_recv_unlink() unlinks the URB by a call to usb_unlink_urb(). * By unlinking the urb asynchronously, stub_rx can continuously * process coming urbs.  Even if the urb is unlinked, its completion * handler will be called and stub_tx will send a return pdu. * * See also comments about unlinking strategy in vhci_hcd.c. */static int stub_recv_cmd_unlink(struct stub_device *sdev, struct usbip_header *pdu){	struct list_head *listhead = &sdev->priv_init;	struct list_head *ptr;	unsigned long flags;	struct stub_priv *priv;	spin_lock_irqsave(&sdev->priv_lock, flags);	for (ptr = listhead->next; ptr != listhead; ptr = ptr->next) {		priv = list_entry(ptr, struct stub_priv, list);		if (priv->seqnum == pdu->u.cmd_unlink.seqnum) {			int ret;			uinfo("unlink urb %p\n", priv->urb);			/*			 * This matched urb is not completed yet (i.e., be in			 * flight in usb hcd hardware/driver). Now we are			 * cancelling it. The unlinking flag means that we are			 * now not going to return the normal result pdu of a			 * submission request, but going to return a result pdu			 * of the unlink request.			 */			priv->unlinking = 1;			/*			 * In the case that unlinking flag is on, prev->seqnum			 * is changed from the seqnum of the cancelling urb to			 * the seqnum of the unlink request. This will be used			 * to make the result pdu of the unlink request.			 */			priv->seqnum = pdu->base.seqnum;			spin_unlock_irqrestore(&sdev->priv_lock, flags);			/*			 * usb_unlink_urb() is now out of spinlocking to avoid			 * spinlock recursion since stub_complete() is			 * sometimes called in this context but not in the			 * interrupt context.  If stub_complete() is executed			 * before we call usb_unlink_urb(), usb_unlink_urb()			 * will return an error value. In this case, stub_tx			 * will return the result pdu of this unlink request			 * though submission is completed and actual unlinking			 * is not executed. OK?			 */			/* In the above case, urb->status is not -ECONNRESET,			 * so a driver in a client host will know the failure			 * of the unlink request ?			 */			ret = usb_unlink_urb(priv->urb);			if (ret != -EINPROGRESS)				uerr("faild to unlink a urb %p, ret %d\n", priv->urb, ret);			return 0;		}	}	dbg_stub_rx("seqnum %d is not pending\n", pdu->u.cmd_unlink.seqnum);	/*	 * The urb of the unlink target is not found in priv_init queue. It was	 * already completed and its results is/was going to be sent by a	 * CMD_RET pdu. In this case, usb_unlink_urb() is not needed. We only	 * return the completeness of this unlink request to vhci_hcd.	 */	stub_enqueue_ret_unlink(sdev, pdu->base.seqnum, 0);	spin_unlock_irqrestore(&sdev->priv_lock, flags);	return 0;}static int valid_request(struct stub_device *sdev, struct usbip_header *pdu){	struct usbip_device *ud = &sdev->ud;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久精品国产麻豆演员表| 国产精品影视天天线| 色老综合老女人久久久| 亚洲人成小说网站色在线| 色婷婷综合久久久中文一区二区| 一区二区三区四区五区视频在线观看 | 91麻豆高清视频| 一区二区三区日韩精品| 欧美在线视频不卡| 美女免费视频一区| 欧美韩国日本一区| 欧美日韩在线综合| 久久不见久久见免费视频7 | 日韩亚洲欧美一区二区三区| 国产美女精品在线| 亚洲免费视频成人| 久久久精品一品道一区| 成人爽a毛片一区二区免费| 亚洲欧美乱综合| 日韩精品一区二区三区四区| 国产iv一区二区三区| 亚洲美女精品一区| 日韩女优毛片在线| 99r精品视频| 免费在线看成人av| 日韩美女精品在线| 日韩视频一区二区| 色呦呦日韩精品| 国产麻豆视频精品| 亚洲mv大片欧洲mv大片精品| 26uuu国产日韩综合| 欧美专区日韩专区| 国产伦精品一区二区三区在线观看| 亚洲精品视频在线| 精品国产一二三区| 欧美日韩精品欧美日韩精品| 粉嫩欧美一区二区三区高清影视 | 日韩视频免费直播| 91麻豆国产福利在线观看| 韩国精品在线观看| 亚洲午夜久久久久中文字幕久| 国产欧美综合在线| 日韩欧美国产成人一区二区| 欧美伊人精品成人久久综合97| 国产精品123| 精一区二区三区| 亚洲国产成人精品视频| 亚洲视频在线一区二区| 国产亚洲精品免费| 日韩精品一区国产麻豆| 欧美日产在线观看| 欧美这里有精品| 97久久超碰国产精品| 国产精品一区二区久激情瑜伽 | 欧美亚洲国产怡红院影院| 国产大片一区二区| 久久精品国产色蜜蜜麻豆| 亚洲国产一区二区a毛片| 国产精品久久国产精麻豆99网站 | 中文字幕不卡在线观看| 欧美tk—视频vk| 日韩一区二区在线播放| 精品视频999| 欧美日韩一区二区在线观看| 日本高清无吗v一区| 色综合天天综合网国产成人综合天| 国产精品影视网| 国产寡妇亲子伦一区二区| 国产精品白丝jk黑袜喷水| 免费在线看一区| 久久精品国产网站| 久久激情五月婷婷| 成人av电影观看| 大美女一区二区三区| 国产成人免费视频网站高清观看视频 | 91精品国产综合久久久久久久| 欧美日韩一区二区在线观看| 欧美日韩你懂得| 欧美高清视频一二三区| 91精选在线观看| 日韩欧美在线不卡| 亚洲精品一区二区三区精华液 | 国产精品成人一区二区艾草| 国产精品色一区二区三区| 国产精品视频你懂的| 国产精品毛片久久久久久久| 中文字幕av一区 二区| 中文字幕中文字幕在线一区| 亚洲理论在线观看| 亚洲午夜免费电影| 美女精品一区二区| 国产成人午夜99999| 99久久婷婷国产| 欧美猛男男办公室激情| 日韩无一区二区| 国产欧美一区二区精品性色超碰| 国产精品看片你懂得 | 亚洲.国产.中文慕字在线| 五月婷婷综合激情| 国产在线播精品第三| eeuss影院一区二区三区| 91精品办公室少妇高潮对白| 色综合久久久久久久久| 欧美一区二区精品久久911| 亚洲精品一区二区三区精华液| 国产精品久久久久影院亚瑟 | 国产精品久久一级| 亚洲一区在线播放| 久久成人精品无人区| 99久久国产综合精品女不卡| 欧美日韩一区二区在线观看视频| 日韩精品一区二区三区中文精品| 国产无遮挡一区二区三区毛片日本| ㊣最新国产の精品bt伙计久久| 午夜国产不卡在线观看视频| 国产一区美女在线| 色网综合在线观看| 精品嫩草影院久久| 一个色综合网站| 国产乱码一区二区三区| 在线免费av一区| 久久精品这里都是精品| 亚洲6080在线| 99在线热播精品免费| 欧美一区二区三区免费在线看| 国产精品乱码人人做人人爱| 日本va欧美va精品发布| 日本丶国产丶欧美色综合| 精品精品国产高清a毛片牛牛| 伊人婷婷欧美激情| 国产成人免费视频一区| 欧美一区二区三区免费大片| 亚洲综合色婷婷| 欧美日韩一区二区在线视频| 中文字幕乱码久久午夜不卡 | 人人超碰91尤物精品国产| 波多野结衣视频一区| 日韩欧美www| 五月综合激情网| 欧美视频一区二区在线观看| 中文乱码免费一区二区| 激情伊人五月天久久综合| 欧美日韩午夜在线| 亚洲在线成人精品| av电影在线观看完整版一区二区| 久久综合视频网| 久久国产精品第一页| 欧美一区二区网站| 午夜欧美视频在线观看| 欧美性感一类影片在线播放| 亚洲欧美日韩国产成人精品影院| 成人午夜碰碰视频| 国产精品乱码一区二区三区软件| 国产一区二区看久久| 337p日本欧洲亚洲大胆色噜噜| 麻豆精品一二三| 日韩丝袜美女视频| 另类调教123区| 精品国产免费一区二区三区四区| 男女激情视频一区| 日韩欧美一区电影| 蜜桃av一区二区在线观看| 日韩一级二级三级| 日韩**一区毛片| 欧美一区二区人人喊爽| 久久99久久久欧美国产| 日韩欧美的一区二区| 狠狠狠色丁香婷婷综合久久五月| 日韩免费电影一区| 国产一区二区三区四区在线观看 | 色老综合老女人久久久| 一区二区三区免费在线观看| 欧美色图天堂网| 午夜电影久久久| 欧美r级在线观看| 国产精品1024久久| 国产精品高潮呻吟久久| 色综合天天综合在线视频| 亚洲午夜在线电影| 欧美一区二区视频在线观看| 激情综合网激情| 欧美韩国日本不卡| 91福利国产成人精品照片| 亚洲一区二区高清| 精品日韩在线观看| 国产91露脸合集magnet | 亚洲国产精华液网站w| 97久久超碰国产精品| 亚洲国产成人精品视频| 欧美一二三四区在线| 日韩欧美国产1| 在线观看视频91| 亚洲国产精品成人综合色在线婷婷| 欧美tk—视频vk| 欧美日本在线播放| 色婷婷av一区二区三区之一色屋| 黑人精品欧美一区二区蜜桃| 欧美aa在线视频| 久久国产精品99精品国产| 麻豆精品在线播放|