CN105808299A - External device automatic mounting and informing control method and system - Google Patents

External device automatic mounting and informing control method and system Download PDF

Info

Publication number
CN105808299A
CN105808299A CN201610133038.5A CN201610133038A CN105808299A CN 105808299 A CN105808299 A CN 105808299A CN 201610133038 A CN201610133038 A CN 201610133038A CN 105808299 A CN105808299 A CN 105808299A
Authority
CN
China
Prior art keywords
external equipment
plug
list
application
information
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.)
Granted
Application number
CN201610133038.5A
Other languages
Chinese (zh)
Other versions
CN105808299B (en
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.)
Shenzhen TCL New Technology Co Ltd
Shenzhen TCL Digital Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology 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 Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN201610133038.5A priority Critical patent/CN105808299B/en
Priority to PCT/CN2016/084854 priority patent/WO2017152526A1/en
Publication of CN105808299A publication Critical patent/CN105808299A/en
Application granted granted Critical
Publication of CN105808299B publication Critical patent/CN105808299B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Computer Hardware Design (AREA)

Abstract

The invention relates to an external device automatic mounting and informing control method and system. The method comprises following steps of detecting whether there is plug of an external device or not currently; analyzing a plug environment variable when the hot plug of the external device is detected; establishing or deleting corresponding file and path in a sysfs file system according to analyzing results; establishing or deleting a device node corresponding to the external device under a preset path; and sending the plug information of the external device to each application program in an application list subscribing for information. According to the method and the system, the external device is automatically mounted in an embedded system, moreover, the application programs needing to obtain the external device mounting information are informed of the mounting information; the demands of the embedded system are satisfied; moreover, the resources of a CPU are saved; the memory usage is reduced; and the user experience is improved.

Description

The control method of the automatic carry of external equipment and notice and system
Technical field
The present invention relates to field of embedded technology, particularly relate to control method and the system of the automatic carry of external equipment and notice.
Background technology
In the application of embedded device, often occurring accessing the demand of external equipment, wherein, the access of typical external equipment has hot plug USB flash disk, portable hard drive etc., and certainly, user directly uses after wishing to these external equipments of automatic carry.In prior art, external equipment carry is generally adopted udev scheme on PC (personalcomputer: PC), but udev is not particularly suited for embedded system as backstage execution program, it can consume more CPU (central processing unit: CentralProcessingUnit) resource, take too much internal memory simultaneously, and, for embedded system, application layer is except automatic carry, also want to external equipment can automatically notify after such insertion, so that application layer can use this external equipment after obtaining relevant carry information, the program not yet occurs in the prior art.
Summary of the invention
It is an object of the invention to provide the control method of the automatic carry of a kind of external equipment and notice and system, while automatic carry external equipment in embedded systems, realize needing to obtain by this carry information notice each application program of external equipment carry information, and while meeting the demand of embedded system, cpu resource can be saved, reduce EMS memory occupation, and then promote user experience.
First aspect according to embodiments of the present invention, it is provided that the control method of the automatic carry of a kind of external equipment and notice, including:
Whether detection currently exists the plug of external equipment;
When detecting the presence of the hot plug of external equipment, resolve plug environmental variable, and in sysfs file system, create or delete file and the path of correspondence according to analysis result;
Create under preset path or delete the device node corresponding with described external equipment;
The plug information of external equipment is sent each application program to the list of application subscribing to message.
Preferably, described when detecting the presence of the hot plug of external equipment, resolve plug environmental variable, and in sysfs file system, creates or delete corresponding file according to analysis result and path includes:
When detecting the presence of the hot plug of external equipment, receive and resolve the plug environmental variable corresponding with the hot plug events of described external equipment according to preset rules;
Hot plug information according to resolving the obtained external equipment of described plug environmental variable creates in sysfs file system or deletes the file corresponding with external equipment and path;
It is XML message by the hot plug Information encapsulation of described external equipment and sends to kernel process.
Preferably, the control method of the automatic carry of described external equipment and notice also includes:
Sysfs file system is traveled through to search cold plug information during start;
The cold plug Information encapsulation of external equipment obtained after traversal sysfs file system is XML message and sends to described kernel process.
Preferably, described under preset path create or delete the device node corresponding with described external equipment include:
Receive described XML message and unpacked;
Create under path corresponding to described XML message dev file in described sysfs file system or delete the device node corresponding with external equipment, to complete carry or the unloading of described external equipment;
By the establishment of described external equipment or delete information updating to peripheral hardware list.
Preferably, the described each application program plug information of external equipment sent to the list of application subscribing to message includes:
Receive the subscription message request that sends of application program and set up list of application;
The more fresh information of the peripheral hardware list after renewal or described peripheral hardware list is notified each application program in described list of application;
What receive that described application program sends unsubscribes message request and is deleted from described list of application by corresponding application program according to the described message request that unsubscribes.
Preferably, between described kernel process and each application program of described list of application, communicated by the mode of socket or shared drive;
Also include before the plug whether described detection currently exists external equipment:
By in described kernel process write start self-starting script file;
Create described peripheral hardware list and described list of application.
Second aspect according to embodiments of the present invention, also provides for the control system of the automatic carry of a kind of external equipment and notice, including:
Detection module, for detecting the plug that currently whether there is external equipment;
Parsing module, for when detecting the presence of the hot plug of external equipment, resolving plug environmental variable, and create or delete file and the path of correspondence according to analysis result in sysfs file system;
Carry module, for creating or deleting the device node corresponding with described external equipment under preset path;
Notification module, for each application program plug information of external equipment sent to the list of application subscribing to message.
Preferably, described parsing module includes:
Analyzing sub-module, for when detecting the presence of the hot plug of external equipment, receiving and resolve the plug environmental variable corresponding with the hot plug events of described external equipment according to preset rules;
Information changes submodule, for creating in sysfs file system according to the hot plug information resolving the obtained external equipment of described plug environmental variable or delete the file corresponding with external equipment and path;
Message transmits submodule, for being XML message by the hot plug Information encapsulation of described external equipment and sending to kernel process.
Preferably, the control system of the automatic carry of described external equipment and notice also includes:
Cold plug detection module, travels through sysfs file system to search cold plug information when being used for starting shooting;
Message sending modules, for being XML message by the cold plug Information encapsulation of external equipment obtained after traversal sysfs file system and send to described kernel process.
Preferably, described carry module includes:
Message sink submodule, is used for receiving described XML message and being unpacked;
Device node management submodule, for creating under the path corresponding to described XML message dev file in described sysfs file system or deleting the device node corresponding with external equipment, to complete carry or the unloading of described external equipment;
Carry submodule, for by the establishment of described external equipment or delete information updating to peripheral hardware list.
Preferably, described notification module includes:
Subscribe to submodule, for receiving subscription message request that application program sends and setting up list of application;
Notice submodule, for notifying each application program in described list of application by the more fresh information of the peripheral hardware list after renewal or described peripheral hardware list;It is additionally operable to receive that described application program sends unsubscribes message request and deleted from described list of application by corresponding application program according to the described message request that unsubscribes.
Preferably, between described kernel process and each application program of described list of application, communicated by the mode of socket or shared drive;The control system of the automatic carry of described external equipment and notice also includes:
Process writing module, for by described kernel process write start self-starting script file;
List creating module, is used for creating described peripheral hardware list and described list of application.
The technical scheme that the embodiment of the present invention provides can produce following beneficial effect: whether detection currently exists the plug of external equipment;When detecting the presence of the hot plug of external equipment, resolve plug environmental variable, and in sysfs file system, create or delete file and the path of correspondence according to analysis result;Create under preset path or delete the device node corresponding with described external equipment;The plug information of external equipment is sent each application program to the list of application subscribing to message.While the present invention automatic carry external equipment in embedded systems, realize by this carry information notice need obtain external equipment carry information each application program, meet embedded system demand meanwhile, it is capable to save cpu resource, reduce EMS memory occupation, and then promote user experience.
Other features and advantages of the present invention will be set forth in the following description, and, partly become apparent from description, or understand by implementing the present invention.The purpose of the present invention and other advantages can be realized by structure specifically noted in the description write, claims and accompanying drawing and be obtained.
Below by drawings and Examples, technical scheme is described in further detail.
Accompanying drawing explanation
Fig. 1 is the flow chart of the control method of the present invention automatic carry of a kind of external equipment according to an exemplary embodiment and notice;
Fig. 2 is the flow chart of the step S20 of the control method of the present invention automatic carry of a kind of external equipment according to an exemplary embodiment and notice;
Fig. 3 is the flow chart of the control method of the present invention automatic carry of another kind of external equipment according to an exemplary embodiment and notice;
Fig. 4 be the step S30 of the control method of the present invention automatic carry of a kind of external equipment according to an exemplary embodiment and notice flow chart;
Fig. 5 is the flow chart of the step S40 of the control method of the present invention automatic carry of a kind of external equipment according to an exemplary embodiment and notice;
Fig. 6 is the flow chart of the control method of the present invention automatic carry of another external equipment according to an exemplary embodiment and notice;
Fig. 7 is the block diagram of the control system of the present invention automatic carry of a kind of external equipment according to an exemplary embodiment and notice;
Fig. 8 is the block diagram of the parsing module 62 of the control system of the present invention automatic carry of external equipment according to an exemplary embodiment and notice;
Fig. 9 is the figure of the control system of the present invention automatic carry of another kind of external equipment according to an exemplary embodiment and notice;
Figure 10 is the block diagram of the carry module 63 of the control system of the present invention automatic carry of a kind of external equipment according to an exemplary embodiment and notice;
Figure 11 is the block diagram of the notification module 64 of the control system of the present invention automatic carry of a kind of external equipment according to an exemplary embodiment and notice;
Figure 12 is the block diagram of the control system of the present invention automatic carry of another external equipment according to an exemplary embodiment and notice.
Detailed description of the invention
In order to make the purpose of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein is only in order to explain the present invention, is not intended to limit the present invention.
Embodiments provide control method and the system of the automatic carry of a kind of external equipment and notice, while automatic carry external equipment in embedded systems, realize needing to obtain by this carry information notice each application program of external equipment carry information, and while meeting the demand of embedded system, cpu resource can be saved, reduce EMS memory occupation, and then promote user experience.As it is shown in figure 1, the method comprising the steps of S10-S40:
In step slo, whether detection currently exists the plug of external equipment;Wherein, the plug (inserting or pull out) of described external equipment includes hot plug and cold plug, and the plug of the external equipment carried out before start is defined as cold plug;And the plug of the external equipment carried out after power-up is defined as hot plug.
In step S20, when detecting the presence of the hot plug of external equipment, resolve plug environmental variable, and according to analysis result in sysfs file system newly-built or delete corresponding file and path;Namely, insert after power-up when detecting or extracted external equipment, now, due to the plug environmental variable being configured when having pre-defined external equipment hot plug in embedded systems, therefore when there being external equipment insert after power-up or extract, can receive and parse through the plug environmental variable corresponding to the hot plug of external equipment, and according to the plug environmental variable after resolving, newly-built or delete corresponding file and path in sysfs file system.Wherein, the detection of the plug behavior of external equipment is performed by peripheral hardware aware processes, peripheral hardware aware processes performs following operation: when detecting that external equipment inserts, the file of newly-built correspondence and path in sysfs file system, when detecting that external equipment is extracted, by the file of this external equipment already present in sysfs file system and route deletion, namely carry out synchronizing to change to the change in the file in the file system caused by the hot plug of this external equipment and path.
In certain embodiments, as in figure 2 it is shown, described step S20 includes:
Step S201, when detecting the presence of the hot plug of external equipment, receive and also resolve the plug environmental variable corresponding with the hot plug events of described external equipment according to preset rules;Concrete, in one embodiment, when detecting the presence of the hot plug of external equipment, default mechanism in linux (embedded system) kernel (such as uevent_helper mechanism) call as described in peripheral hardware aware processes, receive the plug environmental variable corresponding with the hot plug events of described external equipment, and the configuration rule according to plug environmental variable predefined in Linux system, resolve described plug environmental variable, to judge that current external equipment is to insert or pull out;Such as, the plug environmental variable ACTION after parsing is add, represents that external equipment inserts, and the plug environmental variable ACTION after parsing is remove, then it represents that external equipment is extracted.
Step S202, create in sysfs file system according to the hot plug information resolving the obtained external equipment of described plug environmental variable or delete the file corresponding with external equipment and path;Namely the hot plug synchronizing information according to external equipment obtained after resolving described plug environmental variable changes the file in sysfs file system and path, and described path is assigned to path environment variable;In one embodiment, described path environment variable is DEVPATH, namely, after the path of external equipment changes, need to be assigned to DEVPATH, to change its path, and be assigned under the path after DEVPATH preserve file (be /dev catalogue under dev file) also should according to the plug time of described external equipment carry out synchronize change.
Step S203, it is XML message by the hot plug Information encapsulation of described external equipment and sends to kernel process.Wherein, the hot plug information of the described external equipment of encapsulation includes the corresponding file changed of hot plug events and the routing information of external equipment, also includes the described plug environmental variable information after resolving.
As shown in Figure 6, step S70 is also included before described step S10: peripheral hardware aware processes and kernel process are write in start self-starting script file;Create described peripheral hardware list and described list of application.In one embodiment, described step S70 is particularly as follows: start shooting above-mentioned peripheral hardware aware processes in self-starting script file (described self-starting script file can be/etc/inittab or/etc/rc.d/rc.local) with the write of above-mentioned kernel process;Wherein, the start self-starting deadline of described kernel process is prior to described peripheral hardware aware processes, and the cold plug of described external equipment can be detected after peripheral hardware aware processes described in start self-operating.
In certain embodiments, as it is shown on figure 3, also include step S50 and step S60 after described step S10:
In step s 50, sysfs file system is traveled through during start to search cold plug information;Concrete, it is possible to interface environment variable such as SUBSYSTEM is set in embedded systems, automatically detects this interface environment variable when start, and then obtain the cold plug information of external equipment.Meanwhile, when the cold plug detecting the presence of external equipment, the file in sysfs file system is traveled through by described peripheral hardware aware processes;Wherein, the file in the described sysfs file system of traversal include/path such as sys/class ,/sys/block ,/sys/device under file.
In step S60, the cold plug Information encapsulation of external equipment obtained after traversal sysfs file system is XML message and sends to described kernel process.Wherein, the cold plug information of the described external equipment of encapsulation includes the file corresponding to cold hot plug event and the routing information of external equipment, also includes the information inserted or pull out of described external equipment.
In step s 30, create under preset path or delete the device node corresponding with described external equipment;Concrete, in one embodiment, described kernel process, after receiving the XML message of encapsulation, is unpacked and is looked for default path and created/delete the device node of described external equipment under this path, completes the carry/unloading of described external equipment.
In certain embodiments, as shown in Figure 4, described step S30 includes:
Step S301, receive described XML message and unpacked;Wherein, described XML message includes the cold plug information of external equipment and the hot plug information of external equipment, and XML message is likely to the plugging condition (the cold plugs of the multiple external equipments detected when such as comprising start) that comprises multiple equipment, it is also possible to the situation of only one of which hot-plug equipment.
Create under step S302, path corresponding to described XML message dev file in described sysfs file system or delete the device node corresponding with external equipment, to complete carry or the unloading of described external equipment;Described dev file is the path associated by path environment variable DEVPATH, be also in sysfs file system/dev catalogue under file.
Step S303, by the establishment of described external equipment or delete information updating to peripheral hardware list.Namely, if the hot plug of external equipment, such as, if the plug environmental variable ACTION in XML information is add after resolving, so below/dev catalogue, create new device node, such as according to predetermined rule (simultaneously, regular expression can be used to represent this rule, and this rule can use configuration file to configure) it is mounted under certain catalogue, and access limit and owner, the group owner of this external equipment are set, meanwhile, add this external equipment to list of devices, thus completing the carry of described external equipment;And if the plug environmental variable ACTION in XML information is remove after resolving, now needing the device node under deletion/dev catalogue, unloading corresponding catalogue, described external equipment equipment being removed from list of devices simultaneously.Intelligible, if the cold plug of described external equipment, it is also possible to reference to upper type, while the plug information that directly basis detects is by described external equipment carry/unloading, establishment/deletion information changes to peripheral hardware list, completes the carry/unloading of described external equipment.
In step s 40, the plug information of external equipment is sent each application program to the list of application subscribing to message.Namely, in one embodiment, all application can be connected to described kernel process and be sent to message, if described kernel process is sent subscription information and represents that the plug change of external equipment is interested by it by an application, now this application is joined in list of application, in order to be sent to the plug information of external equipment.Simultaneously, each application in list of application can also send the information of unsubscribing to represent that it is not intended to be not concerned with the plug situation of change of external equipment, now, described kernel process will delete described application and the connection of disconnection and described application from described list of application.Certainly, when kernel process described in all application First Contact Connections, the facility information that described kernel process is required for sending in now peripheral hardware list is to this application, in order to this application determines if to need to subscribe to.
In certain embodiments, as it is shown in figure 5, described step S40 includes:
Step S401, receive subscription message request that application program (such as multimedia scanning imaging system, file browser etc. application) sends and set up list of application;Namely, all application can be connected to described kernel process and be sent to message, if described kernel process is sent subscription information and represents that the plug change of external equipment is interested by it by an application, now this application is joined in list of application, in order to be sent to the plug information of external equipment.
Step S402, the peripheral hardware list after updating or the more fresh information of described peripheral hardware list are notified each application program in described list of application;Wherein, described kernel process is additionally operable to receive that described application program sends unsubscribes message request and deleted from described list of application by corresponding application program according to the described message request that unsubscribes.Wherein, the plug information of the described external equipment of broadcast announcement is the facility information in described peripheral hardware list, and described facility information includes the information of external equipment of all hot plugs after the external equipment information of cold plug and start.Simultaneously, each application in list of application can also send the information of unsubscribing to represent that it is not intended to be not concerned with the plug situation of change of external equipment, now, described kernel process will delete described application and the connection of disconnection and described application from described list of application.
In certain embodiments, between described kernel process and each application program of described list of application, communicated by socket (two programs on network realize the exchange of data by a two-way communication connection, and one end of this connection is called a socket) or the mode of shared drive;Meanwhile, between described peripheral hardware aware processes and described kernel process, mode also by socket or shared drive communicates;Wherein, the communication between described kernel process and described list of application is two-way, and connection can be kept between the two for a long time can also to connect once just disconnection.
As shown in Figure 6, also include step S80 before described step S10: in step S80, create peripheral hardware list and list of application.After described kernel process starts shooting self-starting, namely need to create described peripheral hardware list and list of application voluntarily, in order to described kernel process circulation reception information also processes.
The said method that the embodiment of the present invention provides, whether detection currently exists the plug of external equipment;When detecting the presence of the hot plug of external equipment, resolve plug environmental variable, and in sysfs file system, create or delete file and the path of correspondence according to analysis result;Create under preset path or delete the device node corresponding with described external equipment;The plug information of external equipment is sent each application program to the list of application subscribing to message.While the present invention automatic carry external equipment in embedded systems, realize by this carry information notice need obtain external equipment carry information each application program, and meet embedded system demand meanwhile, it is capable to save cpu resource, reduce EMS memory occupation, and then promote user experience.
The automatic carry of external equipment of corresponding embodiment of the present invention offer and the control method of notice, the present invention also provides for the control system of the automatic carry of a kind of external equipment and notice, as it is shown in fig. 7, this system comprises the steps that
Detection module 61, for detecting the plug that currently whether there is external equipment;
Parsing module 62, for when detecting the presence of the hot plug of external equipment, resolving plug environmental variable, and create or delete file and the path of correspondence according to analysis result in sysfs file system;
Carry module 63, for creating or deleting the device node corresponding with described external equipment under preset path;
Notification module 63, for each application program plug information of external equipment sent to the list of application subscribing to message.
Preferably, as shown in Figure 8, described parsing module 62 includes:
Analyzing sub-module 621, for when detecting the presence of the hot plug of external equipment, receiving and resolve the plug environmental variable corresponding with the hot plug events of described external equipment according to preset rules;
Information changes submodule 622, for creating in sysfs file system according to the hot plug information resolving the obtained external equipment of described plug environmental variable or delete the file corresponding with external equipment and path;
Message transmits submodule 623, for being XML message by the hot plug Information encapsulation of described external equipment and sending to kernel process.
Preferably, as it is shown in figure 9, the control system of the automatic carry of described external equipment and notice also includes:
Cold plug detection module 65, travels through sysfs file system to search cold plug information when being used for starting shooting;
Message sending modules 66, for being XML message by the cold plug Information encapsulation of external equipment obtained after traversal sysfs file system and send to kernel process.
Preferably, as shown in Figure 10, described carry module 63 includes:
Message sink submodule 631, is used for receiving described XML message and being unpacked;
Device node management submodule 632, for creating under the path corresponding to described XML message dev file in described sysfs file system or deleting the device node corresponding with external equipment, to complete carry or the unloading of described external equipment;
Carry submodule 633, for by the establishment of described external equipment or delete information updating to peripheral hardware list.
Preferably, as shown in figure 11, described notification module 64 includes:
Subscribe to submodule 641, for receiving subscription message request that application program sends and setting up list of application;
Notice submodule 642, for notifying each application program in described list of application by the more fresh information of the peripheral hardware list after renewal or described peripheral hardware list;It is additionally operable to receive that described application program sends unsubscribes message request and deleted from described list of application by corresponding application program according to the described message request that unsubscribes.
Preferably, between described kernel process and each application program of described list of application, communicated by the mode of socket or shared drive;As shown in figure 12, the control system of the automatic carry of described external equipment and notice also includes:
Process writing module 67, for by described kernel process write start self-starting script file;
List creating module 68, is used for creating described peripheral hardware list and described list of application.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, complete software implementation or the embodiment in conjunction with software and hardware aspect.And, the present invention can adopt the form at one or more upper computer programs implemented of computer-usable storage medium (including but not limited to disk memory and optical memory etc.) wherein including computer usable program code.
The present invention is that flow chart and/or block diagram with reference to method according to embodiments of the present invention, equipment (system) and computer program describe.It should be understood that can by the combination of the flow process in each flow process in computer program instructions flowchart and/or block diagram and/or square frame and flow chart and/or block diagram and/or square frame.These computer program instructions can be provided to produce a machine to the processor of general purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device so that the instruction performed by the processor of computer or other programmable data processing device is produced for realizing the device of function specified in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions may be alternatively stored in and can guide in the computer-readable memory that computer or other programmable data processing device work in a specific way, the instruction making to be stored in this computer-readable memory produces to include the manufacture of command device, and this command device realizes the function specified in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, make on computer or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computer or other programmable devices provides for realizing the step of function specified in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all any amendment, equivalent replacement and improvement etc. made within the spirit and principles in the present invention, should be included within protection scope of the present invention.

Claims (12)

1. the control method of the automatic carry of external equipment and notice, it is characterised in that including:
Whether detection currently exists the plug of external equipment;
When detecting the presence of the hot plug of external equipment, resolve plug environmental variable, and in sysfs file system, create or delete file and the path of correspondence according to analysis result;
Create under preset path or delete the device node corresponding with described external equipment;
The plug information of external equipment is sent each application program to the list of application subscribing to message.
2. the control method of the automatic carry of external equipment as claimed in claim 1 and notice, it is characterized in that, described when detecting the presence of the hot plug of external equipment, resolve plug environmental variable, and in sysfs file system, creates or delete corresponding file according to analysis result and path includes:
When detecting the presence of the hot plug of external equipment, receive and resolve the plug environmental variable corresponding with the hot plug events of described external equipment according to preset rules;
Hot plug information according to resolving the obtained external equipment of described plug environmental variable creates in sysfs file system or deletes the file corresponding with external equipment and path;
It is XML message by the hot plug Information encapsulation of described external equipment and sends to kernel process.
3. the control method of the automatic carry of external equipment as claimed in claim 2 and notice, it is characterised in that also include:
Sysfs file system is traveled through to search cold plug information during start;
The cold plug Information encapsulation of external equipment obtained after traversal sysfs file system is XML message and sends to described kernel process.
4. the control method of the automatic carry of external equipment as claimed in claim 3 and notice, it is characterised in that described create under preset path or delete the device node corresponding with described external equipment include:
Receive described XML message and unpacked;
Create under path corresponding to described XML message dev file in described sysfs file system or delete the device node corresponding with external equipment, to complete carry or the unloading of described external equipment;
By the establishment of described external equipment or delete information updating to peripheral hardware list.
5. the control method of the automatic carry of external equipment as claimed in claim 4 and notice, it is characterised in that the described each application program plug information of external equipment sent to the list of application subscribing to message includes:
Receive the subscription message request that sends of application program and set up list of application;
The more fresh information of the peripheral hardware list after renewal or described peripheral hardware list is notified each application program in described list of application;
What receive that described application program sends unsubscribes message request and is deleted from described list of application by corresponding application program according to the described message request that unsubscribes.
6. the control method of the automatic carry of external equipment as claimed in claim 4 and notice, it is characterised in that between described kernel process and each application program of described list of application, communicated by the mode of socket or shared drive;
Also include before the plug whether described detection currently exists external equipment:
By in described kernel process write start self-starting script file;
Create described peripheral hardware list and described list of application.
7. the control system of the automatic carry of external equipment and notice, it is characterised in that including:
Detection module, for detecting the plug that currently whether there is external equipment;
Parsing module, for when detecting the presence of the hot plug of external equipment, resolving plug environmental variable, and create or delete file and the path of correspondence according to analysis result in sysfs file system;
Carry module, for creating or deleting the device node corresponding with described external equipment under preset path;
Notification module, for each application program plug information of external equipment sent to the list of application subscribing to message.
8. the control system of the automatic carry of external equipment as claimed in claim 7 and notice, it is characterised in that described parsing module includes:
Analyzing sub-module, for when detecting the presence of the hot plug of external equipment, receiving and resolve the plug environmental variable corresponding with the hot plug events of described external equipment according to preset rules;
Information changes submodule, for creating in sysfs file system according to the hot plug information resolving the obtained external equipment of described plug environmental variable or delete the file corresponding with external equipment and path;
Message transmits submodule, for being XML message by the hot plug Information encapsulation of described external equipment and sending to kernel process.
9. the control system of the automatic carry of external equipment as claimed in claim 8 and notice, it is characterised in that the control system of the automatic carry of described external equipment and notice also includes:
Cold plug detection module, travels through sysfs file system to search cold plug information when being used for starting shooting;
Message sending modules, for being XML message by the cold plug Information encapsulation of external equipment obtained after traversal sysfs file system and send to described kernel process.
10. the control system of the automatic carry of external equipment as claimed in claim 9 and notice, it is characterised in that described carry module includes:
Message sink submodule, is used for receiving described XML message and being unpacked;
Device node management submodule, for creating under the path corresponding to described XML message dev file in described sysfs file system or deleting the device node corresponding with external equipment, to complete carry or the unloading of described external equipment;
Carry submodule, for by the establishment of described external equipment or delete information updating to peripheral hardware list.
11. the control system of the automatic carry of external equipment as claimed in claim 10 and notice, it is characterised in that described notification module includes:
Subscribe to submodule, for receiving subscription message request that application program sends and setting up list of application;
Notice submodule, for notifying each application program in described list of application by the more fresh information of the peripheral hardware list after renewal or described peripheral hardware list;It is additionally operable to receive that described application program sends unsubscribes message request and deleted from described list of application by corresponding application program according to the described message request that unsubscribes.
12. the automatic carry of external equipment as described in any one of claim 1 to 11 and the control system of notice, it is characterised in that between described kernel process and each application program of described list of application, communicated by the mode of socket or shared drive;The control system of the automatic carry of described external equipment and notice also includes:
Process writing module, for by described kernel process write start self-starting script file;
List creating module, is used for creating described peripheral hardware list and described list of application.
CN201610133038.5A 2016-03-09 2016-03-09 The control method and system of the automatic carry of external equipment and notice Active CN105808299B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610133038.5A CN105808299B (en) 2016-03-09 2016-03-09 The control method and system of the automatic carry of external equipment and notice
PCT/CN2016/084854 WO2017152526A1 (en) 2016-03-09 2016-06-04 External device automatic mounting and notification control method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610133038.5A CN105808299B (en) 2016-03-09 2016-03-09 The control method and system of the automatic carry of external equipment and notice

Publications (2)

Publication Number Publication Date
CN105808299A true CN105808299A (en) 2016-07-27
CN105808299B CN105808299B (en) 2018-07-03

Family

ID=56467007

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610133038.5A Active CN105808299B (en) 2016-03-09 2016-03-09 The control method and system of the automatic carry of external equipment and notice

Country Status (2)

Country Link
CN (1) CN105808299B (en)
WO (1) WO2017152526A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542805A (en) * 2018-11-22 2019-03-29 北京奇安信科技有限公司 USB storage device control method, device, electronic equipment and storage medium
CN110111790A (en) * 2019-05-09 2019-08-09 青岛海信电器股份有限公司 Processing method, device and the equipment of the external equipment access of smart machine
CN112231761A (en) * 2020-12-14 2021-01-15 统信软件技术有限公司 Device mounting method, computing device and readable storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032165A (en) * 2021-03-24 2021-06-25 中国邮政储蓄银行股份有限公司 Peripheral calling method and device, processor and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101520792A (en) * 2008-12-17 2009-09-02 康佳集团股份有限公司 Method and system for automatically mounting and recognizing system file
CN102830970A (en) * 2012-08-10 2012-12-19 深圳市共进电子股份有限公司 Hot-plug treatment method applicable to Linux embedded system
CN103186487A (en) * 2011-12-31 2013-07-03 青岛海尔软件有限公司 Method for real-time recognition of USB device hot plugging
CN103186373A (en) * 2011-12-29 2013-07-03 盛乐信息技术(上海)有限公司 System and method for realizing hot plugging of input equipment
US8839193B1 (en) * 2011-06-06 2014-09-16 The Mathworks, Inc. Control surfaces for a technical computing environment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU1618601A (en) * 1999-11-17 2001-05-30 Granite Microsystems, Inc. Device bay system with surprise removal prevention for supporting and controlling usb and ieee 1394 peripheral devices

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101520792A (en) * 2008-12-17 2009-09-02 康佳集团股份有限公司 Method and system for automatically mounting and recognizing system file
US8839193B1 (en) * 2011-06-06 2014-09-16 The Mathworks, Inc. Control surfaces for a technical computing environment
CN103186373A (en) * 2011-12-29 2013-07-03 盛乐信息技术(上海)有限公司 System and method for realizing hot plugging of input equipment
CN103186487A (en) * 2011-12-31 2013-07-03 青岛海尔软件有限公司 Method for real-time recognition of USB device hot plugging
CN102830970A (en) * 2012-08-10 2012-12-19 深圳市共进电子股份有限公司 Hot-plug treatment method applicable to Linux embedded system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542805A (en) * 2018-11-22 2019-03-29 北京奇安信科技有限公司 USB storage device control method, device, electronic equipment and storage medium
CN110111790A (en) * 2019-05-09 2019-08-09 青岛海信电器股份有限公司 Processing method, device and the equipment of the external equipment access of smart machine
CN112231761A (en) * 2020-12-14 2021-01-15 统信软件技术有限公司 Device mounting method, computing device and readable storage medium
CN112231761B (en) * 2020-12-14 2021-07-30 统信软件技术有限公司 Device mounting method, computing device and readable storage medium

Also Published As

Publication number Publication date
WO2017152526A1 (en) 2017-09-14
CN105808299B (en) 2018-07-03

Similar Documents

Publication Publication Date Title
CN108933948B (en) Video playing progress synchronization method and device
CN107832100B (en) APK plug-in loading method and terminal thereof
CN105808299A (en) External device automatic mounting and informing control method and system
JP6359652B2 (en) Information transmission method, apparatus and device
CN109618174B (en) Live broadcast data transmission method, device, system and storage medium
CN107995286B (en) Automatic service starting and stopping method based on dubbo platform, server and storage medium
CN103188098B (en) A kind of disaster tolerance switching method, system and device
CN103294553A (en) Method and device for managing multimedia resources of mobile terminal
CN105260655A (en) Application program starting protection method, device and system
CN108924043A (en) System monitoring method, gateway communication, gateway apparatus, service processing equipment
CN103677988A (en) Multi-process communication method and system for software system
EP3174318A1 (en) Method for realizing resource attribute notification, and common service entity
CN103888491A (en) Diskless workstation start system and method
WO2022214012A1 (en) System and method for implementing multi-language translation of application program, device and medium
CN103544039A (en) Plug-in loading processing method and device
CN110290009B (en) Data scheduling method and device and computer readable storage medium
US20170270031A1 (en) Information processing apparatus, test execution method, and computer-readable recording medium
CN104702534A (en) Method and device for processing data of multi-process sharing port
CN110908881B (en) Buried point data transmitting method and device, electronic equipment and computer readable storage medium
CN102185881A (en) Household digital equipment wireless multi-protocol space sharing storage manager and method
CN109193653B (en) Power distribution method and device
CN113821333A (en) Android application program migration method and device
CN103259863B (en) Based on the system and method that the control zookeeper of cluster serves
CN114040378B (en) Method, device, computer equipment and storage medium for arranging application
CN110308938B (en) Management method and device for plugging and unplugging peripheral events

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant