在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<s id="cmphk"><label id="cmphk"></label></s>
    <span id="cmphk"><var id="cmphk"></var></span>
    <dfn id="cmphk"><var id="cmphk"></var></dfn>
    <menu id="cmphk"><thead id="cmphk"></thead></menu>

    <address id="cmphk"></address>

      <dfn id="cmphk"></dfn>
      
      
      <span id="cmphk"></span>

      <object id="cmphk"><tt id="cmphk"></tt></object>
      1. 新聞中心

        USB設(shè)備的枚舉

        作者: 時(shí)間:2016-12-15 來源:網(wǎng)絡(luò) 收藏
        一,枚舉是如何進(jìn)行的
        此處摘錄一個(gè),[12]中的關(guān)于windows下USB枚舉的過程的總結(jié):
        1. The host or hub detects the connection of a new device via the devices pull
        up resistors on thedata pair. The host waits for at least 100ms allowing for
        the plug to be inserted fully and for power to stabilise on the device.
        2. Host issues a reset placing the device is the default state. The device may
        now respond to the default address zero.
        3. The MS Windows host asks for the first 64 bytes of the Device Descriptor.
        4. After receiving the first 8 bytes of the Device Descriptor, it immediately issues
        another bus reset.
        5. The host now issues a Set Address command, placing the device in the
        addressed state.
        6. The host asks for the entire 18 bytes of the Device Descriptor.
        7. It then asks for 9 bytes of the Configuration Descriptor to determine the
        overall size.
        8. The host asks for 255 bytes of the Configuration Descriptor.
        9. Host asks for any String Descriptors if they were specified.
        At the end of Step 9, Windows will ask for a driver for your device. It is
        then common to see it request all the descriptors again before it issues a Set
        Configuration request.
        以上大概的含義如下


        二,枚舉的過程
        1,獲取設(shè)備描述符
        主機(jī)向address 0發(fā)送USB協(xié)議規(guī)定的Get_Device_Descriptor命令,以取得卻缺省控制管道所支持的最大數(shù)據(jù)包長(zhǎng)度,并在有限的時(shí)間內(nèi)等待USB設(shè)備的響應(yīng),該長(zhǎng)度包含在設(shè)備描述符的bMaxPacketSize0字段中,其地址偏移量為7,所以這時(shí)主機(jī)只需讀取該描述符的前8個(gè)字節(jié)。注意,主機(jī)一次只能列舉一個(gè)USB設(shè)備,所以同一時(shí)刻只能有一個(gè)USB設(shè)備使用缺省地址0。




        2,設(shè)置地址
        主機(jī)通過發(fā)送一個(gè)Set_Address請(qǐng)求來分配一個(gè)唯一的地址給設(shè)備。設(shè)備讀取這個(gè)請(qǐng)求,返回一個(gè)確認(rèn),并保存新的地址。從此開始所有通信都使用這個(gè)新地址



        3,獲取設(shè)備描述符
        主機(jī)向新地址重新發(fā)送Get_Device_Descriptor命令,此次讀取其設(shè)備描述符的全部字段,以了解該設(shè)備的總體信息,如VID,PID。



        4,獲取配置描述符
        主機(jī)向設(shè)備循環(huán)發(fā)送Get_Device_Configuration命令,要求USB設(shè)備回答,以讀取全部配置信息。





        5,獲取配置描述符其它內(nèi)容




        6再次獲取設(shè)備和配置描述符





        7,主機(jī)發(fā)送Get_Device_String命令,獲得字符集描述(unicode),比如產(chǎn)商、產(chǎn)品描述、型號(hào)等等。這是可選項(xiàng),如果設(shè)備有這些信息,主機(jī)將會(huì)彈出窗口,展示發(fā)現(xiàn)新設(shè)備的信息,產(chǎn)商、產(chǎn)品描述、型號(hào)等。本例中Device_Descriptor,Device_Configuration,Device_InterFace中有關(guān)字符串的字段都為0,因而沒有字符串描述,所以此處無此命令.

        8,設(shè)置配置
        根據(jù)Device_Descriptor和Device_Configuration應(yīng)答,主機(jī)判斷是否能夠提供USB的Driver,一般主機(jī)能提供幾大類的設(shè)備,如鍵盤、鼠標(biāo)、游戲操作桿、存儲(chǔ)、打印機(jī)、掃描儀等,該操作就在后臺(tái)運(yùn)行。
        如果主機(jī)不能提供驅(qū)動(dòng),此時(shí)將會(huì)彈出對(duì)話框,索要USB的Driver。
        加載了USB設(shè)備驅(qū)動(dòng)以后,主機(jī)發(fā)送Set_Configuration(x)命令請(qǐng)求為該設(shè)備選擇一個(gè)合適的配置(x代表非0的配置值)。如果配置成功,USB設(shè)備進(jìn)入“配置”狀態(tài),并可以和客戶軟件進(jìn)行數(shù)據(jù)傳輸。




        至此,常規(guī)的USB完成了其必須進(jìn)行的配置和連接工作。查看注冊(cè)表,能夠發(fā)現(xiàn)相應(yīng)的項(xiàng)目已經(jīng)添加完畢,至此設(shè)備應(yīng)當(dāng)可以開始使用。不過,USB協(xié)議還提供了一些用戶可選的協(xié)議,設(shè)備如果不應(yīng)答,也不會(huì)出錯(cuò),但是會(huì)影響到系統(tǒng)的功能。


        關(guān)鍵詞: USB設(shè)備枚

        評(píng)論


        技術(shù)專區(qū)

        關(guān)閉