改变移动存储设备功能或状态的方法 技术领域 Method for changing function or state of mobile storage device TECHNICAL FIELD
本发明是关于一种改变移动存储设备功能或状态的方法, 特别是 关于一种无需机械式拨动开关的改变移动存储设备功能或状态的方 法。 背景技术 The present invention relates to a method for changing the function or state of a mobile storage device, and more particularly to a method for changing the function or state of a mobile storage device without requiring a mechanical toggle switch. Background technique
随着信息技术的发展, 数据处理存储与人们的工作生活关系曰益 密切, 而移动存储设备以其方便灵活的特点成为数据存储与携带的重 要手段之一。 随着人们对移动存储设备要求的日益提高, 各种存储设 备层出不穷, 从早期的软盘到目前使用的闪存盘、 CF卡、 MMC卡、 SM 卡、 SD卡等, 存储设备的体积越来越小, 实现的功能越来越多, 如写 保护、 隐藏、 加密、 及多分区等, 其中写保护作为移动存储设备的一 项基本功能存在于各种移动存储设备。 早期的软盘, 使用一个机械式 拨动开关, 驱动器通过机械装置检测写保护幵关的位置, 实现写保护 这一功能。 目前的移动存储设备虽然具有更小的体积及更多的功能, 但其写保护及其他功能选择的实现的方法仍然类似于早期的软盘, 即 通过拨动类似的机械式开关来实现。 这样就使得存储设备出现了两个 甚至更多的开关, 这无疑是增加了模具的设计难度及外观设计的工作 量, 进而增加硬件成本。 而且其占用 PCB板上较大的空间, 成为影响 存储设备小型化的瓶颈之一。 另外, 还存在功能选择单一, 使用寿命 短等缺陷。 发明内容 With the development of information technology, data processing and storage have a close relationship with people's work and life, and mobile storage devices have become one of the important means of data storage and carrying due to their convenient and flexible characteristics. With the increasing requirements of people for mobile storage devices, various storage devices have emerged endlessly. From the early floppy disks to the currently used flash disks, CF cards, MMC cards, SM cards, SD cards, etc., the size of storage devices has become smaller and smaller. More and more functions are implemented, such as write protection, hiding, encryption, and multiple partitions. Among them, write protection exists as a basic function of mobile storage devices in various mobile storage devices. Earlier floppy disks used a mechanical toggle switch, and the drive detected the position of the write-protect switch through a mechanical device to achieve the function of write-protection. Although the current mobile storage device has a smaller size and more functions, the method of implementing write protection and other function selection is still similar to the earlier floppy disk, that is, it is achieved by flipping a similar mechanical switch. In this way, two or more switches appear in the storage device, which undoubtedly increases the design difficulty of the mold and the workload of the appearance design, thereby increasing the hardware cost. In addition, it takes up a large space on the PCB and becomes one of the bottlenecks affecting the miniaturization of the storage device. In addition, there are also defects such as single function selection and short service life. Summary of the invention
本发明的目的在于为移动存储设备提供一种无需拨动机械式开关 的改变移动存储设备功能或状态的方法。 An object of the present invention is to provide a method for changing the function or state of a mobile storage device without moving a mechanical switch for the mobile storage device.
本发明的目的是通过下列技术方案实现的: 本发明改变移动存储 设备功能或状态的方法包括以下步骤: 在所述移动存储设备中设置固 化软件; 在所述移动存储设备中写入特定文件; 通过所述移动存储设
备对所述特定文件的信息进行设定; 所还固化软仵通过所述特定文仵 的信息来判断并执行所述移动存储设备欲实现的功能或状态。 The object of the present invention is achieved by the following technical solutions: The method for changing the function or state of a mobile storage device according to the present invention includes the following steps: setting firmware in the mobile storage device; writing a specific file in the mobile storage device; By the mobile storage device Preparing the information of the specific file; the hardened soft disk judges and executes a function or state to be implemented by the mobile storage device through the information of the specific file.
与现有技术相比较, 本发明采用软实现方法来改变移动存储设备 的功能或状态, 从而省去了业界常用的机械开关装置, 进而达到简化 结构、 扩展功能和降低成本的效果、 且使用方便灵活。 附图说明 Compared with the prior art, the present invention uses a soft implementation method to change the function or state of the mobile storage device, thereby eliminating the mechanical switch device commonly used in the industry, thereby achieving the effects of simplifying the structure, expanding functions, and reducing costs, and is easy to use flexible. BRIEF DESCRIPTION OF THE DRAWINGS
图 1是本发明改变移动存储设备功能或状态的方法中第一实施例 的上位机操作系统的文件分配表。 FIG. 1 is a file allocation table of a host computer operating system in a first embodiment of a method for changing the function or state of a mobile storage device according to the present invention.
图 2是本发明改变移动存储设备功能或状态的方法第一实施例中 所述移动存储设备中的固化软件工作的流程图。 Fig. 2 is a flowchart of the operation of the firmware in the mobile storage device in the first embodiment of the method for changing the function or state of the mobile storage device according to the present invention.
图 3是本发明改变移动存储设备功能或状态的方法另一实施例中 所述移动存储设备中的固化软件工作的流程图。 具体实施方式 FIG. 3 is a flowchart of the operation of the firmware in the mobile storage device according to another embodiment of the method for changing the function or status of the mobile storage device according to the present invention. detailed description
本发明改变移动存储设备功能或状态的方法的第一实施例包括以 下步骤: 在所述移动存储设备中设置固化软件; 向所述移动存储设备 写入特定文件; 对所述特定文件属性进行设定; 所述固化软件通过所 述特定文件属性判断并执行所述移动存储设备欲实现的功能或状态。 A first embodiment of the method for changing the function or state of a mobile storage device of the present invention includes the following steps: setting firmware in the mobile storage device; writing a specific file to the mobile storage device; setting a property of the specific file The firmware determines and executes a function or state to be implemented by the mobile storage device through the specific file attribute.
所述固化软件中包括各种功能实现模块及文件查询模块, 所述功 能实现模块包括写保护、 分区、 加密及隐藏等功能实现模块, 所述文 件査询模块用来査询所述特定文件的属性。 The firmware includes various function implementation modules and a file query module. The function implementation modules include write protection, partitioning, encryption, and hiding function implementation modules. The file query module is used to query the specific file. Attributes.
向移动存储设备写入特定文件是通过移动存储设备格式化工具将 所述特定文件写入所述移动存储设备的固定位置, 所述特定文件可以 是各种类型的文件, 所述固定文件也可由用户通过操作系统自行写入, 但由格式化工具将所述特定文件写入固定位置更有利于对所述特定文 件的查询。 Writing a specific file to a mobile storage device is to write the specific file to a fixed location of the mobile storage device through a mobile storage device formatting tool. The specific file may be various types of files, and the fixed file may also be The user writes by himself through the operating system, but writing the specific file to a fixed location by a formatting tool is more beneficial to querying the specific file.
对所述特定文件属性进行设定包括: 通过所述移动存储设备连接 的上位机操作系统对所述特定文件的属性进行设定。 本实施例中以 windows 2000操作系统为例进行说明, 但不限于该操作系统。 Windows 2000操作系统中的文件一般具有 "只读" 、 "隐藏" 、 "存档"等属
性。对所述特定文件的属性进行设定时,只需按 windows 2000操作糸统 的操作流程进行, 即点击右键进入文件 "属性 "设定窗口, 对其中的Setting the attribute of the specific file includes: setting the attribute of the specific file through an operating system of a host computer connected to the mobile storage device. In this embodiment, a Windows 2000 operating system is used as an example for description, but it is not limited to this operating system. Files in the Windows 2000 operating system generally have "read-only", "hidden", "archive" and other attributes Sex. When setting the properties of the specific file, simply follow the operating procedure of the Windows 2000 operating system, that is, right-click to enter the file "Properties" setting window,
"只读" 、 "隐藏" 、 "存档"等属性中的一个或者多个进行选择设 定。 对所述特定文件属性的设定进行 "确定"操作后, 所述特定文件 的属性变化即反映于操作系统的文件系统中, 本实施例中所述文件系 统以 FAT16为例进行说明, 但不限于该文件系统。 如图 1所示, 图 1为 FAT16文件系统的文件分配表, 其中第一栏 " offset"表示文件存储的 偏移地址, 第二栏 "0〜F"为文件信息位, 每个信息位的内容都由一个 2位的 16进制码表示。现假设所述特定文件的偏移地址为 9679E0, 文件 名为 "0000.txt", 属性为 "存档", 则所述特定文件的文件名 "0000" 对应偏移地址为 9679E0, 文件信息位为 4-7的 4个 16进制码 "20 20 20 20",其扩展名" TXT"对应文件信息位为 8-A的 3个 16进制码 " 54 58 54", 其属性 "存档" 对应文件信息位为 B的 16进制码 "20", 所述 16进制码Select one or more of "Read-only", "Hide", "Archive" and other attributes. After the "determine" operation is performed on the setting of the specific file attribute, the attribute change of the specific file is reflected in the file system of the operating system. The file system in this embodiment is described by using FAT16 as an example, but not Limited to this file system. As shown in FIG. 1, FIG. 1 is a file allocation table of the FAT16 file system. The first column “offset” represents the offset address of the file storage, and the second column “0 ~ F” is the file information bit. The contents are represented by a 2-digit hexadecimal code. Now suppose that the offset address of the specific file is 9679E0, the file name is "0000.txt", and the attribute is "archive", then the file name "0000" of the specific file corresponds to the offset address of 9679E0, and the file information bit is 4-7 hexadecimal codes "20 20 20 20", its extension "TXT" corresponds to 3 hexadecimal codes "54 58 54" of file information bits 8-A, and its attribute "archive" corresponds The file information bit is a hexadecimal code "20" of B, and the hexadecimal code
"20"对应的二进制码为 "xxlx xxxx " ( " X "是表示不需要判断的 位) , 即 "存档"属性标识位为 1, 当文件属性为 "只读" 时, 对应的 二进制码为 "xxxx xxxl " , 即 "只读"属性标识位为 1, 当文件属性 为 "隐藏" 时, 对应的二进制码为 "xxxx xxlx" , 即 "隐藏"属性标 识位为 1, 由此可看出, 所述 "隐藏"、 "只读"及 "存档"三种文件 属性分别对应于所述文件管理表中表示文件属性的信息位的二进制码 中的三个标识位, 每个标志位有 " 0"和 " 1 "两种状态, 该三个标识 位组合可表示文件的 23即 8种状态。 The binary code corresponding to "20" is "xxlx xxxx"("X" is a bit that does not need to be judged), that is, the "archive" attribute identification bit is 1, and when the file attribute is "read-only", the corresponding binary code is "xxxx xxxl", that is, the "read-only" attribute flag is 1, when the file attribute is "hidden", the corresponding binary code is "xxxx xxlx", that is, the "hidden" attribute flag is 1, which shows that The three file attributes of "hidden", "read-only" and "archive" respectively correspond to three identification bits in the binary code of the information bits representing the file attributes in the file management table, and each flag bit has " 0 "and" 1 "states, the three flag 23 may represent a combination of eight states i.e. files.
所述固化软件通过所述特定文件的属性来判断并执行所述移动存 储设备欲实现的功能或状态包括: 所述移动存储设备在与上位机连接 或执行操作时, 如图 2所示, 所述固化软件先对所述移动存储设备进行 初始化; 接着所述文件查询模块检测所述特定文件是否存在, 如果不 存在则结束流程, 如果存在则同过所述上位机操作系统的文件分配表 检测所述特定文件的属性; 然后根据所述特定文件的属性来判断所述 移动存储设备欲实现的功能或状态, 可设定 8种功能或状态, 所述功能 或状态可以是但不限于写保护、 隐藏、 加密及分区等等; 之后, 所述 固化软件根据所述移动存储模块欲实现的功能或状态调用相应的功能 实现模块。
现以实现所述移动存储模块的 "写保护"功能为例进行说明, 在 所述移动存储设备中设置固化软件, 所述固化软件中包括所述文件査 询模块和各种功能实现模块, 所述功能实现模块包括实现所述移动存 储设备的写保护、 隐藏、 加密及分区等功能的各功能实现模块。 通过 格式化工具软件向所述移动存储设备中写入特定文件。 将所述移动存 储模块与上位机连接, 进入所述上位机操作系统在本实施例中即为 windows 2000操作系统, 选中所述特定文件, 点击鼠标右键弹出菜单, 在菜单中选择 "属性"便进入文件属性设定框, 文件属性设定框中显 示出 "只读" 、 "隐藏"及 "存档"三个可供选择的文件属性, 用鼠 标选择 "只读"属性, 所述固化软件则通过操作系统的文件分配表查 询所述特定文件的属性, 调用 "写保护"功能模块。 各文件属性对应 的功能模块可在所述固化软件中设定, 本实例中为了方便用户使用, 将所述特定文件的 "只读"属性直接对应所述移动存储设备的 "写保 护"功能, 也可设定 "隐藏"或 "存档" , 即当所述文件系统中 "隐 藏"或 "存档"标识位为 1时, 调用 "写保护"功能, 也可设定当 "只 读" 、 "隐藏 "及 "存档"属性的其中某两种或多种属性组合时, 调 用 "写保护"功能。 要实现所述移动存储设备的其他功能如分区、 加 密及隐藏时, 只需按上述方式改变所述特定文件的属性, 再由所述固 化软件的所述文件查询模块通过所述特定文件的属性判断所述移动存 储设备欲实现的功能, 并调用相应的功能实现模块即可。 The firmware determining and executing a function or state to be implemented by the mobile storage device through the attributes of the specific file includes: When the mobile storage device is connected to a host computer or performs an operation, as shown in FIG. 2, The firmware first initializes the mobile storage device; then the file query module detects whether the specific file exists, and if it does not exist, the process ends, and if it does, the file allocation table detection of the operating system of the host computer is the same. The attribute of the specific file; and then determining the function or state to be implemented by the mobile storage device according to the attribute of the specific file; 8 functions or states may be set, and the functions or states may be, but not limited to, write protection , Hiding, encryption, partitioning, etc .; after that, the firmware calls a corresponding function implementation module according to the function or status of the mobile storage module. Taking the implementation of the "write protection" function of the mobile storage module as an example for description, a firmware is provided in the mobile storage device, and the firmware includes the file query module and various function implementation modules. The function implementation module includes various function implementation modules that implement write protection, hiding, encryption, and partitioning functions of the mobile storage device. Write a specific file to the removable storage device by using a formatting tool software. Connect the mobile storage module to the upper computer, and enter the upper computer operating system, which in this embodiment is the Windows 2000 operating system. Select the specific file, right-click the pop-up menu, and select "Properties" from the menu. Enter the file attribute setting box. The file attribute setting box displays three file attributes of "Read-only", "Hide" and "Archive". Use the mouse to select the "Read-only" attribute. The firmware is Query the attributes of the specific file through the file allocation table of the operating system, and call the "write protection" function module. The function module corresponding to each file attribute can be set in the firmware. In this example, for the convenience of users, the "read-only" attribute of the specific file directly corresponds to the "write protection" function of the mobile storage device. You can also set "Hide" or "Archive", that is, when the "Hide" or "Archive" flag in the file system is 1, the "write protection" function is called, and when "Read-only", " The "write protection" function is called when a combination of two or more of the "hidden" and "archived" attributes is invoked. To implement other functions of the mobile storage device, such as partitioning, encryption, and hiding, it is only necessary to change the attributes of the specific file as described above, and then the file query module of the firmware software passes the attributes of the specific file. Judge the function to be implemented by the mobile storage device, and call the corresponding function implementation module.
所述特定文件也可写入所述移动存储设备的某个分区中, 从而实 现对所述移动存储设备的某个分区的功能或状态的选择。 The specific file may also be written into a certain partition of the mobile storage device, so as to implement selection of a function or status of a certain partition of the mobile storage device.
本发明改变移动存储设备功能或状态的方法的另一实施例包括以 下步骤: 在所述移动存储设备中设置固化软件; 向移动存储设备写入 特定文件; 对所述特定文件内容进行设定; 所述固化软件通过所述特 定文件内容来判断及执行所述移动存储设备欲实现的功能或状态。 Another embodiment of the method for changing the function or state of the mobile storage device of the present invention includes the following steps: setting firmware in the mobile storage device; writing a specific file to the mobile storage device; setting the content of the specific file; The firmware determines and executes a function or state to be implemented by the mobile storage device through the specific file content.
所述固化软件中包括各种功能实现模块及文件査询模块, 所述功 能实现模块包括写保护、 分区、 加密及隐藏等功能实现模块, 所述文 件查询模块用来査询所述特定文件的内容。 The firmware includes various function implementation modules and a file query module. The function implementation modules include write protection, partitioning, encryption, and hiding function implementation modules. The file query module is used to query the specific file. content.
向移动存储设备写入特定文件是通过移动存储设备格式化工具写 入, 其中所述特定文件可以是各种可编辑的文件。
所述回化软忏通 还特定文仵内容釆判断及执仃所还移动存储 设备欲实现的功能或状态包括: 如图 3所示, 开始后, 所述移动存储设 备的固化软件对所述移动存储设备进行初始化; 初始化后, 所述固化 软件检测所述特定文件是否存在, 如果不存在则结束流程, 如果存在 则查询所述特定文件的位置并且读取所述特定文件的内容; 接着, 根 据所述特定文件的内容判断所述移动存储设备欲实现的功能或状态, 所述功能或状态包括但不限于写保护、 隐藏、 加密及分区; 然后, 根 据所述移动存储设备欲实现的功能或状态调用相应的功能实现模块。 Writing a specific file to the mobile storage device is written by a mobile storage device formatting tool, where the specific file may be various editable files. The reverting software also specifies the content, judgment, and execution of the functions or states to be implemented by the mobile storage device. As shown in FIG. 3, after the start, the firmware of the mobile storage device The mobile storage device is initialized. After the initialization, the firmware detects whether the specific file exists, if not, the process ends, and if it exists, queries the location of the specific file and reads the content of the specific file; then, Determine a function or state to be implemented by the mobile storage device according to the content of the specific file, the function or state includes, but is not limited to, write protection, hiding, encryption, and partitioning; and then, according to the function to be implemented by the mobile storage device Or state calls the corresponding function implementation module.
所述特定文件也可写入所述移动存储设备的某个分区中, 从而实 现对所述移动存储设备的某个分区的功能或状态的选择。 The specific file may also be written into a certain partition of the mobile storage device, so as to implement selection of a function or status of a certain partition of the mobile storage device.
本发明所述上位机操作系统可以是 windows系列操作系统中的任 一禾中, 例如 windows 98、 windows me、 windows 2000、 windows XP及 后续的 windows操作系统, 也可为其它类型操作系统, 如 MAC OSX、 Unix, Linux等操作系统。本发明中所述上位机操作系统为 windows时, 对应的所述文件系统包括但不限于 FAT12、 VFAT、 FAT16、 FAT32、 CDFS、 NTFSo 本发明中所述上位机操作系统为 Linux时, 对应的所述 文件系统包括但不限于 EXT2、 EXT3、 JFS、 NFS、 RAMFS、 RAMFS、 HPFS、 CRAMFSo 所述移动存储设备可以是闪存盘、 CF卡、 MMC卡、 SM卡、 SD卡等, 但不限于上述移动存储设备; 所述移动存储设备实现 的功能或状态包括但不限于写保护、 隐藏、 加密及分区等。 The host computer operating system described in the present invention may be any one of the windows series operating systems, such as windows 98, windows me, windows 2000, windows XP and subsequent windows operating systems, or other types of operating systems, such as MAC OSX, Unix, Linux and other operating systems. When the operating system of the host computer in the present invention is windows, the corresponding file system includes but is not limited to FAT12, VFAT, FAT16, FAT32, CDFS, NTFS. When the operating system of the host computer in the present invention is Linux, The file system includes, but is not limited to, EXT2, EXT3, JFS, NFS, RAMFS, RAMFS, HPFS, CRAMFS. The mobile storage device may be a flash disk, CF card, MMC card, SM card, SD card, etc., but is not limited to the above mobile Storage device; The functions or states implemented by the mobile storage device include, but are not limited to, write protection, hiding, encryption, and partitioning.
以上所述仅是本发明的优选实施方式, 应当指出, 对于本技术领 域的普通技术人员来说, 在不脱离本发明原理的前提下, 还可以作出 若干改进和润饰, 这些改进和润饰也应视为本发明的保护范围。
The above are only preferred embodiments of the present invention. It should be noted that, for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and retouches can be made. These improvements and retouches should also be made. It is regarded as the protection scope of the present invention.