WO2020088263A1 - Sd卡热插拔的识别方法、识别模组及电子设备 - Google Patents

Sd卡热插拔的识别方法、识别模组及电子设备 Download PDF

Info

Publication number
WO2020088263A1
WO2020088263A1 PCT/CN2019/111707 CN2019111707W WO2020088263A1 WO 2020088263 A1 WO2020088263 A1 WO 2020088263A1 CN 2019111707 W CN2019111707 W CN 2019111707W WO 2020088263 A1 WO2020088263 A1 WO 2020088263A1
Authority
WO
WIPO (PCT)
Prior art keywords
card
status
message
interrupt
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/111707
Other languages
English (en)
French (fr)
Inventor
李昭早
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Autel Robotics Co Ltd
Original Assignee
Autel Robotics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Autel Robotics Co Ltd filed Critical Autel Robotics Co Ltd
Publication of WO2020088263A1 publication Critical patent/WO2020088263A1/zh
Priority to US17/244,112 priority Critical patent/US11797184B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/24Handling requests for interconnection or transfer for access to input/output bus using interrupt
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • G06F13/4081Live connection to bus, e.g. hot-plugging
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the program performs an interfacing function, e.g. device driver
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0605Improving or facilitating administration, e.g. storage management by facilitating the interaction with a user or administrator
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0632Configuration or reconfiguration of storage systems by initialisation or re-initialisation of storage systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Definitions

  • the invention relates to the technical field of SD cards, in particular to an SD card hot plug identification method, SD card identification module and electronic equipment.
  • SD card is a data storage device based on semiconductor flash memory. Due to its advantages of small size and fast data transmission speed, it is widely used in some small-sized electronic devices (such as various types of portable intelligent terminals, image acquisition devices, or communication devices) as large-capacity storage devices.
  • the SD card is usually placed in the SD card slot specially provided for the electronic device, and an electrical connection is established between the electronic device and the corresponding pin.
  • the SD card also has the feature of supporting hot swap. That is to say, the user can easily insert the SD card into the slot or pull it out of the slot without affecting the use of the SD card when the device is in operation according to the needs of actual use.
  • the SD card when the SD card is hot-swapped many times and inserted and removed frequently, the SD card may not be recognized or the device may crash, and the SD card may be damaged, making the SD card unable to read or write normally.
  • the problem of damaged storage content when the SD card is hot-swapped many times and inserted and removed frequently, the SD card may not be recognized or the device may crash, and the SD card may be damaged, making the SD card unable to read or write normally. The problem of damaged storage content.
  • the embodiments of the present invention provide an identification method, an identification module, and an electronic device that can ensure stable operation of an electronic device when a SD card is quickly inserted and removed, and a hot-plug of an SD card that does not cause identification errors.
  • the identification method includes:
  • the SD card state is determined according to the interrupt message; the interrupt message is triggered by the SD card insertion and removal behavior; according to the SD card state, the corresponding SD card operation is performed.
  • performing the corresponding SD card operation according to the SD card state includes: performing a loading operation when the SD card state is inserted; performing an unloading operation when the SD card state is unplugged .
  • the method further includes: when the device is started, searching for a device node to determine the SD card status.
  • searching the device node to determine the SD card status includes: determining whether the device node can be opened; if not, determining that the SD card status is unplugged; if so, searching the SD card under the device node Nodes and corresponding SD card partitions; when searching for SD card nodes and SD card partitions, determine that the SD card status is inserted; when there are no SD card nodes and SD card partitions, determine the SD card status as unplug .
  • the determining the state of the SD card according to the interrupt message includes: triggering a corresponding kernel interrupt with the SD card insertion and removal behavior; sending a corresponding interrupt message to the application layer according to the kernel interrupt; parsing at the application layer When the message content obtained by the interrupt message includes an SD card insertion field, determine that the SD card status is inserted; when the message content obtained by the application layer parsing the interrupt message includes an SD card pull out field, determine the SD The card status is unplugged.
  • the uninstall operation includes: stopping the read and write operations on the SD card; determining whether the SD card is successfully uninstalled; if not, waiting for a preset time and then uninstalling the SD card again.
  • the method further includes: before performing the loading operation, unloading the SD card, and after performing the loading operation, determining whether the test file can be written into the loaded SD card and deleted from the SD card; If yes, it is determined that the SD card is loaded successfully; if not, it is determined that the SD card fails to be loaded.
  • the SD card identification module includes:
  • An interrupt generating unit is used to trigger an interrupt message according to the SD card insertion and removal behavior; a message parsing unit is used to determine the SD card status according to the interrupt message when the device is in operation; a device operation unit is used to determine the SD card status according to the message Describe the SD card status determined by the device node search unit and perform the corresponding SD card operation.
  • the device operation unit includes: an SD card loading component, which is used to perform a loading operation when the SD card status is inserted; an SD card unloading component, which is used when the SD card status is unplugged, Perform the uninstall operation.
  • the SD card identification module further includes: a device node search unit, configured to search the device node to determine the SD card status when the device is started
  • the device node search unit is used to: determine whether the device node can be opened; if not, determine that the SD card status is unplugged; if so, search the SD card node and the corresponding one under the device node SD card partition; when searching to obtain the SD card node and the SD card partition, the SD card status is determined to be inserted; when there is no SD card node and SD card partition, the SD card status is determined to be unplugged.
  • the interrupt generation unit is specifically configured to trigger a corresponding kernel interrupt with the SD card insertion and removal behavior; according to the kernel interrupt, send a corresponding interrupt message to the application layer;
  • the message parsing unit is at the application layer, and is specifically used to parse the interrupt message to obtain message content, and;
  • the message content When the message content includes an SD card insertion field, it is determined that the SD card status is inserted; when the message content includes an SD card removal field, it is determined that the SD card status is unplugged.
  • the SD card uninstall component is specifically used to: stop reading and writing operations on the SD card; determine whether the SD card is successfully uninstalled; if not, wait for a preset time and then uninstall the SD card again.
  • the SD card loading component is also used to: determine whether the test file can be written to the loaded SD card and be deleted from the SD card; if it is, determine that the SD card is loaded successfully; if not, then It is determined that the loading of the SD card failed.
  • An electronic device including an SD card slot and a controller, wherein the SD card slot is used to receive an SD card and establish a connection with the SD card Electrical connection; the controller is connected to the SD card slot to perform data read and write operations on the SD card inserted into the SD card slot; the controller also includes the SD card identification module as described above , Used to identify the SD card insertion and removal behavior in the SD card slot by the SD card identification module.
  • the SD card identification method can detect the insertion and removal of the SD card in an interrupt triggered manner when the device is in the running state, which can better reduce resource consumption and quickly
  • the hot-swap action reacts to accurately identify the current SD card status to prevent problems such as the device not recognizing the SD card, system crash, or SD card damage.
  • FIG. 1 is a schematic diagram of an application environment according to an embodiment of the present invention.
  • FIG. 2 is a functional block diagram of a drone provided by an embodiment of the present invention.
  • FIG. 3 is a flowchart of a method for identifying an SD card hot-swap according to an embodiment of the present invention
  • FIG. 4 is a flowchart of a method for searching an SD card device provided by an embodiment of the present invention.
  • FIG. 5 is a flowchart of the method of step 200 shown in FIG. 3;
  • FIG. 6 is a flowchart of a method for uninstalling an SD card provided by an embodiment of the present invention.
  • FIG. 7 is a flowchart of a method for loading an SD card according to an embodiment of the present invention.
  • FIG. 8 is a structural block diagram of an SD card hot swap identification module provided by an embodiment of the present invention.
  • Hot-plugging also known as hot-plugging, refers to the action of removing or replacing storage devices, interactive devices, and other components connected to the host system without shutting down the host system and without cutting off the power supply.
  • data such as aerial images or operation logs of the drones are usually stored in large-capacity storage devices such as SD cards.
  • SD cards In the case of a large amount of aerial photography tasks, it is usually necessary to replace the SD card at intervals to facilitate management of related data.
  • the SD card needs to be frequently pulled out or inserted from the relevant equipment of the aerial drone, that is, the hot swap operation of the SD card.
  • the identification of the hot swap operation of the SD card is performed in the form of active search or identification, and the state of the SD card device node is actively acquired at a set period.
  • active search or identification method consumes more resources, and it is also prone to state identification errors during frequent hot-plugging, resulting in problems such as SD card unrecognition and device crashes.
  • the application environment may include: a drone 10, a user equipment 20, and an SD card 30.
  • the unmanned aerial vehicle 10 may be an unmanned aerial vehicle driven by any type of power (such as electricity), including but not limited to a four-axis unmanned aerial vehicle, a fixed-wing aircraft, and a helicopter model.
  • a four-axis UAV is used as an example for description.
  • the unmanned aerial vehicle 10 has a volume or power corresponding to actual needs, and can provide users with a load capacity, flight speed, and flight cruising range that meet the needs of use.
  • the UAV 10 may be provided with one or more functional modules to perform corresponding tasks (such as aerial photography reconnaissance).
  • FIG. 2 is a functional block diagram of the drone 10 provided by an embodiment of the present invention. As shown in FIG. 2, in this embodiment, the drone 10 may be equipped with an aerial camera 11 and an image transmission device 12 and have a remote controller 13 paired.
  • the aerial camera 11 can be installed on the drone 10 through mounting and fixing components such as a gimbal, and used to collect image information of the target area during the flight.
  • the image transmission device 12 is connected with an aerial camera and is an image data transmission system.
  • the image transmission device can transmit data collected by an aerial camera based on wireless radio frequency and other communication connection methods.
  • the image transmission device 12 is a data transmission device that is provided at one end of the drone and used to transmit processed video data to an intelligent terminal or other ground-end equipment.
  • the image transmission device may be provided with a corresponding antenna and a radio frequency unit, and the image data is loaded on the radio frequency signal and sent.
  • the remote controller 13 serves as an interactive device to realize the interaction between the drone and the user.
  • the user can send control commands to the drone through the remote control 13 or receive image information fed back by the image transmission device in real time through the remote control 13.
  • the remote controller may be provided with one or more interactive devices to perform corresponding interactive functions, such as a display screen, buttons, touch screen, or joystick.
  • the aerial camera 11, the image transmission device 12, and the remote controller 13 may be provided with an SD card slot 14 for accommodating an SD card.
  • the SD card slot is provided with one or more metal pins to establish an electrical connection with the SD card to provide a physical transmission channel required for data transmission.
  • the SD card slot can also add one or more structural settings according to actual needs. For example, add a card lock structure that locks the SD card position, or a foolproof structure that prevents the SD card from being inserted backwards.
  • the SD card 30 can choose to use any suitable shape, size, storage capacity, and read / write speed according to the needs of the actual situation.
  • the SD card 30 is adapted to the SD card slot and is used as a mass storage device for electronic devices such as the aerial camera 11, the image transmission device 12, and the remote controller 13 when inserted into the SD card slot of the electronic device.
  • the SD card can be used to store the image data captured by the aerial camera 11 and the operation log during the flight of the drone.
  • the user can directly take the SD card out of the SD card slot, insert it into the user device 20 used by himself, and directly operate the data on the SD card on the user device 20 .
  • the user device 20 may be any type of electronic device with SD card data reading capability, such as a mobile phone, a tablet computer, or a PDA.
  • the user equipment 20 may be equipped with one or more different input / output devices. These input / output devices include, but are not limited to: buttons, scroll wheels, display screens, touch screens, mice, and speakers.
  • the electronic equipment set on the drone runs a host system (such as Linux operating system) to coordinate and control the work between various hardware devices.
  • a host system such as Linux operating system
  • the host system needs to get timely feedback to determine the current state of the SD card and perform the corresponding configuration operations so that the SD card can be loaded or unloaded smoothly Ensure the normal operation and use of the system and SD card.
  • FIG. 3 is a method flowchart of a recognition method provided by an embodiment of the present invention. As shown in FIG. 3, the identification method is divided into two situations: device startup and device operation to perform SD card status detection.
  • the SD card status is determined by searching the device node.
  • the SD card state refers to the current working state of the SD card slot, which is used to indicate whether an SD card is inserted into the SD card slot and establish electrical connection with the pins of the SD card slot connection.
  • the interrupt message may specifically adopt any type of format or content structure, and is passed to the application layer for analysis to obtain the occurrence of plugging and unplugging, and the status of the SD card is updated accordingly.
  • the above method uses a passive detection method to determine the SD card status, and only responds and feeds back when a plug-in behavior occurs.
  • passive triggering on the one hand, there is no need to maintain the long-term existence of the detection thread, and the resource consumption is less.
  • it can also respond and feed back the status of the SD card more quickly, making it less prone to recognition errors or untimely updates.
  • the SD card operation refers to the process that the host system configures the SD card that has been removed or newly inserted. After the configuration is completed, the SD card can really be used as a large-capacity storage device of the host system to realize the function of reading and writing data.
  • the SD card operation may include two types: an unloading operation to remove the original SD card from the host system and a loading operation to add the SD card to the host system.
  • the SD card is detected in two different ways during device startup and operation, which can well reflect the SD card insertion and removal actions.
  • the SD card when the SD card is plugged and unplugged in the form of an interrupt message during operation, it can accurately reflect the SD card being unplugged or the SD card being inserted. Even when the SD card is quickly plugged and unplugged Accurate identification of SD card status.
  • the method of searching the device node to determine the SD card status may include:
  • the device node refers to the representation item of the external device connected to the device in the host system.
  • Each hardware device that is connected to an electronic device and can operate normally will have a corresponding device node in the host system.
  • step 102 Determine whether the SD card node can be searched. If yes, go to step 103, if no, go to step 105.
  • the SD card node is one of the device nodes. It can be understood that when the SD card is inserted into the SD card slot to establish an electrical connection with the electronic device, the SD card node can be retrieved under the device node directory.
  • step 103 Determine whether the SD card partition can be obtained. If yes, go to step 104; if no, go to step 105.
  • the SD card is used as a large-capacity device and can be divided into several different partitions when it is used. Each partition occupies a certain storage space or capacity to store different data.
  • the state of the SD card is inserted, indicating that the current SD card slot is inserted with an SD card, and the SD card can be normally connected and identified with the system of the device, and the device can read and write data on the SD card.
  • the SD card status When the SD card status is unplugged, it indicates that there is no SD card in the current SD card slot, the device has not established a connection with the SD card, and the SD card slot is empty.
  • the method for determining the SD card status according to the interrupt message may specifically include the following steps:
  • the SD card insertion and removal behavior refers to the action of the user inserting or removing the SD card into the SD card slot. As these actions occur, the hardware will respond to such action signals and trigger the generation of a kernel interrupt.
  • the kernel interrupt send a corresponding interrupt message to the application layer.
  • the kernel can edit the interrupt message with the corresponding content message to the application layer accordingly, and respond to the SD card insertion and removal behavior to the device in a timely manner.
  • the SD card insertion field may be of any type or structure, and is used to indicate that there is data information or content of the SD card insertion action.
  • the specific form depends on the editing or format of the interrupt message.
  • the unplugged field of the SD card refers to the content of the message obtained after parsing the interrupt message is different in the same or different field positions.
  • the SD card removal field may be "Status”: “Inserted”; and the SD card removal field may be "Status”: “Ejected”.
  • the related message starts with “add” or a similar field, it can also be regarded as an SD card insertion field.
  • these related messages start with “remove” or similar fields, it is considered to be the SD card removal field, indicating that the SD card removal has occurred.
  • the uninstall operation provided by the embodiment of the present invention may include:
  • the read-write operation of the SD card refers to an operation of reading data from the SD card or writing data to the SD card. For example, aerial camera photography, video recording, or file playback operations on the remote control.
  • a changing electrical signal will be generated on the physical transmission channel (such as the transmission pin of the SD card), and the SD card will need to maintain the connection status with the host system.
  • step 313. Determine whether the uninstallation is successful, if yes, go to step 314, if not, go to step 315.
  • the operation instructions for uninstalling the SD card are not always successful, and are easily affected by many factors. For example, when the SD card is busy (occupied by a thread of the host system), it cannot be successfully executed. Therefore, multiple attempts may be required.
  • the preset time is an empirical value, which can be set by a technician according to actual conditions or actual needs, for example, it can be set to 1 s. After a suitable waiting time, try to uninstall again to ensure that the SD card can be uninstalled successfully.
  • a complete loading operation may be composed of the following three steps:
  • the first way to perform the uninstall operation can prevent or avoid the impact of the previously loaded SD card not being uninstalled, and avoid system errors.
  • the read-write test can be realized by writing and deleting files. For example, you can try to write a small test file in the SD card path and delete it after showing that the load is successful. Then, determine whether the test file supports writing and deleting. If yes, it is determined that the SD card is loaded successfully; if not, it is determined that the SD card fails to be loaded.
  • the identification method provided by the embodiment of the present invention is described using the Linux operating system as an example. However, based on the inventive ideas and principles disclosed in the embodiments of the present invention, those skilled in the art can also generally adjust, combine, or modify the identification method and apply it to other different operating systems to achieve rapid hot plugging of the SD card. SD card status recognition at the time.
  • an embodiment of the present invention also provides an SD card identification module.
  • the SD card identification module can be discretely or integratedly set in the controller of the related electronic device to implement one or more steps in the above method embodiments to support and realize rapid hot swap of the SD card.
  • the SD card identification module may include: a device node search unit 810, an interrupt generation unit 820, a message analysis unit 830, and a device operation unit 840.
  • the device node searching unit 810 is used to search the device node to determine the SD card status when the device is started.
  • the interrupt generating unit 820 is used to trigger an interrupt message according to the SD card insertion and removal behavior.
  • the message parsing unit 830 is connected to the interrupt generating unit, and is used to determine the state of the SD card according to the interrupt message in the device running state.
  • the device operation unit 840 may be used to execute and execute the SD card state determined by the message parsing unit and the device node search unit Corresponding SD card operation.
  • the device operation unit 840 may be composed of an SD card loading component 841 and an SD card unloading component 842.
  • the SD card loading component 841 is used to perform a loading operation when the SD card state is inserted.
  • the SD card uninstall component 842 is used to perform an uninstall operation when the SD card status is unplugged. Based on the SD card loading component 841 and the SD card unloading component 842, the SD card can be automatically loaded or unloaded according to the state of the SD card, which is more convenient for users to use.
  • the SD card uninstall component when it performs the uninstall operation, it can be specifically divided into the following functional steps: first, stop the read and write operations for the SD card. Then, try to uninstall the SD card and determine whether the SD card is successfully uninstalled. If not, after waiting for a preset time, unmount the SD card again until the SD card can be unloaded successfully. This way you can avoid the problem that the SD card cannot be unloaded in a busy state.
  • the SD card loading component 841 can also be used to determine whether the test file can be written into the loaded SD card and deleted from the SD card after loading the SD card; if it is, determine the The SD card is loaded successfully; if not, it is determined that the SD card failed to load.
  • the SD card unloading component may also unload the SD card.
  • the device node search unit may specifically perform the following functional steps: first, determine whether the device node can be opened; if not, determine that the SD card status is unplugged; if so. Then, under the device node, search for the SD card node and the corresponding SD card partition. When searching for an SD card node and an SD card partition, it is determined that the SD card status is inserted; when there is no SD card node and SD card partition, it is determined that the SD card status is unplugged.
  • the interrupt generating unit 820 and the message parsing unit 830 respectively perform the following steps in response to the SD card insertion and removal actions:
  • the interrupt generating unit 820 is used to trigger a corresponding kernel interrupt with the SD card insertion and removal behavior and send a corresponding interrupt message to the application layer of the system according to the kernel interrupt.
  • the message parsing unit 830 is a component in the application layer. It can parse the interrupt message to obtain the corresponding message content, and judge the specific state of the SD card according to this.
  • the message content includes an SD card insertion field, it is determined that the SD card status is inserted.
  • the content of the message includes the SD card unplugged field, it is determined that the SD card status is unplugged.
  • the identification module uses different detection methods to identify the SD card status during device operation and startup, which can better reflect the current SD card status and prevent Misoperation to prevent the device from recognizing the SD card, system crash, or SD card damage after multiple operations.
  • the SD card in the process of hot plugging and unplugging the SD card, the SD card can be automatically loaded and unloaded according to the state of the SD card, which is more convenient for users to use.
  • the SD card identification module such as the device node search unit 810, the interrupt generation unit 820, the message analysis unit 830, and Equipment operation unit 840.
  • those skilled in the art can use different methods to implement the described functions for each specific application according to actual needs (such as power consumption, chip area cost, circuit implementation difficulty, etc.), such as choosing to use hardware and software Or a combination of software and hardware to implement one or more functions of the SD card identification module disclosed in the embodiments of the present invention, and such implementation should not be considered beyond the scope of the present invention.
  • the functions that need to be performed are known, the hardware circuit combinations or software programs used to implement these functions are well known to those skilled in the art.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)
  • Telephone Function (AREA)
  • Telephonic Communication Services (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

一种SD卡热插拔的识别方法、识别模组及电子设备。该SD卡识别模组包括:中断发生单元(820),用于根据SD卡插拔行为触发中断消息;消息解析单元(830),用于在设备运行状态下,根据中断消息确定SD卡状态以及设备操作单元,用于根据所述消息解析单元(830)和设备节点搜索单元(810)确定的SD卡状态,执行对应的SD卡操作。其通过以中断触发的方式来检测SD卡的插拔动作,可以较好的降低资源消耗,并且快速的对热插拔动作作出反应,准确识别当前的SD卡状态,防止出现设备不识别SD卡、系统崩溃或者SD卡损坏的问题。

Description

SD卡热插拔的识别方法、识别模组及电子设备
【相关申请交叉引用】
本申请要求于2018年10月31日申请的、申请号为201811286397.X、申请名称为“SD卡热插拔的识别方法、识别模组及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
【技术领域】
本发明涉及SD卡技术领域,尤其涉及一种SD卡热插拔的识别方法、SD卡识别模组及电子设备。
【背景技术】
SD卡是一种基于半导体闪存记忆体的数据存储设备。由于具备体积小,数据传输速度快等优势,被广泛的应用在一些体积设计较小的电子设备(如各类型的便携式智能终端、图像采集设备或者通信设备)中,作为大容量存储设备使用。
在使用过程中,SD卡通常被放置在电子设备特别设置的SD卡插槽内,通过相应的针脚与电子设备之间建立电性连接。SD卡还具有支持热插拔的特性。亦即,用户可以根据实际使用的需要,在设备处于运转状态时,方便的将SD卡插入插槽或者从插槽拔出而不影响SD卡的使用。
现有的SD卡热插拔方式通常是采用定时检测设备节点下的SD卡节点状态的方式来实现的,受限于资源消耗的问题,定时检测的周期不能无限制的缩短。
因此,在SD卡热插拔次数较多,插拔比较频繁的情况下,经常会发生SD卡无法识别或者设备崩溃的现象,甚至还会造成SD卡的损坏,令SD卡无法正常读写或者存储内容受损的问题。
【发明内容】
为了解决上述技术问题,本发明实施例提供一种可以在SD卡快速插拔时确保电子设备运行稳定,不会出现识别错误的SD卡热插拔的识别方法、识别模组及电子设备。
为解决上述技术问题,本发明实施例提供以下技术方案:一种SD卡热插拔的识别方法。该识别方法包括:
在设备运行状态下,根据中断消息确定SD卡状态;所述中断消息由SD卡插拔行为触发;根据所述SD卡状态,执行对应的SD卡操作。
可选地,所述根据所述SD卡状态,执行对应的SD卡操作,包括:在所述SD卡状态为插入时,执行加载操作;在所述SD卡状态为拔出时,执行卸载操作。
可选地,所述方法还包括:在设备启动时,搜索设备节点以确定SD卡状态。
可选地,所述搜索设备节点以确定SD卡状态,包括:判断是否能够打开设备节点;若否,则确定所述SD卡状态为拔出;若是,在所述设备节点下,搜索SD卡节点及对应的SD卡分区;在搜索获得SD卡节点和SD卡分区时,确定所述SD卡状态为插入;在不存在SD卡节点和SD卡分区时,确定所述SD卡状态为拔出。
可选地,所述根据中断消息确定SD卡状态,包括:随SD卡插拔行为,触发对应的内核中断;根据所述内核中断,发送对应的中断消息至应用层;在所述应用层解析所述中断消息获得的消息内容包括SD卡插入字段时,确定所述SD卡状态为插入;在所述应用层解析所述中断消息获得的消息内容包括SD卡拔出字段时,确定所述SD卡状态为拔出。
可选地,所述卸载操作包括:停止针对SD卡的读写操作;确定SD卡是否卸载成功;若否,则等待预设的时间后,重新卸载所述SD卡。
可选地,所述方法还包括:在执行加载操作之前,卸载所述SD卡,并且在执行加载操作以后,判断测试文件是否能够写入加载后的SD卡并从所述SD卡中删除;若是,则确定所述SD卡加载成功;若否,则确定所述SD卡加载失败。
为解决上述技术问题,本发明实施例还提供以下技术方案:一种SD卡识别模组。所述SD卡识别模组包括:
中断发生单元,用于根据SD卡插拔行为触发中断消息;消息解析单元,用于在设备运行状态下,根据中断消息确定SD卡状态;设备操作单元,用于根据所述消息解析单元和所述设备节点搜索单元确定的SD卡状态,执行对应的SD卡操作。
可选地,所述设备操作单元包括:SD卡加载组件,用于在所述SD卡状态为插入时,执行加载操作;SD卡卸载组件,用于在所述SD卡状态为拔出时,执行卸载操作。
可选地,所述SD卡识别模组还包括:设备节点搜索单元,用于在设备启动时,搜索设备节点以确定SD卡状态
可选地,所述设备节点搜索单元用于:判断是否能够打开设备节点;若否,则确定所述SD卡状态为拔出;若是,在所述设备节点下,搜索SD卡节点及对应的SD卡分区;在搜索获得SD卡节点和SD卡分区时,确定所述SD卡状态为插入;在不存在SD卡节点和SD卡分区时,确定所述SD卡状态为拔出。
可选地,所述中断发生单元具体用于,随SD卡插拔行为,触发对应的内核中断;根据所述内核中断,发送对应的中断消息至应用层;
所述消息解析单元处于应用层,具体用于解析所述中断消息以获得消息内容,并且;
在所述消息内容包括SD卡插入字段时,确定所述SD卡状态为插入;在所述消息内容包括SD卡拔出字段时,确定所述SD卡状态为拔出。
可选地,所述SD卡卸载组件具体用于:停止针对SD卡的读写操作;确定SD卡是否卸载成功;若否,则等待预设的时间后,重新卸载所述SD卡。
可选地,所述SD卡加载组件还用于:判断测试文件是否能够写入加载后的SD卡并从所述SD卡中删除;若是,则确定所述SD卡加载成功;若否,则确定所述SD卡加载失败。
为解决上述技术问题,本发明实施例还提供以下技术方案:一种电子设备,包括SD卡插槽以及控制器,其中,所述SD卡插槽用于收容SD卡并建 立与所述SD卡的电性连接;所述控制器与所述SD卡插槽连接,对插入所述SD卡插槽的SD卡执行数据读写操作;所述控制器还包括如上所述的SD卡识别模组,用于通过所述SD卡识别模组识别所述SD卡插槽中发生的SD卡插拔行为。
与现有技术相比较,本发明实施例提供的SD卡识别方法在设备运行状态时,通过以中断触发的方式来检测SD卡的插拔动作,可以较好的降低资源消耗,并且快速的对热插拔动作作出反应,准确识别当前的SD卡状态,防止出现设备不识别SD卡、系统崩溃或者SD卡损坏的问题。
【附图说明】
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。
图1为本发明实施例的应用环境示意图;
图2为本发明实施例提供的无人机的功能框图;
图3为本发明实施例提供的SD卡热插拔的识别方法的方法流程图;
图4为本发明实施例提供的SD卡设备搜索方法的方法流程图;
图5为图3所示的步骤200的方法流程图;
图6为本发明实施例提供的SD卡卸载操作的方法流程图;
图7为本发明实施例提供的SD卡加载操作的方法流程图;
图8为本发明实施例提供的SD卡热插拔识别模组的结构框图。
【具体实施方式】
为了便于理解本发明,下面结合附图和具体实施例,对本发明进行更详细的说明。需要说明的是,当元件被表述“固定于”另一个元件,它可以直接在另一个元件上、或者其间可以存在一个或多个居中的元件。当一个元件被表述“连接”另一个元件,它可以是直接连接到另一个元件、或者其间可以存在一个或多个居中的元件。本说明书所使用的术语“上”、“下”、“内”、“外”、“底部”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有 特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”“第三”等仅用于描述目的,而不能理解为指示或暗示相对重要性。
除非另有定义,本说明书所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本说明书中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是用于限制本发明。本说明书所使用的术语“和/或”包括一个或多个相关的所列项目的任意的和所有的组合。
此外,下面所描述的本发明不同实施例中所涉及的技术特征只要彼此之间未构成冲突就可以相互结合。
热插拔(hot-plugging)又被称为带电插拔,是指在不关闭主机系统和不切断电源的情况下,取出或者更换与主机系统连接的存储设备、交互设备等部件的动作。
在航拍无人机的应用过程中,航拍图像或者无人机的运行日志等数据通常被保存在SD卡等大容量存储设备中。在航拍任务量较大的情况下,通常需要每间隔一段时间对SD卡进行更换,以便于管理相关数据。
而且,用户获取和调用航拍图像、飞行日志等相关数据信息时,由于数据量较大,需要较高的传输速度。因此,通常需要从航拍无人机等设备中取出SD卡并将其与自己使用的设备连接,直接从SD卡中获得相关的数据信息。
基于以上的一项或者多项实际应用场景的需求,SD卡需要经常的从航拍无人机的相关设备中拔出或者插入,亦即SD卡的热插拔操作。
在惯常的操作系统中,对于SD卡热插拔操作的识别以主动搜索或者识别的形式进行,以设定的周期主动的获取SD卡设备节点的状态。这样的主动搜索或识别的方法消耗资源较多,也容易在频繁热插拔的过程中出现状态识别错误,导致SD卡无法识别,设备崩溃等问题。
以图1所示的应用环境为例,如图1所示,该应用环境可以包括:无人机10、用户设备20以及SD卡30。
无人机10可以是以任何类型的动力驱动(如电力)的无人飞行载具,包括但不限于四轴无人机、固定翼飞行器以及直升机模型等。在本实施例中以四轴无人机为例进行陈述。
该无人机10具备与实际需求相应的体积或者动力,能够为用户提供满足使用需要的载重能力、飞行速度以及飞行续航里程等。无人机10作为移动载具,可以设置一种或者多种功能模块,以执行相应的任务(如航拍侦查)。
图2为本发明实施例提供的无人机10的功能框图。如图2所示,在本实施例中,该无人机10可以搭载有航拍相机11以及图传装置12,并具有配对设置的遥控器13。
其中,该航拍相机11可以通过云台等安装固定部件安装设置在无人机10上,用于在飞行过程中,采集目标区域的图像信息。图传装置12与航拍相机连接,是一个图像数据传输系统。图传装置可以基于无线射频等通信连接方式,向外传输由航拍相机采集获得的数据。
图传装置12是设置于无人机一端,用于向智能终端或者其它的地面端设备传输处理后的视频数据的数据发送装置。该图传装置可以设置有相应的天线和射频单元,将图像数据加载在射频信号上发送。
遥控器13作为交互设备,实现无人机与用户之间的交互。用户可以通过遥控器13对无人机发送控制指令,或者通过遥控器13实时接收图传装置反馈的图像信息等。该遥控器根据实际情况的需要,可以设置有一个或者多个交互设备,用以执行对应的交互功能,例如,显示屏、按键、触控屏幕或者摇杆。
该航拍相机11、图传装置12上以及遥控器13上均可以设置有用于收容SD卡的SD卡插槽14。该SD卡插槽内设置有一个或者多个金属针脚,与SD卡建立电性连接,提供数据传输所需的物理传输信道。
在一些实施例中,该SD卡插槽还可以根据实际情况的需求,增加一个或者多个结构设置。例如,增加锁定SD卡位置的卡锁结构,或者是避免SD卡反插的防呆结构。
SD卡30根据实际情况的需要,可以选择使用任何合适的形状、尺寸存储容量以及读写速度。SD卡30与SD卡插槽相适配,在插入到航拍相机11、图传装置12上以及遥控器13等电子设备的SD卡插槽时,作为这些电子设备的大容量存储设备使用。
例如,SD卡可以用于存储航拍相机11拍摄或者的图像数据以及无人机飞行过程中的运行日志等。
在需要获得SD卡30内存储的数据时,用户可以直接将SD卡从SD卡插槽中取出,插入到自己使用的用户设备20以后,直接在用户设备20上对SD卡上的数据进行操作。
用户设备20可以是任何类型的,具备SD卡数据读取能力的电子设备,例如手机、平板电脑或者PDA等。该用户设备20可以装配有一种或者多种不同的输入/输出设备。这些输入/输出装置包括但不限于:按键、滚轮、显示屏、触摸屏、鼠标以及扬声器等。
无人机上设置的电子设备运行有主机系统(如Linux操作系统),用以协调和控制各个硬件设备之间的工作。在主机系统运行状态下,SD卡被用户拔出或者插入时,主机系统需要及时的得到反馈,确定SD卡当前所处的状态并执行相应的配置操作,使得SD卡可以被顺利加载或者卸载,保证系统和SD卡的正常运行和使用。
图3为本发明实施例提供的识别方法的方法流程图。如图3所示,所述识别方法分为设备启动和设备运行两种情形进行SD卡的状态检测。
100、在设备启动时,通过搜索设备节点的方式来确定SD卡状态。
在本实施例中,该SD卡状态是指SD卡插槽当前所处的工作状态,其用于表示是否有SD卡插入到SD卡插槽内并与SD卡插槽的引脚建立电性连接。
通过该步骤,可以提供或者确定SD卡插槽的初始SD卡状态,是否已经有SD卡插入到SD卡插槽内。
200、在设备运行状态下,根据中断消息确定SD卡状态。所述中断消息由SD卡插拔行为触发。
由于插拔行为发生时,电子设备处于正常的运转状态。因此,这样的SD卡插拔行为通常会导致相应的电信号发生变化(例如SD卡插槽中某个检测引脚的电平信号的改变)。
基于这样的变化,操作系统中将产生相对应的中断消息。该中断消息具体可以采用任何类型的格式或者内容结构,传递应用层进行解析以获取插拔发生并据此更新确定所述SD卡状态。
上述方法在设备采用了被动检测方式来确定SD卡状态,只在插拔行为发生时才响应和反馈。这样被动触发的方式,一方面不需要维持检测线程等的长期存在,资源消耗较少。另一方面,也能够更快速的响应和反馈SD卡状态, 不容易出现识别错误或者更新不及时。
300、根据所述SD卡状态,执行对应的SD卡操作。
该SD卡操作是指主机系统对已经移除或者新插入的SD卡进行配置的过程。配置完成后的SD卡才能够真正作为主机系统的大容量存储设备,实现数据读写的功能。
具体的,所述SD卡操作可以包括将原SD卡从主机系统中移除的卸载操作以及在主机系统中新增SD卡的加载操作两种。
其中,在所述SD卡状态为插入时,执行加载操作。而在所述SD卡状态为拔出时,执行卸载操作。
在本发明实施例中,在设备启动和运行时采用两种不同的方式进行SD卡检测,可以很好的反应SD卡的插拔动作。尤其是,在运行时以中断消息的方式来检测SD卡的插拔动作,能够准确的反映SD卡被拔出或者SD卡被插入的情况,即使在快速插拔SD卡时,也可以保持对SD卡状态的准确识别。
这样产生中断的方式不会产生一个周期性运行的特定线程,只在动作时才发生相应的消息内容反馈至系统,可以较好的降低资源消耗。
在一些实施例中,如图4所示,搜索设备节点以确定SD卡状态的方法可以包括:
101、判断是否能够打开设备节点。若是,则执行步骤102,若否,则执行步骤105。设备节点是指与设备连接的外部设备在主机系统中的表示项目。每一个与电子设备连接,可以正常运行的硬件设备会在主机系统中具有对应的设备节点。
102、确定是否能够搜索到SD卡节点。若是,则执行步骤103,若否,则执行步骤105。
SD卡节点是该设备节点下的其中一项。可以理解,当SD卡插入SD卡插槽,与电子设备建立电性连接时,在设备节点的目录下,可以检索到SD卡节点。
103、确定是否能够获取SD卡分区。若是,则执行步骤104;若否,则执行步骤105。
SD卡是作为一种大容量设备,使用时可以被划分若干个不同的分区。每个分区占有一定的存储空间或容量用以保存不同的数据。
104、确定所述SD卡状态为插入。
所述SD卡状态为插入,表明当前SD卡插槽内插有SD卡,并且该SD卡能够与设备的系统之间正常连接和识别,设备可以在该SD卡上读写数据。
105、确定所述SD卡状态为拔出。
而在SD卡状态为拔出时,表明当前SD卡插槽内不存在SD卡,设备没有与SD卡建立连接,SD卡插槽处于空的状态。
在另一些实施例中,如图5所示,所述根据中断消息确定SD卡状态的方法具体可以包括如下步骤:
201、随SD卡插拔行为,触发对应的内核中断。
该SD卡插拔行为是指用户将SD卡插入SD卡插槽或者从SD卡插槽中拔出的动作。随着这些动作的发生,硬件上会响应这样的动作信号,触发生成一个内核中断。
202、根据所述内核中断,发送对应的中断消息至应用层。
在出现了该内核中断以后,内核可以相应的编辑具有对应内容消息的中断消息至应用层,以及时的向设备反应SD卡插拔行为。
203、在所述应用层解析所述中断消息获得的消息内容包括SD卡插入字段时,确定所述SD卡状态为插入。
该SD卡插入字段具体可以是任何类型或者结构的,用于表示存在SD卡插入动作的数据信息或者内容。其具体形式取决于中断消息的编辑或者格式。
204、在所述应用层解析所述中断消息获得的消息内容包括SD卡拔出字段时,确定所述SD卡状态为拔出。
相类似地,所述SD卡拔出字段是指在解析中断消息后获得的消息内容在相同或者不同的字段位置上不同的消息内容。
例如,该SD卡拔出字段可以是"Status":"Inserted";而SD卡拔出字段可以是"Status":"Ejected"。
在一些实施例中,在解析获得的消息内容如果存在"SUBSYSTEM=block"和"DEVTYPE=partition"等字段时,可以表明这些字段是与SD卡相关的信息。在相关消息以“add”或者类似字段为开头时,也可以被认为是SD卡插入字段。而在这些相关消息以“remove”或者类似字段为开头时,则被认为是SD 卡拔出字段,表明发生了拔出SD卡的行为。而SD卡分区名则可以由应用层通过解释"DEVNAME="获取。
为成功的完成SD卡的加载或者卸载,除常规的卸载和加载以外,还可以进一步的增加额外的步骤。如图6所示,本发明实施例提供的卸载操作可以包括:
311、停止针对SD卡的读写操作。
所述SD卡的读写操作是指从SD卡中读取数据或者向SD卡写入数据的操作。例如,航拍相机的拍照、录像或者遥控器上的文件回放操作等。读写操作执行时,会在物理传输信道(如SD卡的传输引脚)上产生变化的电信号,并且SD卡将需要保持与主机系统之间的连接状态。
312、尝试卸载SD卡。
313、判断是否卸载成功,若是,则执行步骤314,若否,则执行步骤315。
通常的,卸载SD卡的操作指令并不总是能够成功,容易受到许多因素的影响。例如当SD卡正在忙碌状态(被主机系统的某个线程占用)时,是无法成功执行的。因此,可能需要多次的尝试。
314、确定SD卡卸载成功,完成SD卡卸载操作。
315、等待预设的时间后,返回步骤312。
该预设的时间是一个经验性数值,具体可以根据实际情况或者实际需要,由技术人员设置,例如可以设置为1s。经过合适的等待时间后,重新尝试进行卸载可以确保SD卡可以被卸载成功。
当然,为了避免重复尝试卸载SD卡对系统的运行造成影响,还可以设置尝试次数上限。在尝试卸载次数过多到达上限时,进入其它合适的补救途径。
如图7所示,在本发明实施例中,完整的加载操作可以由如下三步组成:
321、在执行加载操作之前,卸载所述SD卡。
首先进行卸载操作的方式可以防止或者避免之前加载的SD卡未进行卸载操作的影响,避免系统出现错误。
322、执行加载操作,加载SD卡。
323、在加载SD卡以后,进行SD卡读写测试。该读写测试具体可以通过测试文件的写入和删除操作来实现。例如,可以在显示加载成功以后,可 以尝试在SD卡路径中写入一个小的测试文件并删除。然后,判断测试文件是否支持写入和删除。若是,则确定所述SD卡加载成功;若否,则确定所述SD卡加载失败。
应当说明的是,本发明实施例提供的识别方法以Linux操作系统为例进行阐述。但是本领域技术人员基于本发明实施例揭露的发明思路和原则,还可以将所述识别方法进行一般性的调整、组合或者更改,应用到其它不同的操作系统中,实现SD卡快速热插拔时的SD卡状态识别。
基于上述方法实施例揭露的识别方法,本发明实施例还提供了一种SD卡识别模组。该SD卡识别模组可以分立或者整合设置在相关电子设备的控制器中,实现上述方法实施例中的一个或者多个步骤,支持和实现SD卡的快速热插拔。
图8为本发明实施例提供的SD卡识别模组。如图8所示,所述SD卡识别模组可以包括:设备节点搜索单元810、中断发生单元820、消息解析单元830以及设备操作单元840。
其中,所述设备节点搜索单元810用于在设备启动时,搜索设备节点以确定SD卡状态。
所述中断发生单元820用于根据SD卡插拔行为触发中断消息。所述消息解析单元830与所述中断发生单元连接,用于在设备运行状态下,根据中断消息确定SD卡状态。
基于设备节点搜索单元810或所述消息解析单元830提供的SD卡状态检测结果,所述设备操作单元840可以用于根据所述消息解析单元和所述设备节点搜索单元确定的SD卡状态并执行对应的SD卡操作。
具体的,如图8所示,所述设备操作单元840可以由SD卡加载组件841和SD卡卸载组件842组成。
其中,所述SD卡加载组件841用于在所述SD卡状态为插入时,执行加载操作。所述SD卡卸载组件842用于在所述SD卡状态为拔出时,执行卸载操作。基于该SD卡加载组件841和SD卡卸载组件842,可以自动的根据SD卡的状态加载或者卸载SD卡,更便于用户的使用。
较佳的是,所述SD卡卸载组件执行卸载操作时,具体可以划分为如下几个功能步骤:首先停止针对SD卡的读写操作。然后,尝试卸载SD卡,并确 定SD卡是否卸载成功。若否,则等待预设的时间后,重新卸载所述SD卡直至SD卡能够卸载成功。这样的方式可以避免在忙碌状态下的SD卡无法被卸载的问题。
所述SD卡加载组件841除执行加载操作以外,还可以用于在加载SD卡以后,判断测试文件是否能够写入加载后的SD卡并从所述SD卡中删除;若是,则确定所述SD卡加载成功;若否,则确定所述SD卡加载失败。
另外,为了避免加载SD卡前,存在尚未卸载的SD卡。在所述SD卡加载组件加载SD卡之前,还可以由所述SD卡卸载组件卸载所述SD卡。
在一些实施例中,所述设备节点搜索单元具体可以执行如下功能步骤:首先,判断是否能够打开设备节点;若否,则确定所述SD卡状态为拔出;若是。然后,在所述设备节点下,搜索SD卡节点及对应的SD卡分区。在搜索获得SD卡节点和SD卡分区时,确定所述SD卡状态为插入;在不存在SD卡节点和SD卡分区时,确定所述SD卡状态为拔出。
在另一些实施例中,当设备处于运行状态时,所述中断发生单元820和所述消息解析单元830分别执行如下步骤来响应SD卡的插拔动作:
首先,所述中断发生单元820用于随SD卡插拔行为,触发对应的内核中断并且根据所述内核中断,发送对应的中断消息至系统的应用层。
所述消息解析单元830是处于应用层组件。其可以解析所述中断消息以获得对应的消息内容,并据此判断SD卡具体的状态。
亦即,在所述消息内容包括SD卡插入字段时,确定所述SD卡状态为插入。而在所述消息内容包括SD卡拔出字段时,确定所述SD卡状态为拔出。
综上所述,本发明实施例提供的识别模组,采用不同的检测方式,对设备运行时和启动时的SD卡状态进行识别,可以较好的反应当前SD卡状态,防止针对SD卡的误操作,从而防止出现多次操作之后设备不识别SD卡、系统崩溃或者SD卡损坏的问题。
另外,在SD卡热插拔过程中,能够根据SD卡的状态,自动加载和卸载SD卡,更便于用户使用。
应当说明的是,虽然在本发明实施例中,仅使用了功能性命名和描述的方式,对SD卡识别模组进行描述(如设备节点搜索单元810、中断发生单元820、消息解析单元830以及设备操作单元840)。但是,本领域技术人员可以 根据实际情况的需要(如功耗、芯片面积成本,电路实现难度等),对每个特定的应用来使用不同方法来实现所描述的功能,例如选择使用硬件、软件或者软硬件结合的方式来实现本发明实施例揭露的SD卡识别模组的一种或者多种功能,这种实现不应认为超出本发明的范围。在已知所需要执行的功能的前提下,用于实现这些功能的硬件电路结合或者软件程序均为本领域技术人员所熟知。
以上实施例仅用以说明本发明的技术方案,而非对其限制;在本发明的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,步骤可以以任意顺序实现,并存在如上所述的本发明的不同方面的许多其它变化,为了简明,它们没有在细节中提供;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (15)

  1. 一种SD卡热插拔的识别方法,其特征在于,包括:
    在设备运行状态下,根据中断消息确定SD卡状态;所述中断消息由SD卡插拔行为触发;
    根据所述SD卡状态,执行对应的SD卡操作。
  2. 根据权利要求1所述的识别方法,其特征在于,所述根据所述SD卡状态,执行对应的SD卡操作,包括:
    在所述SD卡状态为插入时,执行加载操作;在所述SD卡状态为拔出时,执行卸载操作。
  3. 根据权利要求1所述的识别方法,其特征在于,所述方法还包括:在设备启动时,搜索设备节点以确定所述SD卡状态。
  4. 根据权利要求3所述的识别方法,其特征在于,所述搜索设备节点以确定所述SD卡状态,包括:
    判断是否能够打开设备节点;若否,则确定所述SD卡状态为拔出;
    若是,在所述设备节点下,搜索SD卡节点及对应的SD卡分区;
    在搜索获得SD卡节点和SD卡分区时,确定所述SD卡状态为插入;
    在不存在SD卡节点和SD卡分区时,确定所述SD卡状态为拔出。
  5. 根据权利要求2所述的识别方法,其特征在于,所述根据中断消息确定SD卡状态,包括:
    随所述SD卡插拔行为,触发对应的内核中断;
    根据所述内核中断,发送对应的中断消息至应用层;
    在所述应用层解析所述中断消息获得的消息内容包括SD卡插入字段时,确定所述SD卡状态为插入;
    在所述应用层解析所述中断消息获得的消息内容包括SD卡拔出字段时,确定所述SD卡状态为拔出。
  6. 根据权利要求2所述的识别方法,其特征在于,所述卸载操作包括:
    停止针对SD卡的读写操作;
    确定SD卡是否卸载成功;
    若否,则等待预设的时间后,重新卸载所述SD卡。
  7. 根据权利要求2所述的识别方法,其特征在于,所述方法还包括:
    在执行加载操作之前,卸载所述SD卡,并且
    在执行加载操作以后,判断测试文件是否能够写入加载后的SD卡并从所述SD卡中删除;
    若是,则确定所述SD卡加载成功;若否,则确定所述SD卡加载失败。
  8. 一种SD卡识别模组,其特征在于,包括:
    中断发生单元,用于根据SD卡插拔行为触发中断消息;
    消息解析单元,用于在设备运行状态下,根据所述中断消息确定SD卡状态;
    设备操作单元,用于根据所述消息解析单元和所述设备节点搜索单元确定的SD卡状态,执行对应的SD卡操作。
  9. 根据权利要求8所述的SD卡识别模组,其特征在于,所述设备操作单元包括:
    SD卡加载组件,用于在所述SD卡状态为插入时,执行加载操作;
    SD卡卸载组件,用于在所述SD卡状态为拔出时,执行卸载操作。
  10. 根据权利要求9所述的SD卡识别模组,其特征在于,还包括:设备节点搜索单元,用于在设备启动时,搜索设备节点以确定SD卡状态。
  11. 根据权利要求10所述的SD卡识别模组,其特征在于,所述设备节点搜索单元用于:
    判断是否能够打开设备节点;若否,则确定所述SD卡状态为拔出;
    若是,在所述设备节点下,搜索SD卡节点及对应的SD卡分区;
    在搜索获得SD卡节点和SD卡分区时,确定所述SD卡状态为插入;
    在不存在SD卡节点和SD卡分区时,确定所述SD卡状态为拔出。
  12. 根据权利要求9所述的SD卡识别模组,其特征在于,所述中断发生单元具体用于,随SD卡插拔行为,触发对应的内核中断;根据所述内核中断,发送对应的中断消息至应用层;
    所述消息解析单元处于应用层,具体用于解析所述中断消息以获得消息内容,并且;
    在所述消息内容包括SD卡插入字段时,确定所述SD卡状态为插入;在 所述消息内容包括SD卡拔出字段时,确定所述SD卡状态为拔出。
  13. 根据权利要求9所述的SD卡识别模组,其特征在于,所述SD卡卸载组件具体用于:停止针对SD卡的读写操作;确定SD卡是否卸载成功;若否,则等待预设的时间后,重新卸载所述SD卡。
  14. 根据权利要求9所述的SD卡识别模组,其特征在于,所述SD卡加载组件还用于:判断测试文件是否能够写入加载后的SD卡并从所述SD卡中删除;若是,则确定所述SD卡加载成功;若否,则确定所述SD卡加载失败。
  15. 一种电子设备,包括SD卡插槽以及控制器,其特征在于,所述SD卡插槽用于收容SD卡并建立与所述SD卡的电性连接;
    所述控制器与所述SD卡插槽连接,对插入所述SD卡插槽的SD卡执行数据读写操作;
    所述控制器还包括如权利要求8-14任一项所述的SD卡识别模组,用于通过所述SD卡识别模组识别所述SD卡插槽中发生的SD卡插拔行为。
PCT/CN2019/111707 2018-10-31 2019-10-17 Sd卡热插拔的识别方法、识别模组及电子设备 Ceased WO2020088263A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/244,112 US11797184B2 (en) 2018-10-31 2021-04-29 SD card hot plugging identification method, SD card identification module and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811286397.XA CN109471829A (zh) 2018-10-31 2018-10-31 Sd卡热插拔的识别方法、识别模组及电子设备
CN201811286397.X 2018-10-31

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/244,112 Continuation US11797184B2 (en) 2018-10-31 2021-04-29 SD card hot plugging identification method, SD card identification module and electronic device

Publications (1)

Publication Number Publication Date
WO2020088263A1 true WO2020088263A1 (zh) 2020-05-07

Family

ID=65666411

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/111707 Ceased WO2020088263A1 (zh) 2018-10-31 2019-10-17 Sd卡热插拔的识别方法、识别模组及电子设备

Country Status (3)

Country Link
US (1) US11797184B2 (zh)
CN (2) CN114328341A (zh)
WO (1) WO2020088263A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328341A (zh) 2018-10-31 2022-04-12 深圳市道通智能航空技术股份有限公司 Sd卡热插拔的识别方法、识别模组及电子设备
CN113312095B (zh) * 2021-04-16 2024-04-16 深圳市智微智能软件开发有限公司 管理显示设备的插拔事件的方法、装置、终端及存储介质
JP2024082761A (ja) * 2022-12-09 2024-06-20 キヤノン株式会社 情報処理装置、情報処理の制御方法、及び、プログラム

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130185471A1 (en) * 2012-01-18 2013-07-18 Mstar Semiconductor, Inc. Detection method and apparatus for hot-swapping of sd card
CN104272326A (zh) * 2013-12-03 2015-01-07 华为终端有限公司 防烧卡检测装置、终端设备及防烧卡检测、处理方法
CN104866385A (zh) * 2015-06-09 2015-08-26 广东欧珀移动通信有限公司 移动终端及其存储卡热插拔方法
CN105354116A (zh) * 2015-10-23 2016-02-24 青岛海信移动通信技术股份有限公司 一种热插拔检测方法、装置、系统及移动终端
CN106301428A (zh) * 2015-06-01 2017-01-04 中兴通讯股份有限公司 数码卡的处理方法及终端
CN109471829A (zh) * 2018-10-31 2019-03-15 深圳市道通智能航空技术有限公司 Sd卡热插拔的识别方法、识别模组及电子设备

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5095325B2 (ja) * 2007-09-14 2012-12-12 株式会社リコー 画像処理装置及び画像処理方法
CN101674445A (zh) * 2008-09-10 2010-03-17 上海晨兴电子科技有限公司 具有存储功能的多媒体信号接收装置
CN102479169A (zh) * 2010-11-24 2012-05-30 上海三旗通信科技股份有限公司 Mtk6223d平台实现sd卡热插拔功能
CN104104774A (zh) * 2013-04-02 2014-10-15 中兴通讯股份有限公司 Sim卡热插拔的方法、装置及系统
CN103530265B (zh) * 2013-10-24 2016-06-01 烽火通信科技股份有限公司 实现电子设备的cf卡安全热插拔的装置及方法
CN104466470B (zh) * 2014-11-18 2017-03-22 惠州Tcl移动通信有限公司 防抖动sd卡座、终端及识别sd卡插拔状态的方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130185471A1 (en) * 2012-01-18 2013-07-18 Mstar Semiconductor, Inc. Detection method and apparatus for hot-swapping of sd card
CN104272326A (zh) * 2013-12-03 2015-01-07 华为终端有限公司 防烧卡检测装置、终端设备及防烧卡检测、处理方法
CN106301428A (zh) * 2015-06-01 2017-01-04 中兴通讯股份有限公司 数码卡的处理方法及终端
CN104866385A (zh) * 2015-06-09 2015-08-26 广东欧珀移动通信有限公司 移动终端及其存储卡热插拔方法
CN105354116A (zh) * 2015-10-23 2016-02-24 青岛海信移动通信技术股份有限公司 一种热插拔检测方法、装置、系统及移动终端
CN109471829A (zh) * 2018-10-31 2019-03-15 深圳市道通智能航空技术有限公司 Sd卡热插拔的识别方法、识别模组及电子设备

Also Published As

Publication number Publication date
US20210247901A1 (en) 2021-08-12
CN109471829A (zh) 2019-03-15
CN114328341A (zh) 2022-04-12
US11797184B2 (en) 2023-10-24

Similar Documents

Publication Publication Date Title
US10437631B2 (en) Operating system hot-switching method and apparatus and mobile terminal
US20200218694A1 (en) File management method and apparatus
US12099700B2 (en) Method for browsing application folder and electronic device
US11797184B2 (en) SD card hot plugging identification method, SD card identification module and electronic device
EP2270675B1 (en) Information processing apparatus and control method thereof
US20180137072A1 (en) Intelligent storage device signal transmission method
CN107168905A (zh) 一种文件显示方法、装置、存储介质及移动终端
EP3772681B1 (en) Electronic device and method for sharing data thereof
US12608253B2 (en) Data processing method and apparatus for electronic device, and electronic device and storage medium
US20150113544A1 (en) Method for controlling process of application and computer system
GB2463809A (en) Peripheral device operation method, peripheral device and host
CN115951949A (zh) 一种bios的配置参数的恢复方法、装置及计算设备
CN107239238B (zh) 一种基于分布式锁的存储的io操作方法及装置
US20180213128A1 (en) Camera supporting removable storage divided into multiple partitions
CN113412480B (zh) 挂载处理方法、装置、电子设备及计算机可读取存储介质
CN119987877A (zh) 一种安卓系统的热插拔稳定性保障方法和热插拔系统
US11341095B2 (en) Electronic device for searching for file information stored in external device and operation method thereof
CN105183673B (zh) 在恢复模式下支持外置存储设备热插拔的方法及装置
US20250321748A1 (en) Chip boot method, chip, electronic device, and readable storage medium
CN108170585A (zh) 日志处理方法、装置、终端设备及存储介质
CN103617053A (zh) 一种软件升级的方法及装置
CN109634782B (zh) 一种系统健壮性的检测方法、装置、存储介质及终端
CN119105910A (zh) 磁带库备份归档方法、装置、计算设备及存储介质
CN113687915A (zh) 容器运行方法、装置、设备及存储介质
CN107704307A (zh) 一种虚拟外置存储设备的管理方法、装置及终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19880815

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19880815

Country of ref document: EP

Kind code of ref document: A1