201122803 六、發明說明: 【發明所屬之技術領域】 [0001] 本發明涉及一種測試方法與系統,尤指一種測試電子裝 置之USB設備之方法與系統。 【先前技術3 [0002] 隨著電子技術之快速發展,各種電子裝置之週邊設備越 來越多,例如電腦,各種週邊設備如鍵盤、滑鼠、印表 機、掃描器、攝像頭等均需要連接到電腦之主機上,以 0 實現各種功能,為能讓該等設備方便地與電子裝置相連 ,USB介面被廣泛地應用。 [〇〇〇3]根據USB規範之規定,所有USB設備均有供應商識別碼( VID)與產品識別碼(PID),電子裝置藉由不同之供應 商識別碼與產品識別碼來區別不同之設備,供應商識別 瑪與產品識別碼均係兩個位元組長,其中,供應商識別 碼由供應商向USB標準協切請’每個供應商之供應商識 別碼是唯一的,產品識別碼由供應商自行決定,一般情 〇 況下,不同之產品、相同產品之不同型號、相同型號之 不同設計之產品具有不同之產品識別碼,以便區別相同 廠家之不同設備。 [0004]於電子裝置組裝完成後’需要檢測各種USB週邊設備是否 與電子裝置連接完好’通常之測織方法係人工逐一檢測 ,測試效率低,且測試準確率不高。 【發明内容】 _]黎於以上内容,有必要提供-種可高效地測試電子裝置 之USB設備之方法與系統。 098144008 表單編號A0101 第3頁/共12頁 0982075338-0 201122803 [0006] [0007] [0008] [0009] [0010] [0011] 一種測試電子裝置之USB設備之方法,用以測試一設有 USB介面之電子裝置與對應之USB設備是否連接完好,該 測試方法包括以下步驟: 提供一存儲單元’該存儲單元中存儲了應連接到該USB介 面之USB設備之產品識別碼; 一測試模組查看連接到該USB介面之USB設備之產品識別 碼;及 將該USB設備之產品識別碼與該存儲單元中之產品識別碼 進行比較,若相同’則該電子裝置與對應之USB設備連接 完好,若不相同,則該電子裝置與對應之USB設備未連接 完好。 :: 一種測試電子裝置之USB設備之系統,用以測試電子裝置 與對應之USB設備是否連接完好,該系統包括一測試模組 ,該測試模組中設有一存儲單元〖該存儲單元中存儲了 該電子裝置之各個USB介面與應該連接到電子裝置之各個 USB介面之USB設備之產品識別碼,該測試模組分別連接 到每一USB介面,查看連接到對應USB介面上之USB設備 之產品識別碼是否與存儲單元中—致,從而判斷該電子 裝置與對應之USB設備是否連接完好。 相較於習知技術,本發明測試電子裝置之USB設備之方法 與系統可尚效地測試電子裝置與對應之Usb設備是否連接 完好。 【實施方式】 請參閱圖1與圖2,本發明測試電子裝置之USB設備之系統 098144008 表單編號A0101 第4頁/共12頁 0982075338-0 [0012] 201122803 用以測試一電子裝置10與對應之USB設備是否連接完好’ 該電子裝置10設有複數個USB介面’例如第一 USB介面、 第二USB介面、第三USB介面等,對應之USB設備分別連 接到該等USB介面,例如一第一USB設備連接到第一USB 介面,一第二USB設備連接到第二USB介面,一第三USB 設備連接到一第三USB介面等,上述連接到USB介面之 USB設備可為USB鍵盤、USB滑鼠、USB攝像頭等,該等 USB設備分別設有對應之供應商識別碼與產品識別碼。 0 [0013] 該電子裝置10内設有一測試模组12,該測試模組12可連 接到電子裝置10之各個USB介面,該測試模組12内設有一 存儲單元121,存儲單元121中存儲了電子裝置1〇之各個 USB介面與應該連接到電子裝置1 〇之各個USB介面之USB 設備之供應商識別碼與產品識別碼,例如存館單元121中 存儲有[USB Port 1] : VID = 0x0000, PID = Oxffff ; 上述例子中VID表示供應商識別碼,PID表示產品識別碼 -,上述例子表示連接到第一 USB介面之USB設備之供應商 〇 識別碼應為0x0000、產品識別碼應為〇xf fff。對於不同 之電子裝置,其配置不同,與其連接之USB設備亦不相同 ,可藉由修改該測試模組12之存儲單元121而測試不同類 型之電子裝置。若某一介面沒有連接USB設備,則存儲單 元121中存儲之供應商識別碼與產品識別碼分別為〇。 [0014] 請參閱圖3 ,該測試模組12測試電子裝置1 〇與對應之USB 设備疋否連接元好之方法包括以下步驟: [0015] 步驟2 〇 1 ’測試模組12首先連接到第一 usb介面。 098144008 表單编號A0101 第5頁/共12頁 0982075338-0 201122803 [0016] [0017] [0018] [0019] [0020] [0021] [0022] 步驟2〇2,查看速接到該USB介面之USB設備之供應商識 別碼與產品識別瑪° 步驟203,將上述供應商識別碼與產品識別碼分別與存儲 單元121中之相同USB介面之供應商識別碼與產品識別碼 進行比較,查看是否相同,若不相同,到步驟204 ;若相 同,到步驟2 0 5。 步驟204,電子裝置10與對應之USB設備未連接完好,測 試結束。 步驟205,查看上述USB介面是否是電手裝置1〇之最後一 個USB介面,若是最後—個USB介面,到步驟2〇6 ;若不 是最後一個USB介面,到步驟go?。 步驟206,電子裝置1〇與對應之設備連接完好,測試 結束。 步驟207 ’測試模組12連接到下一個介面,而後回到 步驟202。 . 综上所述,本發明係合乎畚明專利申請條件,爰依法提 出專利中請。惟,以上所述僅為本發明之較佳實施例, 舉凡熟悉本案技藝之人士其所纽本案之創作精神所作 之等效修飾或變化,皆應涵蓋独τ之巾請專利範圍内 〇 【圖式簡單說明】 圖1係本發明測試電子裝置之USB設備之系統之_實施例 之框圖。 098144008 表單編號A0101 第6頁/共12頁 0982075338-0 [0023] 201122803 [0024] 圖2係圖1中電子裝置之框圖。 [0025] 圖3係本發明測試電子裝置之USB設備之方法之一實施例 之流程圖。 【主要元件符號說明】 [0026] 電子裝置:1 0 [0027] 測試模組:12 [0028] 存儲單元:121 〇 098144008 表單編號A0101 第7頁/共12頁 0982075338-0201122803 VI. Description of the Invention: [Technical Field] [0001] The present invention relates to a test method and system, and more particularly to a method and system for testing a USB device of an electronic device. [Prior Art 3 [0002] With the rapid development of electronic technology, more and more peripheral devices of various electronic devices, such as computers, various peripheral devices such as keyboards, mice, printers, scanners, cameras, etc., need to be connected. To the host of the computer, various functions are implemented with 0, and the USB interface is widely used in order to allow such devices to be easily connected to electronic devices. [〇〇〇3] According to the USB specification, all USB devices have a vendor identification number (VID) and a product identification number (PID). The electronic device distinguishes between different vendor identification codes and product identification codes. The equipment, supplier identification and product identification code are two bytes long. The supplier identification code is negotiated by the supplier to the USB standard. 'The supplier identification code of each supplier is unique, the product identification code. It is up to the supplier to decide. Under normal circumstances, different products, different models of the same product, and different designs of the same model have different product identification codes to distinguish different devices of the same manufacturer. [0004] After the electronic device is assembled, it is necessary to detect whether various USB peripheral devices are connected to the electronic device intact. Generally, the weaving method is manually detected one by one, the test efficiency is low, and the test accuracy is not high. SUMMARY OF THE INVENTION _] In the above content, it is necessary to provide a method and system for efficiently testing a USB device of an electronic device. 098144008 Form No. A0101 Page 3 / Total 12 Page 0992075338-0 201122803 [0006] [0009] [0011] [0011] A method of testing a USB device of an electronic device for testing a USB device Whether the electronic device of the interface is connected to the corresponding USB device, the testing method includes the following steps: providing a storage unit, wherein the storage unit stores a product identification code of the USB device to be connected to the USB interface; a product identification code of the USB device connected to the USB interface; and comparing the product identification code of the USB device with the product identification code in the storage unit, if the same, the electronic device is connected to the corresponding USB device, if If not, the electronic device is not connected to the corresponding USB device. A system for testing a USB device of an electronic device for testing whether an electronic device is connected to a corresponding USB device, the system comprising a test module, wherein the test module is provided with a storage unit, wherein the storage unit stores Each USB interface of the electronic device and a product identifier of a USB device that should be connected to each USB interface of the electronic device, the test module is respectively connected to each USB interface, and the product identification of the USB device connected to the corresponding USB interface is viewed. Whether the code is consistent with the storage unit, thereby determining whether the electronic device and the corresponding USB device are connected properly. Compared with the prior art, the method and system for testing a USB device of an electronic device of the present invention can effectively test whether the electronic device and the corresponding Usb device are properly connected. [Embodiment] Please refer to FIG. 1 and FIG. 2, a system for testing a USB device of an electronic device according to the present invention. 098144008 Form No. A0101 Page 4 / 12 pages 0982075338-0 [0012] 201122803 is used to test an electronic device 10 and corresponding Whether the USB device is properly connected or not, the electronic device 10 is provided with a plurality of USB interfaces, such as a first USB interface, a second USB interface, a third USB interface, etc., and the corresponding USB devices are respectively connected to the USB interfaces, for example, a first The USB device is connected to the first USB interface, a second USB device is connected to the second USB interface, a third USB device is connected to a third USB interface, etc., and the USB device connected to the USB interface can be a USB keyboard, USB sliding Mouse, USB camera, etc., these USB devices are respectively provided with corresponding supplier identification code and product identification code. [0013] The electronic device 10 is provided with a test module 12, and the test module 12 is connected to each USB interface of the electronic device 10. The test module 12 is provided with a storage unit 121, and the storage unit 121 stores [USB Port 1] : VID = 0x0000 is stored in each USB interface of the electronic device 1 and the USB device of the USB device that should be connected to each USB interface of the electronic device 1 , for example, the deposit unit 121 , PID = Oxffff; In the above example, VID represents the supplier identification code, and PID represents the product identification code - the above example indicates that the supplier USB identification code of the USB device connected to the first USB interface should be 0x0000, and the product identification code should be 〇 Xf fff. For different electronic devices, the configuration is different, and the USB devices connected thereto are different. The different types of electronic devices can be tested by modifying the storage unit 121 of the test module 12. If a USB device is not connected to an interface, the vendor identification code and the product identification code stored in the storage unit 121 are respectively 〇. [0014] Referring to FIG. 3, the test module 12 tests the electronic device 1 and the corresponding USB device. The method includes the following steps: [0015] Step 2 〇1 'The test module 12 is first connected to The first usb interface. 098144008 Form No. A0101 Page 5 / Total 12 Page 0992075338-0 201122803 [0017] [0019] [0022] [0022] Step 2〇2, view the connection to the USB interface Step 203: Comparing the vendor identifier and the product identifier with the vendor identifier of the same USB interface in the storage unit 121 and the product identifier to check whether the same is the same. If not, go to step 204; if they are the same, go to step 2 0 5. In step 204, the electronic device 10 and the corresponding USB device are not connected, and the test ends. Step 205: Check whether the USB interface is the last USB interface of the USB device. If it is the last USB interface, go to Step 2〇6; if it is not the last USB interface, go to step go?. In step 206, the electronic device 1 is connected to the corresponding device, and the test ends. Step 207' test module 12 is connected to the next interface and then returns to step 202. In summary, the present invention is in accordance with the conditions of the patent application, and the patent is filed according to law. However, the above description is only a preferred embodiment of the present invention, and equivalent modifications or changes made by those who are familiar with the art of the present invention should cover the scope of the patent. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram of an embodiment of a system for testing a USB device of an electronic device of the present invention. 098144008 Form No. A0101 Page 6 of 12 0982075338-0 [0023] FIG. 2 is a block diagram of the electronic device of FIG. 1. 3 is a flow chart of one embodiment of a method of testing a USB device of an electronic device of the present invention. [Main component symbol description] [0026] Electronic device: 1 0 [0027] Test module: 12 [0028] Storage unit: 121 〇 098144008 Form number A0101 Page 7 of 12 0982075338-0