CN105808299B - The control method and system of the automatic carry of external equipment and notice - Google Patents

The control method and system of the automatic carry of external equipment and notice Download PDF

Info

Publication number
CN105808299B
CN105808299B CN201610133038.5A CN201610133038A CN105808299B CN 105808299 B CN105808299 B CN 105808299B CN 201610133038 A CN201610133038 A CN 201610133038A CN 105808299 B CN105808299 B CN 105808299B
Authority
CN
China
Prior art keywords
external equipment
plug
list
notice
application
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.)
Active
Application number
CN201610133038.5A
Other languages
Chinese (zh)
Other versions
CN105808299A (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
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

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 present invention relates to a kind of automatic carry of external equipment and the control method and system of notice, the method includes:Detection currently whether there is the plug of external equipment;When the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and corresponding file and path are created or deleted in sysfs file system according to analysis result;Device node corresponding with the external equipment is created or deleted under preset path;Each application program plug information of external equipment being sent in the list of application for having subscribed to message.While automatic carry external equipment in embedded systems of the invention, it realizes each application program that carry information notice is needed to obtain external equipment carry information, and while meeting the needs of embedded system, cpu resource can be saved, EMS memory occupation is reduced, and then promotes user experience.

Description

The control method and system of the automatic carry of external equipment and notice
Technical field
The present invention relates to field of embedded technology more particularly to the automatic carry of external equipment and notice control method and be System.
Background technology
In the application of embedded device, it often will appear the demand of access external equipment, wherein, typical external equipment Access have hot plug USB flash disk, mobile hard disk etc., unquestionably, user directly makes after wishing to automatic carry these external equipments With.In the prior art, by external equipment carry in PC (personal computer:PC) on generally use udev side Case, however udev is not particularly suited for embedded system as backstage execution program, can consume more CPU (central processing units: Central Processing Unit) resource, while excessive memory is occupied, also, for embedded system, it applies Layer is other than automatic carry, it is also desirable to which external equipment can notify automatically after such insertion, so that application layer is obtaining correlation The external equipment can be used after carry information, the program not yet occurs in the prior art.
Invention content
The purpose of the present invention is to provide a kind of automatic carry of external equipment and the control method and system of notice, to In embedded system while automatic carry external equipment, realizing needs carry information notice to obtain external equipment carry letter Each application program of breath, and while meeting the needs of embedded system, cpu resource can be saved, EMS memory occupation is reduced, into And promote user experience.
It is according to embodiments of the present invention in a first aspect, provide the control method of a kind of automatic carry of external equipment and notice, Including:
Detection currently whether there is the plug of external equipment;
When the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and according to analysis result in sysfs Corresponding file and path are created or deleted in file system;
Device node corresponding with the external equipment is created or deleted under preset path;
Each application program plug information of external equipment being sent in the list of application for having subscribed to message.
Preferably, it is described when the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and according to parsing As a result it creates or deletes corresponding file in sysfs file system and path includes:
When the hot plug for detecting the presence of external equipment, receive and according to preset rules parsing and the external equipment The corresponding plug environmental variance of hot plug events;
According to the hot plug information of the parsing plug obtained external equipment of environmental variance in sysfs file system Create or delete file corresponding with external equipment and path;
The hot plug Information encapsulation of the external equipment for XML message and is sent to kernel process.
Preferably, the control method of the automatic carry of the external equipment and notice further includes:
Sysfs file system is traversed during booting to search cold plug information;
The cold plug Information encapsulation of obtained external equipment after traversal sysfs file system for XML message and is sent To the kernel process.
Preferably, the establishment under preset path or deletion device node corresponding with the external equipment include:
It receives the XML message and is unpacked;
It creates or deletes under path according to corresponding to dev files of the XML message in the sysfs file system Device node corresponding with external equipment, to complete the carry of the external equipment or unloading;
The establishment of the external equipment or deletion information are updated to peripheral hardware list.
Preferably, the described plug information of external equipment is sent in the list of application for having subscribed to message respectively applies journey Sequence includes:
It receives the subscription message request that application program is sent out and establishes list of application;
The fresh information of updated peripheral hardware list or the peripheral hardware list is notified to each application in the list of application Program;
Receive that the application program sends out unsubscribe message request and will be right according to the message request that unsubscribes The application program answered is deleted from the list of application.
Preferably, it between the kernel process and each application program of the list of application, by socket or shares The mode of memory communicates;
The detection currently further includes before with the presence or absence of the plug of external equipment:
The kernel process is written in booting self-starting script file;
Create the peripheral hardware list and the list of application.
Second aspect according to embodiments of the present invention also provides the control system of a kind of automatic carry of external equipment and notice System, including:
Detection module, for detecting the current plug that whether there is external equipment;
Parsing module, for when the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and according to solution Analysis result creates or deletes corresponding file and path in sysfs file system;
Carry module, for device node corresponding with the external equipment to be created or deleted under preset path;
Notification module, for the plug information of external equipment to be sent to each application in the list of application for having subscribed to message Program.
Preferably, the parsing module includes:
Analyzing sub-module, for when the hot plug for detecting the presence of external equipment, receiving and simultaneously being parsed according to preset rules Plug environmental variance corresponding with the hot plug events of the external equipment;
Information changes submodule, for being believed according to the hot plug for parsing the plug obtained external equipment of environmental variance Breath in sysfs file system creates or deletes file corresponding with external equipment and path;
Messaging submodule, for for XML message and the hot plug Information encapsulation of the external equipment to be sent to core Heart process.
Preferably, the control system of the automatic carry of the external equipment and notice further includes:
Cold plug detection module, traversal sysfs file system is to search cold plug information during for being switched on;
Message sending modules, for the cold plug information of obtained external equipment after sysfs file system envelope will to be traversed It fills as XML message and is sent to the kernel process.
Preferably, the carry module includes:
Message sink submodule, for receiving the XML message and being unpacked;
Device node manages submodule, for the dev files according to the XML message in the sysfs file system It is created under corresponding path or deletes device node corresponding with external equipment, to complete the carry of the external equipment or unload It carries;
Carry submodule, for the establishment of the external equipment or deletion information to be updated to peripheral hardware list.
Preferably, the notification module includes:
Submodule is subscribed to, for receiving subscription message request that application program sends out and establishing list of application;
Submodule is notified, for the fresh information of updated peripheral hardware list or the peripheral hardware list to be notified the application Each application program in list;It is additionally operable to receive that the application program sends out unsubscribes message request and according to the cancellation Message request is subscribed to delete corresponding application program from the list of application.
Preferably, it between the kernel process and each application program of the list of application, by socket or shares The mode of memory communicates;The control system of the automatic carry of external equipment and notice further includes:
Process writing module, for the kernel process to be written in booting self-starting script file;
List creating module, for creating the peripheral hardware list and the list of application.
Technical solution provided in an embodiment of the present invention can generate following advantageous effect:Detection currently whether there is external equipment Plug;When the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and according to analysis result in sysfs Corresponding file and path are created or deleted in file system;It creates or deletes corresponding with the external equipment under preset path Device node;Each application program plug information of external equipment being sent in the list of application for having subscribed to message.This hair While bright automatic carry external equipment in embedded systems, realizing needs carry information notice to obtain external equipment extension Each application program of information carrying breath while meeting the needs of embedded system, can save cpu resource, reduce EMS memory occupation, And then promote user experience.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification It obtains it is clear that being understood by implementing the present invention.The purpose of the present invention and other advantages can be by the explanations write Specifically noted structure is realized and is obtained in book, claims and attached drawing.
Below by drawings and examples, technical scheme of the present invention is described in further detail.
Description of the drawings
Fig. 1 is the controlling party of a kind of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The flow chart of method;
Fig. 2 is the controlling party of a kind of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The flow chart of the step S20 of method;
Fig. 3 is the control of another external equipment automatic carry and notice of the present invention according to an exemplary embodiment The flow chart of method;
Fig. 4 is the controlling party of a kind of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The flow chart of the step S30 of method;
Fig. 5 is the controlling party of a kind of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The flow chart of the step S40 of method;
Fig. 6 is the control of another external equipment automatic carry and notice of the present invention according to an exemplary embodiment The flow chart of method;
Fig. 7 is the control system of a kind of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The block diagram of system;
Fig. 8 is the control system of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The block diagram of parsing module 62;
Fig. 9 is the control of another external equipment automatic carry and notice of the present invention according to an exemplary embodiment The figure of system;
Figure 10 is the control of a kind of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The block diagram of the carry module 63 of system;
Figure 11 is the control of a kind of external equipment automatic carry and notice of the present invention according to an exemplary embodiment The block diagram of the notification module 64 of system;
Figure 12 is the control of another external equipment automatic carry and notice of the present invention according to an exemplary embodiment The block diagram of system processed.
Specific embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, it is right The present invention is further elaborated.It should be appreciated that specific embodiment described herein is only to explain the present invention, not For limiting the present invention.
An embodiment of the present invention provides a kind of automatic carry of external equipment and the control method and system of notice, to embedding In embedded system while automatic carry external equipment, realize needs to obtain external equipment carry information by carry information notice Each application program, and while meeting the needs of embedded system, cpu resource can be saved, reduce EMS memory occupation, and then Promote user experience.As shown in Figure 1, the method comprising the steps of S10-S40:
In step slo, detection currently whether there is the plug of external equipment;Wherein, the plug of the external equipment (is inserted Enter or extract) including hot plug and cold plug, the plug of the external equipment carried out before booting is defined as cold plug;And it is opening The plug of the external equipment carried out after machine is defined as hot plug.
In step S20, when the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and according to solution It analyses result and creates or delete corresponding file and path in sysfs file system;That is, it is inserted into after power-up when detecting Or external equipment has been extracted, at this point, due to that can be configured when having pre-defined external equipment hot plug in embedded systems Plug environmental variance, therefore when there is external equipment to be inserted into or extract after power-up, external equipment can be received and parsed through Hot plug corresponding to plug environmental variance, and according to the plug environmental variance after parsing, created in sysfs file system Or delete corresponding file and path.Wherein, the detection of the plug behavior of external equipment is performed by peripheral hardware aware processes, Peripheral hardware aware processes perform following operate:When detecting that external equipment is inserted into, corresponding text is created in sysfs file system Part and path, when detecting that external equipment is extracted, by the file of the external equipment already present in sysfs file system and road Diameter is deleted namely the file in the file system caused by the hot plug as the external equipment and the variation in path is synchronized Change.
In some embodiments, as shown in Fig. 2, the step S20 includes:
Step S201, when the hot plug for detecting the presence of external equipment, receive and according to preset rules parsing with it is described The corresponding plug environmental variance of hot plug events of external equipment;Specifically, it in one embodiment, is set when detecting the presence of outside During standby hot plug, as described in the default mechanism (such as uevent_helper mechanism) in linux (embedded system) kernel is called Peripheral hardware aware processes receive plug environmental variance corresponding with the hot plug events of the external equipment, and according to Linux system In the configuration rule of plug environmental variance that pre-defines, the plug environmental variance is parsed, to judge that current external equipment is It inserts or pull out;For example, the plug environmental variance ACTION after parsing is add, represent that external equipment is inserted into, the plug after parsing Environmental variance ACTION is remove, then it represents that external equipment is extracted.
Step S202, according to the hot plug information of the parsing plug obtained external equipment of environmental variance in sysfs File corresponding with external equipment and path are created or deleted in file system;Namely according to parse it is described plug environmental variance after File and path in the hot plug synchronizing information change sysfs file system of obtained external equipment, and by the path It is assigned to path environment variable;In one embodiment, the path environment variable is DEVPATH, that is, on the road of external equipment It after diameter changes, needs to be assigned to DEVPATH, to change its path, and is assigned under the path after DEVPATH and preserves File (be /dev catalogues under dev files) also should change be synchronized according to the plug time of the external equipment.
Step S203, the hot plug Information encapsulation of the external equipment for XML message and is sent to kernel process.Its In, the hot plug information of the external equipment of encapsulation includes the corresponding file changed of hot plug events and the road of external equipment Diameter information further includes the plug environmental variance information after parsing.
As shown in fig. 6, further include step S70 before the step S10:Peripheral hardware aware processes and kernel process write-in are opened In machine self-starting script file;Create the peripheral hardware list and the list of application.In one embodiment, the step S70 Specially:By above-mentioned peripheral hardware aware processes and above-mentioned kernel process write-in booting self-starting script file (the self-starting script File can be/etc/inittab or/etc/rc.d/rc.local) in;Wherein, the booting self-starting of the kernel process Deadline prior to the peripheral hardware aware processes, and the cold plug of the external equipment peripheral hardware described in booting self-operating perceive into It can be detected after journey.
In some embodiments, as shown in figure 3, further including step S50 and step S60 after the step S10:
In step s 50, sysfs file system is traversed during booting to search cold plug information;It specifically, can be in insertion Interface environment variable such as SUBSYSTEM in formula system is set, detects the interface environment variable automatically in booting, and then is obtained outer The cold plug information of portion's equipment.Meanwhile in the cold plug for detecting the presence of external equipment, pass through the peripheral hardware aware processes time Go through the file in sysfs file system;Wherein, the file in the sysfs file system of traversal include/sys/class ,/ File under the paths such as sys/block ,/sys/device.
In step S60, the cold plug Information encapsulation by obtained external equipment after traversal sysfs file system is XML message is simultaneously sent to the kernel process.Wherein, the cold plug information of the external equipment of encapsulation includes external equipment File and routing information corresponding to cold hot plug event further include the information inserted or pulled out of the external equipment.
In step s 30, device node corresponding with the external equipment is created or deleted under preset path;Specifically , in one embodiment, the kernel process is unpacked after the XML message of encapsulation is received and looks for preset road Diameter and under the path establishment/deletion external equipment device node, complete carry/unloading of the external equipment.
In some embodiments, as shown in figure 4, the step S30 includes:
Step S301, it receives the XML message and is unpacked;Wherein, the XML message includes the cold slotting of external equipment Pull out information and the hot plug information of external equipment, and an XML message may include multiple equipment plugging condition (such as comprising The cold plug of the multiple external equipments detected during booting), it is also possible to only there are one the situations of hot-plug equipment.
Step S302, under the path according to corresponding to dev files of the XML message in the sysfs file system It creates or deletes device node corresponding with external equipment, to complete the carry of the external equipment or unloading;The dev files For the path associated by path environment variable DEVPATH, the file under also as in sysfs file system/dev catalogues.
Step S303, the establishment of the external equipment or deletion information are updated to peripheral hardware list.It is that is, if external The hot plug of equipment, if for example, the plug environmental variance ACTION after parsing in XML information is add, then in/dev catalogues Create new device node below, at the same according to scheduled rule (for example, the rule can be represented using regular expression, and The rule can be configured using configuration file) it is mounted under some catalogue, and the access limit of the external equipment is set With owner, group owner, meanwhile, which is added to list of devices, so as to complete the carry of the external equipment;And such as Plug environmental variance ACTION after fruit parsing in XML information is remove, needs the equipment section under deletion/dev catalogues at this time Point, unloads corresponding catalogue, while being removed in the external equipment equipment slave device list.It is intelligible, if The cold plug of the external equipment, can also with reference to upper type, it is direct according to the plug information detected by the outside While equipment carry/unloading, establishment/deletion information changes to peripheral hardware list, completes carry/unloading of the external equipment.
In step s 40, each application plug information of external equipment being sent in the list of application for having subscribed to message Program.That is, in one embodiment, all applications can be connected to the kernel process and be sent to message, if one A application sends the kernel process subscription information and represents that its variation of plug to external equipment is interested, at this time this Using being added in list of application, in order to be sent to the plug information of external equipment.Meanwhile each application in list of application It can also send and unsubscribe information to represent its plug situation of change for being not intended to be not concerned with external equipment, at this point, the core Heart process will delete the application from the list of application, and disconnect the connection with the application.Certainly, in all applications Described in First Contact Connections during kernel process, the facility information that the kernel process is required for sending in peripheral hardware list at this time should to this With in order to which the application determines if to need to subscribe to.
In some embodiments, as shown in figure 5, the step S40 includes:
Step S401, the subscription that application program (such as the applications such as multimedia scanning imaging system, file browser) is sent out is received Message request simultaneously establishes list of application;That is, all applications can be connected to the kernel process and be sent to message, if One application to the kernel process send subscription information represent its to external equipment plug variation be it is interested, at this time The application is added in list of application, in order to be sent to the plug information of external equipment.
Step S402, the fresh information by updated peripheral hardware list or the peripheral hardware list is notified in the list of application Each application program;Wherein, the kernel process is additionally operable to receive that the application program sends out unsubscribes message request simultaneously It unsubscribes message request according to described and deletes from the list of application corresponding application program.Wherein, notice is broadcasted The plug information of the external equipment is the facility information in the peripheral hardware list, and the facility information includes the outside of cold plug The information of the external equipment of all hot plugs after facility information and booting.Meanwhile each application in list of application can also Transmission unsubscribes information to represent its plug situation of change for being not intended to be not concerned with external equipment, at this point, the kernel process The application will be deleted from the list of application, and disconnects the connection with the application.
In some embodiments, between the kernel process and each application program of the list of application, pass through socket (two programs on network realize the exchange of data by a two-way communication connection, and one end of this connection is known as one Socket) or the mode of shared drive communicates;Meanwhile between the peripheral hardware aware processes and the kernel process also by The mode of socket or shared drive communicates;Wherein, the communication between the kernel process and the list of application is two-way , and can keep connection that can also connect primary just disconnection for a long time between the two.
As shown in fig. 6, further include step S80 before the step S10:In step S80, peripheral hardware list and application are created List.After the kernel process is switched on self-starting, that is, need voluntarily to create the peripheral hardware list and list of application, in order to The kernel process cycle receives information and is handled.
The above method provided in an embodiment of the present invention, detection currently whether there is the plug of external equipment;It is deposited when detecting In the hot plug of external equipment, parsing plug environmental variance, and create or delete in sysfs file system according to analysis result Except corresponding file and path;Device node corresponding with the external equipment is created or deleted under preset path;It will be external The plug information of equipment is sent to each application program in the list of application for having subscribed to message.The present invention in embedded systems from While dynamic carry external equipment, realize and respectively apply journey by what carry information notice needed to obtain external equipment carry information Sequence, and while meeting the needs of embedded system, cpu resource can be saved, EMS memory occupation is reduced, and then promote user's body Degree of testing.
The control method of the corresponding automatic carry of external equipment provided in an embodiment of the present invention and notice, the present invention also provides one The control system of the kind automatic carry of external equipment and notice, as shown in fig. 7, the system may include:
Detection module 61, for detecting the current plug that whether there is external equipment;
Parsing module 62, for when the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and according to Analysis result creates or deletes corresponding file and path in sysfs file system;
Carry module 63, for device node corresponding with the external equipment to be created or deleted under preset path;
Notification module 63, for the plug information of external equipment to be sent to respectively should in the list of application that subscribe to message Use program.
Preferably, as shown in figure 8, the parsing module 62 includes:
Analyzing sub-module 621, for when the hot plug for detecting the presence of external equipment, receiving and according to preset rules solution Analysis plug environmental variance corresponding with the hot plug events of the external equipment;
Information changes submodule 622, for being inserted according to the heat for parsing the plug obtained external equipment of environmental variance It pulls out information and file corresponding with external equipment and path is created or deleted in sysfs file system;
Messaging submodule 623, for the hot plug Information encapsulation of the external equipment for XML message and to be sent to Kernel process.
Preferably, as shown in figure 9, the control system of the automatic carry of the external equipment and notice further includes:
Cold plug detection module 65, traversal sysfs file system is to search cold plug information during for being switched on;
Message sending modules 66, for the cold plug information of obtained external equipment after sysfs file system will to be traversed It is encapsulated as XML message and is sent to kernel process.
Preferably, as shown in Figure 10, the carry module 63 includes:
Message sink submodule 631, for receiving the XML message and being unpacked;
Device node manages submodule 632, for the dev texts according to the XML message in the sysfs file system Corresponding with external equipment device node is created or deleted under path corresponding to part, with complete the carry of the external equipment or Unloading;
Carry submodule 633, for the establishment of the external equipment or deletion information to be updated to peripheral hardware list.
Preferably, as shown in figure 11, the notification module 64 includes:
Submodule 641 is subscribed to, for receiving subscription message request that application program sends out and establishing list of application;
Notify submodule 642, for will the fresh information of updated peripheral hardware list or the peripheral hardware list notice described in Each application program in list of application;It is additionally operable to receive that the application program sends out unsubscribes message request and according to described Message request is unsubscribed to delete corresponding application program from the list of application.
Preferably, it between the kernel process and each application program of the list of application, by socket or shares The mode of memory communicates;As shown in figure 12, the control system of the automatic carry of the external equipment and notice further includes:
Process writing module 67, for the kernel process to be written in booting self-starting script file;
List creating module 68, for creating the peripheral hardware list and the list of application.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer program Product.Therefore, the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware can be used in the present invention Apply the form of example.Moreover, the computer for wherein including computer usable program code in one or more can be used in the present invention The shape of computer program product that usable storage medium is implemented on (including but not limited to magnetic disk storage and optical memory etc.) Formula.
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagram The combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be provided The processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that the instruction performed by computer or the processor of other programmable data processing devices is generated for real The device of function specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction generation being stored in the computer-readable memory includes referring to Enable the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram or The function of being specified in multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps are performed on calculation machine or other programmable devices to generate computer implemented processing, so as in computer or The instruction offer performed on other programmable devices is used to implement in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in a box or multiple boxes.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention All any modification, equivalent and improvement made within refreshing and principle etc., should all be included in the protection scope of the present invention.

Claims (12)

1. a kind of control method of automatic carry of external equipment and notice, which is characterized in that including:
Detection currently whether there is the plug of external equipment;
When the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and according to analysis result in sysfs files Corresponding file and path are created or deleted in system;
Device node corresponding with the external equipment is created or deleted under preset path;
Each application program plug information of external equipment being sent in the list of application for having subscribed to message.
2. the control method of the automatic carry of external equipment as described in claim 1 and notice, which is characterized in that described when detection To there are during the hot plug of external equipment, parsing plugs environmental variance, and is created in sysfs file system according to analysis result Or the corresponding file of deletion and path include:
When the hot plug for detecting the presence of external equipment, receive and inserted according to preset rules parsing and the heat of the external equipment Pull out the corresponding plug environmental variance of event;
Hot plug information according to the plug obtained external equipment of environmental variance is parsed creates in sysfs file system Or delete file corresponding with external equipment and path;
The hot plug Information encapsulation of the external equipment for XML message and is sent to kernel process.
3. the control method of the automatic carry of external equipment as claimed in claim 2 and notice, which is characterized in that further include:
Sysfs file system is traversed during booting to search cold plug information;
The cold plug Information encapsulation of obtained external equipment after traversal sysfs file system for XML message and is sent to institute State kernel process.
4. the control method of the automatic carry of external equipment as claimed in claim 3 and notice, which is characterized in that described default Device node corresponding with the external equipment is created or deleted under path to include:
It receives the XML message and is unpacked;
It creates or deletes under path according to corresponding to dev files of the XML message in the sysfs file system and is outer The corresponding device node of portion's equipment, to complete the carry of the external equipment or unloading;
The establishment of the external equipment or deletion information are updated to peripheral hardware list.
5. the automatic carry of external equipment as claimed in claim 4 and notice control method, which is characterized in that it is described will be external Each application program that the plug information of equipment is sent in the list of application for having subscribed to message includes:
It receives the subscription message request that application program is sent out and establishes list of application;
The fresh information of updated peripheral hardware list or the peripheral hardware list is notified to each application program in the list of application;
Receive that the application program sends out unsubscribe message request and will be corresponding according to the message request that unsubscribes Application program is deleted from the list of application.
6. the automatic carry of external equipment as claimed in claim 4 and notice control method, which is characterized in that the core into Between journey and each application program of the list of application, communicated by way of socket or shared drive;
The detection currently further includes before with the presence or absence of the plug of external equipment:
The kernel process is written in booting self-starting script file;
Create the peripheral hardware list and the list of application.
7. a kind of control system of automatic carry of external equipment and notice, which is characterized in that including:
Detection module, for detecting the current plug that whether there is external equipment;
Parsing module, for when the hot plug for detecting the presence of external equipment, parsing plug environmental variance, and tied according to parsing Fruit creates or deletes corresponding file and path in sysfs file system;
Carry module, for device node corresponding with the external equipment to be created or deleted under preset path;
Notification module respectively applies journey for the plug information of external equipment to be sent in the list of application for having subscribed to message Sequence.
8. the control system of the automatic carry of external equipment as claimed in claim 7 and notice, which is characterized in that the parsing mould Block includes:
Analyzing sub-module, for when the hot plug for detecting the presence of external equipment, receiving and according to preset rules parsing and institute State the corresponding plug environmental variance of hot plug events of external equipment;
Information changes submodule, for being existed according to the hot plug information for parsing the plug obtained external equipment of environmental variance File corresponding with external equipment and path are created or deleted in sysfs file system;
Messaging submodule, for by the hot plug Information encapsulation of the external equipment for XML message and be sent to core into Journey.
9. the control system of the automatic carry of external equipment as claimed in claim 8 and notice, which is characterized in that the outside is set The control system of standby automatic carry and notice further includes:
Cold plug detection module, traversal sysfs file system is to search cold plug information during for being switched on;
Message sending modules, for being by the cold plug Information encapsulation of obtained external equipment after traversal sysfs file system XML message is simultaneously sent to the kernel process.
10. the control system of the automatic carry of external equipment as claimed in claim 9 and notice, which is characterized in that the carry Module includes:
Message sink submodule, for receiving the XML message and being unpacked;
Device node manages submodule, for right according to dev file institute of the XML message in the sysfs file system It is created under the path answered or deletes device node corresponding with external equipment, to complete the carry of the external equipment or unloading;
Carry submodule, for the establishment of the external equipment or deletion information to be updated to peripheral hardware list.
11. the control system of the automatic carry of external equipment as claimed in claim 10 and notice, which is characterized in that the notice Module includes:
Submodule is subscribed to, for receiving subscription message request that application program sends out and establishing list of application;
Submodule is notified, for the fresh information of updated peripheral hardware list or the peripheral hardware list to be notified the list of application In each application program;It is additionally operable to receive that the application program sends out unsubscribes message request and unsubscribed according to described Message request deletes corresponding application program from the list of application.
12. the control system of the automatic carry of external equipment and notice as described in claim 10 or 11, which is characterized in that described Between kernel process and each application program of the list of application, communicated by way of socket or shared drive;It is described The control system of the automatic carry of external equipment and notice further includes:
Process writing module, for the kernel process to be written in booting self-starting script file;
List creating module, for creating the peripheral hardware list and the 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 CN105808299A (en) 2016-07-27
CN105808299B true 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)

Families Citing this family (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
CN110111790B (en) * 2019-05-09 2022-01-28 海信视像科技股份有限公司 Method, device and equipment for processing external equipment access of intelligent equipment
CN112231761B (en) * 2020-12-14 2021-07-30 统信软件技术有限公司 Device mounting method, computing device and readable storage medium
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
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
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

Also Published As

Publication number Publication date
WO2017152526A1 (en) 2017-09-14
CN105808299A (en) 2016-07-27

Similar Documents

Publication Publication Date Title
CN105808299B (en) The control method and system of the automatic carry of external equipment and notice
CN108933948B (en) Video playing progress synchronization method and device
US9692846B2 (en) System, device and method for providing push service using feedback message
CN102843436B (en) A kind of device management method, equipment, server and system
CN109618174B (en) Live broadcast data transmission method, device, system and storage medium
CN108809800B (en) Multimedia data processing method, equipment and system thereof
CN105207886A (en) Instant messaging (IM) message sending and display methods, IM message sending and display devices, and IM message system
CN104756080A (en) Augmenting capabilities of a host device
CN105530277A (en) Method and device for cooperative work of devices
CN103618779A (en) Method and system for resource sharing
WO2015043368A1 (en) Method and device for switching media playing device
CN111163172B (en) Message processing system, method, electronic device and storage medium
CN109684114A (en) Message distributing method, device, terminal and medium based on iOS system
CN103888907A (en) Cross-terminal file transmission method, terminal equipment, and system
CN110290009B (en) Data scheduling method and device and computer readable storage medium
US20160041879A1 (en) Data backup to and restore from trusted devices
CN110881224B (en) Network long connection method, device, equipment and storage medium
CN110908881A (en) Method and device for sending buried point data, electronic equipment and computer readable storage medium
CN111767176A (en) Method and device for remotely controlling terminal equipment
KR20130103191A (en) Method and system for stroring and managing device control information to user terminal and method and user terminal for executing application using the same
CN107368376B (en) Message sending method and device, expansion method and terminal
US20140040380A1 (en) System and method for providing push service for reducing network loads
CN108551429A (en) Flow control methods, electronic device and the computer readable storage medium of application program
CN114566173A (en) Audio mixing method, device, equipment and storage medium
CN113204436A (en) Message processing method, device, equipment and computer readable storage medium

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