Information transmission method, terminal device and storage medium
By setting up a data writing interface between the user space and the kernel space of the terminal device, the application information is transmitted and stored in the kernel space, the problem of inconsistent information storage standards of hardware modules is solved, and the degree of storage uniformity and system stability are improved sex.
Patent Information
- Application Number
- CN202210051915.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-17
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-01-17
AI Technical Summary
Due to the inconsistent storage methods of hardware module information formulated by different developers, the standard for storing hardware module information for each application is low.
Set up a data writing interface between the user space and the kernel space of the terminal device, transmit application information from the user space to the kernel space, and save it in the kernel space, ensuring that all application information is stored uniformly in the kernel space.
It improves the standard uniformity of terminal equipment for storing hardware module information, avoids the storage of partial information in user space and kernel space, and enhances system stability and consistency.
Smart Images

Figure CN114416402B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data storage technology, and in particular to an information transmission method, a terminal device, and a storage medium. Background Art
[0002] During the development and application of terminal devices and systems, each application will obtain multiple pieces of information corresponding to multiple hardware modules during operation. Since different developers or application developers have different ways of storing hardware module information, each application stores hardware module information differently, which results in a low degree of standardization in how each application stores hardware module information. Summary of the invention
[0003] The embodiments of the present application provide an information transmission method, a terminal device, and a storage medium to solve the problem of low standardization of hardware module information stored by each application.
[0004] In a first aspect, an information transmission method is provided, which is applied to a terminal device, wherein the memory space of the terminal device includes: a user space and a kernel space, and the method includes: in the user space, obtaining application information corresponding to a first application, wherein the application information includes: device information and device operation status;
[0005] The application information is transmitted from the user space to the kernel space through a pre-set data writing interface between the user space and the kernel space, and the application information is stored in the kernel space.
[0006] As an optional implementation manner, in the first aspect of the embodiment of the present application, before obtaining the application information through the first application in the user space, the method further includes:
[0007] In the memory space, registering a device node corresponding to the terminal device, the device node being located between the user space and the kernel space;
[0008] On the device node, a data writing interface between the user space and the kernel space is set.
[0009] As an optional implementation, in the first aspect of the embodiment of the present application, the kernel space includes: a first memory area and a second memory area, and the storing the application information in the kernel space includes:
[0010] storing the device information in the first memory area, and storing the device operation status in the second memory area;
[0011] The first memory area and the second memory area are different memory areas in the kernel space.
[0012] As an optional implementation manner, in the first aspect of the embodiment of the present application, the storing the device information in the first memory area and the storing the device operating state in the second memory area include:
[0013] Setting a plurality of enumeration variables in the kernel space, each enumeration variable corresponding to a hardware module;
[0014] Define a first position index and a second position index of a hardware module corresponding to each of the enumeration variables in the kernel space;
[0015] The device information of each hardware module is stored in the first memory area according to the corresponding first position index, and the device operation status of each hardware module is stored in the second memory area according to the corresponding second position index;
[0016] The first location index is used to define the storage location of the device information of each hardware module in the first memory area, and the second location index is used to define the storage location of the device operating status of each hardware module in the second memory area.
[0017] As an optional implementation manner, in the first aspect of the embodiments of the present application, the method further includes:
[0018] When the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through a pre-set data read interface between the user space and the kernel space;
[0019] transmitting the application information to the second application program through the user space;
[0020] The first application and the second application are different applications, and the data read interface and the data write interface are different data interfaces set in the device node.
[0021] As an optional implementation manner, in the first aspect of the embodiment of the present application, when the second application needs to call the application information, transmitting the application information from the kernel space to the user space through a pre-set data read interface between the user space and the kernel space includes:
[0022] When the second application needs to call the application information, obtain the permission list of the device node;
[0023] If it is detected that the permission list includes the second application, the application information is transmitted from the kernel space to the user space through the pre-set data read interface between the user space and the kernel space.
[0024] As an optional implementation, in the first aspect of the embodiment of the present application, the data read interface includes: a first data read interface and a second data read interface, and when the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through the pre-set data read interface between the user space and the kernel space, including:
[0025] When the second application needs to call the application information, the device information is read from the first memory area of the kernel space through the first data read interface and transmitted to the user space, and the device operation status is read from the second memory area of the kernel space through the second data read interface and transmitted to the user space;
[0026] The first data read interface and the second data read interface are different data read interfaces set in the device node.
[0027] In a second aspect, a terminal device is provided, wherein the memory space of the terminal device includes: a user space and a kernel space, and the terminal device includes: an acquisition module, configured to acquire application information corresponding to a first application in the user space, wherein the application information includes: device information and device operation status;
[0028] The processing module is used to transmit the application information from the user space to the kernel space through a pre-set data writing interface between the user space and the kernel space, and store the application information in the kernel space.
[0029] In a third aspect, a terminal device is provided, wherein the memory space of the terminal device includes: a user space and a kernel space, and the terminal device includes:
[0030] A memory storing executable program code;
[0031] a processor coupled to the memory;
[0032] The processor calls the executable program code stored in the memory to execute the information transmission method in the first aspect of the embodiment of the present application.
[0033] In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the information transmission method in the first aspect of the embodiment of the present application is implemented. The computer-readable storage medium includes ROM / RAM, a magnetic disk or an optical disk, etc.
[0034] According to a fifth aspect, a computer program product is provided, which implements part or all of the steps of any one of the methods of the first aspect when the computer program product is run on a computer.
[0035] According to a sixth aspect, an application publishing platform is provided, wherein the application publishing platform is used to publish a computer program product, wherein when the computer program product runs on a computer, part or all of the steps of any one method of the first aspect are implemented.
[0036] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0037] In the embodiment of the present application, the memory space of the terminal device includes: user space and kernel space. The terminal device can obtain application information corresponding to the first application in the user space, and the application information includes: device information and device operation status; then the terminal device can transfer the application information from the user space to the kernel space through the pre-set data write interface between the user space and the kernel space, and save the application information in the kernel space. Through this scheme, the terminal device can pre-set the data write interface in the user space and the kernel space, and the terminal device can transmit and store the application information obtained in the user space in the kernel space through the data write interface, so as to ensure that all application information is saved in the kernel space, so that no matter what application information the terminal device obtains in the user space, it can be stored in the kernel space through the data write interface, and there will be no situation where the user space stores part of the information and the kernel space stores part of the information, which effectively improves the standardization degree of the terminal device to store hardware module information. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 This is a flow diagram of an information transmission method provided in an embodiment of the present application. Figure 1 ;
[0040] Figure 2 This is a flow diagram of an information transmission method provided in an embodiment of the present application. Figure 2 ;
[0041] Figure 3 It is a schematic diagram of the structure of a memory space of a terminal device provided in an embodiment of the present application;
[0042] Figure 4 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Figure 1 ;
[0043] Figure 5 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Figure 2 . DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] The terms "first" and "second" in the specification and claims of this application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first application and a second application are used to distinguish different applications rather than to describe a specific order of applications.
[0046] The terms "including" and "having" and any variations thereof in the embodiments of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0047] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0048] The embodiments of the present application provide an information transmission method, a terminal device, and a storage medium. The terminal device can pre-set a data writing interface in the user space and the kernel space, so that the terminal device can transmit and store the application information obtained in the user space in the kernel space through the data writing interface, thereby ensuring that all application information is saved in the kernel space. In this way, no matter what application information the terminal device obtains in the user space, it can be stored in the kernel space through the data writing interface, and there will be no situation where part of the information is stored in the user space and part of the information is stored in the kernel space, which effectively improves the standardization and unification of the terminal device storage of hardware module information.
[0049] The terminal devices involved in the embodiments of the present application may be mobile phones, tablet computers, laptop computers, PDAs, vehicle-mounted terminal devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc. Among them, the wearable devices may be smart watches, smart bracelets, watch phones, smart anklets, smart earrings, smart necklaces, smart headphones, etc., which are not limited in the embodiments of the present application.
[0050] The execution subject of the information transmission method provided in the embodiment of the present application can be the above-mentioned terminal device, or it can be a functional module and / or functional entity in the terminal device that can implement the information transmission method. The specific information can be determined according to actual use requirements, and the embodiment of the present application does not limit it. The following takes the terminal device as an example to exemplarily illustrate the information transmission method provided in the embodiment of the present application.
[0051] like Figure 1 As shown, an embodiment of the present application provides an information transmission method, which may include the following steps:
[0052] 101. In a user space, obtain application information corresponding to a first application.
[0053] In an embodiment of the present application, the terminal device can obtain application information corresponding to the first application when running the first application.
[0054] It should be noted that, since the application is stored in the user space in the format of a file, the application information corresponding to the first application acquired by the terminal device is stored in the user space.
[0055] Among them, the application information includes: device information and device operating status; the device may include various hardware modules in the terminal device, such as: display screen, camera, gyroscope, acceleration sensor, etc.; each application may call the function of the device in the terminal device when running, so the device information and device operating status corresponding to the device can be obtained, among which the device information can mainly include: the device number, model, manufacturer and other information of the hardware module; the device operating status is the status of the hardware module when it is running, such as: working status, pause status, etc. If a fault occurs, the device operating status may include: fault type, fault cause, etc.
[0056] Optionally, the memory space of the terminal device includes: user space and kernel space, wherein the user space is the memory area where the user process is located, and the kernel space is the memory area occupied by the operating system. All data of the user process and the operating system process are stored in the memory space.
[0057] Before the terminal device is started, the memory space is a piece of raw physical memory. After the terminal device system is started, the physical memory is divided. Of course, this division is a logical division of the operating system. There is no well-divided address and space range on the physical memory bar. The division results of different versions of operating systems are different.
[0058] The basis for the division is that the data of different objects are stored in different places, that is, the data of the operating system is generally stored in the kernel space, and the data of the user process is generally stored in the user space. If the data of the operating system and the data of the user process are stored together, it will affect the operation of the system; storing the system data and the user data separately can prevent the system data and the user data from interfering with each other, ensuring the stability of the operating system. And by isolating the user data and the system data, the access to the two parts of the data can be controlled, which can ensure that the user program cannot arbitrarily operate the system data, thus preventing the user program from misoperating or maliciously damaging the system.
[0059] 102. Application information is transferred from the user space to the kernel space through a pre-set data writing interface between the user space and the kernel space.
[0060] In an embodiment of the present application, the terminal device can transfer application information from the user space to the kernel space through a data write interface, where the data write interface is a pre-set interface, where the data write interface is located between the user space and the kernel space, and where the data write interface is used to transfer information in the user space to the kernel space.
[0061] 103. Save application information in kernel space.
[0062] In an embodiment of the present application, after the terminal device transfers the application information from the user space to the kernel space, the application information can be saved in the kernel space.
[0063] Optionally, after the terminal device transfers the application information from the user space to the kernel space, the application information in the user space may be deleted, that is, the application information is only stored in the kernel space; the terminal device may not delete the application information in the user space, that is, the application information is stored in both the kernel space and the user space.
[0064] The embodiment of the present application provides an information transmission method, the memory space of the terminal device includes: user space and kernel space, the terminal device can obtain application information corresponding to the first application in the user space, and the application information includes: device information and device running status; then the terminal device can transmit the application information from the user space to the kernel space through the pre-set data write interface between the user space and the kernel space, and save the application information in the kernel space. Through this scheme, the terminal device can pre-set the data write interface in the user space and the kernel space, so that the terminal device can transmit and store the application information obtained in the user space in the kernel space through the data write interface, so that all application information can be saved in the kernel space, so that no matter what application information the terminal device obtains in the user space, it can be stored in the kernel space through the data write interface, and there will be no situation where the user space stores part of the information and the kernel space stores part of the information, which effectively improves the standardization degree of the terminal device storing hardware module information.
[0065] like Figure 2 As shown, the embodiment of the present application provides an information transmission method, which may also include the following steps:
[0066] 201. In the memory space, register a device node corresponding to the terminal device.
[0067] In an embodiment of the present application, the terminal device may first register the device node of the terminal device in the memory space.
[0068] It should be noted that devices under the Linux operating system are usually divided into three categories: character devices, block devices, and network devices. The device drivers are also divided into three categories: character device drivers, block device drivers, and network device drivers. Common character devices include mice, keyboards, serial ports, consoles, etc. Common block devices include various hard disks, flash disks, random access memory (RAM) disks, etc.
[0069] The device node is created in the / dev directory and is the hub connecting the kernel space and the user space. It can be used to indicate that the terminal device is connected to a certain ID of a certain interface. The device node is equivalent to the index node (inode) of the hard disk, which records the location and information of the hardware device.
[0070] In the Linux operating system, all devices are stored in the / dev directory in the form of files and are accessed through files. The device node is the abstract description of the device by the Linux operating system. A device node is a file, that is, a device node is a device. Applications access devices through standardized call functions, which are independent of any specific driver.
[0071] Optionally, registering a device node corresponding to a terminal device may specifically include: in a memory space, first generating a device driver file list in a string format based on a device driver name, a device node name, and related parameters related to device driver loading and device node creation, and then pre-storing the device driver file list in a device file storage device independent of the memory space; the terminal device may read files in the device driver file list, create a device node based on the device driver file list, and then save the device node in the device file storage device.
[0072] The device file storage device may be a flash storage device or a RAM storage device.
[0073] It should be noted that the terminal device can first obtain the device node name of the device node to be created from the device driver file list, then load the device driver according to the device driver name in the device driver file list, and obtain the device node number assigned by the Linux operating system. Then the terminal device can create the device node according to the device node name, related parameters and device node number.
[0074] The device node number may include: a master device number and a slave device number.
[0075] Furthermore, before reading the files in the device driver file list, the terminal device can also determine whether the device node has been created based on the mark on the device file storage. If the device node has been created, the terminal device can directly call the stored device node; if the device node has not been created, the terminal device needs to read the files in the device driver file list, create the device node based on the device driver file list, and then save the device node in the device file storage for subsequent needs.
[0076] It should be noted that if a device node has been created but the files in the device driver file list have been updated, the terminal device needs to first delete all device nodes stored in the device file storage, and then read the device file list, and repeat the steps of generating a device driver file list in a string format based on the device driver name, device node name and related parameters related to device driver loading and device node creation to obtain the device node corresponding to the new device driver file list.
[0077] Through the above optional implementation method, the terminal device only needs to create a device node when the Linux operating system is started for the first time. If the files in the device driver file list are not updated, each time the Linux operating system is started, the terminal device only needs to call the previously stored device node. This saves the dynamic process of device node creation and ensures the startup speed of the Linux operating system.
[0078] 202. On the device node, set a data writing interface between the user space and the kernel space.
[0079] In an embodiment of the present application, after the terminal device registers the device node, a data write interface can be set on the device node. The data write node is a data transmission channel between the kernel space and the user space. The terminal device can transmit application information from the user space to the kernel space through the data write interface. The data write interface is located between the user space and the kernel space.
[0080] For example, Figure 3 As shown, the memory space 31 of the terminal device includes a user space and a kernel space, a device node 32 is set between the user space and the kernel space, and a data write interface 321 is set on the device node 32. The terminal device can write the application information in the user space into the kernel space through the data write interface 321.
[0081] 203. In the user space, obtain application information corresponding to the first application.
[0082] 204. The application information is transferred from the user space to the kernel space through a pre-set data writing interface between the user space and the kernel space.
[0083] 205. Save the application information in the kernel space.
[0084] In the embodiment of the present application, for the description of steps 203 to 205, please refer to the detailed description of steps 101 to 103 in the embodiment, and the embodiment of the present application will not be repeated.
[0085] Optionally, saving the application information in the kernel space may specifically include: saving the device information in the first memory area, and saving the device operation status in the second memory area.
[0086] The first memory area and the second memory area are two different memory areas in the kernel space of the terminal device, which are used to store device information and device operation status respectively.
[0087] It should be noted that the terminal device stores application information in the kernel space, and can store device information and device operating status separately, that is, the terminal device can divide two memory areas in the kernel space, one memory area is used to store device information, and the other memory area is used to store device operating status.
[0088] For example, Figure 3 As shown, the terminal device can write the application information in the user space into the kernel space through the data write interface 321, and save the device information in the first memory area 33, and save the device running status in the second memory area 34.
[0089] Optionally, when dividing the two memory areas, the terminal device divides the two memory areas by applying for memory; the applied memory may include: static memory and dynamic memory.
[0090] Among them, static memory refers to the memory allocated by the compiler when the program starts running. Its allocation is completed when the program starts compiling and does not occupy CPU resources; when the user cannot determine the size of the space, or the space is too large to be allocated on the stack, dynamic memory allocation will be used. In the embodiment of the present application, the terminal device can apply for static memory to store application information.
[0091] Through the above optional implementation method, the terminal device can store the device information and device operation status of the hardware module separately in two memory areas in the kernel space, so that the terminal device can quickly distinguish and call, reducing the workload of the terminal device.
[0092] Furthermore, the terminal device stores the device information in the first memory area and stores the device operation status in the second memory area, which may specifically include:
[0093] A plurality of enumeration variables are set in the kernel space, each of which corresponds to a hardware module; a first position index and a second position index of the hardware module corresponding to each enumeration variable in the kernel space are defined; the device information of each hardware module is stored in the first memory area according to the corresponding first position index, and the device operation status of each hardware module is stored in the second memory area according to the corresponding second position index.
[0094] The first location index is used to define the storage location of the device information of each hardware module in the first memory area, and the second location index is used to define the storage location of the device operating status of each hardware module in the second memory area.
[0095] It should be noted that after the terminal device divides the kernel space into two memory areas, the device information and device operating status can be saved in the two memory areas respectively, and when storing, the terminal device needs to store according to the preset location index. Therefore, the terminal device can set multiple enumeration variables in the kernel space, each enumeration variable corresponds to a hardware module, that is, corresponds to a device. The enumeration variable can be used to identify the location index of the hardware module, that is, to identify the storage location and storage order of the application information of the hardware module in the memory.
[0096] After the terminal device sets the enumeration variables, it can define the location index of the corresponding hardware module for each enumeration variable. The location index can be divided into: a first location index and a second location index. The first location index can be used to define the storage location of the device information of each hardware module in the first memory area, and the second location index is used to define the storage location of the device operation status of each hardware module in the second memory area, that is, each hardware module has two parameters: device information and device operation status. When the terminal device stores the device information and the device operation status in the kernel space, the device information of the hardware module can be saved in the first memory area in the kernel space according to the first location index, and the device operation status of the hardware module can be saved in the second memory area in the kernel space according to the second location index.
[0097] It should be noted that each hardware module corresponds to two location indexes, which respectively indicate the storage location of the device information of the hardware module in the first memory area and the storage location of the device operating status of the hardware module in the second memory area.
[0098] Among them, the location index of each hardware module is different.
[0099] Through the above optional implementation method, the location index of the application information stored in the kernel space can be defined for each hardware module, so that the terminal device can store the application information in the kernel space according to the location index corresponding to each hardware module. This can avoid the situation where the terminal device saves the application information at will, and makes the application information stored in the kernel space more orderly.
[0100] 206. When the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through the pre-set data reading interface between the user space and the kernel space.
[0101] In an embodiment of the present application, after the terminal device saves the application information to the kernel space in advance, if the second application in the user space needs to call the application information, the terminal device can then transfer the application information from the kernel space to the user space.
[0102] Among them, the terminal device transmits application information through a data read interface, which is a pre-set interface located between the user space and the kernel space. The data read interface is used to transmit information in the kernel space to the user space.
[0103] It should be noted that the first application and the second application are different applications, and the data read interface and the data write interface are different data interfaces set in the device node.
[0104] It can be understood that when the first application is running, the terminal device can save the application information from the user space to the kernel space through the data write interface; when another application, i.e., the second application needs to call the application information, the terminal device can transfer the application information from the kernel space to the user space through the data read interface.
[0105] Optionally, when the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through a pre-set data reading interface between the user space and the kernel space, which may specifically include:
[0106] When the second application needs to call the application information, the permission list of the device node is obtained; if it is detected that the permission list includes the second application, the application information is transmitted from the kernel space to the user space through the pre-set data read interface between the user space and the kernel space.
[0107] In this optional implementation, if the second application needs to call application information during operation, the terminal device needs to call the application information from the kernel space. Before the call, the application permissions need to be checked first. Therefore, the terminal device can obtain the permission list of the device node. The permission list is set when the device node is registered. If the permission list includes the second application, it means that the second application can call the application information from the kernel space. Therefore, the terminal device can transfer the application information from the kernel space to the user space through the data read interface; if the permission list does not include the second application, it means that the second application cannot call the application information from the kernel space, so the terminal device does not need to call the application information from the kernel space.
[0108] Through the above optional implementation method, the terminal device can set permissions for the device node, and only applications with permissions can call application information from the kernel space. This can avoid each application calling application information, which will increase the workload of the terminal device, and can also ensure the security of application information.
[0109] Optionally, when the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through a pre-set data reading interface between the user space and the kernel space, which may specifically include:
[0110] When the second application needs to call application information, the device information is read from the first memory area of the kernel space through the first data read interface and transmitted to the user space, and the device operating status is read from the second memory area of the kernel space through the second data read interface and transmitted to the user space.
[0111] It should be noted that since the application information includes: device information and device operating status, and the device information is stored in the first memory area of the kernel space, and the device operating status is stored in the second memory area of the kernel space, when the terminal device calls the application information from the kernel space again, it can read the device information and the device operating status respectively through two data read interfaces; that is, the terminal device can read the device information through the first data read interface and transmit the device information from the first memory area of the kernel space to the user space, and then read the device operating status through the second data read interface and transmit the device operating status from the second memory area of the kernel space to the user space.
[0112] The data read interface may include: a first data read interface and a second data read interface, wherein the first data read interface and the second data read interface are different data read interfaces arranged in the device node.
[0113] Optionally, in an embodiment of the present application, the device node may include at least three data interfaces, namely: a data write interface, a first data read interface, and a second data read interface. Among them, the data write interface is a data interface for the terminal device to transfer application information from the user space to the kernel space; the first data read interface is a data interface for the terminal device to transfer device information from the first memory area of the kernel space to the user space; the second data read interface is a data interface for the terminal device to transfer the device operating status from the second memory area of the kernel space to the user space.
[0114] For example, Figure 3As shown, a device node 32 is provided between the user space and the kernel space, and a data write interface 321, a first data read interface 322, and a second data read interface 323 are provided on the device node. The terminal device can write application information in the user space into the kernel space through the data write interface 321, and can also read device information from the first memory area 33 in the kernel space to the user space through the first data read interface 322, and can also read the device operation status from the second memory area 34 in the kernel space to the user space through the second data read interface 323.
[0115] 207. Transmit the application information to the second application program through the user space.
[0116] In an embodiment of the present application, after the terminal device transmits the application information from the kernel space to the user space through the data read interface, the application information can be transmitted to the second application for calling when the second application is running.
[0117] The embodiment of the present application provides an information transmission method, the terminal device can first set the device node in the memory space, then set the data write interface on the device node, and then obtain the application information corresponding to the first application in the user space, the application information includes: device information and device running status; the terminal device can transmit the application information from the user space to the kernel space through the data write interface, and save the application information in the kernel space; if the second application needs to call the application information, the application information can be transmitted from the kernel space to the user space through the data read interface, and then transmitted to the second application. Through this scheme, the terminal device can set the data write interface in the user space and the kernel space in advance, so that the terminal device can transmit and store the application information obtained in the user space in the kernel space through the data write interface, if the second application needs to call the application information, it does not need to re-acquire the application information, and can directly obtain it from the kernel space; and no matter what application information the terminal device obtains in the user space, it can be stored in the kernel space through the data write interface, so there will be no situation where the user space stores part of the information and the kernel space stores part of the information, which effectively improves the standardization degree of hardware module information storage of the terminal device.
[0118] like Figure 4 As shown, an embodiment of the present application provides a terminal device, the memory space of the terminal device includes: a user space and a kernel space, and the terminal device includes:
[0119] The acquisition module 401 is used to acquire application information corresponding to the first application in the user space, where the application information includes: device information and device operation status;
[0120] The processing module 402 is used to transfer the application information from the user space to the kernel space through a preset data writing interface between the user space and the kernel space, and store the application information in the kernel space.
[0121] Optionally, the processing module 402 is further used to register a device node corresponding to the terminal device in the memory space, where the device node is located between the user space and the kernel space;
[0122] The processing module 402 is further used to set a data writing interface between the user space and the kernel space on the device node.
[0123] Optionally, the processing module 402 is specifically configured to store the device information in the first memory area, and store the device operation status in the second memory area;
[0124] The first memory area and the second memory area are different memory areas in the kernel space.
[0125] Optionally, the processing module 402 is specifically configured to set a plurality of enumeration variables in the kernel space, each enumeration variable corresponding to a hardware module;
[0126] The processing module 402 is specifically used to define a first position index and a second position index of a hardware module corresponding to each enumeration variable in the kernel space;
[0127] The processing module 402 is specifically configured to store the device information of each hardware module in the first memory area according to the corresponding first position index, and store the device operation status of each hardware module in the second memory area according to the corresponding second position index;
[0128] The first location index is used to define the storage location of the device information of each hardware module in the first memory area, and the second location index is used to define the storage location of the device operating status of each hardware module in the second memory area.
[0129] Optionally, the processing module 402 is further configured to transmit the application information from the kernel space to the user space through a pre-set data read interface between the user space and the kernel space when the second application needs to call the application information;
[0130] The processing module 402 is further configured to transmit the application information to the second application program through the user space;
[0131] The first application and the second application are different applications, and the data read interface and the data write interface are different data interfaces set in the device node.
[0132] Optionally, the acquisition module 401 is specifically used to acquire the permission list of the device node when the second application needs to call the application information;
[0133] The processing module 402 is specifically configured to transmit application information from the kernel space to the user space through a pre-set data read interface between the user space and the kernel space if it is detected that the permission list includes the second application.
[0134] Optionally, the processing module 402 is specifically configured to read the device information from the first memory area of the kernel space through the first data read interface and transmit it to the user space, and read the device running status from the second memory area of the kernel space through the second data read interface and transmit it to the user space when the second application needs to call the application information;
[0135] The first data read interface and the second data read interface are different data read interfaces arranged in the device node.
[0136] In the embodiments of the present application, each module can implement the information transmission method provided in the above method embodiments and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0137] like Figure 5 As shown, the embodiment of the present application further provides a terminal device, the memory space of the terminal device includes: a user space and a kernel space, and the terminal device may include:
[0138] A memory 501 storing executable program codes;
[0139] a processor 502 coupled to the memory 501;
[0140] The processor 502 calls the executable program code stored in the memory 501 to execute the information transmission method executed by the terminal device in the above-mentioned method embodiments.
[0141] An embodiment of the present application provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements part or all of the steps of the method in the above method embodiments.
[0142] The embodiments of the present application also provide a computer program product, wherein when the computer program product runs on a computer, part or all of the steps of the methods in the above method embodiments are implemented.
[0143] An embodiment of the present application also provides an application publishing platform, wherein the application publishing platform is used to publish a computer program product, wherein when the computer program product runs on a computer, some or all of the steps of the method in the above method embodiments are implemented.
[0144] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present application.
[0145] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0146] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0148] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several requests for a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform some or all of the steps of the above-mentioned methods of various embodiments of the present application.
[0149] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
Claims
1. An information transmission method, characterized in that: Applied to a terminal device, the memory space of the terminal device includes: a user space and a kernel space, and the method includes: In the user space, obtaining application information corresponding to the first application, the application information including: device information and device operation status; The application information is transmitted from the user space to the kernel space through a preset data writing interface between the user space and the kernel space, and the application information is stored in the kernel space; The kernel space includes: a first memory area and a second memory area, and storing the application information in the kernel space includes: Setting a plurality of enumeration variables in the kernel space, each enumeration variable corresponding to a hardware module; Define a first position index and a second position index of a hardware module corresponding to each of the enumeration variables in the kernel space; The device information of each hardware module is stored in the first memory area according to the corresponding first position index, and the device operation status of each hardware module is stored in the second memory area according to the corresponding second position index; The first location index is used to define the storage location of the device information of each hardware module in the first memory area, and the second location index is used to define the storage location of the device operating status of each hardware module in the second memory area.
2. The method according to claim 1, characterized in that Before obtaining the application information through the first application in the user space, the method further includes: In the memory space, registering a device node corresponding to the terminal device, the device node being located between the user space and the kernel space; On the device node, a data writing interface between the user space and the kernel space is set.
3. The method according to claim 1, characterized in that The first memory area and the second memory area are different memory areas in the kernel space.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through a pre-set data read interface between the user space and the kernel space; transmitting the application information to the second application program through the user space; The first application and the second application are different applications, and the data read interface and the data write interface are different data interfaces set in the device node.
5. The method according to claim 4, characterized in that When the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through a pre-set data read interface between the user space and the kernel space, including: When the second application needs to call the application information, obtain the permission list of the device node; If it is detected that the permission list includes the second application, the application information is transmitted from the kernel space to the user space through the pre-set data read interface between the user space and the kernel space.
6. The method according to claim 4, characterized in that The data read interface includes: a first data read interface and a second data read interface, and when the second application needs to call the application information, the application information is transmitted from the kernel space to the user space through the pre-set data read interface between the user space and the kernel space, including: When the second application needs to call the application information, the device information is read from the first memory area of the kernel space through the first data read interface and transmitted to the user space, and the device operation status is read from the second memory area of the kernel space through the second data read interface and transmitted to the user space; The first data read interface and the second data read interface are different data read interfaces set in the device node.
7. A terminal device, characterized in that: The memory space of the terminal device includes: user space and kernel space, including: An acquisition module, configured to acquire application information corresponding to the first application in the user space, wherein the application information includes: device information and device operation status; a processing module, configured to transmit the application information from the user space to the kernel space through a preset data writing interface between the user space and the kernel space, and store the application information in the kernel space; The kernel space includes: a first memory area and a second memory area, the processing module is specifically used to set a plurality of enumeration variables in the kernel space, each enumeration variable corresponds to a hardware module; define a first position index and a second position index of the hardware module corresponding to each enumeration variable in the kernel space; save the device information of each hardware module in the first memory area according to the corresponding first position index, and save the device operation status of each hardware module in the second memory area according to the corresponding second position index; The first location index is used to define the storage location of the device information of each hardware module in the first memory area, and the second location index is used to define the storage location of the device operating status of each hardware module in the second memory area.
8. A terminal device, characterized in that: The memory space of the terminal device includes: user space and kernel space, including: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the information transmission method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the information transmission method according to any one of claims 1 to 6.
Citation Information
Patent Citations
System and method for optimizing host network performance
CN101616194A
Method and device for communication between kernel mode and user mode and terminal
CN108062253A
Method and device for improving the calling efficiency of system command line interface
CN109062713A
Data processing method, device and equipment, and readable storage medium
CN110147296A
Block device access tracking method and device, storage medium and terminal
CN110955584A
