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J$$(B	*/
#define	USB_OWN		1		/* $BBP>]%G%P%$%9(B		*/

/* USB$B%G%P%$%9%j%/%(%9%H!J(BUSB$B5,3J!K(B */
typedef	struct	{
	UB	bmRequestType;		/* $BMW5a$9$kBP>]$N@_Dj(B	*/
	UB	bRequest;		/* $BMW5a%3!<%I(B		*/
	UH	wValue;			/* $B@_Dj$9$kCM(B		*/
	UH	wIndex;			/* $BJ8;zNs(Bindex$BEy$N;XDj(B	*/
	UH	wLength;		/* $BE>AwD9(B		*/
} usbDeviceRequest;

/* bRequest:$BI8=`MW5a%3!<%I!J(BUSB$B5,3J!K(B */
#define	USB_GET_STATUS		0
#define	USB_CLEAR_FEATURE	1
#define	USB_SET_FEATURE		3
#define	USB_SET_ADDRESS		5
#define	USB_GET_DESCRIPTOR	6
#define	USB_SET_DESCRIPTOR	7
#define	USB_GET_CONFIGURATION	8
#define	USB_SET_CONFIGURATION	9
#define	USB_GET_INTERFACE	10
#define	USB_SET_INTERFACE	11
#define	USB_SYNCH_FRAME		12

/* bmRequestType$B!J(BUSB$B5,3J!K(B */
#define	bmR_DEVICE	0x00
#define	bmR_INTERFACE	0x01
#define	bmR_ENDPOINT	0x02
#define	bmR_OTHER	0x03

#define	bmR_STANDARD	0x00
#define	bmR_CLASS	0x20
#define	bmR_VENDOR	0x40

#define	bmR_OUT		0x00
#define	bmR_IN		0x80

/* bDescriptorType:$B%G%#%9%/%j%W%?CHqEEN.(B($B!_(B2 mA)	*/
} usbConfigurationDescriptor;

/* USB $B%$%s%?%U%'!<%9%G%#%9%/%j%W%?!J(BUSB$B5,3J!K(B */
typedef	struct	{
	UB	bLength;		/* $B%G%#%9%/%j%W%?D9(B	*/
	UB	bDescriptorType;	/* I/F Descriptor(4)	*/
	UB	bInterfaceNumber;	/* $B$3$N(BInterface$B$N(BID	*/
	UB	bAlternateSetting;	/* $BBeBX@_Dj$N(BID		*/
	UB	bNumEndpoints;		/* $B%(%s%I%]%$%s%H$N?t(B	*/
	UB	bInterfaceClass;	/* Interface Class	*/
	UB	bInterfaceSubClass;	/* Interface SubClass	*/
	UB	bInterfaceProtocol;	/* Interface Protocol	*/
	UB	iInterface;		/* $BJ8;zNs(Bindex (I/F)	*/
} usbInterfaceDescriptor;

/* USB $B%(%s%I%]%$%s%H%G%#%9%/%j%W%?!J(BUSB$B5,3J!K(B */
typedef	struct	{
	UB	bLength;		/* $B%G%#%9%/%j%W%?D9(B	*/
	UB	bDescriptorType;	/* E/P Descriptor(5)	*/
	UB	bEndpointAddress;	/* endpoint address	*/
	UB	bmAttributes;		/* $BE>Aw7A<0(B(Ctrl/Iso..)	*/
	UH	wMaxPacketSize;		/* $B%Q%1%C%H%5%$%:(B	*/
	UB	bInterval;		/* Iso/Int $BE>Aw<~4|(B(ms)	*/
} usbEndpointDescriptor;

/* $B%(%s%I%]%$%s%H%G%#%9%/%j%W%?$N(BbmAttributes$B$NDj5A!J(BUSB$B5,3J!K(B	*/
#define	USB_CONTROL	0
#define	USB_ISOCHRONOUS	1
#define	USB_BULK	2
#define	USB_INTERRUPT	3

/* USB $B%9%H%j%s%0%G%#%9%/%j%W%?!J(BUSB$B5,3J!K(B */
typedef	struct	{
	UB	bLength;		/* $B%G%#%9%/%j%W%?D9(B	*/
	UB	bDescriptorType;	/* Str. Descriptor(3)	*/
	UH	bString[1];		/* $BJ8;zNs(B (Unicode)	*/
} usbStringDescriptor;

/* USB$B%$%Y%s%H;XDjMQ9=B$BN!J(BUSB$B%^%M!<%8%c!K(B */
typedef	struct	{
	UB	bClass;		/* Device/Interface Class */
	UB	bSubClass;	/* Device/Interface SubClass */
	UB	bProtocol;	/* Device/Interface Protocol */
	UB	mask;		/* bClass/bSubClass/bProtocol/devid$B$NA*Br(B */
} usbEventPattern;

/* nowait$B%b!<%I;~$N1~Ez%a%C%;!<%8!J(BUSB$B%^%M!<%8%c!K(B */
typedef	struct	{
    W	pid;			/* pipe ID */
    W	datacnt;		/* $B%G!<%??t(B */
    W	error;			/* $B%(%i!<%3!<%I(B */
}	usbMsg;    

/* mask$B$NCM!J(BUSB$B%^%M!<%8%c!K(B */
#define	EVENT_CLASS	0x01
#define	EVENT_SUBCLASS	0x02
#define	EVENT_PROTOCOL	0x04
#define	EVENT_ANY	0x08

/* $B%(%i!<%3!<%I(B (USB$B%^%M!<%8%c(B) */
#define	USB_OK			 (EC_OK    << 16)
#define	USB_ERR_BUSY		((EC_BUSY  << 16) |  0)
#define	USB_ERR_PAR		((EC_PAR   << 16) |  0)
#define	USB_ERR_DEVICE		((EC_PAR   << 16) |  1)
#define	USB_ERR_INTERFACE	((EC_PAR   << 16) |  2)
#define	USB_ERR_ENDPOINT	((EC_PAR   << 16) |  3)
#define	USB_ERR_POWER		((EC_LIMIT << 16) |  0)
#define	USB_ERR_REQUEST		((EC_DEV   << 16) |  0)
#define	USB_ERR_SYSTEM		((EC_SYS   << 16) |  0)
#define	USB_ERR_NOMEM		((EC_NOMEM << 16) |  0)
#define	USB_ERR_STALL		((EC_IO    << 16) |  2)
#define	USB_ERR_ABORT		((EC_IO    << 16) |  3)
#define	USB_ERR_IO_NAK		((EC_IO    << 16) |  6)
#define	USB_ERR_IO_SHORT	((EC_IO    << 16) |  7)
#define	USB_ERR_IO_BUFERR	((EC_IO    << 16) |  9)
#define	USB_ERR_IO_BABBLE	((EC_IO    << 16) | 10)
#define	USB_ERR_IO_CRC		((EC_IO    << 16) | 11)
#define	USB_ERR_IO_BITSTUFF	((EC_IO    << 16) | 12)
#define	USB_ERR_IO_NORESP	((EC_IO    << 16) | 13)

/* usbIoPipe()$B$G$N;XDjMQ!J(BUSB$B%^%M!<%8%c!K(B */
#define	USB_WAIT	0x00
#define	USB_SHORTNG	0x00

#define USB_NOWAIT      0x01
#define USB_SHORTOK     0x02

/* usbGetHubInfo()$B$G;HMQ$9$k9=B$BN!J(BUSB$B%^%M!<%8%c!K(B */
/* hub status$B9=B$BN!J(BUSB$B%^%M!<%8%c!K(B */
typedef	union	{
    struct	{
	UH	level:3;	/* hub$B$NCJ?t(B */
	UH	self_power:1;	/* self powered hub$B$J$i(B1 */
	UH	reserved:12;
    }	bmStatus;
    UH	status;
}	usbHubStatus;

/* device status $B!J(BUSB$B%^%M!<%8%c!K(B */
#define	PS_PORT_CONNECTION	0x0001
#define	PS_PORT_ENABLE		0x0002
#define	PS_PORT_SUSPEND		0x0004
#define	PS_PORT_OVER_CURRENT	0x0008
#define	PS_PORT_RESET		0x0010

#define	PS_PORT_POWER		0x0100
#define	PS_PORT_LOW_SPEED	0x0200

15.6 USB$B%$%Y%s%H(B

$BEPO?$7$?%G%P%$%9%I%i%$%P$KBP$7$F$O!"(B $B%G%P%$%9%I%i%$%P$X$NMW5a

$B%G%P%$%9%I%i%$%P$O!"(B $B$I$N$h$&$J;~E@$G$b(BUSB$B%$%Y%s%H8F$S=P$7$rB.$d$+$K

USB$B%$%Y%s%H8F$S=P$7$O!"8F$S=P$7$,9T$o$l$F$+$i(B 30$BIC0JFb$Kl9g$O!"(B $B$=$N%G%P%$%9%I%i%$%P$O%G%P%$%9$r;HMQ$7$J$$$b$N$H$_$J$9!#(B

USB$B%$%Y%s%H8F$S=P$7!&1~Ez$O!"(B $BDL>o$N%G%P%$%9MW5a!&1~Ez$N%G!<%?7A<0$r;HMQ$7$F0J2<$NFbMF$G9T$o$l$k!#(B

$B8F$S=P$7!J%G%P%$%9@\B3;~$NMW5a!K!'(B
DevReq:	devid       (bit 6$B!A(B 0) $B@\B3$5$l$?%G%P%$%9$N%"%I%l%9(B
	            (bit 7)     0
	cmd.cmd     = DC_USBEVENT
	datano      = USB_MOUNT
	datacnt     (bit 7$B!A(B 0) bDeviceClass$B$NCM(B
	            (bit 8$B!A(B15) bDeviceSubClass$B$NCM(B
	            (bit16$B!A(B23) bDeviceProtocol$B$NCM(B
	taskid      $BM=Ls(B(0)
	memptr      $BM=Ls(B(0)
$B1~Ez!J%G%P%$%9@\B3;~$NMW5a!K(B
DevRsp:	devid       (bit 6$B!A(B 0) $B@\B3$5$l$?%G%P%$%9$N%"%I%l%9(B
	            (bit 7)     0
	cmd.cmd     = DC_USBEVENT
	datano      $BM=Ls(B
	datacnt     $BM=Ls(B
	error       $B1~Ez%3!<%I(B(USB_OWN/USB_NONE)
$B8F$S=P$7!J%G%P%$%92r=|;~$NMW5a!K!'(B
DevReq:	devid       (bit 6$B!A(B 0) $B@\B3$5$l$?%G%P%$%9$N%"%I%l%9(B
	            (bit 7)     0
	cmd.cmd     = DC_USBEVENT
	datano      = USB_UNMOUNT
	datacnt     $BM=Ls(B(0)
	taskid      $BM=Ls(B(0)
	memptr      $BM=Ls(B(0)
$B1~Ez!J%G%P%$%92r=|;~$NMW5a!K(B
DevRsp$B$K@_Dj$9$Y$-CM$OL5$$!#(Brpl_rdv()$B$G1~Ez$9$k$@$1$GNI$$!#(B
$B8F$S=P$7!J%$%s%?!<%U%'!<%9@\B3;~$NMW5a!K(B
DevReq:	devid       (bit 6$B!A(B 0) $B@\B3$5$l$?%G%P%$%9$N%"%I%l%9(B
	            (bit 7)     1
	            (bit 8$B!A(B15) $B%$%s%?!<%U%'!<%9%G%#%9%/%j%W%?$N(BbInterfaceNumber
	cmd.cmd     = DC_USBEVENT
	datano      = USB_MOUNT
	datacnt     (bit 7$B!A(B 0) bInterfaceClass$B$NCM(B
	            (bit 8$B!A(B15) bInterfaceSubClass$B$NCM(B
	            (bit16$B!A(B23) bInterfaceProtocol$B$NCM(B
	taskid      $BM=Ls(B(0)
	memptr      $BM=Ls(B(0)
$B1~Ez!J%$%s%?!<%U%'!<%9@\B3;~$NMW5a!K(B
DevRsp:	devid       (bit 6$B!A(B 0) $B@\B3$5$l$?%G%P%$%9$N%"%I%l%9(B
	            (bit 7)     1
	            (bit 8$B!A(B15) $B%$%s%?!<%U%'!<%9%G%#%9%/%j%W%?$N(BbInterfaceNumber
	cmd.cmd     = DC_USBEVENT
	datano      $BM=Ls(B
	datacnt     $BM=Ls(B
	error       $B1~Ez%3!<%I(B(USB_OWN/USB_NONE)
$B8F$S=P$7!J%$%s%?!<%U%'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7$?>uBV$G(Blen$B$,(B0$B0J30$N>l9g$NF0:n$OJ]>Z$7$J$$!#(B

len$B$K;XDj$G$-$kCM$O!$(B4088$B!J(B4096 - $B%G%P%$%9%j%/%(%9%H$NBg$-$5(B(8)$B!K(B $B%P%$%H$,>e8B$H$J$k!#(B

$B$J$*!"%^%M!<%8%cFbIt$G(Blen$B$G;XDj$7$?CM$r(BwLength$B$H$7$F@_Dj$9$k$?$a!"(B $B%G%P%$%9%j%/%(%9%H$N(BwLength$B$r;XDj$9$kI,MW$OL5$$!#(B

$B!Z%(%i!<%3!<%I![(B

USB_ERR_DEVICEdid$B$,IT@5!J%G%P%$%9$,B8:_$7$J$$!K(B
USB_ERR_STALLSTALL$B$,H/@8$7$?(B
USB_ERR_ABORT$BDL?.$,%-%c%s%;%k$5$l$?(B
USB_ERR_IO_*$BF~=PNO%(%i!<$,H/@8$7$?(B
USB_ERR_REQUEST$BH/9T$G$-$J$$%G%P%$%9%j%/%(%9%H$rH/9T$7$h$&$H$7$?(B
USB_ERR_PARrequest$B$,(BNULL$B$G$"$k(B
usbDescriptorDevice
usbDescriptorInterface
usbDescriptorEndpoint
 
$B%G%P%$%9!?%$%s%?!<%U%'!<%9!?%(%s%I%]%$%s%H%G%#%9%/%j%W%?$N

$B!Z7A<0![(B

ERR	usbDescriptorDevice(W did, UB *data, W len, W *rlen)
ERR	usbDescriptorInterface(W iid, UB *data, W len, W *rlen)
ERR	usbDescriptorEndpoint(W pid, UB *data, W len, W *rlen)

$B!Z%Q%i%a!<%?![(B

did$B%G%P%$%9$N%"%I%l%9(B(usbDescriptorDevice())
iid$B%$%s%?!<%U%'!<%9(BID(usbDescriptorInterface())
pid$B%Q%$%W(BID(usbDescriptorPipe())
data$B
len$B
rlen$B%G%#%9%/%j%W%?$NBg$-$5$r3JG<$9$kNN0h$N%]%$%s%?(B

$B!Z%j%?!<%sCM![(B

= 0 (USB_OK)$B%G%#%9%/%j%W%?$N
< 0$B%(%i!

$B!Z2r@b![(B

(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%$%s%?!<%U%'!<%9$N%/%m!<%:(B

$B!Z7A<0![(B

ERR	usbCloseInterface(W iid)

$B!Z%Q%i%a!<%?![(B

iid$B%$%s%?!<%U%'!<%9(BID

$B!Z%j%?!<%sCM![(B

= 0 (USB_OK)$B%$%s%?!<%U%'!<%9$r%/%m!<%:$7$?(B
< 0$B%(%i!

$B!Z2r@b![(B

$B%$%s%?!<%U%'!<%9$KBP$9$kA`:n$N=*N;$r@k8@$9$k!#(B $B%$%s%?!<%U%'!<%9$r%/%m!<%:$9$k$H!"$=$N%$%s%?!<%U%'!<%9$KB0$7$F$$$k(B $B%(%s%I%]%$%s%H$OA4$F%/%m!<%:$5$l$k!#(B

$B%*!<%W%s$7$?%?%9%/0J30$+$i$N%?%9%/$+$i$b%/%m!<%:$r9T$&$3$H$,$G$-$k!#(B $B$h$C$F!"(Biid$B$K8m$C$?CM$r;XDj$7$J$$$h$&$KCm0U$9$k$3$H!#(B

$B!Z%(%i!<%3!<%I![(B

USB_ERR_INTERFACEiid$B$,IT@5!J(Biid$B$G;XDj$7$?%$%s%?!<%U%'!<%9$OB8:_$7$J$$!K(B
usbOpenPipe
 
$B%(%s%I%]%$%s%H$N%*!<%W%s!J%Q%$%W$N:n@.!K(B

$B!Z7A<0![(B

WERR	usbOpenPipe(W iid, W epadr, usbIoMode mode, W mbfid)

$B!Z%Q%i%a!<%?![(B

iid$B%$%s%?!<%U%'!<%9(BID$B!J(BusbOpenInterface()$B$GF@$k!K(B
epadr$BA`:n$NBP>]$H$J$k%(%s%I%]%$%s%H%"%I%l%9!J%(%s%I%]%$%s%H%G%#%9%/%j%W%?$N(BbEndpointAddress$B!K(B
mode$BF0:n%b!<%I(B [USB_NOWAIT] | [USB_SHORTOK]
USB_NOWAITpipe$B$X$N(Bread/write$BCf!"E>Aw$N407k$rBT$?$J$$(B(nowait mode)$B!#;XDj$7$J$$>l9g$O(Bpipe$B$X$N(Bread/write$B$N407k$rBT$D(B (wait mode)$B!#(B
USB_SHORTOKus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(Bnowait$B%b!<%I$r;XDj$7$?>l9g$r=|$-!"(B $BF0:n$,40N;$9$k$^$G$3$N4X?t$O=*N;$7$J$$!#(B

nowait$B%b!<%I$N>l9g!"(Brlen$B$K$O(B0$B$,3JG<$5$l$k!#(B $B$^$?!"0J2<$NE@$KCm0U$9$kI,MW$,$"$k!#(B

$B%(%s%I%]%$%s%H$+$i%G!<%?$rl9g$O(Blen$B$r%(%s%I%]%$%s%H$N(BwMaxPacketSize$B$NG\?t$K$7$J$$$H(B $BFI$_Aw$,9T$($J$/$J$C$F$7$^$&!#(B

$BAw?.$9$k>l9g$O(Bdat$B$K(BNULL$B$r;XDj$7$F$O$J$i$J$$!#(B

$B!Z%(%i!<%3!<%I![(B

USB_ERR_DEVICE$B%G%P%$%9$X$NA`:n$,6X;_$5$l$F$$$k(B
USB_ERR_INTERFACE$B%$%s%?!<%U%'!<%9$X$NA`:n$,6X;_$5$l$F$$$k(B
USB_ERR_ENDPOINT pid$B$,IT@5!J%Q%$%W$,B8:_$7$J$$!K(B
USB_ERR_STALLSTALL$B$,H/@8$7$?(B
USB_ERR_ABORT$BDL?.$,%-%c%s%;%k$5$l$?(B
USB_ERR_IO_*$BF~=PNO%(%i!<$,H/@8$7$?(B
USB_ERR_BUSY$BAw?.MW5a$r
usbCancelDevice
usbCancelInterface
usbCancelPipe
 
$BDL?.$N%-%c%s%;%k!J%G%P%$%9!&%$%s%?!<%U%'!<%9!&%(%s%I%]%$%s%HC10L!K(B

$B!Z7A<0![(B

ERR	usbCancelDevice(W did)
ERR	usbCancelInterface(W iid)
ERR	usbCancelPipe(W pid)

$B!Z%Q%i%a!<%?![(B

did$B%G%P%$%9$N%"%I%l%9!J(BusbCancelDevice()$B$N>l9g!K(B
iid$B%$%s%?!<%U%'!<%9(BID$B!J(BusbCancelInterface()$B$N>l9g!K(B
pid$B%Q%$%W(BID$B!J(BusbCancelPipe()$B$N>l9g!K(B

$B!Z%j%?!<%sCM![(B

= 0 (USB_OK)$B%-%c%s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$o$l$k!#(B

usbEventPattern$B9=B$BN$O0J2<$N7A$r$H$k!#$3$N9=B$BN$O!"8e=R$N(B usbRegistInterface()$B$G$b;HMQ$9$k!#(B

	typedef	struct	{
		UB	bClass;
		UB	bSubClass;
		UB	bProtocol;
		UB	mask;
	}	usbEventPattern;

usbRegistDevice()$B$r;HMQ$9$k>l9g!"(B bClass, bSubClass, bProtocol$B$NCM$O%G%P%$%9%G%#%9%/%j%W%?$N(B bDeviceClass, bDeviceSubClass, bDeviceProtocol$B$KBP1~$9$k!#(B usbRegistInterface()$B$r;HMQ$9$k>l9g!"(B bClass, bSubClass, bProtocol$B$NCM$O%$%s%?!<%U%'!<%9%G%#%9%/%j%W%?$N(B bInterfaceClass, bInterfaceSubClass, bInterfaceProcotol$B$KBP1~$9$k!#(B

mask$B$O0J2<$N#4]$H$9$k%G%P%$%9$KBP$9$k%$%Y%s%H$rH/@8$5$;$k(B $B!J$?$@$7!"(Bmask$B$K(B0$B$O;XDj$G$-$J$$!K!#(B

EVENT_ANY$B%G%P%$%9!&%$%s%?!<%U%'!<%9$N
EVENT_CLASSbClass$B$rHf3SBP>]$H$9$k(B
EVENT_SUBCLASSbSubClass$B$rHf3SBP>]$H$9$k(B
EVENT_PROTOCOLbProtocol$B$rHf3SBP>]$H$9$k(B

$B!Z%(%i!<%3!<%I![(B

USB_ERR_DEVICE$B;XDj$7$?%]!<%H$KBP$9$k%G%P%$%9@\B3%$%Y%s%H$NEPO?$,9T$o$l$F$$$J$$!J(Bpattern = NULL$B$N;~$KH/@8!K(B
USB_ERR_NOMEM$B$3$l0J>e%G%P%$%9%$%Y%s%H$rEPO?$G$-$J$$(B
USB_ERR_PARpattern.mask$B$,(B0$B$G$"$k(B
usbRegistInterface
 
$B%$%s%?!<%U%'!<%9@\B3!&2r=|%$%Y%s%H$NDLCN@h$rEPO?(B

$B!Z7A<0![(B

ERR	usbRegistInterface(ID portid, usbEventPattern *pattern)

$B!Z%Q%i%a!<%?![(B

portid$B%G%P%$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$o$l$F$$$J$$!J(Bpattern = NULL$B$N;~$KH/@8!K(B
USB_ERR_NOMEM$B$3$l0J>e%$%s%?!<%U%'!<%9%$%Y%s%H$rEPO?$G$-$J$$(B
USB_ERR_PARpattern.mask$B$,(B0$B$G$"$k(B
usbSuspend
usbResume
 
USB$B%^%M!<%8%c$N%5%9%Z%s%I!&%l%8%e!<%`@)8f(B

$B!Z7A<0![(B

VOID	usbSuspend(Bool start)
VOID	usbResume(Bool start)

$B!Z%Q%i%a!<%?![(B

startTrue$B%5%9%Z%s%I0\9T=hM}$r3+;O$9$k(B(usbSuspend())
$B2?$b$7$J$$(B(usbResume())
False$B2?$b$7$J$$(B(usbSuspend())
$B%l%8%e!<%`0\9T=hM}$r3+;O$9$k(B(usbResume())

$B!Z%j%?!<%sCM![(B

$B$J$7(B

$B!Z2r@b![(B

$B%7%9%F%`$N%5%9%Z%s%I!&%l%8%e!<%`=hM}$r(BUSB$B%^%M!<%8%c$KDLCN$9$k!#(B

$B%5%9%Z%s%ICf$O%G%P%$%9@\B3!&2r=|$r8!=P$9$k$3$H$,$G$-$J$/$J$k$?$a(B $B%5%9%Z%s%ICf$O%G%P%$%9$r2r=|$7!"%l%8%e!<%`;~$K%G%P%$%9$r@\B3$9$k(B $B=hM}$r9T$C$F$$$k!#(B

$B$h$C$F!"%5%9%Z%s%I=hM}Cf$K%G%P%$%9!&%$%s%?!<%U%'!<%92r=|%$%Y%s%H$,!"(B $B%l%8%e!<%`=hM}Cf$K%G%P%$%9!&%$%s%?!<%U%'!<%9@\B3%$%Y%s%H$,H/@8$9$k!#(B $B!J%G%P%$%9%I%i%$%P$O!"$3$l$i$N%$%Y%s%H$r

usbSuspend()$B$b$7$/$O(BusbResume()$B$N(B $B$I$A$i$+$N=hM}$,=*N;$9$k$^$G$b$&JRJ}$N=hM}$r9T$C$?>l9g$NF0:n$O(B $BJ]>Z$7$J$$!#(B

usbResetDevice
 
$B%G%P%$%9$N%j%;%C%H!J%=%U%H%&%'%"$K$h$k%G%P%$%9$N@Z$jN%$7!&:F@\B3!K(B

$B!Z7A<0![(B

ERR   usbResetDevice(W did)

$B!Z%Q%i%a!<%?![(B

did$B%G%P%$%9$N%"%I%l%9(B

$B!Z%j%?!<%sCM![(B

= 0 (USB_OK)$B%G%P%$%9$r%j%;%C%H$7$?(B
< 0$B%(%i!<(B

$B!Z2r@b![(B

did$B$G;XDj$7$?%G%P%$%9$r%j%;%C%H$9$k!#(B

$B%G%P%$%9$r0lC62r=|$7!":FEY@\B3$7$?$NF1$88z2L$,$"$j!"(B $B%j%;%C%H$NBP>]$K$J$C$?%G%P%$%9$KBP1~IU$1$i$l$F$$$k%I%i%$%P$K$O(B $B%G%P%$%92r=|%$%Y%s%H"*%G%P%$%9@\B3%$%Y%s%H$N=g$K%$%Y%s%H$,(B $BAw$i$l$k!#(B

$B%j%;%C%H$r9T$C$?8e$N%G%P%$%9$N%"%I%l%9$O%j%;%C%H$r9T$&A0$H(B $BF1$8$H$O8B$i$J$$!#(B $B$^$?!"%G%P%$%9$N%j%;%C%H$,40N;$9$k$^$G$3$N4X?t$,BT$D$3$H$OL5$$!#(B

$B!Z%(%i!<%3!<%I![(B

USB_ERR_DEVICEdid$B$,IT@5!J%G%P%$%9$,B8:_$7$J$$!K(B
usbGetHubInfo
 
$B%G%P%$%9@\B3>pJs$N

$B!Z7A<0![(B

WERR	usbGetHubInfo(W *report, W size)

$B!Z%Q%i%a!<%?![(B

report$B@\B3>pJs$r3JG<$9$kNN0h$N%]%$%s%?(B
size$B@\B3>pJs$r3JG<$9$kNN0h$NBg$-$5(B

$B!Z%j%?!<%sCM![(B

>= 0$B@\B3>pJs$N%5%$%:!J%P%$%H!K(B
< 0$B%(%i!<(B

$B!Z2r@b![(B

USB$B%O%V%G%P%$%9$N@\B3>pJs$r

	 bit 31                         16  15                           0
	+0 [[    hub device$B$N%"%I%l%9(B     ][    hub device$B$N%9%F!<%?%9(B    ]]
	 bit 31                                    8  7                  0
	+4 [[               $BL$;HMQ(B(0)               ][hub device$B$N%]!<%H?t(B]]

	+8$B!A(B	(port$B$N?t$@$17+$jJV$7(B)
	 bit 31                         16  15                           0
	   [[ $B@\B3$5$l$F$$$k(Bdevice$B$N(Baddr. ][       device$B$N%9%F!<%?%9(B     ]]

hub device$B$N%9%F!<%?%9$O0J2<$N9=B$BN$GI=$5$l$k!#(B

	typedef union   {
	    struct      {
	        UH      level:3;        /* hub$B$NCJ?t(B */
	        UH      self_power:1;   /* self powered hub$B$J$i(B1 */
	        UH      reserved:12;
	    }   bmStatus;
	    UH  status;
	}       usbHubStatus;
PS_PORT_CONNECTION0x0001$B%G%P%$%9$,@\B3$5$l$F$$$k>l9g$K@_Dj$5$l$k(B
PS_PORT_ENABLE0x0002$B%G%P%$%9$,%*!<%W%s$5$l$F$$$k>l9g$K@_Dj$5$l$F$$$k(B
PS_PORT_SUSPEND0x0004$B%G%P%$%9$,%5%9%Z%s%I>uBV$N>l9g$K@_Dj$5$l$k!JDL>o!"$3$NCM$,@_Dj$5$l$k$3$H$O$J$$!K(B
PS_PORT_OVER_CURRENT0x0008$B%G%P%$%9$,2aEEN.>uBV$K$"$k>l9g!J(Bbus-powered hub$B$,#2$DO"B3$G@\B3$5$l$?>l9g$O%[%9%H$+$i1s$$B&$N(Bhub$B$K@_Dj$5$l$k!K(B
PS_PORT_RESET0x0010$B%G%P%$%9$O%j%;%C%H$r9T$C$F$$$k!JDL>o!"$3$NCM$,@_Dj$5$l$k$3$H$O$J$$!K(B
PS_PORT_POWER0x0100device$B$KBP$7$FEE8;$,6!5k$5$l$F$$$k>l9g$K@_Dj$5$l$k!JDL>o$O$3$NCM$,@_Dj$5$l$F$$$k$,!"%O%V$b$7$/$O%G%P%$%9$K2?$i$+$N0[>o$,5/$3$C$F$$$k>l9g$O@_Dj$5$l$F$$$J$$$3$H$,$"$k!K(B
PS_PORT_LOW_SPEED0x0200low speed device$B!J%-!<%\!<%I$d%^%&%9Ey$,5s$2$i$l$k!K$,@\B3$5$l$?>l9g$K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