CN114416292A - Virtualization method, device, apparatus, medium and product for serial port of positioning device - Google Patents

Virtualization method, device, apparatus, medium and product for serial port of positioning device Download PDF

Info

Publication number
CN114416292A
CN114416292A CN202111672866.3A CN202111672866A CN114416292A CN 114416292 A CN114416292 A CN 114416292A CN 202111672866 A CN202111672866 A CN 202111672866A CN 114416292 A CN114416292 A CN 114416292A
Authority
CN
China
Prior art keywords
virtual
serial port
slave node
service process
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111672866.3A
Other languages
Chinese (zh)
Other versions
CN114416292B (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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202111672866.3A priority Critical patent/CN114416292B/en
Publication of CN114416292A publication Critical patent/CN114416292A/en
Application granted granted Critical
Publication of CN114416292B publication Critical patent/CN114416292B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/10Program control for peripheral devices
    • G06F13/105Program control for peripheral devices where the programme performs an input/output emulation function
    • G06F13/107Terminal emulation
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Position Fixing By Use Of Radio Waves (AREA)

Abstract

The invention provides a virtualization method, equipment, a device, a medium and a product for a serial port of positioning equipment, wherein the method comprises the following steps: establishing an agent service process in the Linux system, wherein the agent service process is used for forwarding the position information; establishing a corresponding virtual master node and a corresponding virtual slave node for a target serial port in a Linux system based on an agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node; sharing the virtual slave node to an Android container in a Linux system; the Android container communicates with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information. The Linux system and the android system can simultaneously access the positioning equipment by creating the virtual master node, the virtual slave node and the proxy service process.

Description

Virtualization method, device, apparatus, medium and product for serial port of positioning device
Technical Field
The invention relates to the technical field of terminals, in particular to a virtualization method, equipment, a device, a medium and a product for a serial port of positioning equipment.
Background
At present, the Android subsystem can be compatible in the Linux system in a container mode. For some reusable devices, the device nodes under dev can be directly exposed to Android in a container sharing mode. However, for the positioning device, serial port communication is usually adopted, for example, Serial Peripheral Interface (SPI) or inter-integrated circuit (IIC) is adopted, such that such a bus node cannot be used by one system at the same time under the condition that the bus node is used by another system, and sharing of the positioning position information in the container cannot be realized by a method of sharing the serial port of the positioning device, so that in a dual system in which a Linux system and an Android subsystem are simultaneously operated, the two systems cannot simultaneously use the positioning position information.
Disclosure of Invention
The invention provides a virtualization method, equipment, a device, a medium and a product for a serial port of positioning equipment, which are used for solving the defect that in the prior art, the positioning mostly adopts serial port communication and cannot be used by one system under the condition that the system is used by the other system at the same time, and the Linux system and the Android subsystem can simultaneously use positioning position information in a dual system simultaneously operating the Linux system and the Android subsystem.
The invention provides a virtualization method for a serial port of a positioning device, which comprises the following steps:
the method comprises the steps of establishing an agent service process in a Linux system, wherein the agent service process is used for forwarding position information;
establishing a corresponding virtual master node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node;
sharing the virtual slave node to an Android container in the Linux system;
and the Android container communicates with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
According to the virtualization method for the serial port of the positioning device, the method for establishing the corresponding virtual master node and virtual slave node for the target serial port in the Linux system based on the agent service process comprises the following steps:
and using remote virtual terminal file equipment in a Linux system to create the virtual master node and the virtual slave node for a target serial port.
According to the virtualization method for the serial port of the positioning device, the step of sharing the virtual slave node to the Android container in the Linux system comprises the following steps:
mounting the virtual slave node into the Android container through a mount function;
and modifying the target serial port registered in the hardware abstraction layer of the Android container into the virtual slave node.
According to the virtualization method for the serial port of the positioning device, provided by the invention, the step of modifying the target serial port registered in the hardware abstraction layer of the Android container into the virtual slave node comprises the following steps:
and modifying a GPS HAL layer file gpsstateinit function in the Android container to establish a communication connection between the Android container and the virtual slave node.
According to the virtualization method for the serial port of the positioning device, the Android container communicates with the positioning device through the virtual slave node, the virtual master node and the proxy service process to acquire the position information, and the method comprises the following steps:
the Android container writes request information into the virtual slave node;
the virtual slave node transmits the request information to the virtual master node;
the virtual main node sends the request information to the agent service process;
the agent service process sends the request information to a geographic position service interface in the Linux system;
the geographic position service interface acquires geographic position information data from positioning equipment and sends the geographic position information data to the agent service process;
the proxy service process converts the geographic position information data into the target data and forwards the target data to the virtual main node;
the virtual master node transmits the target data to the virtual slave node;
and the virtual slave node sends the target data to the Android container.
According to the virtualization method for the serial port of the positioning device provided by the invention, the proxy service process forwards the target data to the virtual main node, and the virtualization method comprises the following steps:
and under the condition that a plurality of positioning devices are provided, the proxy service process fuses the target data from the plurality of positioning devices and forwards the fused target data to the virtual main node.
The invention also provides a virtualization device for the serial port of the positioning equipment, which comprises:
the system comprises a first establishing module, a second establishing module and a third establishing module, wherein the first establishing module is used for establishing an agent service process in the Linux system, and the agent service process is used for forwarding position information;
the second establishing module is used for establishing a corresponding virtual main node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node;
the sharing module is used for sharing the virtual slave node to an Android container in the Linux system;
and the communication module is used for the Android container to communicate with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the program to realize the steps of the virtualization method of the serial port of the positioning device.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method for virtualizing a serial port of a positioning device as described in any of the above.
The invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method for virtualizing a serial port of a positioning device as described in any one of the above.
According to the virtualization method, the virtualization device, the virtualization apparatus, the virtualization medium and the virtualization product for the serial port of the positioning device, the virtual master node and the virtual slave node corresponding to the target serial port for communication of the positioning device are established, a pipeline from the Linux system to the Android subsystem is established for real positioning data, and the Linux system and the Android subsystem can access the positioning device simultaneously by using the proxy service process, the virtual master node and the virtual slave node, so that the Linux system and the Android subsystem can access the positioning device simultaneously to acquire positioning position information.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a virtualization method for a serial port of a positioning device according to the present invention;
FIG. 2 is a schematic diagram of the internal framework of the Linux system provided by the present invention;
fig. 3 is a schematic structural diagram of a virtualization apparatus for a serial port of a positioning device according to the present invention;
fig. 4 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For convenience of explanation, terms related to the present invention will be explained first.
(1) Serial port communication
The serial interface is a device which can convert parallel data characters received from a central processing unit into a continuous serial data stream and transmit the serial data stream, and can convert the received serial data stream into parallel data characters and supply the parallel data characters to the central processing unit. The circuit that typically performs this function is referred to as a serial interface circuit.
Serial Communications (Serial Communications) is a communication mode in which a Serial interface sends and receives bytes in bits.
(2) Remote virtual terminal file equipment (devpts)
The remote virtual terminal file device can be understood as a virtual file system, which is a common implementation manner of a pseudo terminal. In the invention, the real positioning data is forwarded through the virtual file system, and a pipeline from the Linux system to the Android subsystem is established for the real positioning data based on the virtual serial port established by the virtual file system.
(3) Virtual node
It is understood that some nodes are created for the virtual terminals based on the virtual file system.
(4)mount
mount is a command under Linux that can attach a partition to a folder in Linux, linking the partition to the directory, and therefore accessing this folder is equivalent to accessing the partition.
Usage of mount instruction: mount the file to a virtual disk or a virtual folder, and use the entire file by accessing the virtual disk or folder.
(5) Global Navigation Satellite System (GNSS)
The GNSS is a global navigation satellite system, and may be, for example, a Global Positioning System (GPS), a BeiDou satellite navigation system (BDS), a Glonass global navigation satellite system (Glonass), a Galileo satellite navigation system (galois), or a cellular network.
In the Android system, positioning is realized in a layered manner. In particular to a positioning management service (location manager service) in a framework service, a GNSS JNI encapsulating a GNSS HAL layer interface (IGnss) and a GNSS HAL layer for realizing the IGnss interface and the IGnss service. The GNSS JNI encapsulates interfaces of the GNSS HAL layer, and the positioning management service can call the GNSS HAL through the GNSS JNI to realize related functions.
The following describes a virtualization method, device, apparatus, medium, and product for a serial port of a positioning device according to the present invention with reference to fig. 1 to 4.
Fig. 1 is a schematic flow chart of a virtualization method for a serial port of a positioning device according to the present invention. It will be appreciated that the method of figure 1 may be performed by a virtualization device that locates the serial port of the device. As shown in fig. 1, the virtual method of the positioning device provided by the present invention includes the following steps:
step 110, creating a proxy service process in the Linux system, wherein the proxy service process is used for forwarding the position information.
It can be understood that in a dual system in which a Linux system and an Android subsystem are simultaneously operated, since the Linux system and the Android subsystem cannot be directly interacted with each other, an agent service process is required to complete the interaction between the Linux system and the Android subsystem.
In particular, a proxy service may be used to forward location information. The position information may be positioning position information generated by a positioning device.
And 120, establishing a corresponding virtual master node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process.
The target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node. A virtual master node and a virtual slave node may be understood as an interface for communicating with a positioning device.
It is understood that the proxy service may be used to create a corresponding virtual master node and virtual slave node for the target serial port, in addition to forwarding the location information.
The positioning device may be a positioning device corresponding to any one of GPS, BDS, Glonass, Galileo, or cellular network positioning systems, for example. The target serial port is a serial port which is in communication connection with the positioning device in the Linux system.
It can be understood that, in a dual system in which the Linux system and the Android subsystem are simultaneously operated, both the Linux system and the Android subsystem need to access the positioning device, but because the positioning device usually adopts serial port communication, the positioning device cannot be simultaneously used by one system while being used by the other system, so that the positioning device cannot be simultaneously accessed by the Linux system and the Android subsystem. Therefore, the method establishes a pipeline from the Linux system to the Android subsystem for the real positioning data by adopting a mode of establishing the corresponding virtual master node and virtual slave node for the target serial port.
And step 130, sharing the virtual slave node to an Android container in the Linux system.
Wherein, the Android container can be understood as running the Android subsystem in the Linux container. The Android subsystem at least comprises positioning related modules, such as: application (APP), location manager service (location manager service), GNSS JNI, and GNSS HAL layers.
The application program can send a positioning request to a positioning management service to acquire the position information, and the positioning management service can call the GNSS HAL through the GNSS JNI to access the positioning device to acquire the positioning position information.
It will be appreciated that since the GNSS HAL is located in the Android subsystem running in the Android container, it is necessary to establish an interface for communication with the positioning device, i.e. corresponding to the virtual slave node, in order to access the positioning device.
And 140, the Android container communicates with the positioning device through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
It can be understood that the request can be sent through the proxy service process, or the corresponding feedback can be received and forwarded through the proxy service process, and since the virtual master node and the virtual slave node can share data, and the virtual slave node is shared to the Android container, the Android subsystem in the Android container can share data to the virtual master node through the virtual slave node, and the virtual master node can communicate with the positioning device through the proxy service process to acquire the position information.
According to the virtualization method for the serial port of the positioning equipment, the corresponding virtual master node and the corresponding virtual slave node are established for the target serial port used for communication of the positioning equipment, a pipeline from a Linux system to an Android subsystem is established for real positioning data, and the Linux system and the Android subsystem access the positioning equipment together through the proxy service process, the virtual master node and the virtual slave node, so that in a dual system with the Linux system and the Android subsystem running simultaneously, the Linux system and the Android subsystem can access the positioning equipment simultaneously to obtain positioning position information.
Based on any one of the above embodiments, in this embodiment, the creating, in the Linux system and based on the proxy service process, a corresponding virtual master node and a virtual slave node for a target serial port includes:
and using remote virtual terminal file equipment in a Linux system to create the virtual master node and the virtual slave node for a target serial port.
The remote virtual terminal file device (devpts) is a file system in the Linux system. It can be understood that the virtual master node and the virtual slave node form a pipeline, the virtual master node is opened in the Linux system, the virtual slave node is used as a serial device in the Android subsystem, and the Linux system and the Android subsystem can exchange data with each other through the pipeline.
Specifically, a group of virtual terminals corresponding to the target serial port may be created through a function, where the function may be int rv ═ openpty (& mpty, & spty, sptyname, NULL), the function automatically traverses the virtual terminals in the system and finds a group of unused virtual terminals, and returning sptyname when creation is successful is the name of the virtual slave node.
The virtual terminal is divided into a virtual main node under a/dev/ptmx directory and a virtual slave node under the/dev/pts/directory, data are directly forwarded to the corresponding virtual slave node under the/dev/pts/, reverse data are written in the virtual slave node, and the virtual main node can also receive the reverse data.
According to the method for virtualizing the serial port of the positioning device, the remote virtual terminal file device is used for establishing the corresponding virtual master node and virtual slave node for the target serial port used for communication of the positioning device, and a pipeline from the Linux system to the Android subsystem is established for real positioning data, so that the Linux system and the Android subsystem can complete access to the positioning device through the virtual master node and the virtual slave node, and therefore in a dual system with the Linux system and the Android subsystem running at the same time, the Linux system and the Android subsystem can simultaneously access the positioning device to obtain positioning position information.
Based on any one of the foregoing embodiments, in this embodiment, the sharing the virtual slave node to the Android container in the Linux system includes:
mounting the virtual slave node into the Android container through a mount function;
and modifying the target serial port registered in the hardware abstraction layer of the Android container into the virtual slave node.
It can be understood that the virtual master node and the virtual slave node are created in the Linux system based on the remote virtual terminal file device, and therefore cannot be directly used in the Android container, and therefore the virtual slave node can be mounted inside the Android container through a mount function.
Specifically, the instruction for mounting the virtual slave node into the Android container through the mount function may be: mount the/dev/pts directory under the Linux file system under the Aandroid in a bind manner.
And modifying a serial port registered in a hardware abstraction layer corresponding to the positioning device into a virtual slave node, so that the Android container can interactively access the positioning device through the virtual slave node and a Linux system.
According to the virtualization method for the serial port of the positioning device, the virtual slave node is mounted in the Android container, so that the Android container can interact with a Linux system through the virtual slave node, and the serial port registered in the hardware abstraction layer corresponding to the positioning device is modified into the virtual slave node, so that in a dual system with the Linux system and the Android subsystem running simultaneously, the Linux system and the Android subsystem can simultaneously access the positioning device to obtain the positioning position information.
Based on any one of the foregoing embodiments, in this embodiment, the modifying a target serial port registered in a hardware abstraction layer of an Android container into the virtual slave node includes:
and modifying a GPS HAL layer file gpsstateinit function in the Android container to establish a communication connection between the Android container and the virtual slave node.
Wherein the gpsstateinit function is a function used for registering a serial port for the GPS in the hardware abstraction layer. It can be understood that, when the corresponding positioning device is a GPS system, the function in the corresponding hardware abstraction layer for registering the serial port for the GPS is a gpsstateinit function.
According to the virtualization method for the serial port of the positioning device, the gpsstateinit function used for registering the serial port for the GPS in the hardware abstraction layer is modified, so that the target serial port which is registered in the hardware abstraction layer of the Android container in advance is modified into the virtual slave node, the Android container can communicate with the virtual slave node, and the GPS positioning device is accessed, and therefore in a dual system with a Linux system and an Android subsystem running simultaneously, the Linux system and the Android subsystem can access the GPS positioning device simultaneously to obtain the positioning position information.
Based on any one of the foregoing embodiments, in this embodiment, the obtaining, by the Android container, the location information by communicating with the positioning device through the virtual slave node, the virtual master node, and the proxy service process includes:
the Android container writes request information into the virtual slave node;
the virtual slave node transmits the request information to the virtual master node;
the virtual main node sends the request information to the agent service process;
the agent service process sends the request information to a geographic position service interface in the Linux system;
the geographic position service interface acquires geographic position information data from positioning equipment and sends the geographic position information data to the agent service process;
the proxy service process converts the geographic position information data into the target data and forwards the target data to the virtual main node;
the virtual master node transmits the target data to the virtual slave node;
and the virtual slave node sends the target data to the Android container.
The request information may be a request for obtaining geographic position information data in the positioning device. The geographical location information data in the positioning device may be understood as positioning location information.
The geographic location service interface is a location service of the Linux end, for example, geoplus, and geoplus can send geographic location information data to the proxy service process through a data bus dbus. The target data refers to data obtained by packaging the geographic position information data into an NMEA message format.
It can be understood that an application program in the Android container can request to acquire the geographic position information data in the positioning device. Based on the method for accessing the positioning device in the Linux system by the Android container in the foregoing embodiment, the Android container can access the positioning device in the Linux system through the virtual slave node. Therefore, the request information can be written into the virtual slave node, the virtual slave node transmits the request information to a geographic position service interface in the Linux system through the virtual master node and the proxy service process in sequence, then the geographic position service interface in the Linux system acquires geographic position information data from the positioning device, analyzes the geographic position information data into target data, and transmits the target data to the Android container through the proxy service process, the virtual master node and the virtual slave node in sequence.
According to the virtualization method for the serial port of the positioning equipment, the Android subsystem can access the positioning equipment of the Linux system through the constructed virtual slave node, the virtual master node and the proxy service process, so that in a dual system with the Linux system and the Android subsystem running simultaneously, the Linux system and the Android subsystem can access the GPS positioning equipment simultaneously to obtain the positioning position information.
Based on any one of the above embodiments, in this embodiment, the forwarding, by the proxy service process, the target data to the virtual host node includes:
and under the condition that a plurality of positioning devices are provided, the proxy service process fuses the target data from the plurality of positioning devices and forwards the fused target data to the virtual main node.
It is understood that there may be one or more positioning devices. And under the condition that the number of the positioning devices is multiple, the positioning devices correspond to multiple target data, so that the proxy service process can fuse the multiple target data and then forward the fused data to the virtual main node, so as to improve the positioning accuracy.
For example, in the case of simultaneous presence of GPS, BDS, GLONASS, Galileo, and cellular network positioning, a predetermined algorithm may be adopted in the proxy service process to fuse a plurality of target data corresponding to these positioning systems. For a specific fusion process, reference may be made to the prior art, and details are not described herein for brevity.
According to the virtualization method for the serial port of the positioning equipment, the target data from the plurality of positioning equipment are fused through the proxy service process, and the positioning precision is improved, so that in a dual system with a Linux system and an Android subsystem running simultaneously, the Linux system and the Android subsystem can obtain geographic position information data with higher precision.
FIG. 2 is a schematic diagram of an internal framework of the Linux system provided by the present invention. The user virtual NMEA is virtual position information generated by the Linux system, and can also be understood as the fact that the Linux system can forge simulated positioning information, and then the forged simulated positioning information is forwarded to the Android subsystem by the proxy server in an NMEA coding format, so that the purpose of deceiving some positioning software of the Android subsystem is achieved. As shown in fig. 2, the Android subsystem is run in the Linux system using a Linux Container (lxc) method. The method comprises the steps of creating a proxy service process in a Linux system, creating a corresponding virtual master node and a virtual slave node for a target serial port corresponding to a positioning device by using devpts in the Linux system based on the proxy service process, enabling the created virtual master node to be in a/dev/ptmx directory, enabling the created virtual slave node to be in a/dev/pts/atm directory, and mounting the virtual slave node into an Android container in a sharing mode. And modifying the target serial port corresponding to the positioning equipment registered in the GNSS HAL into a virtual slave node. When an application program in the Android container sends a positioning request to a positioning management service to acquire position information, the positioning management service calls a GNSS HAL to call an interface function of a positioning device through a GNSS JNI, and communicates with the positioning service in the Linux system through a virtual slave node, a virtual master node and a proxy service process to acquire geographic position information data acquired by the positioning service in the Linux system from the positioning device in the Linux kernel.
According to the virtualization method for the serial port of the positioning equipment, the corresponding virtual master node and the corresponding virtual slave node are established for the target serial port used for communication of the positioning equipment, a pipeline from a Linux system to an Android subsystem is established for real positioning data, and the Linux system and the Android subsystem access the positioning equipment together through the proxy service process, the virtual master node and the virtual slave node, so that the Linux system and the Android subsystem can simultaneously access the positioning equipment in a dual system simultaneously operating the Linux system and the Android subsystem.
The following describes the virtualization apparatus for a serial port of a positioning device according to the present invention, and the virtualization apparatus for a serial port of a positioning device described below and the virtualization method for a serial port of a positioning device described above may be referred to in correspondence with each other.
Fig. 3 is a schematic diagram of a virtualization apparatus for a serial port of a positioning device, shown in fig. 3, the virtualization apparatus for a serial port of a positioning device according to an embodiment of the present invention includes:
the first creating module 310 is configured to create a proxy service process in the Linux system, where the proxy service process is used to forward the location information.
A second creating module 320, configured to create, in the Linux system, a corresponding virtual master node and a corresponding virtual slave node for a target serial port based on the proxy service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node;
the sharing module 330 is configured to share the virtual slave node to an Android container in the Linux system;
a communication module 340, configured to communicate with the positioning device through the virtual slave node, the virtual master node, and the proxy service process by the Android container to obtain the location information.
According to the virtualization device for the serial port of the positioning equipment, the corresponding virtual master node and the corresponding virtual slave node are established for the target serial port used for communication of the positioning equipment, a pipeline from a Linux system to an Android subsystem is established for real positioning data, and the Linux system and the Android subsystem access the positioning equipment together through the proxy service process, the virtual master node and the virtual slave node, so that in a dual system with the Linux system and the Android subsystem running simultaneously, the Linux system and the Android subsystem can access the positioning equipment simultaneously to obtain positioning position information.
Based on any one of the above embodiments, in this embodiment, the second creating module 320 includes:
and the creating unit is used for creating the virtual master node and the virtual slave node for a target serial port by using remote virtual terminal file equipment in the Linux system.
According to the virtualization device for the serial port of the positioning equipment, the corresponding virtual master node and the corresponding virtual slave node are established for the target serial port used for communication of the positioning equipment through the remote virtual terminal file equipment, and a pipeline from the Linux system to the Android subsystem is established for real positioning data, so that the Linux system and the Android subsystem can complete access to the positioning equipment through the virtual master node and the virtual slave node, and therefore in a dual system with the Linux system and the Android subsystem running simultaneously, the Linux system and the Android subsystem can access the positioning equipment simultaneously to obtain positioning position information.
Based on any one of the above embodiments, in this embodiment, the sharing module 330 includes:
the mounting unit is used for mounting the virtual slave node into the Android container through a mount function;
and the modifying unit is used for modifying the target serial port registered in the hardware abstraction layer of the Android container into the virtual slave node.
According to the virtualization device for the serial port of the positioning equipment, the virtual slave node is mounted in the Android container, so that the Android container can interact with a Linux system through the virtual slave node, and the serial port registered in the hardware abstraction layer corresponding to the positioning equipment is modified into the virtual slave node, so that the Linux system and the Android subsystem can simultaneously access the positioning equipment to acquire the positioning position information in a dual system simultaneously operating the Linux system and the Android subsystem.
Based on any one of the above embodiments, in this embodiment, the modifying unit is configured to modify a GPS HAL layer file gpsstateinit function in the Android container, so as to establish a communication connection between the Android container and the virtual slave node.
According to the virtualization device for the serial port of the positioning equipment, the gpsstateinit function used for registering the target serial port for the GPS in the hardware abstraction layer is modified, so that the Android container can communicate with the virtual slave node to access the GPS positioning equipment, the Android subsystem can interact with the Linux system through the virtual slave node, and therefore in a dual system with the Linux system and the Android subsystem running simultaneously, the Linux system and the Android subsystem can simultaneously access the GPS positioning equipment to obtain the positioning position information.
Based on any one of the above embodiments, in this embodiment, the communication module 340 includes:
a writing unit, configured to write request information to the virtual slave node by the Android container;
a first transmission unit, configured to transmit the request information to the virtual master node by the virtual slave node;
a first sending unit, configured to send, by the virtual master node, the request information to the proxy service process;
the second sending unit is used for sending the request information to a geographic position service interface in the Linux system by the agent service process;
the first processing unit is used for the geographic position service interface to acquire geographic position information data from positioning equipment and send the geographic position information data to the proxy service process;
the forwarding unit is used for converting the geographical position information data into the target data and forwarding the target data to the virtual main node by the proxy service process;
a second transmission unit, configured to transmit the target data to the virtual slave node by the virtual master node;
and a third sending unit, configured to send the target data to the Android container by the virtual slave node.
According to the virtualization device for the serial port of the positioning equipment, the Android subsystem can access the positioning equipment of the Linux system through the constructed virtual slave node, the virtual master node and the proxy service process, so that in a dual system with the Linux system and the Android subsystem running simultaneously, the Linux system and the Android subsystem can access the GPS positioning equipment simultaneously to obtain the positioning position information.
Based on any one of the foregoing embodiments, in this embodiment, the forwarding unit includes:
and the second processing unit is configured to, when there are a plurality of positioning devices, forward the fused target data from the plurality of positioning devices to the virtual host node by the proxy service process.
According to the virtualization device for the serial port of the positioning equipment, the target data from the plurality of positioning equipment are fused through the proxy service process, and the positioning precision is improved, so that in a dual system with a Linux system and an Android subsystem running simultaneously, the Linux system and the Android subsystem can obtain geographic position information data with higher precision.
Fig. 4 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 4: a processor (processor)410, a communication Interface 420, a memory (memory)430 and a communication bus 440, wherein the processor 410, the communication Interface 420 and the memory 430 are communicated with each other via the communication bus 440. The processor 410 may invoke logic instructions in the memory 430 to perform a virtualization method for locating a device serial port, the method comprising: the method comprises the steps of establishing an agent service process in a Linux system, wherein the agent service process is used for forwarding position information; establishing a corresponding virtual master node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node; sharing the virtual slave node to an Android container in the Linux system; and the Android container communicates with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
In addition, the logic instructions in the memory 430 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being stored on a non-transitory computer readable storage medium, wherein when the computer program is executed by a processor, the computer is capable of executing the method for virtualizing a serial port of a positioning device provided by the present invention, the method including: the method comprises the steps of establishing an agent service process in a Linux system, wherein the agent service process is used for forwarding position information; establishing a corresponding virtual master node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node; sharing the virtual slave node to an Android container in the Linux system; and the Android container communicates with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium, on which a computer program is stored, the computer program being implemented by a processor to execute the virtualization method for a serial port of a positioning device provided by the present invention, the method comprising: the method comprises the steps of establishing an agent service process in a Linux system, wherein the agent service process is used for forwarding position information; establishing a corresponding virtual master node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node; sharing the virtual slave node to an Android container in the Linux system; and the Android container communicates with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A virtualization method for a serial port of a positioning device is characterized by comprising the following steps:
the method comprises the steps of establishing an agent service process in a Linux system, wherein the agent service process is used for forwarding position information;
establishing a corresponding virtual master node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node;
sharing the virtual slave node to an Android container in the Linux system;
and the Android container communicates with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
2. The method for virtualizing the serial port of the positioning device according to claim 1, wherein the creating corresponding virtual master nodes and virtual slave nodes for the target serial port in the Linux system based on the proxy service process comprises:
and using remote virtual terminal file equipment in a Linux system to create the virtual master node and the virtual slave node for a target serial port.
3. The virtualization method for the serial port of the positioning device according to claim 2, wherein the sharing the virtual slave node to the Android container in the Linux system comprises:
mounting the virtual slave node into the Android container through a mount function;
and modifying the target serial port registered in the hardware abstraction layer of the Android container into the virtual slave node.
4. The method for virtualizing the serial port of the positioning device according to claim 3, wherein the modifying the target serial port registered in the hardware abstraction layer of the Android container into the virtual slave node comprises:
and modifying a GPS HAL layer file gpsstateinit function in the Android container to establish a communication connection between the Android container and the virtual slave node.
5. The method for virtualizing the serial port of the positioning device according to claim 1, wherein the Android container communicates with the positioning device through the virtual slave node, the virtual master node, and the proxy service process to obtain the location information, and the method includes:
the Android container writes request information into the virtual slave node;
the virtual slave node transmits the request information to the virtual master node;
the virtual main node sends the request information to the agent service process;
the agent service process sends the request information to a geographic position service interface in the Linux system;
the geographic position service interface acquires geographic position information data from positioning equipment and sends the geographic position information data to the agent service process;
the proxy service process converts the geographic position information data into the target data and forwards the target data to the virtual main node;
the virtual master node transmits the target data to the virtual slave node;
and the virtual slave node sends the target data to the Android container.
6. The virtualization method of the serial port of the positioning device according to claim 5, wherein the forwarding the target data to the virtual host node by the proxy service process comprises:
and under the condition that a plurality of positioning devices are provided, the proxy service process fuses the target data from the plurality of positioning devices and forwards the fused target data to the virtual main node.
7. A virtualization device for a serial port of a positioning device is characterized by comprising:
the system comprises a first establishing module, a second establishing module and a third establishing module, wherein the first establishing module is used for establishing an agent service process in the Linux system, and the agent service process is used for forwarding position information;
the second establishing module is used for establishing a corresponding virtual main node and a corresponding virtual slave node for a target serial port in the Linux system based on the agent service process; the target serial port is in communication connection with the positioning equipment; the virtual master node transmits the received data to the virtual slave node, and/or the virtual slave node transmits the received data to the virtual master node;
the sharing module is used for sharing the virtual slave node to an Android container in the Linux system;
and the communication module is used for the Android container to communicate with the positioning equipment through the virtual slave node, the virtual master node and the proxy service process to acquire the position information.
8. An electronic device comprising a memory, a processor and a computer program stored on said memory and executable on said processor, characterized in that said processor, when executing said program, implements the steps of a method for virtualizing a serial port of a positioning device according to any one of claims 1 to 6.
9. A non-transitory computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of a method for virtualizing a serial port of a positioning device according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, carries out the steps of a method for virtualizing a serial port of a positioning device according to any one of claims 1 to 6.
CN202111672866.3A 2021-12-31 2021-12-31 Virtualization method, equipment, device, medium and product for serial port of positioning equipment Active CN114416292B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111672866.3A CN114416292B (en) 2021-12-31 2021-12-31 Virtualization method, equipment, device, medium and product for serial port of positioning equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111672866.3A CN114416292B (en) 2021-12-31 2021-12-31 Virtualization method, equipment, device, medium and product for serial port of positioning equipment

Publications (2)

Publication Number Publication Date
CN114416292A true CN114416292A (en) 2022-04-29
CN114416292B CN114416292B (en) 2024-05-28

Family

ID=81271618

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111672866.3A Active CN114416292B (en) 2021-12-31 2021-12-31 Virtualization method, equipment, device, medium and product for serial port of positioning equipment

Country Status (1)

Country Link
CN (1) CN114416292B (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593225A (en) * 2013-10-30 2014-02-19 浙江大学 Method for multiplexing Binder IPC mechanism by multiple Android systems in mobile virtualization scene
US20150106443A1 (en) * 2013-10-10 2015-04-16 Eric Jensen Automated mobile positional social media method and system
WO2015121750A1 (en) * 2014-02-14 2015-08-20 6Wind System and method for data communication between virtual interfaces
US20160253200A1 (en) * 2015-02-27 2016-09-01 Electronics And Telecommunications Research Institute Server virtualization method of multi node system and apparatus thereof
US20160359955A1 (en) * 2015-06-05 2016-12-08 Nutanix, Inc. Architecture for managing i/o and storage for a virtualization environment using executable containers and virtual machines
CN108509435A (en) * 2017-02-24 2018-09-07 海马云(天津)信息技术有限公司 The method and apparatus of instance system carry telefile
CN109491759A (en) * 2018-10-26 2019-03-19 深圳康佳电子科技有限公司 Process debugged method, device and computer equipment based on Virtual File System
KR102105000B1 (en) * 2018-11-15 2020-04-27 주식회사 엘지유플러스 Apparatus and method for virtual device service
CN111638944A (en) * 2020-06-01 2020-09-08 浙江大学 Serial port virtualization optimization method for mixed kernel operating system
CN112099925A (en) * 2020-11-23 2020-12-18 江苏北弓智能科技有限公司 Hardware sensor sharing method and system for Android container operating system of cloud mobile phone
CN113448740A (en) * 2021-09-01 2021-09-28 北京鲸鲮信息系统技术有限公司 Power management method and device for operating system
CN113448648A (en) * 2021-06-29 2021-09-28 技德技术研究所(武汉)有限公司 Linux-compatible Android camera access method and device
CN113778714A (en) * 2021-09-13 2021-12-10 北京技德系统技术有限公司 Linux-compatible Android-compatible shear plate sharing method and device
CN113791875A (en) * 2021-11-18 2021-12-14 北京鲸鲮信息系统技术有限公司 Input device virtualization method and device, electronic device and storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150106443A1 (en) * 2013-10-10 2015-04-16 Eric Jensen Automated mobile positional social media method and system
CN103593225A (en) * 2013-10-30 2014-02-19 浙江大学 Method for multiplexing Binder IPC mechanism by multiple Android systems in mobile virtualization scene
WO2015121750A1 (en) * 2014-02-14 2015-08-20 6Wind System and method for data communication between virtual interfaces
US20160253200A1 (en) * 2015-02-27 2016-09-01 Electronics And Telecommunications Research Institute Server virtualization method of multi node system and apparatus thereof
US20160359955A1 (en) * 2015-06-05 2016-12-08 Nutanix, Inc. Architecture for managing i/o and storage for a virtualization environment using executable containers and virtual machines
CN108509435A (en) * 2017-02-24 2018-09-07 海马云(天津)信息技术有限公司 The method and apparatus of instance system carry telefile
CN109491759A (en) * 2018-10-26 2019-03-19 深圳康佳电子科技有限公司 Process debugged method, device and computer equipment based on Virtual File System
KR102105000B1 (en) * 2018-11-15 2020-04-27 주식회사 엘지유플러스 Apparatus and method for virtual device service
CN111638944A (en) * 2020-06-01 2020-09-08 浙江大学 Serial port virtualization optimization method for mixed kernel operating system
CN112099925A (en) * 2020-11-23 2020-12-18 江苏北弓智能科技有限公司 Hardware sensor sharing method and system for Android container operating system of cloud mobile phone
CN113448648A (en) * 2021-06-29 2021-09-28 技德技术研究所(武汉)有限公司 Linux-compatible Android camera access method and device
CN113448740A (en) * 2021-09-01 2021-09-28 北京鲸鲮信息系统技术有限公司 Power management method and device for operating system
CN113778714A (en) * 2021-09-13 2021-12-10 北京技德系统技术有限公司 Linux-compatible Android-compatible shear plate sharing method and device
CN113791875A (en) * 2021-11-18 2021-12-14 北京鲸鲮信息系统技术有限公司 Input device virtualization method and device, electronic device and storage medium

Also Published As

Publication number Publication date
CN114416292B (en) 2024-05-28

Similar Documents

Publication Publication Date Title
CN115291964B (en) Mechanism for reducing start-up delay of server-less function
US9628290B2 (en) Traffic migration acceleration for overlay virtual environments
CN103580937B (en) A kind of Web services the method and system thereof and service broker system simulated
CN109597109B (en) Positioning method, positioning device and positioning system
WO2023284672A1 (en) Positioning information acquisition method and apparatus,, electronic device, and storage medium
RU2523964C2 (en) Method for inter-process interaction between different applications in mobile terminal and corresponding device
CN108737141B (en) Satellite link intermittent and delayed simulation method
CN108255614A (en) A kind of interface calling system and method based on micro services framework
CN103838516B (en) A kind of method and system for polycaryon processor efficient access iscsi disk array
US20130152069A1 (en) Method, apparatus and system for initiating terminal operation
CN112817617A (en) Software upgrading method, device and system
CN111857733B (en) Construction method, device and system of service environment and readable storage medium
CN109684148B (en) Airborne embedded software virtual bus communication construction method based on ARINC653
CN113411363A (en) Uploading method of image file, related equipment and computer storage medium
JP2022069420A (en) Computer implementation method, computer system, and computer program product (managing failures in edge computing environments)
CN114416292B (en) Virtualization method, equipment, device, medium and product for serial port of positioning equipment
CN111654559B (en) Container data transmission method and device
CN113360386A (en) Switching chip drive test method, device, electronic equipment and storage medium
CN109656674B (en) Computer equipment, virtualization chip and data transmission method
CN110806932A (en) Algorithm scheduling method and device
CN113162677B (en) Method and device for communicating physical equipment and virtual network simulation platform
CN112383617B (en) Method, device, terminal equipment and medium for performing long connection
CN113704120A (en) Data transmission method, device, equipment and storage medium
CN114466000A (en) CDN gateway source returning method and device
CN117056029B (en) Resource processing method, system, device, storage medium and electronic equipment

Legal Events

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