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

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

?? hub.c

?? usb driver for 2.6.17
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * USB hub driver. * * (C) Copyright 1999 Linus Torvalds * (C) Copyright 1999 Johannes Erdfelt * (C) Copyright 1999 Gregory P. Smith * (C) Copyright 2001 Brad Hards (bhards@bigpond.net.au) * */#include <linux/config.h>#include <linux/kernel.h>#include <linux/errno.h>#include <linux/module.h>#include <linux/moduleparam.h>#include <linux/completion.h>#include <linux/sched.h>#include <linux/list.h>#include <linux/slab.h>#include <linux/smp_lock.h>#include <linux/ioctl.h>#include <linux/usb.h>#include <linux/usbdevice_fs.h>#include <linux/kthread.h>#include <linux/mutex.h>#include <asm/semaphore.h>#include <asm/uaccess.h>#include <asm/byteorder.h>#include "usb.h"#include "hcd.h"#include "hub.h"/* Protect struct usb_device->state and ->children members * Note: Both are also protected by ->dev.sem, except that ->state can * change to USB_STATE_NOTATTACHED even when the semaphore isn't held. */static DEFINE_SPINLOCK(device_state_lock);/* khubd's worklist and its lock */static DEFINE_SPINLOCK(hub_event_lock);static LIST_HEAD(hub_event_list);	/* List of hubs needing servicing *//* Wakes up khubd */static DECLARE_WAIT_QUEUE_HEAD(khubd_wait);static struct task_struct *khubd_task;/* cycle leds on hubs that aren't blinking for attention */static int blinkenlights = 0;module_param (blinkenlights, bool, S_IRUGO);MODULE_PARM_DESC (blinkenlights, "true to cycle leds on hubs");/* * As of 2.6.10 we introduce a new USB device initialization scheme which * closely resembles the way Windows works.  Hopefully it will be compatible * with a wider range of devices than the old scheme.  However some previously * working devices may start giving rise to "device not accepting address" * errors; if that happens the user can try the old scheme by adjusting the * following module parameters. * * For maximum flexibility there are two boolean parameters to control the * hub driver's behavior.  On the first initialization attempt, if the * "old_scheme_first" parameter is set then the old scheme will be used, * otherwise the new scheme is used.  If that fails and "use_both_schemes" * is set, then the driver will make another attempt, using the other scheme. */static int old_scheme_first = 0;module_param(old_scheme_first, bool, S_IRUGO | S_IWUSR);MODULE_PARM_DESC(old_scheme_first,		 "start with the old device initialization scheme");static int use_both_schemes = 1;module_param(use_both_schemes, bool, S_IRUGO | S_IWUSR);MODULE_PARM_DESC(use_both_schemes,		"try the other device initialization scheme if the "		"first one fails");#ifdef	DEBUGstatic inline char *portspeed (int portstatus){	if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED))    		return "480 Mb/s";	else if (portstatus & (1 << USB_PORT_FEAT_LOWSPEED))		return "1.5 Mb/s";	else		return "12 Mb/s";}#endif/* Note that hdev or one of its children must be locked! */static inline struct usb_hub *hdev_to_hub(struct usb_device *hdev){	return usb_get_intfdata(hdev->actconfig->interface[0]);}/* USB 2.0 spec Section 11.24.4.5 */static int get_hub_descriptor(struct usb_device *hdev, void *data, int size){	int i, ret;	for (i = 0; i < 3; i++) {		ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),			USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB,			USB_DT_HUB << 8, 0, data, size,			USB_CTRL_GET_TIMEOUT);		if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2))			return ret;	}	return -EINVAL;}/* * USB 2.0 spec Section 11.24.2.1 */static int clear_hub_feature(struct usb_device *hdev, int feature){	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),		USB_REQ_CLEAR_FEATURE, USB_RT_HUB, feature, 0, NULL, 0, 1000);}/* * USB 2.0 spec Section 11.24.2.2 */static int clear_port_feature(struct usb_device *hdev, int port1, int feature){	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),		USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port1,		NULL, 0, 1000);}/* * USB 2.0 spec Section 11.24.2.13 */static int set_port_feature(struct usb_device *hdev, int port1, int feature){	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),		USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port1,		NULL, 0, 1000);}/* * USB 2.0 spec Section 11.24.2.7.1.10 and table 11-7 * for info about using port indicators */static void set_port_led(	struct usb_hub *hub,	int port1,	int selector){	int status = set_port_feature(hub->hdev, (selector << 8) | port1,			USB_PORT_FEAT_INDICATOR);	if (status < 0)		dev_dbg (hub->intfdev,			"port %d indicator %s status %d\n",			port1,			({ char *s; switch (selector) {			case HUB_LED_AMBER: s = "amber"; break;			case HUB_LED_GREEN: s = "green"; break;			case HUB_LED_OFF: s = "off"; break;			case HUB_LED_AUTO: s = "auto"; break;			default: s = "??"; break;			}; s; }),			status);}#define	LED_CYCLE_PERIOD	((2*HZ)/3)static void led_work (void *__hub){	struct usb_hub		*hub = __hub;	struct usb_device	*hdev = hub->hdev;	unsigned		i;	unsigned		changed = 0;	int			cursor = -1;	if (hdev->state != USB_STATE_CONFIGURED || hub->quiescing)		return;	for (i = 0; i < hub->descriptor->bNbrPorts; i++) {		unsigned	selector, mode;		/* 30%-50% duty cycle */		switch (hub->indicator[i]) {		/* cycle marker */		case INDICATOR_CYCLE:			cursor = i;			selector = HUB_LED_AUTO;			mode = INDICATOR_AUTO;			break;		/* blinking green = sw attention */		case INDICATOR_GREEN_BLINK:			selector = HUB_LED_GREEN;			mode = INDICATOR_GREEN_BLINK_OFF;			break;		case INDICATOR_GREEN_BLINK_OFF:			selector = HUB_LED_OFF;			mode = INDICATOR_GREEN_BLINK;			break;		/* blinking amber = hw attention */		case INDICATOR_AMBER_BLINK:			selector = HUB_LED_AMBER;			mode = INDICATOR_AMBER_BLINK_OFF;			break;		case INDICATOR_AMBER_BLINK_OFF:			selector = HUB_LED_OFF;			mode = INDICATOR_AMBER_BLINK;			break;		/* blink green/amber = reserved */		case INDICATOR_ALT_BLINK:			selector = HUB_LED_GREEN;			mode = INDICATOR_ALT_BLINK_OFF;			break;		case INDICATOR_ALT_BLINK_OFF:			selector = HUB_LED_AMBER;			mode = INDICATOR_ALT_BLINK;			break;		default:			continue;		}		if (selector != HUB_LED_AUTO)			changed = 1;		set_port_led(hub, i + 1, selector);		hub->indicator[i] = mode;	}	if (!changed && blinkenlights) {		cursor++;		cursor %= hub->descriptor->bNbrPorts;		set_port_led(hub, cursor + 1, HUB_LED_GREEN);		hub->indicator[cursor] = INDICATOR_CYCLE;		changed++;	}	if (changed)		schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD);}/* use a short timeout for hub/port status fetches */#define	USB_STS_TIMEOUT		1000#define	USB_STS_RETRIES		5/* * USB 2.0 spec Section 11.24.2.6 */static int get_hub_status(struct usb_device *hdev,		struct usb_hub_status *data){	int i, status = -ETIMEDOUT;	for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) {		status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),			USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0,			data, sizeof(*data), USB_STS_TIMEOUT);	}	return status;}/* * USB 2.0 spec Section 11.24.2.7 */static int get_port_status(struct usb_device *hdev, int port1,		struct usb_port_status *data){	int i, status = -ETIMEDOUT;	for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) {		status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),			USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port1,			data, sizeof(*data), USB_STS_TIMEOUT);	}	return status;}static void kick_khubd(struct usb_hub *hub){	unsigned long	flags;	spin_lock_irqsave(&hub_event_lock, flags);	if (list_empty(&hub->event_list)) {		list_add_tail(&hub->event_list, &hub_event_list);		wake_up(&khubd_wait);	}	spin_unlock_irqrestore(&hub_event_lock, flags);}void usb_kick_khubd(struct usb_device *hdev){	kick_khubd(hdev_to_hub(hdev));}/* completion function, fires on port status changes and various faults */static void hub_irq(struct urb *urb, struct pt_regs *regs){	struct usb_hub *hub = (struct usb_hub *)urb->context;	int status;	int i;	unsigned long bits;	switch (urb->status) {	case -ENOENT:		/* synchronous unlink */	case -ECONNRESET:	/* async unlink */	case -ESHUTDOWN:	/* hardware going away */		return;	default:		/* presumably an error */		/* Cause a hub reset after 10 consecutive errors */		dev_dbg (hub->intfdev, "transfer --> %d\n", urb->status);		if ((++hub->nerrors < 10) || hub->error)			goto resubmit;		hub->error = urb->status;		/* FALL THROUGH */		/* let khubd handle things */	case 0:			/* we got data:  port status changed */		bits = 0;		for (i = 0; i < urb->actual_length; ++i)			bits |= ((unsigned long) ((*hub->buffer)[i]))					<< (i*8);		hub->event_bits[0] = bits;		break;	}	hub->nerrors = 0;	/* Something happened, let khubd figure it out */	kick_khubd(hub);resubmit:	if (hub->quiescing)		return;	if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0			&& status != -ENODEV && status != -EPERM)		dev_err (hub->intfdev, "resubmit --> %d\n", status);}/* USB 2.0 spec Section 11.24.2.3 */static inline inthub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt){	return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),			       HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,			       tt, NULL, 0, 1000);}/* * enumeration blocks khubd for a long time. we use keventd instead, since * long blocking there is the exception, not the rule.  accordingly, HCDs * talking to TTs must queue control transfers (not just bulk and iso), so * both can talk to the same hub concurrently. */static void hub_tt_kevent (void *arg){	struct usb_hub		*hub = arg;	unsigned long		flags;	spin_lock_irqsave (&hub->tt.lock, flags);	while (!list_empty (&hub->tt.clear_list)) {		struct list_head	*temp;		struct usb_tt_clear	*clear;		struct usb_device	*hdev = hub->hdev;		int			status;		temp = hub->tt.clear_list.next;		clear = list_entry (temp, struct usb_tt_clear, clear_list);		list_del (&clear->clear_list);		/* drop lock so HCD can concurrently report other TT errors */		spin_unlock_irqrestore (&hub->tt.lock, flags);		status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt);		spin_lock_irqsave (&hub->tt.lock, flags);		if (status)			dev_err (&hdev->dev,				"clear tt %d (%04x) error %d\n",				clear->tt, clear->devinfo, status);		kfree(clear);	}	spin_unlock_irqrestore (&hub->tt.lock, flags);}/** * usb_hub_tt_clear_buffer - clear control/bulk TT state in high speed hub * @udev: the device whose split transaction failed * @pipe: identifies the endpoint of the failed transaction * * High speed HCDs use this to tell the hub driver that some split control or * bulk transaction failed in a way that requires clearing internal state of * a transaction translator.  This is normally detected (and reported) from * interrupt context. * * It may not be possible for that hub to handle additional full (or low) * speed transactions until that state is fully cleared out. */void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe){	struct usb_tt		*tt = udev->tt;	unsigned long		flags;	struct usb_tt_clear	*clear;	/* we've got to cope with an arbitrary number of pending TT clears,	 * since each TT has "at least two" buffers that can need it (and	 * there can be many TTs per hub).  even if they're uncommon.	 */	if ((clear = kmalloc (sizeof *clear, SLAB_ATOMIC)) == NULL) {		dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n");		/* FIXME recover somehow ... RESET_TT? */		return;	}	/* info that CLEAR_TT_BUFFER needs */	clear->tt = tt->multi ? udev->ttport : 1;	clear->devinfo = usb_pipeendpoint (pipe);	clear->devinfo |= udev->devnum << 4;	clear->devinfo |= usb_pipecontrol (pipe)			? (USB_ENDPOINT_XFER_CONTROL << 11)			: (USB_ENDPOINT_XFER_BULK << 11);	if (usb_pipein (pipe))		clear->devinfo |= 1 << 15;		/* tell keventd to clear state for this TT */	spin_lock_irqsave (&tt->lock, flags);	list_add_tail (&clear->clear_list, &tt->clear_list);	schedule_work (&tt->kevent);	spin_unlock_irqrestore (&tt->lock, flags);}static void hub_power_on(struct usb_hub *hub){	int port1;	unsigned pgood_delay = hub->descriptor->bPwrOn2PwrGood * 2;	u16 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);	/* if hub supports power switching, enable power on each port */	if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2) {		dev_dbg(hub->intfdev, "enabling power on all ports\n");		for (port1 = 1; port1 <= hub->descriptor->bNbrPorts; port1++)			set_port_feature(hub->hdev, port1,					USB_PORT_FEAT_POWER);	}	/* Wait at least 100 msec for power to become stable */	msleep(max(pgood_delay, (unsigned) 100));}static inline void __hub_quiesce(struct usb_hub *hub){	/* (nonblocking) khubd and related activity won't re-trigger */	hub->quiescing = 1;	hub->activating = 0;	hub->resume_root_hub = 0;}static void hub_quiesce(struct usb_hub *hub){	/* (blocking) stop khubd and related activity */	__hub_quiesce(hub);	usb_kill_urb(hub->urb);	if (hub->has_indicators)		cancel_delayed_work(&hub->leds);	if (hub->has_indicators || hub->tt.hub)		flush_scheduled_work();}static void hub_activate(struct usb_hub *hub){	int	status;	hub->quiescing = 0;	hub->activating = 1;	hub->resume_root_hub = 0;	status = usb_submit_urb(hub->urb, GFP_NOIO);	if (status < 0)		dev_err(hub->intfdev, "activate --> %d\n", status);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费伊人电影| 国产精品一线二线三线精华| 秋霞午夜av一区二区三区| 日本道在线观看一区二区| 91精品国产综合久久久蜜臀粉嫩| 日韩一区欧美一区| 狠狠色狠狠色综合| 欧美日韩一级视频| 亚洲免费观看高清完整版在线观看| 国产综合久久久久影院| 欧美一区二区三区的| 一区二区三区四区在线| 丰满少妇久久久久久久| 欧美精品一区二区久久久| 亚洲高清免费视频| 欧美图片一区二区三区| 亚洲免费观看在线观看| 成人一区二区三区在线观看| 精品国一区二区三区| 免费在线欧美视频| 欧美一级在线视频| 婷婷开心激情综合| 51精品视频一区二区三区| 亚洲sss视频在线视频| 在线亚洲高清视频| 一区二区三区精品视频在线| 99r国产精品| 1024国产精品| 91精品福利在线| 亚洲乱码日产精品bd| 一本久久a久久精品亚洲| 亚洲天堂久久久久久久| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品久久久爽爽爽麻豆色哟哟| 国产成人无遮挡在线视频| 国产日产欧美一区| 国产suv精品一区二区883| 午夜精品福利一区二区三区av| 91成人免费网站| 亚洲国产成人91porn| 欧美日韩国产大片| 视频一区视频二区在线观看| 日韩一区二区免费电影| 国模一区二区三区白浆| 国产色产综合色产在线视频| 成人午夜激情视频| 亚洲一区免费视频| 欧美一区二区三区在线视频| 久久99久久久久| 久久理论电影网| 97久久精品人人爽人人爽蜜臀| 亚洲精品视频一区| 69久久夜色精品国产69蝌蚪网| 水蜜桃久久夜色精品一区的特点| 日韩欧美亚洲一区二区| 国产一区二区三区四区五区美女| 国产精品久久午夜夜伦鲁鲁| 在线亚洲人成电影网站色www| 午夜精品国产更新| 国产日韩欧美精品电影三级在线| 99视频有精品| 午夜一区二区三区在线观看| 精品国产凹凸成av人网站| 不卡一区中文字幕| 日日欢夜夜爽一区| 中文字幕精品一区二区精品绿巨人| 91免费视频观看| 日产欧产美韩系列久久99| 国产情人综合久久777777| 欧美午夜精品理论片a级按摩| 麻豆精品在线观看| 亚洲美女少妇撒尿| 久久久久成人黄色影片| 日本电影欧美片| 国产在线播放一区| 亚洲国产视频网站| 国产精品成人免费在线| 日韩亚洲国产中文字幕欧美| 91美女片黄在线观看| 经典三级一区二区| 一级做a爱片久久| 国产日韩av一区| 日韩三级精品电影久久久 | 日韩女优毛片在线| 色婷婷av一区二区| 国产麻豆成人精品| 免费的国产精品| 一区二区三区免费观看| 中文字幕乱码日本亚洲一区二区 | 欧美精品一区二区三区一线天视频| 日本乱人伦一区| 成人动漫在线一区| 国产福利不卡视频| 韩国av一区二区三区| 日韩和的一区二区| 一级中文字幕一区二区| 中文字幕一区二区三区四区不卡| 久久这里都是精品| 日韩欧美亚洲一区二区| 宅男在线国产精品| 欧美揉bbbbb揉bbbbb| 99在线精品视频| 国产成人精品1024| 国产·精品毛片| 韩国v欧美v日本v亚洲v| 精品一区二区三区在线播放| 日韩国产成人精品| 丝袜诱惑制服诱惑色一区在线观看 | 亚洲视频狠狠干| 中文在线免费一区三区高中清不卡| 久久综合色婷婷| 久久综合久久综合九色| 精品国产91久久久久久久妲己| 91精品国产91久久综合桃花 | 天堂一区二区在线| 日日噜噜夜夜狠狠视频欧美人 | 亚洲一级二级在线| 亚洲在线成人精品| 天堂va蜜桃一区二区三区 | 久久久高清一区二区三区| 2023国产精品视频| 国产精品短视频| 一区二区三区四区在线| 五月天中文字幕一区二区| 秋霞电影网一区二区| 国产一区在线看| 成人ar影院免费观看视频| 99久久久久免费精品国产| 色婷婷综合中文久久一本| 欧美在线免费观看视频| 欧美日韩电影一区| 久久综合色婷婷| 中文字幕日韩一区| 亚洲成av人片www| 美国毛片一区二区| 高清国产一区二区| 欧美在线观看视频一区二区三区| 欧美日韩国产bt| 久久久精品中文字幕麻豆发布| 久久久午夜精品| 一区二区三区 在线观看视频 | 日韩欧美国产麻豆| 中文在线一区二区| 亚洲国产wwwccc36天堂| 国产在线精品一区二区夜色| 成人av电影在线观看| 欧美人体做爰大胆视频| 国产视频一区二区在线观看| 亚洲精品视频免费看| 久久综合综合久久综合| 成人国产精品免费观看动漫| 欧美夫妻性生活| 一区在线观看视频| 久久国内精品视频| 精品视频1区2区| 欧美国产精品一区| 免费观看在线综合色| 成人深夜在线观看| 欧美一区二区播放| 成人欧美一区二区三区黑人麻豆| 免费看日韩精品| 日本福利一区二区| 国产喷白浆一区二区三区| 天堂成人免费av电影一区| www.66久久| 2021中文字幕一区亚洲| 亚洲va国产va欧美va观看| zzijzzij亚洲日本少妇熟睡| 精品免费日韩av| 偷拍亚洲欧洲综合| 91九色最新地址| 国产精品久久久久一区| 精品在线播放午夜| 欧美精品xxxxbbbb| 一区二区三区四区在线免费观看 | 亚洲视频在线一区观看| 国产一区二区网址| 欧美va在线播放| 男人操女人的视频在线观看欧美 | 成人午夜视频在线| 欧美大胆一级视频| 青椒成人免费视频| 欧美日韩精品是欧美日韩精品| 亚洲少妇最新在线视频| av动漫一区二区| 中文字幕精品在线不卡| 国产高清成人在线| 2021久久国产精品不只是精品| 蜜桃视频在线一区| 日韩一级片在线观看| 日日噜噜夜夜狠狠视频欧美人| 欧美日韩亚洲国产综合| 亚洲福利视频导航| 欧美视频一区二| 亚洲一区二区三区爽爽爽爽爽 | 日韩精品一区二区三区中文精品| 婷婷中文字幕综合| 欧美一区二区三区在线观看| 蜜臂av日日欢夜夜爽一区| 欧美videossexotv100|