LinuxÏÂUSB suspend/resumeÔ´Âë·ÖÎö
Linux
ÏÂ
USB
suspend/resume
Ô´Âë·ÖÎö
Author:aaron
±¾ÎÄÖ÷Òª´Ó×Ô¼º¿ª·¢µÄÒ»¸ö
USB
Çý¶¯µÄÀý×ÓÀ´ÉîÈë½²½â
linux
ÄÚºËÊÇÈçºÎÖ§³Ö
USB
É豸µÄÐÝÃߺͻ½ÐѵÄ
,
×î½üÎÒÔÚΪÎÒÃǹ«Ë¾µÄÒ»¸öÄ£¿éд
linux
ϵÄÇý¶¯
,
ÆäÖÐÖ®Ò»¾ÍÊÇÒªÖ§³Ö
USB
µÄÐÝÃß»½ÐÑÎÊÌâ
,
ʵ¼ÊÉÏ
linux
Äں˶Ô
USB
µÄÕâ¸ö¹¦ÄܵÄÖ§³Ö»¹ÊDZȽÏеÄ
,
Ò²¾ÍÊÇ×î½ü¼¸ÄêµÄÊÂ
.
Ò»
´ò¿ª
/
¹Ø±Õ
USB suspend/resuem
¹¦ÄÜ
ÒªÈÃ
linux
Ö§³Ö
usb suspend/resuem,
µ±È»ÏÈÒª°ÑÄÚºËÖÐÕâ¸ö¹¦ÄܵĴúÂë±àÒë½øÈ¥¿©
,
¼´ÒªÔÚ
make menuconfig
ʱ´ò¿ª¶ÔÕâÏÄܵÄÖ§³Ö
.
µÚÒ»¸ö´ò¿ªµÄÏîÊÇ
CONFIG_PM,
¼´Õû¸öϵͳµÄµçÔ´¹ÜÀí
, USB suspend/resuem
Ö»ÊÇÕû¸öµçÔ´¹ÜÀíµÄÒ»¸ö×Ôϵͳ
.
Ö»Óдò¿ªÁËÕâ¸ö¹¦ÄܲÅÄÜÈÃ
USB
µÄÕâ¸öÌØÐÔÄÜÓÃ
.
µÚ¶þ¸öÒª´ò¿ªµÄµ±ÈÃÊÇ
USB
×Ô¼ºµÄ¿ª¹ØÁË
CONFIG_USB_SUSPEND.
¼´´ò¿ªÁËÕâ¸ö¹¦ÄܺóÎÒÃÇÖ»ÒªÔÚÎÒÃÇ×Ô¼ºµÄÇý¶¯Àï¼òµ¥µ÷ÓÃÏÂ
USB core
ÌṩµÄº¯Êý½Ó¿Ú¾ÍÄÜʹÎÒÃǵÄÉ豸ÐÝÃßÁË
.
¶þ
Ô´Âë·ÖÎö
ÔÚ
2.6.19
֮ǰµÄ´úÂëÖв»Ö§³Ö
USB
×Ô¶¯ÐÝÃߵŦÄÜ
,
ËüÖ»ÄÜÊÇÔÚ
host
ÐÝÃßÇé¿öϲŻáÈÃ
USB
É豸ҲÐÝÃß
.
ËùÒÔÈç¹ûÎÒÃÇÒªÈÃ×Ô¼ºµÄÉ豸ÔÚ²»Ê¹ÓõÄÇé¿öϾÍÐÝÃ߾͵Ã×Ô¼ºÌí¼ÓÏàÓ¦µÄ´úÂë
,
ÐÒÔ˵ÄÊÇÎÒÃDz»ÐèÒªÌí¼Ó¸´ÔӵĴúÂë¾ÍÄÜ´ïµ½Õâ¸öÄ¿µÄ
,
ÒòΪ
USB core
ÀïÌṩÁ˼¸¸ö½Ó¿Ú¿ÉÒÔÖ±½ÓÈÃÎÒÃǵÄÇý¶¯µ÷ÓÃÒÔ°ÑÎÒÃǵÄÉ豸ÖÃÈëÐÝÃß״̬
.
ÏÂÃæÎÒÃÇÒÔ
2.6.16
µÄ´úÂëΪÀýÀ´·ÖÎöÏÂ
USB
É豸ÊÇÈçºÎ½øÈëÐÝÃßµÄ
.
Drivers\usr\core\hub.c:
int usb_suspend_device(struct usb_device *udev)
{
#ifdef
CONFIG_USB_SUSPEND
if (udev->state ==
USB_STATE_NOTATTACHED)
return -ENODEV;
return
__usb_suspend_device(udev, udev->portnum);
#else
/* NOTE:
udev->state unchanged, it's not lying ...
*/
udev->dev.power.power_state
= PMSG_SUSPEND;
return 0;
#endif
}
û´í
,
ÔÚÎÒÃǵ
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
2.2 °²×°LinuxÖÁÓ²ÅÌ
×¼±¸¹¤×÷Íê³ÉÖ®ºó£¬¾Í¿ÉÒÔ×ÅÊÖ½«Linux°²×°µ½Ó²ÅÌÖÐÁË¡£Èç½ñLinuxµÄ°²×°¹ý³ÌÒѾ·Ç³£“ɵ¹Ï”»¯£¬Ö»ÐèÒªÇáµã¼¸ÏÂÊó±ê£¬¾ÍÄܹ»Íê³ÉÕû¸öϵͳµÄ°²×°¡£¾¡¹ÜÈç´Ë£¬ÕâÀïÈÔÈ»ÏêϸµØ¸ø³ö°²×°¹ý³ÌµÄÿһ²½¡£Í¬Ê±£¬¶ÔÓÚºÍWindows´æÔÚÏÔÖøÇø±ðµÄµØ·½£¬ÈçÓ²ÅÌ·ÖÇøµÄ×éÖ¯·½Ê½£¬±¾½Ú½«×öÏêϸµÄÌÖÂÛ¡£ ......
Linux ÓÐ×Ô¼ºµÄ input ×Óϵͳ£¬¿ÉÒÔͳһ¹ÜÀíÊó±êºÍ¼üÅÌʼþ¡£
»ùÓÚÊäÈë×Óϵͳ ʵÏÖµÄ uinput ¿ÉÒÔ·½±ãµÄÔÚÓû§¿Õ¼äÄ£ÄâÊó±êºÍ¼üÅÌʼþ¡£
µ±È»£¬Ò²¿ÉÒÔ×Ô¼ºÔìÂÖ×Ó£¬ ×öÒ»¸ö×Ö·ûÉ豸½ÓÊÕÓû§ÊäÈ룬¸ù¾ÝÊäÈ룬ͶµÝ input ʼþ¡£
»¹ÓÐÒ»ÖÖ·½Ê½¾ÍÊÇÖ±½Ó Íù evnent ÀïдÈëÊý¾Ý£¬ ¶¼¿ÉÒÔ´ïµ½¿ØÖÆÊó±ê¼üÅ̵ŦÄÜ¡£
±¾ÆªÎÄÕ¾ÍÊÇ ......