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

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

?? hub.c

?? 是關于linux2.5.1的完全源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
		/* if we`ve finished resetting, then break out of the loop */		if (!(portstatus & USB_PORT_STAT_RESET) &&		    (portstatus & USB_PORT_STAT_ENABLE)) {			if (portstatus & USB_PORT_STAT_HIGH_SPEED)				dev->speed = USB_SPEED_HIGH;			else if (portstatus & USB_PORT_STAT_LOW_SPEED)				dev->speed = USB_SPEED_LOW;			else				dev->speed = USB_SPEED_FULL;			return 0;		}		/* switch to the long delay after two short delay failures */		if (delay_time >= 2 * HUB_SHORT_RESET_TIME)			delay = HUB_LONG_RESET_TIME;		dbg("port %d of hub %s not reset yet, waiting %dms", port + 1,			hub->devpath, delay);	}	return -1;}/* return: -1 on error, 0 on success, 1 on disconnect.  */static int usb_hub_port_reset(struct usb_device *hub, int port,				struct usb_device *dev, unsigned int delay){	int i, status;	/* Reset the port */	for (i = 0; i < HUB_RESET_TRIES; i++) {		usb_set_port_feature(hub, port + 1, USB_PORT_FEAT_RESET);		/* return on disconnect or reset */		status = usb_hub_port_wait_reset(hub, port, dev, delay);		if (status != -1) {			usb_clear_port_feature(hub,				port + 1, USB_PORT_FEAT_C_RESET);			return status;		}		dbg("port %d of hub %s not enabled, trying reset again...",			port + 1, hub->devpath);		delay = HUB_LONG_RESET_TIME;	}	err("Cannot enable port %i of hub %s, disabling port.",		port + 1, hub->devpath);	err("Maybe the USB cable is bad?");	return -1;}void usb_hub_port_disable(struct usb_device *hub, int port){	int ret;	ret = usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_ENABLE);	if (ret)		err("cannot disable port %d of hub %s (err = %d)",			port + 1, hub->devpath, ret);}/* USB 2.0 spec, 7.1.7.3 / fig 7-29: * * Between connect detection and reset signaling there must be a delay * of 100ms at least for debounce and power-settling. The corresponding * timer shall restart whenever the downstream port detects a disconnect. *  * Apparently there are some bluetooth and irda-dongles and a number * of low-speed devices which require longer delays of about 200-400ms. * Not covered by the spec - but easy to deal with. * * This implementation uses 400ms minimum debounce timeout and checks * every 100ms for transient disconnects to restart the delay. */#define HUB_DEBOUNCE_TIMEOUT	400#define HUB_DEBOUNCE_STEP	100/* return: -1 on error, 0 on success, 1 on disconnect.  */static int usb_hub_port_debounce(struct usb_device *hub, int port){	int ret;	unsigned delay_time;	u16 portchange, portstatus;	for (delay_time = 0; delay_time < HUB_DEBOUNCE_TIMEOUT; /* empty */ ) {		/* wait debounce step increment */		wait_ms(HUB_DEBOUNCE_STEP);		ret = usb_hub_port_status(hub, port, &portstatus, &portchange);		if (ret < 0)			return -1;		if ((portchange & USB_PORT_STAT_C_CONNECTION)) {			usb_clear_port_feature(hub, port+1, USB_PORT_FEAT_C_CONNECTION);			delay_time = 0;		}		else			delay_time += HUB_DEBOUNCE_STEP;	}	return ((portstatus&USB_PORT_STAT_CONNECTION)) ? 0 : 1;}static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,					u16 portstatus, u16 portchange){	struct usb_device *hub = hubstate->dev;	struct usb_device *dev;	unsigned int delay = HUB_SHORT_RESET_TIME;	int i;	dbg("hub %s port %d, portstatus %x, change %x, %s",		hub->devpath, port + 1,		portstatus, portchange, portspeed (portstatus));	/* Clear the connection change status */	usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION);	/* Disconnect any existing devices under this port */	if (hub->children[port])		usb_disconnect(&hub->children[port]);	/* Return now if nothing is connected */	if (!(portstatus & USB_PORT_STAT_CONNECTION)) {		if (portstatus & USB_PORT_STAT_ENABLE)			usb_hub_port_disable(hub, port);		return;	}	if (usb_hub_port_debounce(hub, port)) {		err("connect-debounce failed, port %d disabled", port+1);		usb_hub_port_disable(hub, port);		return;	}	/* Some low speed devices have problems with the quick delay, so */	/*  be a bit pessimistic with those devices. RHbug #23670 */	if (portstatus & USB_PORT_STAT_LOW_SPEED)		delay = HUB_LONG_RESET_TIME;	down(&usb_address0_sem);	for (i = 0; i < HUB_PROBE_TRIES; i++) {		struct usb_device *pdev;		int	len;		/* Allocate a new device struct */		dev = usb_alloc_dev(hub, hub->bus);		if (!dev) {			err("couldn't allocate usb_device");			break;		}		hub->children[port] = dev;		/* Reset the device, and detect its speed */		if (usb_hub_port_reset(hub, port, dev, delay)) {			usb_free_dev(dev);			break;		}		/* Find a new address for it */		usb_connect(dev);		/* Set up TT records, if needed  */		if (hub->tt) {			dev->tt = hub->tt;			dev->ttport = hub->ttport;		} else if (dev->speed != USB_SPEED_HIGH				&& hub->speed == USB_SPEED_HIGH) {			dev->tt = &hubstate->tt;			dev->ttport = port + 1;		}		/* Save readable and stable topology id, distinguishing		 * devices by location for diagnostics, tools, etc.  The		 * string is a path along hub ports, from the root.  Each		 * device's id will be stable until USB is re-cabled, and		 * hubs are often labeled with these port numbers.		 *		 * Initial size: ".NN" times five hubs + NUL = 16 bytes max		 * (quite rare, since most hubs have 4-6 ports).		 */		pdev = dev->parent;		if (pdev->devpath [0] != '/')	/* parent not root */			len = snprintf (dev->devpath, sizeof dev->devpath,				"%s.%d", pdev->devpath, port + 1);		else	/* root == "/", root port 2 == "2", port 3 that hub "/2.3" */			len = snprintf (dev->devpath, sizeof dev->devpath,				"%d", port + 1);		if (len == sizeof dev->devpath)			warn ("devpath size! usb/%03d/%03d path %s",				dev->bus->busnum, dev->devnum, dev->devpath);		info("new USB device %s-%s, assigned address %d",			dev->bus->bus_name, dev->devpath, dev->devnum);		/* put the device in the global device tree */		dev->dev.parent = &dev->parent->dev;		sprintf (&dev->dev.name[0], "USB device %04x:%04x",			 dev->descriptor.idVendor,			 dev->descriptor.idProduct);		/* find the number of the port this device is connected to */		sprintf (&dev->dev.bus_id[0], "unknown_port_%03d", dev->devnum);		for (i = 0; i < USB_MAXCHILDREN; ++i) {			if (dev->parent->children[i] == dev) {				sprintf (&dev->dev.bus_id[0], "%02d", i);				break;			}		}		/* Run it through the hoops (find a driver, etc) */		if (!usb_new_device(dev))			goto done;		/* Free the configuration if there was an error */		usb_free_dev(dev);		/* Switch to a long reset time */		delay = HUB_LONG_RESET_TIME;	}	hub->children[port] = NULL;	usb_hub_port_disable(hub, port);done:	up(&usb_address0_sem);}static void usb_hub_events(void){	unsigned long flags;	struct list_head *tmp;	struct usb_device *dev;	struct usb_hub *hub;	struct usb_hub_status hubsts;	u16 hubstatus;	u16 hubchange;	u16 portstatus;	u16 portchange;	int i, ret;	/*	 *  We restart the list everytime to avoid a deadlock with	 * deleting hubs downstream from this one. This should be	 * safe since we delete the hub from the event list.	 * Not the most efficient, but avoids deadlocks.	 */	while (1) {		spin_lock_irqsave(&hub_event_lock, flags);		if (list_empty(&hub_event_list))			break;		/* Grab the next entry from the beginning of the list */		tmp = hub_event_list.next;		hub = list_entry(tmp, struct usb_hub, event_list);		dev = hub->dev;		list_del(tmp);		INIT_LIST_HEAD(tmp);		down(&hub->khubd_sem); /* never blocks, we were on list */		spin_unlock_irqrestore(&hub_event_lock, flags);		if (hub->error) {			dbg("resetting hub %s for error %d",				dev->devpath, hub->error);			if (usb_hub_reset(hub)) {				err("error resetting hub %s - disconnecting",					dev->devpath);				up(&hub->khubd_sem);				usb_hub_disconnect(dev);				continue;			}			hub->nerrors = 0;			hub->error = 0;		}		for (i = 0; i < hub->descriptor->bNbrPorts; i++) {			ret = usb_hub_port_status(dev, i, &portstatus, &portchange);			if (ret < 0) {				continue;			}			if (portchange & USB_PORT_STAT_C_CONNECTION) {				dbg("hub %s port %d connection change",					dev->devpath, i + 1);				usb_hub_port_connect_change(hub, i, portstatus, portchange);			} else if (portchange & USB_PORT_STAT_C_ENABLE) {				dbg("hub %s port %d enable change, status %x",					dev->devpath, i + 1, portstatus);				usb_clear_port_feature(dev,					i + 1, USB_PORT_FEAT_C_ENABLE);				/*				 * EM interference sometimes causes badly				 * shielded USB devices to be shutdown by				 * the hub, this hack enables them again.				 * Works at least with mouse driver. 				 */				if (!(portstatus & USB_PORT_STAT_ENABLE)				    && (portstatus & USB_PORT_STAT_CONNECTION)				    && (dev->children[i])) {					err("already running hub %s port %i "					    "disabled by hub (EMI?), "					    "re-enabling...",						dev->devpath, i + 1);					usb_hub_port_connect_change(hub,						i, portstatus, portchange);				}			}			if (portchange & USB_PORT_STAT_C_SUSPEND) {				dbg("hub %s port %d suspend change",					dev->devpath, i + 1);				usb_clear_port_feature(dev,					i + 1,  USB_PORT_FEAT_C_SUSPEND);			}						if (portchange & USB_PORT_STAT_C_OVERCURRENT) {				err("hub %s port %d over-current change",					dev->devpath, i + 1);				usb_clear_port_feature(dev,					i + 1, USB_PORT_FEAT_C_OVER_CURRENT);				usb_hub_power_on(hub);			}			if (portchange & USB_PORT_STAT_C_RESET) {				dbg("hub %s port %d reset change",					dev->devpath, i + 1);				usb_clear_port_feature(dev,					i + 1, USB_PORT_FEAT_C_RESET);			}		} /* end for i */		/* deal with hub status changes */		if (usb_get_hub_status(dev, &hubsts) < 0)			err("get_hub_status %s failed", dev->devpath);		else {			hubstatus = le16_to_cpup(&hubsts.wHubStatus);			hubchange = le16_to_cpup(&hubsts.wHubChange);			if (hubchange & HUB_CHANGE_LOCAL_POWER) {				dbg("hub %s power change", dev->devpath);				usb_clear_hub_feature(dev, C_HUB_LOCAL_POWER);			}			if (hubchange & HUB_CHANGE_OVERCURRENT) {				dbg("hub %s overcurrent change", dev->devpath);				wait_ms(500);	/* Cool down */				usb_clear_hub_feature(dev, C_HUB_OVER_CURRENT);                        	usb_hub_power_on(hub);			}		}		up(&hub->khubd_sem);        } /* end while (1) */	spin_unlock_irqrestore(&hub_event_lock, flags);}static int usb_hub_thread(void *__hub){	lock_kernel();	/*	 * This thread doesn't need any user-level access,	 * so get rid of all our resources	 */	daemonize();	/* Setup a nice name */	strcpy(current->comm, "khubd");	/* Send me a signal to get me die (for debugging) */	do {		usb_hub_events();		wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); 	} while (!signal_pending(current));	dbg("usb_hub_thread exiting");	unlock_kernel();	complete_and_exit(&khubd_exited, 0);}static struct usb_device_id hub_id_table [] = {    { match_flags: USB_DEVICE_ID_MATCH_DEV_CLASS,      bDeviceClass: USB_CLASS_HUB},    { match_flags: USB_DEVICE_ID_MATCH_INT_CLASS,      bInterfaceClass: USB_CLASS_HUB},    { }						/* Terminating entry */};MODULE_DEVICE_TABLE (usb, hub_id_table);static struct usb_driver hub_driver = {	name:		"hub",	probe:		hub_probe,	ioctl:		hub_ioctl,	disconnect:	hub_disconnect,	id_table:	hub_id_table,};/* * This should be a separate module. */int usb_hub_init(void){	int pid;	if (usb_register(&hub_driver) < 0) {		err("Unable to register USB hub driver");		return -1;	}	pid = kernel_thread(usb_hub_thread, NULL,		CLONE_FS | CLONE_FILES | CLONE_SIGHAND);	if (pid >= 0) {		khubd_pid = pid;		return 0;	}	/* Fall through if kernel_thread failed */	usb_deregister(&hub_driver);	err("failed to start usb_hub_thread");	return -1;}void usb_hub_cleanup(void){	int ret;	/* Kill the thread */	ret = kill_proc(khubd_pid, SIGTERM, 1);	wait_for_completion(&khubd_exited);	/*	 * Hub resources are freed for us by usb_deregister. It calls	 * usb_driver_purge on every device which in turn calls that	 * devices disconnect function if it is using this driver.	 * The hub_disconnect function takes care of releasing the	 * individual hub resources. -greg	 */	usb_deregister(&hub_driver);} /* usb_hub_cleanup() *//* * WARNING - If a driver calls usb_reset_device, you should simulate a * disconnect() and probe() for other interfaces you doesn't claim. This * is left up to the driver writer right now. This insures other drivers * have a chance to re-setup their interface. * * Take a look at proc_resetdevice in devio.c for some sample code to * do this. */int usb_reset_device(struct usb_device *dev){	struct usb_device *parent = dev->parent;	struct usb_device_descriptor descriptor;	int i, ret, port = -1;	if (!parent) {		err("attempting to reset root hub!");		return -EINVAL;	}	for (i = 0; i < parent->maxchild; i++)		if (parent->children[i] == dev) {			port = i;			break;		}	if (port < 0)		return -ENOENT;	down(&usb_address0_sem);	/* Send a reset to the device */	if (usb_hub_port_reset(parent, port, dev, HUB_SHORT_RESET_TIME)) {		usb_hub_port_disable(parent, port);		up(&usb_address0_sem);		return(-ENODEV);	}	/* Reprogram the Address */	ret = usb_set_address(dev);	if (ret < 0) {		err("USB device not accepting new address (error=%d)", ret);		usb_hub_port_disable(parent, port);		up(&usb_address0_sem);		return ret;	}	/* Let the SET_ADDRESS settle */	wait_ms(10);	up(&usb_address0_sem);	/*	 * Now we fetch the configuration descriptors for the device and	 * see if anything has changed. If it has, we dump the current	 * parsed descriptors and reparse from scratch. Then we leave	 * the device alone for the caller to finish setting up.	 *	 * If nothing changed, we reprogram the configuration and then	 * the alternate settings.	 */	ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &descriptor,			sizeof(descriptor));	if (ret < 0)		return ret;	le16_to_cpus(&descriptor.bcdUSB);	le16_to_cpus(&descriptor.idVendor);	le16_to_cpus(&descriptor.idProduct);	le16_to_cpus(&descriptor.bcdDevice);	if (memcmp(&dev->descriptor, &descriptor, sizeof(descriptor))) {		usb_destroy_configuration(dev);		ret = usb_get_device_descriptor(dev);		if (ret < sizeof(dev->descriptor)) {			if (ret < 0)				err("unable to get device %s descriptor "					"(error=%d)", dev->devpath, ret);			else				err("USB device %s descriptor short read "					"(expected %Zi, got %i)",					dev->devpath,					sizeof(dev->descriptor), ret);        			clear_bit(dev->devnum, dev->bus->devmap.devicemap);			dev->devnum = -1;			return -EIO;		}		ret = usb_get_configuration(dev);		if (ret < 0) {			err("unable to get configuration (error=%d)", ret);			usb_destroy_configuration(dev);			clear_bit(dev->devnum, dev->bus->devmap.devicemap);			dev->devnum = -1;			return 1;		}		dev->actconfig = dev->config;		usb_set_maxpacket(dev);		return 1;	}	ret = usb_set_configuration(dev, dev->actconfig->bConfigurationValue);	if (ret < 0) {		err("failed to set dev %s active configuration (error=%d)",			dev->devpath, ret);		return ret;	}	for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {		struct usb_interface *intf = &dev->actconfig->interface[i];		struct usb_interface_descriptor *as;		as = &intf->altsetting[intf->act_altsetting];		ret = usb_set_interface(dev, as->bInterfaceNumber,			as->bAlternateSetting);		if (ret < 0) {			err("failed to set active alternate setting "				"for dev %s interface %d (error=%d)",				dev->devpath, i, ret);			return ret;		}	}	return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本成人在线看| 国产91在线看| 色综合天天综合在线视频| 欧美国产日韩一二三区| 国产乱码字幕精品高清av| 国产偷国产偷精品高清尤物 | 欧美亚洲国产怡红院影院| 亚洲免费观看高清完整版在线观看熊 | 国内精品嫩模私拍在线| 欧美精品99久久久**| 日韩高清国产一区在线| 精品国产精品一区二区夜夜嗨| 日本欧美加勒比视频| 久久夜色精品国产噜噜av | 亚洲一二三区在线观看| 日本韩国一区二区| 免费成人结看片| 日韩成人一级大片| 国产精品白丝在线| 欧美日韩国产综合一区二区| 国产黄色91视频| 亚洲一区二区三区四区五区黄 | 91丝袜美女网| 精品一区二区影视| 亚洲在线观看免费视频| 亚洲精品网站在线观看| 国产人成亚洲第一网站在线播放| 不卡区在线中文字幕| 免费观看久久久4p| 香蕉久久一区二区不卡无毒影院| 久久久久国产一区二区三区四区| 日本乱码高清不卡字幕| 波多野结衣精品在线| 狠狠网亚洲精品| 美女爽到高潮91| 午夜精品福利在线| 亚洲另类在线制服丝袜| 欧美激情一二三区| 精品99久久久久久| 精品久久久久久久久久久久包黑料 | 天天色天天操综合| 国产日本欧美一区二区| 美女视频黄a大片欧美| 亚洲天堂免费在线观看视频| 欧美精品一区二区不卡| 欧美一区二区三区婷婷月色| 91国偷自产一区二区三区成为亚洲经典 | 日韩一二在线观看| 日韩一区二区影院| 欧美一区三区四区| 日韩一级高清毛片| 26uuu精品一区二区| 久久久久久久一区| 国产精品卡一卡二| 综合在线观看色| 午夜电影网一区| 国产一区不卡精品| proumb性欧美在线观看| 日本高清不卡在线观看| 欧美日韩综合不卡| 久久婷婷国产综合国色天香| 国产精品亲子乱子伦xxxx裸| 亚洲欧美自拍偷拍| 亚洲国产va精品久久久不卡综合| 色婷婷综合久久久久中文 | 亚洲va欧美va人人爽| 免费在线观看不卡| 成人app在线| 欧美一区二区免费视频| 亚洲国产成人在线| 久久综合狠狠综合久久激情| 一区二区三区四区亚洲| 国内成+人亚洲+欧美+综合在线 | 精品国产sm最大网站免费看| 亚洲欧洲99久久| 激情六月婷婷久久| 欧美另类videos死尸| 欧美国产禁国产网站cc| 麻豆视频一区二区| 在线观看免费成人| 国产精品久久久久久久午夜片| 老司机精品视频一区二区三区| av电影在线观看完整版一区二区| 日韩视频在线永久播放| 亚洲aaa精品| 欧美日韩国产一区二区三区地区| 国产精品午夜春色av| 免费观看久久久4p| 日韩一区二区在线观看| 日韩电影一区二区三区| 欧美日韩一二三| 亚洲一级不卡视频| 在线日韩一区二区| 一区二区三区四区高清精品免费观看 | 国产另类ts人妖一区二区| 欧美一区二区三区免费观看视频 | 精品日韩成人av| 激情图区综合网| 久久久久久**毛片大全| 国产ts人妖一区二区| 国产精品美女www爽爽爽| 成人免费毛片片v| 亚洲乱码国产乱码精品精的特点| 色偷偷成人一区二区三区91| 亚洲午夜电影网| 欧美一区二区在线看| 国模少妇一区二区三区| 国产欧美一区二区在线| 色综合久久综合网| 成人av网址在线| 亚洲愉拍自拍另类高清精品| 欧美日韩成人在线一区| 国产一区二区毛片| 亚洲美女屁股眼交3| 日韩视频在线观看一区二区| 国产一区二区在线观看免费| 亚洲女同ⅹxx女同tv| 欧美一区二区三区在线视频| 国产成人精品一区二| 亚洲无人区一区| 国产蜜臀97一区二区三区| 欧美三级蜜桃2在线观看| 国产成人欧美日韩在线电影| 亚洲电影第三页| 中文字幕一区二区三区在线播放| 制服丝袜激情欧洲亚洲| 99久久婷婷国产综合精品电影| 日韩高清在线电影| 91成人免费在线| 奇米精品一区二区三区四区| 国产精品三级在线观看| 欧美日韩国产成人在线免费| 高清在线观看日韩| 久久电影网站中文字幕| 亚洲成人一区在线| 夜夜爽夜夜爽精品视频| 中文字幕制服丝袜一区二区三区 | 色哟哟国产精品| 成人免费看黄yyy456| 国产精品18久久久| 国产在线视频一区二区| 激情丁香综合五月| 欧美午夜电影在线播放| 色综合天天综合网国产成人综合天| 国产精品1024| 成人国产精品视频| 成人开心网精品视频| 成人av中文字幕| 91老司机福利 在线| 色偷偷久久一区二区三区| 欧美伊人久久久久久久久影院| 色噜噜狠狠成人中文综合| 色狠狠av一区二区三区| 欧美日韩在线直播| 精品人在线二区三区| 国产日韩精品久久久| 亚洲欧洲制服丝袜| 全部av―极品视觉盛宴亚洲| 国产精品自拍在线| 成人av一区二区三区| 欧美伊人久久久久久午夜久久久久| 欧美探花视频资源| 日韩欧美国产精品一区| 国产精品久久久久四虎| 午夜精品久久久久久不卡8050| 美女国产一区二区三区| 成人aa视频在线观看| 337p亚洲精品色噜噜狠狠| 欧美激情一区在线| 三级成人在线视频| 99久久婷婷国产综合精品电影| 欧美一区二区视频在线观看 | 男人的天堂久久精品| eeuss鲁片一区二区三区| 日韩视频免费观看高清完整版| 国产精品国产自产拍在线| 日本欧美一区二区三区乱码| 成人黄动漫网站免费app| 欧美大片国产精品| 亚洲一区二区三区在线看| 成人av在线播放网站| 久久久久久日产精品| 另类成人小视频在线| 欧美日精品一区视频| 亚洲综合一区在线| 91原创在线视频| 综合色天天鬼久久鬼色| 成人美女视频在线观看18| 国产亚洲女人久久久久毛片| 精品午夜久久福利影院| 日韩欧美国产三级电影视频| 蜜桃一区二区三区在线观看| 69堂国产成人免费视频| 午夜久久久久久久久| 欧美一区二区视频网站| 久久99久久久欧美国产| 精品国产3级a| 成人一级黄色片| 亚洲精品第一国产综合野| 欧美体内she精视频|