200807434 九、發明說明: 【勒明所屬之技術領域】 本發明係有關—種儲存裝置,特财關於一種切 換USB儲存裝置媒體類型的方法。 【先前技術】 由於USB隨身碟具有攜帶方便以及隨插即用的優點, 因此已漸漸成為人們儲存資料的重要選擇。近來,為了防 止非特疋人讀取隨身碟中的資料,因此在隨身碟中增加了 加密功能:在目前的USB隨身碟中,一般係以快閃記憶體 作為儲存資料的元件,纟USB隨身碟中的快閃記憶體分為 或數個邏輯單元,每—個邏輯單元都具有—對應的邏輯200807434 IX. INSTRUCTIONS: [Technical Fields of Leming] The present invention relates to a storage device, and a method for switching the media type of a USB storage device. [Prior Art] Since the USB flash drive has the advantages of being easy to carry and plug and play, it has gradually become an important choice for people to store data. Recently, in order to prevent non-special people from reading the data in the flash drive, the encryption function has been added to the flash drive: in the current USB flash drive, the flash memory is generally used as a component for storing data, and the USB flash drive is used. The flash memory is divided into several logical units, each of which has a corresponding logic
主機 單元編號(Logical Unit Number; LUN),在識別上 將每一個邏輯單元視為一個裝置。 u為了對隨身碟中的資料加密,在習知的技術中係將邏 輯單元分成兩部分,如圖i的邏輯單元職所示,唯讀 ,域^為光碟媒體類型,其中儲存了—應用程式,保密 在將且右……Γ 寫入及刪除資料’ 主機上將顯示—唯讀先碟裝置對應區 域12被隱藏,接著執行唯讀區域1〇二二 而/、山= 現-對話方塊以供使用者輪入密碼,:„式= 於區域10及12是兩種不同的媒體類型 確⑷馬彳在身 碟并咚五许μ仏I,因此必須將隨身 碟拔除再插上後才能使顯示在主機上㈣置變為對應保 5 200807434 密區域12的可移除式磁碟裝置。然而,此種需要經由拔 插來切換媒體類型的方式,在使用上較不方便。 在美國專利公開號第2003/0225971號中,Oishi等人 提出另一種USB儲存裝置,其將快閃記憶體分為兩個邏輯 單元LUN0及LUN1,如圖2所示,邏輯單元lun〇包括一般 區域20及保密區域22,邏輯單元LUN1則包括唯讀區域The Logical Unit Number (LUN), which identifies each logical unit as a device. u In order to encrypt the data in the flash drive, in the prior art, the logical unit is divided into two parts, as shown in the logical unit of Figure i, only read, the domain ^ is the disc media type, and the application is stored. , confidentiality will be and right ... 写入 write and delete data ' will be displayed on the host - only the first disc device corresponding area 12 is hidden, then execute the read-only area 1 〇 22, / mountain = now - dialog box to For the user to enter the password,: „式= In the area 10 and 12 are two different media types (4) the horse is on the body and 咚 five μ仏I, so the flash drive must be removed and plugged in to make Displayed on the host (4) is placed into a removable disk device corresponding to the security zone 5 200807434. However, this way of switching the media type via plugging and unplugging is less convenient in use. No. 2003/0225971, Oishi et al. propose another USB storage device, which divides the flash memory into two logical units LUN0 and LUN1, as shown in FIG. 2, the logical unit lun〇 includes the general area 20 and the security. Area 22, logical unit LUN1 Read-only area
24,其=一般區域20及保密區域22均為磁碟媒體類型, 其可供讀取、寫人及刪除資料,准讀區域24係光碟媒體 類型,其僅供讀取資料。當此USB儲存I置插入主機後, 主機上將顯示可移除式磁絲置及唯讀光碟裝置分別對 應-般區域20及唯讀區域24,純密區域22則被隱藏, 在執灯唯項區域24中的應用程式及輸人正確密碼後,原 2=一Γ的可移除式磁碟裳置將變為對應保密 域 區域2G及22同樣為磁碟媒體類型,因此益 需拔插便可以進行切換。然而,此種方法、似 上的邏輯單元才能實現。 々要有兩cm 由拔插切換不同 因此’一種在單-邏輯單元中無需經 媒體類型的方法,乃為所冀。 【發明内容】 本發明的目的< 媒體類型的方法。 在一 USB儲存裝 ’在於提出一種切換USB儲存裝置 置中,一 域及-第二媒雜區域,一通訊號媒埠- 6 200807434 控制器連接該邏輯單元及通訊介面,在該USB儲存裝置插 到一主機上時,該介面訊號埠連接該主機,根據本發明, 一種切換該USB儲存裝置媒體類型的方法包括在該USB儲 存裝置仍經由該介面訊號埠連接該主機時,以將該USB儲 存裝置從一正常操作模式切換到一非驅動模式而中斷與 該主機之間的通訊,在經過一段時間後再回到該正常操作 杈式以恢復與該主機之間的通訊,傳送該第二媒體區域的 資訊給該主機。 【實施方式】 圖3顯示一 USB隨身碟32的方塊圖,快閃記憶體326 包έ 一邏輯單元LUN0如圖1所示,具有一唯讀區域1〇及 一保密區域12,唯讀區域10儲存一應用程式,保密區域 可供讀取、寫入及删除資料,控制器324連接通訊介面322 及快閃記憶體326,通訊介面322具有介面訊號埠d+及D__ 供連接主機30,通訊介面322的功用在於讓控制器324能 與主機30溝通。在圖3中,通訊介面322及控制器324 之間僅顯不操作模式滙流排0pM〇de,實際上,在通訊介面 322及控制器324之間仍有其他的滙流排未示出。在 的規格中,操作模< 滙流排0pMode $二位元的湿流排, 當操作模式滙流排OpMode上的訊號為”Ub”時,USB隨身 碟32將操作在正常操作模式,當操作模式涯流排^加 上的訊號為,,〇lb”時,則表示USB隨身碟&在非驅動模式 下,此時介面訊號埠D+及D-上的阻抗將被拉高,這種狀 7 200807434 態就像是USB隨身碟32沒有插 圖4顯示根據本發明的一個機3〇t 一樣。 及圖[在將·隨身磾32插圖。參照圖1、圖3 ^ q? . f 32插到主機30上後,USB隨身 將軸單元職中唯龍域iq的資訊 光砗:在主機30上顯示對應唯讀區域10的 =伴!使用者要將對應唯讀區域1◦的光碟裝置切24, the general area 20 and the secret area 22 are both disk media types, which are available for reading, writing, and deleting data. The read-ahead area 24 is a type of optical disc media, which is only for reading data. When the USB storage I is inserted into the host, the removable magnetic wire and the read-only optical disk device respectively display the corresponding area 20 and the read-only area 24, and the pure-density area 22 is hidden. After the application in the item area 24 and the correct password are entered, the original 2 = one removable removable disk will become the corresponding security domain area 2G and 22 are also the disk media type, so the need to insert and remove You can switch. However, this method, similar to the logic unit can be achieved. There are two cm to be switched by the plug-in. Therefore, a method that does not require a media type in a single-logic unit is a problem. SUMMARY OF THE INVENTION The object of the present invention is a method of media type. In a USB storage device, a switching USB storage device is proposed, a domain and a second medium, and a communication medium - 6 200807434 controller connects the logic unit and the communication interface, and the USB storage device is inserted. When the device is connected to a host, the interface signal is connected to the host. According to the present invention, a method for switching the media type of the USB storage device includes storing the USB when the USB storage device is still connected to the host via the interface signal The device switches from a normal operation mode to a non-drive mode to interrupt communication with the host, and returns to the normal operation mode after a period of time to resume communication with the host, and transmits the second medium. Information about the zone is given to the host. [Embodiment] FIG. 3 shows a block diagram of a USB flash drive 32. The flash memory 326 is packaged. A logical unit LUN0 has a read-only area 1 and a secure area 12, and a read-only area 10, as shown in FIG. An application is stored, the secret area is for reading, writing and deleting data, the controller 324 is connected to the communication interface 322 and the flash memory 326, and the communication interface 322 has interface signals 埠d+ and D__ for connecting to the host 30, and the communication interface 322 The function is to allow the controller 324 to communicate with the host 30. In FIG. 3, only the mode bus bar 0pM〇de is displayed between the communication interface 322 and the controller 324. In fact, there are still other bus bars not shown between the communication interface 322 and the controller 324. In the specification, the operation mode < bus line 0pMode $ two-bit wet flow row, when the signal on the operation mode bus OpMode is "Ub", the USB flash drive 32 will operate in the normal operation mode, when the operation mode The signal added by the current row is ", 〇 lb", which means that the USB flash drive & in the non-drive mode, the impedance of the interface signals 埠D+ and D- will be pulled high. 200807434 The state is like the USB flash drive 32 without the illustration 4 showing the same as the one machine 3〇t according to the present invention. And the figure [in the illustration of the portable body 32. Refer to Fig. 1, Fig. 3 ^ q? . f 32 to the host After 30, USB will carry the information of the axis unit in the Weilong domain iq: display the corresponding read-only area 10 on the host 30 = user! The user should cut the disc device corresponding to the read-only area 1◦
4;;主::區域12❸可移除式磁碟裝置時,進行步驟 從主機30送出一切槌;{^人 刀換扣令給控制器324,令其執行預 機子在唯項區域10中的應用程式(步驟42),因而在主 ^上顯不一對話方塊供使用者輸人密碼(步驟43),接 者進行步驟44輸人密碼給隨身碟犯,跟著進行步驟 奸驗證密碼,若密碼不正確’則回到步驟44,若密碼正 確,則接著進行步驟48。 在確認密碼正確後,控制器324根據應用程式的指令 將操作模式滙流排Opcode上的訊號從,,iib,,改變 為01b,使USB隨身碟32進入非驅動模式以中斷與主機 30的通訊,此時的狀態就像是USB隨身碟32從主機30上 拔除一樣,因此,主機30將認為USB隨身碟32已被拔除, 雖然主機30無法偵測到USB隨身碟32的存在,但USB隨 身碟32仍能使用滙流排供電(bus power)使控制器324正 苇工作,在步驟49中專待一段時間T,例如〇· 1秒,隨後 再進行步驟50,控制器324再次改變操作模式滙流排 OpMode上的訊號為”llb,’,使USB隨身碟32回到正常操作 模式以恢復與主機30的通訊,此時的狀態就像是USB隨 8 200807434 -身二32再次插到主機30上一樣’因此 碟32已完成拔插的動作,故在接著的步驟52 =: 身碟32將邏輯單元咖中保密區域12訊= 機30,因而在主機3〇上顯千斟斑位i 1得达、、、口主 -磁碟裝置。 知對應保祕域12的可移除式 - ® 5顯示根據本發明的另-個_圖。^ 3及圖5,在此實施例中,唯讀區域㈣存的;、用喊: •有自動執行(論―功能,因此,在將咖隨身碑插 到主機30上後,脱隨身碟32立即自動 唯讀區域10中的應用程式(步驟•因而 =-對話方塊供❹者輸人密碼(㈣⑻,接。= u=32,跟著進行步驟⑽驗證密碼, 以碼不正確,則回到步驟64,若密碼正確 為,,〇lb,,,使USB隨身碟32進入非驅 改艾 • 30的軌,此時的狀態就像是卿隨身^^ 拔除一樣,然而USB隨身碟32仍能使用 制器324正常工作,在步驟7"等待一段二二電=控 0.1秒,隨後再進行步驟72,控制哭 ,例如4;; main:: area 12 ❸ removable disk device, the steps are sent from the host 30 to send all the 槌; {^ knives to the controller 324, so that it performs the pre-machine in the only area 10 The application (step 42), thus displaying a dialog box on the main unit for the user to enter the password (step 43), and then proceeding to step 44 to enter the password to the portable disc, followed by the step to verify the password, if If the password is incorrect, then go back to step 44. If the password is correct, proceed to step 48. After confirming that the password is correct, the controller 324 changes the signal on the operation mode bus line Opcode from the instruction, iib, to 01b according to the instruction of the application program, so that the USB flash drive 32 enters the non-drive mode to interrupt the communication with the host 30. The state at this time is like that the USB flash drive 32 is unplugged from the host 30. Therefore, the host 30 will think that the USB flash drive 32 has been removed, although the host 30 cannot detect the presence of the USB flash drive 32, but the USB flash drive 32 can still use the bus power to make the controller 324 work in the positive direction, and in step 49, the special time T, for example, 1 second, then step 50, the controller 324 changes the operation mode bus again. The signal on OpMode is "llb,", so that the USB flash drive 32 returns to the normal operation mode to resume communication with the host 30. At this time, the state is like USB with 8 200807434 - the body 2 is inserted into the host 30 again. 'Therefore the disc 32 has completed the plugging and unplugging action, so in the next step 52 =: the disc 32 will be in the logical unit of the secret area 12 = machine 30, thus displaying the thousands of spots i 1 on the host 3 ,,, mouth master - disk device. The removable type of the corresponding secret domain 12 is shown in Fig. 5 and Fig. 5, in this embodiment, the read only area (4) is stored; Auto-execution (on the function, therefore, after inserting the coffee plug on the host 30, the off-disk 32 immediately automatically reads the application in the area 10 (step • thus =- dialog box for the input password ( (4) (8), connect. = u=32, follow step (10) to verify the password. If the code is incorrect, go back to step 64. If the password is correct, 〇lb,,, make USB flash drive 32 enter non-drive Ai 30 The track, the state at this time is like the Qing ^^ pull out, but the USB flash drive 32 can still work normally with the controller 324, in step 7 "wait a period of two or two = control 0.1 seconds, then proceed to step 72 To control crying, for example
-OpMode USB _正常操作模式以恢復與主機30的通訊,此B士身業32回到 是咖隨身碟32再次插到主機3〇上一樣,^的狀態就傳 隨身碟32已完成拔插 此’可視為 A U的貧訊傳 200807434 給主機30,因而在主機30上顯示對應保密區域12的可移 除式磁碟裝置。' 本發明的方法係藉由USB規格中原有的設定讓控制器 324切換USB隨身碟32的操作模式,因此不用像習知技術 一樣要將USB隨身碟12拔除後再插上才能切換媒體類 型,是以本發明的方法在使用上更為便利,而且在切換的 速度上也較為迅速,成本也低於使用兩個邏輯單元的裝 置。 【圖式簡單說明】 圖1係一快閃記憶體中邏輯單元的示意圖; 圖2係另一快閃記憶體中邏輯單元的示意圖; 圖3係USB隨身碟的方塊圖; 圖4係本發明的流程圖;以及 圖5係本發明的另一流程圖。 【主要元件符號說明】 10 唯讀區域 12 保密區域 20 一般區域 22 保密區域 24 唯讀區域 30 主機 32 USB隨身碟 200807434 322 通訊介面 324 控制器 326 快閃記憶體 40 ' 主機30 將邏輯單元LUN0中唯讀區域10的資訊傳送給 • 41 切換指令 42 執行預先儲存在唯讀區域10中的應用程式 • 43 顯示一對話方塊 44 輸入密碼 46 驗證密碼 48 進入非驅動模式以中斷與主機30的通訊 49 等待一段時間T 50 回到正常操作模式以恢復與主機30的通訊 52 主機30 將邏輯單元LUN0中保密區域12的資訊傳送給 • 60 執行預先儲存在唯讀區域10中的應用程式 62 顯示一對話方塊 64 輸入密碼 66 驗證密碼 . 68 進入非驅動模式以中斷與主機30的·通訊 70 等待一段時間T 72 回到正常操作模式以恢復與主機30的通訊 74 主機30 將邏輯單元LUN0中保密區域12的資訊傳送給 11-OpMode USB _ normal operation mode to resume communication with the host 30, this B shi body 32 back to the coffee drive 32 is inserted into the host 3 再次 again, ^ state of the portable drive 32 has been plugged in this The AU's poor communication 200807434 is given to the host 30, and thus the removable disk device corresponding to the secure area 12 is displayed on the host 30. The method of the present invention allows the controller 324 to switch the operation mode of the USB flash drive 32 by the original settings in the USB specification. Therefore, it is not necessary to remove the USB flash drive 12 and then plug it in to switch the media type as in the prior art. It is more convenient to use in the method of the invention, and it is also faster in switching speed, and the cost is lower than that of the device using two logic units. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a schematic diagram of a logic unit in a flash memory; FIG. 2 is a schematic diagram of a logic unit in another flash memory; FIG. 3 is a block diagram of a USB flash drive; A flowchart of the present invention; and FIG. 5 is another flow chart of the present invention. [Main component symbol description] 10 Read-only area 12 Security area 20 General area 22 Security area 24 Read-only area 30 Host 32 USB flash drive 200807434 322 Communication interface 324 Controller 326 Flash memory 40 'Host 30 Logical unit LUN0 The information of the read-only area 10 is transferred to the 41. The switching instruction 42 executes the application stored in the read-only area 10 in advance. • 43 displays a dialog box 44. Enters the password 46. The verification password 48 enters the non-drive mode to interrupt communication with the host 30. Waiting for a period of time T 50 returns to the normal operating mode to resume communication with the host 30. The host 30 transmits the information of the secure area 12 in the logical unit LUN0 to the application 60. The application 62 pre-stored in the read-only area 10 displays a dialog. Block 64 Enter password 66 Verify password. 68 Enter non-drive mode to interrupt communication with host 30. 70 Wait for a period of time T 72 Return to normal operation mode to resume communication with host 30 74 Host 30 Secure area 12 in logical unit LUN0 Information sent to 11