linuxÄÚºËÖÐusbϵͳÖ÷ÒªµÄÊý¾Ý½á¹¹
USB Äںˣ¨USBÇý¶¯£¬USBD £©´¦ÓÚϵͳµÄÖÐÐÄ£¬¶ÔÓÚËü½øÐÐÑо¿ÊÇÄܹ»½øÐÐUSBÇý¶¯¿ª·¢£¨°üÀ¨¿Í»§Çý¶¯ºÍÖ÷»úÇý¶¯£©µÄµÚÒ»²½¡£ËüΪ¿Í»§¶ËÇý¶¯ºÍÖ÷»ú¿ØÖÆÆ÷Çý¶¯ÌṩÁËÖ÷ÒªÊý¾Ý½á¹¹ºÍ½Ó¿Úº¯Êý£¬Ö÷ÒªÓÐËÄÀ๦ÄÜ£º¿Í»§¶ËÇý¶¯¹ÜÀí£¬USBÉ豸µÄÅäÖú͹ÜÀí£¬Ö÷»ú¿ØÖÆÆ÷µÄ¹ÜÀí£¬ÐÒé¿ØÖÆÃüÁºÍÊý¾Ý´«ÊäµÄ¹ÜÀí¡£¾ßÌå´úÂëÖ÷Òª¼¯ÖÐÔÚ linux/drivers/usbϵÄusb.c, usb.hÖÐ
Ö÷ÒªÊý¾Ý½á¹¹·ÖÎö
Ö÷ÒªÓÐËĸöÊý¾Ý½á¹¹£¬·Ö±ðÊÇUSBÉ豸usb_device£¬±£´æÁËÒ»¸öUSBÉ豸µÄÐÅÏ¢£¬°üÀ¨É豸µØÖ·£¬É豸ÃèÊö·û£¬ÅäÖÃÃèÊö·û£¬µÈµÈ
USB×ÜÏßϵͳusb_bus£¬±£´æÁËÒ»¸öUSB×ÜÏßϵͳµÄÐÅÏ¢£¬°üÀ¨×ÜÏßÉÏÉ豸µØÖ·ÐÅÏ¢£¬¸ù¼¯Ï߯÷£¬´ø¿íʹÓÃÇé¿öµÈ¡£Ò»¸öUSB×ÜÏßϵͳ¿Ï¶¨ÓÐÒ»¸öÖ÷»ú¿ØÖÆÆ÷ºÍÒ»¸ö¸ù¼¯Ï߯÷¡£LinuxÖ§³Ö¶àUSB×ÜÏßϵͳ
¿Í»§¶ËÇý¶¯³ÌÐòusb_driver£¬±£´æÁ˿ͻ§Çý¶¯ÐÅÏ¢£¬°üÀ¨Çý¶¯Ãû³Æ£¬ÒÔ¼°Çý¶¯Ìṩ¸øUSBÄÚºËʹÓõĺ¯ÊýÖ¸ÕëµÈ
£¨USB Request Block£©urb£¬ÊǽøÐÐUSBͨÐŵÄÊý¾Ý½á¹¹¡£LinuxµÄUSB×ÓϵͳֻʹÓÃÕâôһÖÖÊý¾Ý½á¹¹À´½øÐÐUSBͨÐÅ£¬urb°üº¬Á˽¨Á¢ÈκΠUSB´«ÊäËùÐèµÄËùÓÐÐÅÏ¢£¬²¢¹á´©ÓÚUSBÐÒéÕ»¶ÔÊý¾Ý´¦ÀíµÄÕû¸ö¹ý³Ì¡£
ÏÂÃæÊǶԸ÷²¿·Ö½øÐÐÏêϸ·ÖÎö¡£
struct usb_device { //´ú±íÒ»¸öUSBÉ豸
int devnum; //·ÖÅäµÄÉ豸µØÖ·£¬1-127
enum {
USB_SPEED_UNKNOWN = 0, /* enumerating */
USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
USB_SPEED_HIGH /* usb 2.0 */
} speed; //É豸ËÙ¶È£¬µÍËÙ/È«ËÙ/¸ßËÙ
struct usb_device *tt; /* usb1.1 device on usb2.0 bus */£¬ÊÂÎñ´¦Àí½âÊÍÆ÷
int ttport; /* device/hub port on that tt */É豸ËùÁ¬½ÓµÄ¾ßÓÐÊÂÎñ´¦Àí½âÊÍÆ÷¹¦Äܵļ¯Ï߯÷¶Ë¿Ú
atomic_t refcnt; /* Reference count */ÒýÓüÆÊý
struct semaphore serialize; //ÓÃÓÚͬ²½
unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */ÓÃÓÚͬ²½Çл»µÄλͼ£¬Ã¿¸ö¶ËµãÕ¼ÓÃ1룬[0]±íʾÊäÈ룬[1]Êä³ö
unsigned int halted[2]; /* endpoint halts; one bit per endpoint # & direction; [0] = IN, [1] = OUT */±íʾ¶ËµãÊÇ·ñ´¦ÓÚֹͣ״̬µÄλͼ
int epmaxpacketin
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
ǰÑÔ
ÄÚ´æ¹ÜÀíÒ»ÏòÊÇËùÓвÙ×÷ϵͳÊé¼®²»Ï§±Êī֨µãÌÖÂÛµÄÄÚÈÝ£¬ÎÞÂÛÊÐÃæÉÏ»òÊÇÍøÉ϶¼³ä³â×Å´óÁ¿Éæ¼°ÄÚ´æ¹ÜÀíµÄ½Ì²ÄºÍ×ÊÁÏ¡£Òò´ËÎÒÃÇÕâÀïËùҪдµÄLinuxÄÚ´æ¹ÜÀí²ÉÈ¡±ØÖؾÍÇáµÄ²ßÂÔ£¬´ÓÀíÂÛ²ãÃæ¾Í²»È¥°åÃÅŪ¸«£¬êÝЦ´ó·½ÁË¡£ÎÒÃÇ×îÏë×öµÄºÍ¿ÉÄÜ×öµ½µÄÊÇÒÔ¿ª·¢ÕߵĽǶÈ̸̸¶ÔÄÚ´æ¹ÜÀíµÄÀí½â£¬×îÖÕÄ¿µÄÊǰÑÎÒÃÇÔÚÄں˿ª·¢ÖÐÊ¹Ó ......
linuxĿ¼¼Ü¹¹
/ ¸ùĿ¼
/bin ³£ÓõÄÃüÁî
binary file µÄÄ¿錄
/boot ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ
(kernel) ÔÚÄÚ
/boot/grub/menu.lst GRUBÉèÖÃ
/boot/vmlinuz ÄÚºË
......
¡¡¡¡±¾ÎÄÒ²¼´¡¶Learning the bash Shell¡·3rd EditionµÄµÚÆßÕÂInput/Output and Command-Line ProcessintÖ®¶ÁÊé±Ê¼ÇÖ®Ò»¡£ÎÒÃÇÔø¾Ñ§Ï°¹ýshellµÄ»ù±¾IOÖØ¶¨Ïò²Ù×÷£º>¡¢<ºÍ|¡£»ù±¾ÉÏÄÜÂú×ã95%µÄÇé¿ö£¬µ«ÊÇÎÒÃÇÐèÒªÖªµÀbashÖ§³ÖµÄÖØ¶¨Ïò²Ù×÷¡£
cmd1
|cmd2
£º pipe£¬½«cmd1
µÄ±ê×¼Êä³ö×÷Ϊcmd2
µÄ±ê×¼ÊäÈë
> ......