Summary of the invention
To overcome above-mentioned technical problem or at least being partially solved above-mentioned technical problem, spy proposes following technical scheme:
The embodiment of the present invention proposes a kind of side that the slave equipment for running multisystem passes through USB connection access main equipment
Method, comprising:
It is connect from equipment by USB connection by the USB device function of being provided in the system kernel from equipment by described
Enter main equipment;
Connection event is sent to and described is matched from the device with the USB device function of being provided in the system kernel
Any system;
By the USB device function in any system to the connection event and the interaction between the main equipment
Data are handled.
Preferably, any system includes the first system for being currently at front stage operation, this method further include:
By be currently at front stage operation the first system USB device function to the USB in the system kernel
Functions of the equipments are configured.
Preferably, when Foreground and Background switching occurs for multisystem, the system for being currently at front stage operation is cut from the first system
It is changed to second system, if described do not access the main equipment, this method by USB connection from equipment further include:
By the USB device function of the second system in front stage operation after switching in the system kernel
USB device function is configured.
Preferably, when Foreground and Background switching occurs for multisystem, the system for being currently at front stage operation is cut from the first system
It is changed to second system, if described accessed the main equipment, this method by USB connection from equipment further include:
The USB device function of providing to the main equipment and provide in the system kernel is provided;
By the USB device function of the second system in front stage operation after switching in the system kernel
USB device function is configured.
Preferably, this method further include:
Again the USB device function of providing in the system kernel is provided to the main equipment;
Between USB device function pair and the main equipment by the second system in front stage operation after switching
Interaction data is handled.
The slave equipment that another embodiment of the present invention proposes a kind of operation multisystem passes through USB connection and accesses main equipment
Device, comprising:
AM access module is passed through described from equipment by the USB device function of providing in the system kernel from equipment
USB connection accesses main equipment;
Connection event is sent to and described sets from the device with the USB provided in the system kernel by event sending module
Any system that standby function matches;
First processing module, by the USB device function in any system to the connection event and with the master
Interaction data between equipment is handled.
Preferably, any system includes the first system for being currently at front stage operation, the device further include:
First setup module, by be currently at front stage operation the first system USB device function to the system
USB device function in system kernel is configured.
Preferably, the device further include:
First setup module when Foreground and Background switching occurs for multisystem, is currently at the system of front stage operation from described first
System is switched to second system, if described do not access the main equipment by USB connection from equipment, by being in foreground after switching
The USB device function of the second system of operation is configured the USB device function in the system kernel.
Preferably, the device further include:
Interrupt module when Foreground and Background switching occurs for multisystem, is currently at the system of front stage operation from the first system
It is switched to second system, if described accessed the main equipment by USB connection from equipment, interrupts to the main equipment and institute is provided
The USB device function of providing in system kernel is provided;
Second setup module, by the USB device function of the second system in front stage operation after switching to described
USB device function in system kernel is configured.
Preferably, the device further include:
Module is provided, the USB device function of providing in the system kernel is provided to the main equipment again;
Second processing module, USB device function pair and institute by the second system in front stage operation after switching
The interaction data stated between main equipment is handled.
In the embodiment of the present invention, the slave equipment for proposing a kind of operation multisystem passes through USB connection and accesses main equipment
Scheme will access main equipment from equipment by USB connection by the USB device function of providing from the system kernel of equipment, from
And it fills up the prior art and has not been directed to the blank that the slave equipment of multisystem accesses the solution of main equipment by USB connection.
Function is arranged to kernel USB by the USB device function of each system from the device to be accordingly arranged, it can be achieved that root from the device
Different USB device functions is provided according to not homologous ray, to more meet the actual use demand of user;Further, main equipment
It can be according to the USB device function of multi-system equipment Dynamic Recognition correspondence switching in the case where switching at runtime system, so that USB function
Can switching smooth switching in user's unaware ground with system switching, to improve the usage experience of user.
The additional aspect of the present invention and advantage will be set forth in part in the description, these will become from the following description
Obviously, or practice through the invention is recognized.
Specific embodiment
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end
Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached
The embodiment of figure description is exemplary, and for explaining only the invention, and is not construed as limiting the claims.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singular " one " used herein, " one
It is a ", " described " and "the" may also comprise plural form.It is to be further understood that being arranged used in specification of the invention
Diction " comprising " refer to that there are the feature, integer, step, operation, element and/or component, but it is not excluded that in the presence of or addition
Other one or more features, integer, step, operation, element, component and/or their group.It should be understood that when we claim member
Part is " connected " or when " coupled " to another element, it can be directly connected or coupled to other elements, or there may also be
Intermediary element.In addition, " connection " used herein or " coupling " may include being wirelessly connected or wirelessly coupling.It is used herein to arrange
Diction "and/or" includes one or more associated wholes for listing item or any cell and all combinations.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art
Language and scientific term), there is meaning identical with the general understanding of those of ordinary skill in fields of the present invention.Should also
Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art
The consistent meaning of meaning, and unless idealization or meaning too formal otherwise will not be used by specific definitions as here
To explain.
Multisystem in the embodiment of the present invention can be realized based on a variety of virtual technologies, hereafter under linux system
The detailed description of embodiment is carried out for container technique.Wherein, the multiple operating system realized using linux container technology, each
It is packed into independent system in container, it is mutually indepedent between multiple systems, and multiple systems operate in same physical terminal device
On.
In the embodiment of the present invention, by two equipment of USB connection, one is main equipment, and one is from equipment.Such as U
Disk is connected in PC machine, and USB flash disk is from equipment, and PC machine is main equipment.Terminal device based on container multisystem is connect by USB connection
When entering PC machine, the terminal device based on container multisystem is from equipment, and PC machine is main equipment.
Fig. 1 is that the slave equipment of the operation multisystem of one embodiment in the present invention accesses the side of main equipment by USB connection
The flow chart of method.
Step S110: it will be connect from equipment by USB connection by the USB device function of being provided from the system kernel of equipment
Enter main equipment;Step S120: connection event is sent to and is matched from the device with the USB device function of being provided in system kernel
Any system;Step S130: pass through interaction of the USB device function to connection event and between main equipment in any system
Data are handled.
In the embodiment of the present invention, the slave equipment for proposing a kind of operation multisystem passes through USB connection and accesses main equipment
Scheme will access main equipment from equipment by USB connection by the USB device function of providing from the system kernel of equipment, from
And it fills up the prior art and has not been directed to the blank that the slave equipment of multisystem accesses the solution of main equipment by USB connection.
Function is arranged to kernel USB by the USB device function of each system from the device to be accordingly arranged, it can be achieved that root from the device
Different USB device functions is provided according to not homologous ray, to more meet the actual use demand of user;Further, main equipment
It can be according to the USB device function of multi-system equipment Dynamic Recognition correspondence switching in the case where switching at runtime system, so that USB function
Can switching smooth switching in user's unaware ground with system switching, to improve the usage experience of user.
Step S110: it will be connect from equipment by USB connection by the USB device function of being provided from the system kernel of equipment
Enter main equipment.
Wherein, the USB device in system kernel is carried out by the USB device function of scheduled any system from the device
Setting.
Wherein, USB device function includes at least:
1) MTP (Media Transfer Protocol, media transmission protocol), MTP utilize intelligent terminal and PC machine
Between connection can with the media application in PC machine, such as Windows media player synchrodata, such as multimedia
Video, audio, picture etc..
2) PTP (picture transfer protocol, picture transfer protocol);
3) Mass storage (mass storage) executes intelligent terminal and PC by Mass storage agreement
Data transmission, storage and read-write between machine etc.;
4) ADB is debugged, and is the program at client-server end, wherein client PC machine, server-side set for intelligent terminal
It is standby.
Preferably, the USB in system kernel is set by being currently at the USB device function of the first system of front stage operation
Standby function is configured.
Wherein, the multisystem based on container from the device, before each system is managed by multisystem management service
Information transmitting etc. between the running correlation function setting of backstage information converting, each system and each system, which specifically may be used
It is realized by the modes such as such as multisystem managing process.
For example, including at least the first system and second system from the device in multisystem, the first system is system OS1,
Second system is system OS2, and the system OS from the device of multisystem1It is currently at foreground state, system OS2After being currently at
Mesa-shaped state, when being attached from equipment by USB interface and main equipment, predetermined main equipment preferentially identify in multi-system equipment when
The preceding USB device function in foreground system, reservation system OS1USB device function be MTP equipment, multisystem management service
Notice system OS1USB device service, system OS will be set as from the USB device function in device core1USB device function
Can, i.e., MTP equipment then will pass through USB connection from equipment from the MTP function of the USB device in device core by multisystem
Access main equipment.
In another example predetermined main equipment preferentially identifies multisystem when being attached from equipment by USB interface and main equipment
It is currently at the USB device function of foreground system in equipment, is to be in the system for being currently at foreground from the device of multisystem
Unite OS1, reservation system OS1USB device function be MTP equipment, by multisystem management service be arranged from device core
USB device function is system OS1USB device function set by MTP function, then, through multisystem from device core
USB device the corresponding service routine of MTP function will from equipment pass through USB connection access main equipment.
Step S120: connection event is sent to and is matched from the device with the USB device function of being provided in system kernel
Any system.
For example, connect example, when multisystem is accessed main equipment by USB connection from equipment, by connection event be sent to from
Equipment is currently at the system OS on foreground1。
Step S130: pass through interaction number of the USB device function in any system to connection event and between main equipment
According to being handled.
For example, example is connected, system OS1After receiving connection event, pass through system OS1In service journey corresponding with MTP function
Sequence handles connection event, such as establishes connection, and handle the interaction data between main equipment, such as data sharing.
In being preferably implemented one, when from equipment Foreground and Background system, which occurs, for multisystem switches, it is currently at front stage operation
System is switched to second system from the first system, if not accessing main equipment, this method by USB connection from equipment further include: logical
The USB device function of crossing the second system for being in front stage operation after switching is configured the USB device function in system kernel.
For example, the system for being currently at foreground from the device is OS1, system OS2In backstage;Reservation system OS2USB
Functions of the equipments are PTP equipment, when multisystem management service is detected from equipment generating system OS1With system OS2Front and back switching
When, if not accessing main equipment by USB connection from equipment, set by the USB that multisystem management service is arranged from device core
Standby function is system OS2USB device function set by PTP function, then, by multisystem from the USB in device core
The corresponding service routine of PTP function of equipment will access main equipment from equipment by USB connection.
In another example the system for being currently at foreground from the device is OS1, system OS2In backstage;Predefined system OS2's
USB device function is PTP equipment, when multisystem management service is detected from equipment generating system OS1With system OS2Front and back
When switching, if not accessing main equipment by USB connection from equipment, multisystem management service notifies system OS2USB device clothes
Business, will be set as system OS from the USB device function in device core2USB device function, that is, be set as PTP equipment, with
Afterwards, it will be connect from the corresponding service routine of USB device PTP function in device core from equipment by USB connection by multisystem
Enter main equipment.
In another preferred implementation, as shown in Fig. 2, when from equipment the switching of Foreground and Background system occurs for multisystem, it is current to locate
It is switched to second system from the first system in the system of front stage operation, if having accessed main equipment, the party by USB connection from equipment
Method further includes step S210 and step S220.Step S210: it interrupts and provides the USB device function provided in system kernel to main equipment
Energy;Step S220: the USB in system kernel is set by the USB device function of the second system in front stage operation after switching
Standby function is configured.
For example, if main equipment has been accessed by USB connection from equipment, when multisystem is currently at foreground from equipment
System OS1With the system OS for being currently at backstage2Front and back switching when, interrupt from the USB device function in device core to master
Equipment provides the MTP function of the USB device in the kernel, i.e., USB device and main equipment in kernel are arranged by software mode
It disconnects, then, the system OS of front stage operation is in after the notice switching of multisystem management service2USB device service, will be from
USB device function in device core is set as system OS2USB device function, that is, be set as PTP equipment.
In another preferred implementation, as shown in figure 3, this method further includes step S310 and step S320.Step S310: weight
The USB device function of providing in system kernel is newly provided to main equipment;Step S320: by being in front stage operation after switching
Interaction data between the USB device function pair and main equipment of second system is handled.
For example, connecting example, it will be provided to main equipment from the PTP functions of the equipments of the USB device in device core, then, led to
It crosses after switching and is in the system OS of front stage operation2USB device the corresponding service routine pair of PTP functions of the equipments and main equipment it
Between interaction data handled, such as realize system OS2In picture and main equipment between the operation such as shared, copied.
In a concrete application scene, predetermined main equipment, which preferentially identifies, is currently at foreground system in multi-system equipment
USB device function is system OS in the system for being currently at foreground from the device of multisystem1, predefined system OS1USB set
Standby function is MTP equipment, will be set as system OS from the USB device function in device core by multisystem management service1's
USB device function is set as MTP equipment;Then, pass through the corresponding service of MTP function from the USB device in device core
Program will access main equipment from equipment by USB connection, as the system OS for being currently at foreground from equipment1Be currently at
The system OS on backstage2Front and back switching when, interrupt from the USB device function in device core to main equipment and provide in the kernel
USB device MTP function, then, multisystem management service notice switching after be in front stage operation system OS2USB set
Standby service, will be set as system OS from the USB device function in device core2USB device function, that is, be set as PTP equipment,
It will be provided to main equipment from the PTP functions of the equipments of the USB device in device core, then, by being in front stage operation after switching
System OS2USB device the corresponding service routine pair of PTP functions of the equipments and main equipment between interaction data at
Reason such as realizes system OS2In picture and main equipment between the operation such as shared, copied.
Fig. 4 is that the slave equipment of the operation multisystem of another embodiment in the present invention accesses the dress of main equipment by USB connection
The structural schematic diagram set.
AM access module 410 will pass through USB connection from equipment by the USB device function of providing from the system kernel of equipment
Access main equipment;Event sending module 420 by connection event be sent to from the device with the USB device function that is provided in system kernel
Any system that can be matched;First processing module 430 by the USB device function in any system to connection event and with master
Interaction data between equipment is handled.
In the embodiment of the present invention, the slave equipment for proposing a kind of operation multisystem passes through USB connection and accesses main equipment
Scheme will access main equipment from equipment by USB connection by the USB device function of providing from the system kernel of equipment, from
And it fills up the prior art and has not been directed to the blank that the slave equipment of multisystem accesses the solution of main equipment by USB connection.
Function is arranged to kernel USB by the USB device function of each system from the device to be accordingly arranged, it can be achieved that root from the device
Different USB device functions is provided according to not homologous ray, to more meet the actual use demand of user;Further, main equipment
It can be according to the USB device function of multi-system equipment Dynamic Recognition correspondence switching in the case where switching at runtime system, so that USB function
Can switching smooth switching in user's unaware ground with system switching, to improve the usage experience of user.
AM access module 410 will pass through USB connection from equipment by the USB device function of providing from the system kernel of equipment
Access main equipment.
Wherein, the USB device in system kernel is carried out by the USB device function of scheduled any system from the device
Setting.
Preferably, any system includes the first system for being currently at front stage operation, which further includes the first setting mould
Block, the first setup module set the USB in system kernel by being currently at the USB device function of the first system of front stage operation
Standby function is configured.
Wherein, the multisystem based on container from the device, before each system is managed by multisystem management service
Information transmitting etc. between the running correlation function setting of backstage information converting, each system and each system, which specifically may be used
It is realized by the modes such as such as multisystem managing process.
For example, including at least the first system and second system from the device in multisystem, the first system is system OS1,
Second system is system OS2, and the system OS from the device of multisystem1It is currently at foreground state, system OS2After being currently at
Mesa-shaped state, when being attached from equipment by USB interface and main equipment, predetermined main equipment preferentially identify in multi-system equipment when
The preceding USB device function in foreground system, reservation system OS1USB device function be MTP equipment, multisystem management service
Notice system OS1USB device service, system OS will be set as from the USB device function in device core1USB device function
Can, i.e., MTP equipment then will pass through USB connection from equipment from the MTP function of the USB device in device core by multisystem
Access main equipment.
In another example predetermined main equipment preferentially identifies multisystem when being attached from equipment by USB interface and main equipment
It is currently at the USB device function of foreground system in equipment, is to be in the system for being currently at foreground from the device of multisystem
Unite OS1, reservation system OS1USB device function be MTP equipment, by multisystem management service be arranged from device core
USB device function is system OS1USB device function set by MTP function, then, through multisystem from device core
USB device the corresponding service routine of MTP function will from equipment pass through USB connection access main equipment.
Event sending module 420 by connection event be sent to from the device with the USB device function that is provided in system kernel
Any system to match.
For example, connect example, when multisystem is accessed main equipment by USB connection from equipment, by connection event be sent to from
Equipment is currently at the system OS on foreground1。
First processing module 430 is by the USB device function in any system to connection event and between main equipment
Interaction data is handled.
For example, example is connected, system OS1After receiving connection event, pass through system OS1In service journey corresponding with MTP function
Sequence handles connection event, such as establishes connection, and handle the interaction data between main equipment, such as data sharing.
In being preferably implemented one, when from equipment Foreground and Background system, which occurs, for multisystem switches, it is currently at front stage operation
System is switched to second system from the first system, if not accessing main equipment by USB connection from equipment, which further includes second
Setup module;Second setup module is by the USB device function of the second system in front stage operation after switching to system kernel
In USB device function be configured.
For example, the system for being currently at foreground from the device is OS1, system OS2In backstage;Reservation system OS2USB
Functions of the equipments are PTP equipment, when multisystem management service is detected from equipment generating system OS1With system OS2Front and back switching
When, if not accessing main equipment by USB connection from equipment, set by the USB that multisystem management service is arranged from device core
Standby function is system OS2USB device function set by PTP function, then, by multisystem from the USB in device core
The corresponding service routine of PTP function of equipment will access main equipment from equipment by USB connection.
In another example the system for being currently at foreground from the device is OS1, system OS2In backstage;Predefined system OS2's
USB device function is PTP equipment, when multisystem management service is detected from equipment generating system OS1With system OS2Front and back
When switching, if not accessing main equipment by USB connection from equipment, multisystem management service notifies system OS2USB device clothes
Business, will be set as system OS from the USB device function in device core2USB device function, that is, be set as PTP equipment, with
Afterwards, it will be connect from the corresponding service routine of USB device PTP function in device core from equipment by USB connection by multisystem
Enter main equipment.
In another preferred implementation, as shown in figure 5, when from equipment the switching of Foreground and Background system occurs for multisystem, it is current to locate
It is switched to second system from the first system in the system of front stage operation, if having accessed main equipment, the dress by USB connection from equipment
Set further includes interrupt module 510 and the second setup module 520.Interrupt module 510 is interrupted to provide in system kernel to main equipment and be mentioned
The USB device function of confession;The USB device function that second setup module member 520 passes through the second system in front stage operation after switching
USB device function in system kernel can be configured.
For example, if main equipment has been accessed by USB connection from equipment, when multisystem is currently at foreground from equipment
System OS1With the system OS for being currently at backstage2Front and back switching when, interrupt from the USB device function in device core to master
Equipment provides the MTP function of the USB device in the kernel, i.e., USB device and main equipment in kernel are arranged by software mode
It disconnects, then, the system OS of front stage operation is in after the notice switching of multisystem management service2USB device service, will be from
USB device function in device core is set as system OS2USB device function, that is, be set as PTP equipment.
In another preferred implementation, as shown in fig. 6, the device further includes providing module 610 and Second processing module 620.
Module 610 is provided, the USB device function of providing in system kernel is provided to main equipment again;Second processing module 620 passes through
Interaction data between the USB device function pair and main equipment of second system after switching in front stage operation is handled.
For example, connecting example, it will be provided to main equipment from the PTP functions of the equipments of the USB device in device core, then, led to
It crosses after switching and is in the system OS of front stage operation2USB device the corresponding service routine pair of PTP functions of the equipments and main equipment it
Between interaction data handled, such as realize system OS2In picture and main equipment between the operation such as shared, copied.
In a concrete application scene, predetermined main equipment, which preferentially identifies, is currently at foreground system in multi-system equipment
USB device function is system OS in the system for being currently at foreground from the device of multisystem1, predefined system OS1USB set
Standby function is MTP equipment, will be set as system OS from the USB device function in device core by multisystem management service1's
USB device function is set as MTP equipment;Then, pass through the corresponding service of MTP function from the USB device in device core
Program will access main equipment from equipment by USB connection, as the system OS for being currently at foreground from equipment1Be currently at
The system OS on backstage2Front and back switching when, interrupt from the USB device function in device core to main equipment and provide in the kernel
USB device MTP function, then, multisystem management service notice switching after be in front stage operation system OS2USB set
Standby service, will be set as system OS from the USB device function in device core2USB device function, that is, be set as PTP equipment,
It will be provided to main equipment from the PTP functions of the equipments of the USB device in device core, then, by being in front stage operation after switching
System OS2USB device the corresponding service routine pair of PTP functions of the equipments and main equipment between interaction data at
Reason such as realizes system OS2In picture and main equipment between the operation such as shared, copied.
Those skilled in the art of the present technique are appreciated that the present invention includes being related to for executing in operation described herein
One or more equipment.These equipment can specially design and manufacture for required purpose, or also may include general
Known device in computer.These equipment have the computer program being stored in it, these computer programs are selectively
Activation or reconstruct.Such computer program can be stored in equipment (for example, computer) readable medium or be stored in
It e-command and is coupled in any kind of medium of bus respectively suitable for storage, the computer-readable medium includes but not
Be limited to any kind of disk (including floppy disk, hard disk, CD, CD-ROM and magneto-optic disk), ROM (Read-Only Memory, only
Read memory), RAM (Random Access Memory, immediately memory), EPROM (Erasable Programmable
Read-Only Memory, Erarable Programmable Read only Memory), EEPROM (Electrically Erasable
Programmable Read-Only Memory, Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or light card
Piece.It is, readable medium includes by equipment (for example, computer) with any Jie for the form storage or transmission information that can be read
Matter.
Those skilled in the art of the present technique be appreciated that can be realized with computer program instructions these structure charts and/or
The combination of each frame and these structure charts and/or the frame in block diagram and/or flow graph in block diagram and/or flow graph.This technology neck
Field technique personnel be appreciated that these computer program instructions can be supplied to general purpose computer, special purpose computer or other
The processor of programmable data processing method is realized, to pass through the processing of computer or other programmable data processing methods
The scheme specified in frame or multiple frames of the device to execute structure chart and/or block diagram and/or flow graph disclosed by the invention.
Those skilled in the art of the present technique have been appreciated that in the present invention the various operations crossed by discussion, method, in process
Steps, measures, and schemes can be replaced, changed, combined or be deleted.Further, each with having been crossed by discussion in the present invention
Kind of operation, method, other steps, measures, and schemes in process may also be alternated, changed, rearranged, decomposed, combined or deleted.
Further, in the prior art to have and the step in various operations, method disclosed in the present invention, process, measure, scheme
It may also be alternated, changed, rearranged, decomposed, combined or deleted.
The above is only some embodiments of the invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.