WO2023134411A1 - Information transmission method, terminal apparatus, and storage medium - Google Patents

Information transmission method, terminal apparatus, and storage medium Download PDF

Info

Publication number
WO2023134411A1
WO2023134411A1 PCT/CN2022/140518 CN2022140518W WO2023134411A1 WO 2023134411 A1 WO2023134411 A1 WO 2023134411A1 CN 2022140518 W CN2022140518 W CN 2022140518W WO 2023134411 A1 WO2023134411 A1 WO 2023134411A1
Authority
WO
WIPO (PCT)
Prior art keywords
space
information
kernel space
interface
application
Prior art date
Application number
PCT/CN2022/140518
Other languages
French (fr)
Chinese (zh)
Inventor
侯志鹏
Original Assignee
闻泰通讯股份有限公司
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 闻泰通讯股份有限公司 filed Critical 闻泰通讯股份有限公司
Publication of WO2023134411A1 publication Critical patent/WO2023134411A1/en

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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Definitions

  • the embodiments of the present disclosure relate to the technical field of data storage, and in particular, to an information transmission method, a terminal device, and a storage medium.
  • each application program will obtain multiple pieces of information corresponding to multiple hardware modules when it is running.
  • the storage method is not uniform, so each application program stores hardware module information in a different way, which will lead to a low degree of standardization for each application program to store hardware module information.
  • an information transmission method a terminal device, and a storage medium are provided.
  • An information transmission method applied to a terminal device, the memory space of the terminal device includes: a user space and a kernel space, the method includes: in the user space, obtaining application information corresponding to a first application program, the Application information includes: device information and device operating status;
  • the method further includes:
  • the device node In the memory space, register a device node corresponding to the terminal device, the device node is located between the user space and the kernel space;
  • a data writing interface between the user space and the kernel space is set.
  • the kernel space includes: a first memory area and a second memory area, and storing the application information in the kernel space includes:
  • the first memory area and the second memory area are different memory areas in the kernel space.
  • the storing the device information in the first memory area, and storing the device operating state in the second memory area includes:
  • the first location index is used to define the storage location of the device information of each hardware module in the first memory area
  • the second location index is used to define the device operation status of each hardware module in the The storage location in the second memory area.
  • the method also includes:
  • the application information is transmitted from the kernel space to the user through the preset data readout interface between the user space and the kernel space. space;
  • first application program and the second application program are different application programs
  • the data read interface and the data write interface are different data interfaces provided in the device node.
  • the second application program needs to call the application information, through the preset data read interface between the user space and the kernel space, from the kernel space Transmitting the application information to the user space, including:
  • the application program is read from the kernel space through the preset data read interface between the user space and the kernel space. Information is transferred to the user space.
  • the data readout interface includes: a first data readout interface and a second data readout interface, and when the second application program needs to call the application information, the pre-set
  • the data readout interface between the user space and the kernel space, which transmits the application information from the kernel space to the user space includes:
  • the device information is read from the first memory area of the kernel space through the first data readout interface and transmitted to the user space, And through the second data readout interface, read the operating state of the device from the second memory area of the kernel space and transmit it to the user space;
  • the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
  • an embodiment of the present disclosure provides a terminal device, the memory space of the terminal device includes: user space and kernel space, and the terminal device includes:
  • An acquisition module configured to acquire application information corresponding to the first application program in the user space, where the application information includes: device information and device operating 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 save the application information in the kernel space.
  • the processing module is further configured to register a device node corresponding to the terminal device in the memory space, and the device node is located between the user space and the kernel space between;
  • the processing module is further configured to set a data writing interface between the user space and the kernel space on the device node.
  • the kernel space includes: a first memory area and a second memory area;
  • the processing module is further configured to save the device information in the first memory area, and save the device operating state in the second memory area;
  • the first memory area and the second memory area are different memory areas in the kernel space.
  • the processing module is further configured to set a plurality of enumeration variables in the kernel space, and each enumeration variable corresponds to a hardware module;
  • the processing module is further configured to define a first location index and a second location index of the hardware module corresponding to each enumerated variable in the kernel space;
  • the processing module is further configured to save the device information of each hardware module in the first memory area according to the corresponding first location index, and store the device operating state of each hardware module according to the corresponding second location index stored in the second memory area;
  • the first location index is used to define the storage location of the device information of each hardware module in the first memory area
  • the second location index is used to define the device operation status of each hardware module in the The storage location in the second memory area.
  • the processing module is further configured to, when the second application program needs to call the application information, through the preset data readout interface between the user space and the kernel space , transmitting the application information from the kernel space to the user space;
  • the processing module is further configured to transmit the application information to the second application program through the user space;
  • first application program and the second application program are different application programs
  • the data read interface and the data write interface are different data interfaces provided in the device node.
  • the obtaining module is further configured to obtain the permission list of the device node when the second application program needs to call the application information
  • the processing module is further configured to, if it is detected that the permission list includes the second application program, through the preset data read-out interface between the user space and the kernel space, read from the The application information is transmitted from the kernel space to the user space.
  • the data readout interface includes: a first data readout interface and a second data readout interface
  • the processing module is further configured to read the device information from the first memory area of the kernel space through the first data readout interface when the second application program needs to call the application information And transmit to the user space, and read the operating state of the device from the second memory area of the kernel space through the second data readout interface and transmit to the user space;
  • the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
  • a terminal device the memory space of the terminal device includes: user space and kernel space, the terminal device includes:
  • a processor coupled to the memory
  • the processor invokes the executable program code stored in the memory to execute the above information transmission method.
  • a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned information transmission method is realized.
  • a computer program product when the computer program product is run on a computer, it can realize some or all steps of any one of the above-mentioned methods.
  • An application distribution platform which is used to distribute computer program products, wherein, when the computer program products run on a computer, part or all of the steps of any one of the above-mentioned methods are realized.
  • FIG. 1 is a first schematic flowchart of an information transmission method provided by one or more embodiments of the present disclosure
  • FIG. 2 is a second schematic flowchart of an information transmission method provided by one or more embodiments of the present disclosure
  • Fig. 3 is a schematic structural diagram of a memory space of a terminal device provided by one or more embodiments of the present disclosure
  • FIG. 4 is a first structural schematic diagram of a terminal device provided by one or more embodiments of the present disclosure.
  • Fig. 5 is a second schematic structural diagram of a terminal device provided by one or more embodiments of the present disclosure.
  • first and second and the like in the specification and claims of the present disclosure are used to distinguish different objects, not to describe a specific order of objects.
  • first application program and the second application program are used to distinguish different application programs, rather than to describe a specific order of the application programs.
  • Kernel It belongs to the kernel of the operating system and provides the most basic functions of the operating system. Manage system processes, memory, device drivers, etc.
  • Proc It is a directory of a file system in the Linux system, which can provide corresponding information through various file nodes.
  • ioctl In the Linux system code, the user space controls the kernel space of the device node, and realizes functions such as parameter setting and data transmission.
  • misc_register A function to register devices in the Linux system kernel, so that the system generates corresponding device nodes.
  • Terminal devices With the development of science and technology, a variety of terminal devices appear in people's daily life, and various applications are installed in the terminal devices. Different applications can provide various functions. Terminal devices start these applications This makes it easier for users to use the provided functions.
  • the terminal device involved in this embodiment of the present disclosure may be a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a vehicle-mounted terminal device, a wearable device, an Ultra-Mobile Personal Computer (Ultra-Mobile Personal Computer, UMPC), a netbook, or a personal Digital Assistant (Personal Digital Assistant, PDA) and other electronic devices.
  • the wearable device may be a smart watch, a smart bracelet, a watch phone, a smart anklet, a smart earring, a smart necklace, a smart earphone, etc., which are not limited in this embodiment of the present disclosure.
  • the operating system of the terminal device can be an Android system, an iOS system, a Linux system, etc.,
  • different operating systems can be used for the development of the terminal equipment.
  • the application program can be compiled based on different operating systems, run on the corresponding operating systems, and provide the basic functions that it can provide.
  • the operating system of the terminal device can also monitor relevant information in the operating system, such as processes, memory usage, driver information of the terminal device, operating system operation or abnormal records, etc. These information are provided by the operating system and managed by the operating system, and can be used in the process of system application and development. Basically, it is also some routine information. For example, in the development and application process of terminal equipment and systems, data synchronization between different databases is a common application.
  • the operating system For the basic information that the system can obtain, the operating system also needs to obtain specific content (determined by the design of the terminal manufacturer), and pass these basic information and specific content to the manufacturer's own application program.
  • specific content determined by the design of the terminal manufacturer
  • an application program obtains specific content, it is often obtained based on a module created by the manufacturer itself, that is, through the interaction between this module and the operating system, the content of the above-mentioned features that need to be obtained is obtained.
  • the operating system platform For example, if you want to obtain platform-related information in an application project developed by a manufacturer, you can first use some methods provided by the operating system platform: read node information in the proc directory; call system-specific attributes; view system logs, etc. wait. Then transmit the read information through some interfaces or file systems provided by the operating system, and on this basis, developers add the information they need to obtain. Among them, in the process of obtaining customized information through the developer's customized module, the corresponding character string is generally generated in the driver application program according to the detection of the corresponding device or event, and saved to the developer's customized module for maintenance. Finally, the module will also provide a function interface to pass the information in this memory to the application program.
  • the interface and file system provided by the current operating system platform cannot meet the customization information of all application program manufacturers.
  • Application program manufacturers need to customize their own modules and function interfaces, and the terminal device driver-related information that needs to be customized is not very good.
  • application vendors usually only care about the information they need to obtain, and do not pay much attention to the reuse of this information (such as allowing other applications or function calls) and compatibility.
  • the device information may need to be obtained in another detection application scenario, but there is no unified interface between the manufacturers of the two application programs, and the device information needs to be obtained again for the detection application scenario.
  • the interface for transmitting information corresponding to the customized module is done in the user space or the kernel space.
  • some information that needs to be obtained is more convenient to obtain from the kernel, and some information that needs to be obtained is more suitable to be obtained from user space, so different companies and projects may have different methods, and the kernel driver and user space are not suitable.
  • the interaction method is not conducive to standardization and normalization.
  • the device will be detected in the kernel driver first, and after the detection is successful, the specific model and manufacturer of the device used can be corresponding to the information. So for most devices, if you want to obtain customized information, you can customize the interface in the kernel driver.
  • Some devices have a special software process (such as a camera), because this part of the device driver already has a complete process, and the detection result is returned to the user space and a corresponding string has been generated. At this time, it is relatively easy to obtain customized information in the user space. convenient. If the interface is made in the kernel driver, it will cause a lot of repetitive work of judging and generating strings (because several cameras are used in the project, and each camera may have two or three suppliers), and the code quality is not high.
  • a special software process such as a camera
  • the execution subject of the information transmission method provided by the embodiments of the present disclosure may be the above-mentioned terminal device, or may be a functional module and/or a functional entity in the terminal device capable of implementing the information transmission method, which may be specifically determined according to actual usage requirements,
  • the embodiments of the present disclosure are not limited.
  • the following uses a terminal device as an example to illustrate the information transmission method provided by the embodiments of the present disclosure.
  • FIG. 1 is a first schematic flowchart of an information transmission method provided by one or more embodiments of the present disclosure. As shown in Figure 1, the information transmission method may include the following steps:
  • the terminal device may obtain application information corresponding to the first application program when running the first application program.
  • the application programs are stored in the user space in a file format
  • the application information corresponding to the first application program acquired by the terminal device is stored in the user space.
  • the application information includes: device information and device operating status; the device can include various hardware modules in the terminal device, such as: display screen, camera, gyroscope, acceleration sensor, etc.; when each application is running, it may Call the function of a device in the terminal device, correspondingly, the terminal device can also obtain the device information and device running status corresponding to the device.
  • the device information may include information such as the device number, model, and manufacturer of the hardware module.
  • the running state of the device is the state of the hardware module during operation, such as: working state, pause state, etc. If a fault occurs , then the device operating status may include: fault type, fault cause, etc.
  • 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 user processes and operating system processes are kept in the memory space.
  • the memory space is a piece of original physical memory.
  • the physical memory is divided. Of course, this division is the logical division of the operating system. There is no well-divided address and space range on the physical memory stick, and the division results of different versions of the operating system are different.
  • 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 user If the data of the process is stored together, it will affect the operation of the system; if the data of the system and the data of the user are stored separately, the data of the system and the data of the user can not interfere with each other, ensuring the stability of the operating system . And if the user data is separated from the system data, access to the two parts of the data can also be controlled to ensure that the user program cannot casually access the data of the operating system, thereby preventing the user program from misoperation or maliciously destroying the system.
  • the terminal device can transmit the application information from the user space to the kernel space through the data writing interface.
  • the data writing interface is an interface set in advance, and the data writing interface is located between the user space and the kernel space. During the period, the data writing interface is an interface for transferring information in the user space to the kernel space.
  • the application information can be stored in the kernel space.
  • the terminal device can delete the application information in the user space, that is, the application information is only stored in the kernel space; the terminal device can also not delete the application information in the user space , that is, application information is stored in both the kernel space and the user space.
  • 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 program in the user space, and the application information includes: device information and Device running state; then the terminal device can transfer application information from user space to kernel space through the pre-set data writing interface between user space and kernel space, and save the application information in kernel space.
  • the terminal device can pre-set the data writing interface in the user space and the kernel space, so that the terminal device can write the application information obtained in the user space through the data writing interface, transmit and store it in the kernel space , 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 writing interface, and there will be no part of the information stored in the user space. Partial information is stored in the kernel space, which effectively improves the degree of standardization of terminal equipment storage hardware module information.
  • FIG. 2 is a schematic flow diagram II of an information transmission method provided by one or more embodiments of the present disclosure. As shown in FIG. 2, the information transmission method may include the following steps:
  • the terminal device may first register the device node of the terminal device in the memory space.
  • devices under the Linux operating system are generally divided into three categories: character devices, block devices, and network devices.
  • the corresponding device drivers are also divided into three categories: character device drivers, block device drivers, and network device drivers.
  • Common character devices include mouse, keyboard, serial port, console, etc.
  • Common block devices include various hard disks, flash disks, random access memory (RAM) disks, and the like.
  • the device node is created in the /dev directory, which 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 can be equivalent to the index node of the hard disk (inode), which records the location and information of the hardware device.
  • the device node is an abstract description of the device in the Linux operating system.
  • a device node is a file, that is, a A device node is just a device.
  • Applications access devices through standardized call functions that are independent of any particular driver.
  • registering the device node corresponding to the terminal device may specifically include: in the memory space, first generate according to the string format based on the device driver name, device node name and related parameters related to device driver loading and device node creation The device driver file list, and then pre-store the device driver file list in a device file storage independent of the memory space; the terminal device can read the files in the device driver file list, and create a device node according to the device driver file list, The device node is then saved in the device file memory.
  • the device file storage may be a flash storage, or a RAM storage, and the like.
  • 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 allocated by the Linux operating system number, and then the terminal device can create a device node according to the device node name, related parameters, and device node number.
  • the device node number may include: a major device number and a slave device number.
  • the terminal device before the terminal device reads the files in the device driver file list, it can also judge whether the device node has been created according to the mark on the device file storage. If the device node has been created, then the terminal device can directly call the storage device node; if no device node has been created, then the terminal device needs to read the file in the device driver file list, and create a device node according to the device driver file list, and then save the device node in the device file memory for future use follow-up needs.
  • the terminal device needs to delete all device nodes stored in the device file storage, and then read the device file list, and repeat
  • the step of generating a device driver file list in a string format is used to obtain the device node corresponding to the new device driver file list.
  • the terminal device only needs to create a device node for the first time when the Linux operating system is started.
  • the terminal device only needs to call the previously stored device node, which not only saves the dynamic process of device node creation, but also ensures the startup speed of the Linux operating system.
  • a data writing interface can be set on the device node.
  • the data writing node is a data transmission channel between the kernel space and the user space.
  • the terminal device can pass The data writing interface transfers application information from the user space to the kernel space, and the data writing interface is located between the user space and the kernel space.
  • FIG. 3 is a schematic structural diagram of a memory space of a terminal device provided by one or more embodiments of the present disclosure.
  • the memory space 31 of the terminal device includes user space and In the kernel space, a device node 32 is set between the user space and the kernel space, and a data writing interface 321 is set on the device node 32.
  • the terminal device can write the application information in the user space to the kernel space through the data writing interface 321 middle.
  • steps 203-205 please refer to the detailed description of steps 101-103 in the embodiment, which will not be repeated in the embodiment of the present disclosure.
  • storing the application information in the kernel space may specifically include: storing the device information in the first memory area, and storing the device running state in the second memory area.
  • the first memory area and the second memory area are two different memory areas in the kernel space of the terminal device, which are respectively used to store device information and device operating status.
  • the terminal device stores application information in the kernel space, and can store device information and device running status separately, that is, the terminal device can divide two memory areas in the kernel space, and one memory area is used to store the device information, another memory area is used to hold the device operating state.
  • the terminal device can write the application information in the user space into the kernel space through the data writing interface 321, and save the device information in the first memory area 33, and save the device operating state stored in the second memory area 34.
  • the terminal device when the terminal device divides the two memory areas, it divides by applying for memory; the applied memory may include: static memory and dynamic memory.
  • static memory refers to the memory allocated by the compiler when the program starts to run. Its allocation is completed when the program starts to compile and does not occupy CPU resources; when the user cannot determine the size of the space, or the space is too large, the memory on the stack When allocation is not possible, dynamic memory allocation is used.
  • the terminal device may apply for a static memory to store application information.
  • the terminal device can store the device information and device running status of the hardware module separately in two memory areas in the kernel space, so that the terminal device can quickly make differentiated calls and reduce the workload of the terminal device.
  • the terminal device saves the device information in the first memory area, and saves the device operating state in the second memory area, which may specifically include:
  • each enumeration variable corresponds to a hardware module; define the first position index and the second position index of the hardware module corresponding to each enumeration variable in the kernel space; set each 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
  • the second location index is used to define the storage location of the device operating state of each hardware module in the second memory area .
  • the terminal device after the terminal device divides the kernel space into two memory areas, it can store device information and device operating status in the two memory areas respectively, and the terminal device needs to store according to the preset location index when storing , so 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, and the enumeration variable can be used to identify the location index of the hardware module, that is, to identify the hardware module's The location and order in which application information is stored in memory.
  • the position index of the corresponding hardware module can be defined for each enumeration variable.
  • the position index can be divided into: a first position index and a second position index.
  • the first position index can be used for Define the storage location of the device information of each hardware module in the first memory area
  • the second location index is used to define the storage location of the device running state of each hardware module in the second memory area, that is, each hardware module has There are two parameters of device information and device operating status.
  • the terminal device When the terminal device stores the device information and device operating status in the kernel space, it can save the device information of the hardware module in the first memory area in the kernel space according to the first position index , and save the device running state of the hardware module in the second memory area in the kernel space according to the second position index.
  • 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 state of the hardware module in the second memory area. Location.
  • the location index of each hardware module is different.
  • the location index of its 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 prevent the terminal device from saving the application information at will, and make the application information stored in the kernel space more orderly.
  • the terminal device after the terminal device saves the application information in the kernel space in advance, if the second application program in the user space needs to call the application information, then the terminal device can transfer the application information from the kernel space to the user space .
  • the terminal device transmits the application information through the data readout interface
  • the data readout interface is an interface set in advance
  • the data readout interface is located between the user space and the kernel space
  • the data readout interface is used Used to transfer information from kernel space to user space.
  • first application program and the second application program are different application programs, and the data read interface and the data write interface are different data interfaces set in the device node.
  • the terminal device can save the application information from the user space to the kernel space through the data writing interface; when another application program, that is, the second application program needs to call the application information, The terminal device can transmit application information from the kernel space to the user space through the data readout interface.
  • the application information is transferred from the kernel space to the user space through the preset data readout interface between the user space and the kernel space, which may specifically include:
  • the second application program When the second application program 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 program, then through the pre-set data readout interface between the user space and the kernel space, from the kernel The application information is transferred from the user space to the user space.
  • the terminal device needs to call the application information from the kernel space. Before calling, it needs to check the application permission first. Therefore, the terminal device The permission list of the device node can be obtained. The permission list is set when the device node is registered. If the permission list includes the second application program, it means that the second application program can call the application information from the kernel space. Therefore, the terminal device The application information can be transferred from the kernel space to the user space through the data readout interface; if the second application program is not included in the permission list, it means that the second application program cannot call the application information from the kernel space, then the terminal device There is no need to call application information from kernel space.
  • the terminal device can set permissions for the device node, and only the application program with the permission can call the application information from the kernel space. It can also guarantee the security of application information.
  • the application information is transferred from the kernel space to the user space through the preset data readout interface between the user space and the kernel space, which may specifically include:
  • the second application program When the second application program needs to call the application information, it reads the device information from the first memory area of the kernel space through the first data readout interface and transmits it to the user space, and through the second data readout interface, reads the device information from the kernel space
  • the device operating state is read from the second memory area of the device and transferred to user space.
  • the application information includes: device information and device operating status
  • the device information is stored in the first memory area of the kernel space
  • the device operating status is stored in the second memory area of the kernel space
  • the terminal device can respectively read the device information and the device operation status through the two data readout interfaces; that is, the terminal device can read the device information through the first data readout interface and transfer the device information from the The first memory area of the kernel space is transmitted to the user space, and then the operating state of the device is read through the second data readout interface, and the operating state of the device is transferred from the second memory area of the kernel space to the user space.
  • the data readout interface may include: a first data readout interface and a second data readout interface, the first data readout interface and the second data readout interface are different data readout interfaces set in the device node .
  • the device node may include at least three data interfaces, which are: a data write interface, a first data read interface, and a second data read interface.
  • the data writing interface is a data interface for the terminal device to transfer application information from the user space to the kernel space
  • the first data readout 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 readout interface is a data interface for the terminal device to transmit the operating state of the device from the second memory area of the kernel space to the user space.
  • 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 are provided on the device node 323.
  • the terminal device can write the application information in the user space into the kernel space through the data writing interface 321, and can also read the device information from the first memory area 33 in the kernel space to the user space through the first data readout interface 322.
  • the operating status of the device can also be read from the second memory area 34 in the kernel space to the user space through the second data readout interface 323 .
  • the data writing interface 321, the first data reading interface 322 and the second data reading interface 323 in FIG. 3 above can all be implemented by ioctl.
  • this solution can configure a device-related information and operation function through the kernel code, call misc_register(&devInfo_device) to register the device node, and implement the ioctl driven by the device.
  • the first interface is the data write interface 321
  • the second interface is the first data read interface 322
  • the third interface is the second data read interface 323.
  • the data writing interface 321 is equivalent to an interface for setting user space strings (that is, application information can be expressed in the form of strings) into the kernel, and saving them to the memory managed by the devInfo module (equivalent to the dev directory) , and sorted by defined module index.
  • the first data readout interface 322 is an interface for transferring the memory managed by the devInfo module storing device information to the user space.
  • the driver part will complete the detection of each module, and also call the devInfo interface to write the detection result string into the memory of the devInfo module, so the user space can obtain the memory of the devInfo module in the kernel through this interface.
  • the desired device information is obtained.
  • the second data readout interface 323 is an interface for transferring the memory managed by the devInfo module and storing the operating state of the device to the user space. This interface is similar to the first data readout interface 322 . It is just that the first data readout interface 322 stores information such as device model and manufacturer, which have been stored during the startup process of the operating system. The information transmitted by the second data readout interface 323 is the running status stored in the devInfo module in the kernel, which will be used for monitoring applications during the entire cycle of operating system running.
  • this part of the logic is generally that if some abnormality occurs during the operation of the driver software, the abnormality is recorded and summarized, and a corresponding character string is generated and stored in the allocated memory, which can also be realized through the second data readout interface 323. Abnormal monitoring of device operation.
  • the first data readout interface 322 and the second data readout interface 323 are designed independently of each other and can be used for different applications. Therefore, both interfaces may be used in an application development project, or only one of them may be selected.
  • an application or process in the operating system when an application or process in the operating system needs to obtain hardware information or device operation status, it can directly call the devInfo module: first, it is necessary to configure the permission to access the device node in the code, and then run it in the Open the dev/devInfo device node in the system, and then call the interface provided by ioctl to transfer memory information to get the string information. You don’t need to implement a set of driver codes to do these tasks. In this way, if there are multiple applications or processes in the operating system that want to obtain hardware-related information, they can directly open dev/devInfo to use, reducing related code work, and the overall code structure is relatively simple.
  • the application information may be transmitted to the second application program for calling when the second application program is running.
  • the terminal device can first set up a device node in the memory space, and then set a data writing interface on the device node, and then obtain the application information corresponding to the first application program 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 writing interface, and save the application information in the kernel space; then if the second application program needs to call
  • the application information can be transmitted from the kernel space to the user space through the data readout interface, and then transmitted to the second application program.
  • the terminal device can pre-set the data writing interface in the user space and the kernel space, so that the terminal device can write the application information obtained in the user space through the data writing interface, transmit and store it in the kernel space , if the second application program wants to call the application information, it does not need to obtain the application information again, it can be obtained directly from the kernel space; and no matter what application information the terminal device obtains in the user space, it can pass the data
  • the write interface is stored in the kernel space, 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 of terminal equipment storage hardware module information.
  • this solution organizes hardware-related information into a highly standardized module, making the software structure clearer and more concise, enabling the kernel space to directly access the existing information in the user space during the normalization work, avoiding duplication and confusion
  • the result is that the code is clearer and easier to use, which improves the clarity of the code implemented on the software after the unified interface, and the code quality is higher.
  • FIG. 4 is a schematic structural diagram of a terminal device provided by one or more embodiments of the present disclosure.
  • the memory space of the terminal device includes: user space and kernel space
  • the terminal device includes :
  • An acquisition module 401 configured to acquire application information corresponding to the first application program in user space, where the application information includes: device information and device operating status;
  • the processing module 402 is configured 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.
  • the processing module 402 is also configured to register a device node corresponding to the terminal device in the memory space, and the device node is located between the user space and the kernel space;
  • the processing module 402 is further configured to set a data writing interface between the user space and the kernel space on the device node.
  • processing module 402 is specifically configured to save the device information in the first memory area, and save the device operating state in the second memory area;
  • the first memory area and the second memory area are different memory areas in the kernel space.
  • the processing module 402 is specifically configured to set multiple enumeration variables in the kernel space, each enumeration variable corresponds to a hardware module;
  • the processing module 402 is specifically configured to define a first position index and a second position index in the kernel space of the hardware module corresponding to each enumerated variable;
  • the processing module 402 is specifically configured to save the device information of each hardware module in the first memory area according to the corresponding first location index, and save the device running state of each hardware module in the first memory area according to the corresponding second location index.
  • the second memory area In the second memory area;
  • the first location index is used to define the storage location of the device information of each hardware module in the first memory area
  • the second location index is used to define the storage location of the device operating state of each hardware module in the second memory area .
  • the processing module 402 is also used to transmit the application information from the kernel space to the user space through the preset data readout interface between the user space and the kernel space when the second application program needs to call the application information ;
  • the processing module 402 is further configured to transmit the application information to the second application program through the user space;
  • first application program and the second application program are different application programs
  • the data read interface and the data write interface are different data interfaces set in the device node.
  • the obtaining module 401 is specifically used to obtain the permission list of the device node when the second application program needs to call the application information;
  • the processing module 402 is specifically configured to transmit application information from the kernel space to the user space through a preset data readout interface between the user space and the kernel space if it is detected that the permission list includes the second application program.
  • the processing module 402 is specifically configured to read the device information from the first memory area of the kernel space and transmit it to the user space through the first data readout interface when the second application program needs to call the application information, and Read the operating state of the device from the second memory area of the kernel space and transmit it to the user space through the second data readout interface;
  • the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
  • each module can implement the information transmission method provided by the above method embodiments, and can achieve the same technical effect. To avoid repetition, details are not repeated here.
  • FIG. 5 is a second structural diagram of a terminal device provided by one or more embodiments of the present disclosure.
  • the memory space of the terminal device includes: user space and kernel space, and the terminal device can include:
  • a memory 501 storing executable program codes
  • processor 502 coupled to the memory 501;
  • the processor 502 invokes the executable program code stored in the memory 501 to execute the information transmission method performed by the terminal device in the foregoing method embodiments.
  • Embodiments of the present disclosure provide a computer-readable storage medium, which stores a computer program, wherein when the computer program is executed by a processor, some or all steps of the methods in the above method embodiments are implemented.
  • Embodiments of the present disclosure also provide a computer program product, wherein when the computer program product is run on a computer, some or all of the steps of the method in the above method embodiments are implemented.
  • Embodiments of the present disclosure also provide an application distribution platform, wherein the application distribution platform is used to distribute computer program products, wherein, when the computer program products run on the computer, part or all of the methods in the above method embodiments are implemented step.
  • sequence numbers of the above-mentioned processes do not necessarily mean the order of execution, and the execution order of each process should be determined by its functions and internal logic, and should not be used in the implementation of the present disclosure.
  • the implementation of the examples constitutes no limitation.
  • the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, located in one place, or distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the above-mentioned integrated units are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-accessible memory.
  • the technical solution of the present disclosure 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, and the computer software product is stored in a memory , including several requests to make a computer device (which may be a personal computer, a server, or a network device, etc., specifically, a processor in the computer device) execute part or all of the steps of the above-mentioned methods in various embodiments of the present disclosure.
  • a computer device which may be a personal computer, a server, or a network device, etc., specifically, a processor in the computer device
  • ROM read-only Memory
  • RAM random access memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read Only Memory
  • OTPROM One-time Programmable Read-Only Memory
  • EEPROM Electronically Erasable Programmable Read-Only Memory
  • CD-ROM Compact Disc Read-Only Memory
  • the terminal device writes the application information obtained in the user space into the interface through the data, transmits and stores it in the kernel space, and when it is necessary to obtain the stored information, it can be directly obtained from the kernel space and any application information acquired by the terminal device in the user space can be stored in the kernel space through the data writing 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. It effectively improves the standard unification degree of terminal equipment storage hardware module information, and has strong industrial applicability.

Abstract

Disclosed in embodiments of the present disclosure are an information transmission method, a terminal apparatus, and a storage medium, applied to the technical field of data storage, and capable of solving the problem that the standard normalization degree of storage of hardware module information by each application is low. The memory space of the terminal apparatus comprises: user space and kernel space. The method comprises: in user space, obtaining application information corresponding to a first application, the application information comprising: device information and a device operation state; and transmitting the application information from the user space to kernel space by means of a preset data write interface between the user space and the kernel space, and storing the application information in the kernel space.

Description

信息传输方法、终端设备及存储介质Information transmission method, terminal device and storage medium
相关交叉引用related cross reference
本公开要求于2022年01月17日提交中国专利局、申请号为202210051915.X、发明名称为“信息传输方法、终端设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。This disclosure claims the priority of the Chinese patent application with the application number 202210051915.X and the title of the invention "information transmission method, terminal equipment and storage medium" submitted to the China Patent Office on January 17, 2022, the entire contents of which are incorporated by reference in this disclosure.
技术领域technical field
本公开实施例涉及数据存储技术领域,尤其涉及一种信息传输方法、终端设备及存储介质。The embodiments of the present disclosure relate to the technical field of data storage, and in particular, to an information transmission method, a terminal device, and a storage medium.
背景技术Background technique
在终端设备和系统的开发和应用过程中,每个应用程序在运行时都会获取多个硬件模块分别对应的多项信息,那么由于不同开发商或是应用研发商制定的对于硬件模块的信息的存储方式不统一,因此每个应用程序存储硬件模块信息的方式不同,这样就会导致每个应用程序存储硬件模块信息的标准统一化程度较低。In the development and application process of terminal equipment and systems, each application program will obtain multiple pieces of information corresponding to multiple hardware modules when it is running. The storage method is not uniform, so each application program stores hardware module information in a different way, which will lead to a low degree of standardization for each application program to store hardware module information.
发明内容Contents of the invention
(一)要解决的技术问题(1) Technical problems to be solved
在现有技术中,由于每个应用程序存储硬件模块信息的方式不同,这样就会导致每个应用程序存储硬件模块信息的标准统一化程度较低的问题。In the prior art, since each application program stores hardware module information in a different way, this will lead to a problem of low standardization of each application program for storing hardware module information.
(二)技术方案(2) Technical solution
根据本公开公开的各种实施例,提供一种信息传输方法、终端设备及存储介质。According to various embodiments of the present disclosure, an information transmission method, a terminal device, and a storage medium are provided.
一种信息传输方法,应用于终端设备,所述终端设备的内存空间包括:用户空间和内核空间,所述方法包括:在所述用户空间中,获取第一应用程序对应的应用信息,所述应用信息包括:器件信息和器件运行状态;An information transmission method, applied to a terminal device, the memory space of the terminal device includes: a user space and a kernel space, the method includes: in the user space, obtaining application information corresponding to a first application program, the Application information includes: device information and device operating status;
通过预先设置的所述用户空间和所述内核空间之间的数据写入接口,将所述应用信息从所述用户空间传输至所述内核空间,并将所述应用信息保存在所述内核空间中。Transmitting 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 saving the application information in the kernel space middle.
作为一种可选的实施方式,所述在所述用户空间中,通过第一应用程序获取应用信息之前,所述方法还包括:As an optional implementation manner, in the user space, before obtaining the application information through the first application program, the method further includes:
在所述内存空间中,注册与所述终端设备对应的设备节点,所述设备节点位于所述用户空 间和所述内核空间之间;In the memory space, register a device node corresponding to the terminal device, the device node is 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.
作为一种可选的实施方式,所述内核空间包括:第一内存区域和第二内存区域,所述将所述应用信息保存在所述内核空间中,包括:As an optional implementation manner, the kernel space includes: a first memory area and a second memory area, and storing the application information in the kernel space includes:
将所述器件信息保存在所述第一内存区域中,以及将所述器件运行状态保存在所述第二内存区域中;storing the device information in the first memory area, and storing the device operating state in the second memory area;
其中,所述第一内存区域和所述第二内存区域为所述内核空间中不同的内存区域。Wherein, the first memory area and the second memory area are different memory areas in the kernel space.
作为一种可选的实施方式,所述将所述器件信息保存在所述第一内存区域中,以及将所述器件运行状态保存在所述第二内存区域中,包括:As an optional implementation manner, the storing the device information in the first memory area, and storing the device operating state in the second memory area includes:
在所述内核空间中设置多个枚举变量,每个枚举变量与一个硬件模块对应;Setting a plurality of enumeration variables in the kernel space, each enumeration variable corresponding to a hardware module;
定义与所述每个枚举变量对应的硬件模块在所述内核空间中的第一位置索引和第二位置索引;defining a first position index and a second position index in the kernel space of the hardware module corresponding to each enumerated variable;
将每个硬件模块的器件信息按照对应的第一位置索引保存在所述第一内存区域中,以及将每个硬件模块的器件运行状态按照对应的第二位置索引保存在所述第二内存区域中;storing the device information of each hardware module in the first memory area according to the corresponding first location index, and saving the device running state of each hardware module in the second memory area according to the corresponding second location index middle;
其中,所述第一位置索引用于定义每个硬件模块的器件信息在所述第一内存区域中的存放位置,所述第二位置索引用于定义每个硬件模块的器件运行状态在所述第二内存区域中的存放位置。Wherein, 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 device operation status of each hardware module in the The storage location in the second memory area.
作为一种可选的实施方式,所述方法还包括:As an optional implementation, the method also includes:
当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间;When the second application program needs to call the application information, the application information is transmitted from the kernel space to the user through the preset data readout interface between the user space and the kernel space. space;
通过所述用户空间将所述应用信息传输至所述第二应用程序;transmitting the application information to the second application via the user space;
其中,所述第一应用程序和所述第二应用程序为不同的应用程序,所述数据读出接口与所述数据写入接口为设置在设备节点中不同的数据接口。Wherein, the first application program and the second application program are different application programs, and the data read interface and the data write interface are different data interfaces provided in the device node.
作为一种可选的实施方式,所述当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间,包括:As an optional implementation manner, when the second application program needs to call the application information, through the preset data read interface between the user space and the kernel space, from the kernel space Transmitting the application information to the user space, including:
当所述第二应用程序需要调用所述应用信息时,获取设备节点的权限名单;When the second application program 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 program, the application program is read from the kernel space through the preset data read interface between the user space and the kernel space. Information is transferred to the user space.
作为一种可选的实施方式,所述数据读出接口包括:第一数据读出接口和第二数据读出接 口,所述当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间,包括:As an optional implementation manner, the data readout interface includes: a first data readout interface and a second data readout interface, and when the second application program needs to call the application information, the pre-set The data readout interface between the user space and the kernel space, which transmits the application information from the kernel space to the user space, includes:
当所述第二应用程序需要调用所述应用信息时,通过所述第一数据读出接口,从所述内核空间的第一内存区域中读取所述器件信息并传输至所述用户空间,以及通过所述第二数据读出接口,从所述内核空间的第二内存区域中读取所述器件运行状态并传输至所述用户空间;When the second application program needs to call the application information, the device information is read from the first memory area of the kernel space through the first data readout interface and transmitted to the user space, And through the second data readout interface, read the operating state of the device from the second memory area of the kernel space and transmit it to the user space;
其中,所述第一数据读出接口和所述第二数据读出接口为设置在设备节点中不同的数据读出接口。Wherein, the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
另一个方面,本公开实施例提供了一种终端设备,所述终端设备的内存空间包括:用户空间和内核空间,所述终端设备包括:In another aspect, an embodiment of the present disclosure provides a terminal device, the memory space of the terminal device includes: user space and kernel space, and the terminal device includes:
获取模块,配置成在所述用户空间中,获取第一应用程序对应的应用信息,所述应用信息包括:器件信息和器件运行状态;An acquisition module configured to acquire application information corresponding to the first application program in the user space, where the application information includes: device information and device operating 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 save the application information in the kernel space.
作为一种可选的实施方式,所述处理模块,还配置成在所述内存空间中,注册与所述终端设备对应的设备节点,所述设备节点位于所述用户空间和所述内核空间之间;As an optional implementation manner, the processing module is further configured to register a device node corresponding to the terminal device in the memory space, and the device node is located between the user space and the kernel space between;
所述处理模块,还配置成在所述设备节点上,设置所述用户空间和所述内核空间之间的数据写入接口。The processing module is further configured to set a data writing interface between the user space and the kernel space on the device node.
作为一种可选的实施方式,所述内核空间包括:第一内存区域和第二内存区域;As an optional implementation manner, the kernel space includes: a first memory area and a second memory area;
所述处理模块,还配置成将所述器件信息保存在所述第一内存区域中,以及将所述器件运行状态保存在所述第二内存区域中;The processing module is further configured to save the device information in the first memory area, and save the device operating state in the second memory area;
其中,所述第一内存区域和所述第二内存区域为所述内核空间中不同的内存区域。Wherein, the first memory area and the second memory area are different memory areas in the kernel space.
作为一种可选的实施方式,所述处理模块,还配置成在所述内核空间中设置多个枚举变量,每个枚举变量与一个硬件模块对应;As an optional implementation manner, the processing module is further configured to set a plurality of enumeration variables in the kernel space, and each enumeration variable corresponds to a hardware module;
所述处理模块,还配置成定义与所述每个枚举变量对应的硬件模块在所述内核空间中的第一位置索引和第二位置索引;The processing module is further configured to define a first location index and a second location index of the hardware module corresponding to each enumerated variable in the kernel space;
所述处理模块,还配置成将每个硬件模块的器件信息按照对应的第一位置索引保存在所述第一内存区域中,以及将每个硬件模块的器件运行状态按照对应的第二位置索引保存在所述第二内存区域中;The processing module is further configured to save the device information of each hardware module in the first memory area according to the corresponding first location index, and store the device operating state of each hardware module according to the corresponding second location index stored in the second memory area;
其中,所述第一位置索引用于定义每个硬件模块的器件信息在所述第一内存区域中的存放 位置,所述第二位置索引用于定义每个硬件模块的器件运行状态在所述第二内存区域中的存放位置。Wherein, 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 device operation status of each hardware module in the The storage location in the second memory area.
作为一种可选的实施方式,所述处理模块,还配置成当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间;As an optional implementation manner, the processing module is further configured to, when the second application program needs to call the application information, through the preset data readout interface between the user space and the kernel space , transmitting the application information from the kernel space to the user space;
所述处理模块,还配置成通过所述用户空间将所述应用信息传输至所述第二应用程序;The processing module is further configured to transmit the application information to the second application program through the user space;
其中,所述第一应用程序和所述第二应用程序为不同的应用程序,所述数据读出接口与所述数据写入接口为设置在设备节点中不同的数据接口。Wherein, the first application program and the second application program are different application programs, and the data read interface and the data write interface are different data interfaces provided in the device node.
作为一种可选的实施方式,所述获取模块,还配置成当所述第二应用程序需要调用所述应用信息时,获取设备节点的权限名单;As an optional implementation manner, the obtaining module is further configured to obtain the permission list of the device node when the second application program needs to call the application information;
所述处理模块,还配置成若检测到所述权限名单中包括所述第二应用程序,则通过预先设置的所述用户空间和所述内核空间之间的所述数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间。The processing module is further configured to, if it is detected that the permission list includes the second application program, through the preset data read-out interface between the user space and the kernel space, read from the The application information is transmitted from the kernel space to the user space.
作为一种可选的实施方式,所述数据读出接口包括:第一数据读出接口和第二数据读出接口;As an optional implementation manner, the data readout interface includes: a first data readout interface and a second data readout interface;
所述处理模块,还配置成当所述第二应用程序需要调用所述应用信息时,通过所述第一数据读出接口,从所述内核空间的第一内存区域中读取所述器件信息并传输至所述用户空间,以及通过所述第二数据读出接口,从所述内核空间的第二内存区域中读取所述器件运行状态并传输至所述用户空间;The processing module is further configured to read the device information from the first memory area of the kernel space through the first data readout interface when the second application program needs to call the application information And transmit to the user space, and read the operating state of the device from the second memory area of the kernel space through the second data readout interface and transmit to the user space;
其中,所述第一数据读出接口和所述第二数据读出接口为设置在设备节点中不同的数据读出接口。Wherein, the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
一种终端设备,所述终端设备的内存空间包括:用户空间和内核空间,所述终端设备包括:A terminal device, the memory space of the terminal device includes: user space and kernel space, the terminal device includes:
存储有可执行程序代码的存储器;a memory storing executable program code;
与所述存储器耦合的处理器;a processor coupled to the memory;
所述处理器调用所述存储器中存储的所述可执行程序代码,执行如上所述的信息传输方法。The processor invokes the executable program code stored in the memory to execute the above information transmission method.
一种计算机可读存储介质,其存储计算机程序,所述计算机程序被处理器执行时实现如上所述的信息传输方法。A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned information transmission method is realized.
一种计算机程序产品,当所述计算机程序产品在计算机上运行时,实现如上所述的任意一种方法的部分或全部步骤。A computer program product, when the computer program product is run on a computer, it can realize some or all steps of any one of the above-mentioned methods.
一种应用发布平台,所述应用发布平台用于发布计算机程序产品,其中,当所述计算机程序产品在计算机上运行时,实现如上所述的任意一种方法的部分或全部步骤。An application distribution platform, which is used to distribute computer program products, wherein, when the computer program products run on a computer, part or all of the steps of any one of the above-mentioned methods are realized.
本公开的其他特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本公开而了解。本公开的目的和其他优点在说明书、权利要求书以及附图中所特别指出的结构来实现和获得,本公开的一个或多个实施例的细节在下面的附图和描述中提出。Additional features and advantages of the disclosure will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the disclosure. The objectives and other advantages of the disclosure will be realized and attained by the structure particularly pointed out in the written description, claims hereof as well as the accompanying drawings, the details of one or more embodiments of the disclosure being set forth in the accompanying drawings and the description below.
为使本公开的上述目的、特征和优点能更明显易懂,下文特举可选实施例,并配合所附附图,作详细说明如下。In order to make the above objects, features and advantages of the present disclosure more comprehensible, optional embodiments are given below and described in detail in conjunction with the accompanying drawings.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用来解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, In other words, other drawings can also be obtained from these drawings without paying creative labor.
图1是本公开一个或多个实施例提供的一种信息传输方法的流程示意图一;FIG. 1 is a first schematic flowchart of an information transmission method provided by one or more embodiments of the present disclosure;
图2是本公开一个或多个实施例提供的一种信息传输方法的流程示意图二;FIG. 2 is a second schematic flowchart of an information transmission method provided by one or more embodiments of the present disclosure;
图3是本公开一个或多个实施例提供的一种终端设备的内存空间的结构示意图;Fig. 3 is a schematic structural diagram of a memory space of a terminal device provided by one or more embodiments of the present disclosure;
图4是本公开一个或多个实施例提供的一种终端设备的结构示意图一;FIG. 4 is a first structural schematic diagram of a terminal device provided by one or more embodiments of the present disclosure;
图5是本公开一个或多个实施例提供的一种终端设备的结构示意图二。Fig. 5 is a second schematic structural diagram of a terminal device provided by one or more embodiments of the present disclosure.
具体实施方式Detailed ways
为了能够更清楚地理解本公开的上述目的、特征和优点,下面将对本公开的方案进行进一步描述。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。In order to more clearly understand the above objects, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that, in the case of no conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are part of the embodiments of the present disclosure, not all of them. Based on the embodiments in the present disclosure, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present disclosure.
本公开的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一应用程序和第二应用程序等是用于区别不同的应 用程序,而不是用于描述应用程序的特定顺序。The terms "first" and "second" and the like in the specification and claims of the present disclosure are used to distinguish different objects, not to describe a specific order of objects. For example, the first application program and the second application program are used to distinguish different application programs, rather than to describe a specific order of the application programs.
本公开实施例的术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "comprising" and "having" and any variations thereof in the embodiments of the present disclosure are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to expressly instead of those steps or elements listed, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
需要说明的是,本公开实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本公开实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。It should be noted that, in the embodiments of the present disclosure, words such as "exemplary" or "for example" are used as examples, illustrations or illustrations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present disclosure shall not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete manner.
本公开提供的方案可以用于日常生活中对不同数据源进行数据同步的场景中,为了便于理解,下面首先对本申请实施例涉及的一些名词以及应用场景进行简单介绍。The solution provided by the present disclosure can be used in the scenario of synchronizing data from different data sources in daily life. For ease of understanding, some terms and application scenarios involved in the embodiments of the present application are briefly introduced below.
Kernel:属于操作系统的内核,提供操作系统的最基本的功能。管理系统的进程、内存、设备驱动等。Kernel: It belongs to the kernel of the operating system and provides the most basic functions of the operating system. Manage system processes, memory, device drivers, etc.
Proc:是Linux系统中一个文件系统的目录,可以通过各种文件节点提供出相应信息。Proc: It is a directory of a file system in the Linux system, which can provide corresponding information through various file nodes.
ioctl:是Linux系统代码中,用户空间对设备节点内核空间的控制接口,实现参数设置、数据传递等功能。ioctl: In the Linux system code, the user space controls the kernel space of the device node, and realizes functions such as parameter setting and data transmission.
misc_register:Linux系统kernel中一个注册设备的函数,使系统生成出来相应设备节点。misc_register: A function to register devices in the Linux system kernel, so that the system generates corresponding device nodes.
随着科学技术的发展,各种各样的终端设备出现在人们的日常生活中,并且终端设备中安装有各种应用程序,不同的应用程序可以提供各种功能,终端设备通过启动这些应用程序从而方便用户使用所提供的功能。With the development of science and technology, a variety of terminal devices appear in people's daily life, and various applications are installed in the terminal devices. Different applications can provide various functions. Terminal devices start these applications This makes it easier for users to use the provided functions.
可选的,本公开实施例涉及的终端设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载终端设备、可穿戴设备、超级移动个人计算机(Ultra-Mobile Personal Computer,UMPC)、上网本或者个人数字助理(Personal Digital Assistant,PDA)等电子设备。其中,可穿戴设备可以为智能手表、智能手环、手表电话、智能脚环、智能耳环、智能项链、智能耳机等,本公开实施例不作限定。可选的,终端设备的操作系统可以是安卓(Android)系统,iOS系统,Linux系统等,Optionally, the terminal device involved in this embodiment of the present disclosure may be a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a vehicle-mounted terminal device, a wearable device, an Ultra-Mobile Personal Computer (Ultra-Mobile Personal Computer, UMPC), a netbook, or a personal Digital Assistant (Personal Digital Assistant, PDA) and other electronic devices. Wherein, the wearable device may be a smart watch, a smart bracelet, a watch phone, a smart anklet, a smart earring, a smart necklace, a smart earphone, etc., which are not limited in this embodiment of the present disclosure. Optionally, the operating system of the terminal device can be an Android system, an iOS system, a Linux system, etc.,
其中,不同的操作系统均可以用于终端设备的开发。比如,对于应用程序可以基于不同的操作系统进行编译,在相应的操作系统上运行,提供自身所能提供的基本功能。终端设备的操作系统除了完成系统本身的功能运行,还可以对操作系统中相关信息进行监测,比如进程、内存的使用情况,终端设备的驱动信息,操作系统运行或出现异常的记录等等。这些信息由 操作系统提供,并且由操作系统管理,在系统应用及开发过程中可以利用。基本上也都是一些常规信息,比如,可以在终端设备和系统的开发和应用过程中,对于不同数据库之间的数据同步就是一种常见的应用。Wherein, different operating systems can be used for the development of the terminal equipment. For example, the application program can be compiled based on different operating systems, run on the corresponding operating systems, and provide the basic functions that it can provide. In addition to completing the functional operation of the system itself, the operating system of the terminal device can also monitor relevant information in the operating system, such as processes, memory usage, driver information of the terminal device, operating system operation or abnormal records, etc. These information are provided by the operating system and managed by the operating system, and can be used in the process of system application and development. Basically, it is also some routine information. For example, in the development and application process of terminal equipment and systems, data synchronization between different databases is a common application.
对于不同的应用程序来说,通常会应用在不同的应用场景中,比如,对于一些终端厂商在开发过程中自制的工具,会用于工程模式、设备调试、检测等应用场景下,除了上述操作系统可以获取到的那些基本信息,操作系统还需要获取到特定的内容(由终端厂商设计决定),将这些基本信息以及特定的内容传给厂家自己的应用程序。通常情况下,应用程序在获取特定的内容时,往往会基于厂商自身创建的一个模块来获取,即,通过这个模块与操作系统之间的交互,得到上述需要获取的特征的内容。For different applications, they are usually applied in different application scenarios. For example, for some terminal manufacturers’ self-made tools during the development process, they will be used in application scenarios such as engineering mode, device debugging, and detection. In addition to the above operations For the basic information that the system can obtain, the operating system also needs to obtain specific content (determined by the design of the terminal manufacturer), and pass these basic information and specific content to the manufacturer's own application program. Usually, when an application program obtains specific content, it is often obtained based on a module created by the manufacturer itself, that is, through the interaction between this module and the operating system, the content of the above-mentioned features that need to be obtained is obtained.
比如,厂商开发的某个应用程序的项目中要获取平台的相关信息,首先可以用到操作系统平台提供的一些方法:读取proc目录中的节点信息;调用系统特有的属性;查看系统日志等等。然后通过操作系统提供的一些的接口或文件系统传输这些读取到的信息,并在此基础上开发者添加自己需要获取的信息。其中,通过开发者定制自己的模块获取定制的信息的过程中,一般是在驱动的应用程序中根据检测到相应的器件或事件,生成相对应的字符串,保存到开发者定制的模块维护的一块内存里,最后该模块也会提供函数接口将这块内存里的信息传递给应用程序。For example, if you want to obtain platform-related information in an application project developed by a manufacturer, you can first use some methods provided by the operating system platform: read node information in the proc directory; call system-specific attributes; view system logs, etc. wait. Then transmit the read information through some interfaces or file systems provided by the operating system, and on this basis, developers add the information they need to obtain. Among them, in the process of obtaining customized information through the developer's customized module, the corresponding character string is generally generated in the driver application program according to the detection of the corresponding device or event, and saved to the developer's customized module for maintenance. Finally, the module will also provide a function interface to pass the information in this memory to the application program.
对于上述方案中,现在操作系统平台提供的接口和文件系统无法满足所有应用程序厂商的定制信息,应用程序厂商需要定制自己的模块及函数接口,而且终端设备驱动相关需要定制的信息还没有很好的整合起来,在定制时,应用程序厂商通常只关心自身需要获取的信息部分,对于这些信息的复用(比如让其他应用程序或者函数调用)以及兼容性并不重视,比如,对于应用场景在工程模式下获取的设备信息来说,该设备信息可能需要在另外一个检测的应用场景也要获取,但是两个应用程序的厂商之间没有统一接口,对于检测的应用场景需要重新获取设备信息。For the above solution, the interface and file system provided by the current operating system platform cannot meet the customization information of all application program manufacturers. Application program manufacturers need to customize their own modules and function interfaces, and the terminal device driver-related information that needs to be customized is not very good. When customizing, application vendors usually only care about the information they need to obtain, and do not pay much attention to the reuse of this information (such as allowing other applications or function calls) and compatibility. For example, for application scenarios in For the device information obtained in engineering mode, the device information may need to be obtained in another detection application scenario, but there is no unified interface between the manufacturers of the two application programs, and the device information needs to be obtained again for the detection application scenario.
而且,在上述应用程序中对于定制的模块对应的传输信息的接口是做在用户空间还是内核空间不够明确。比如,有的需要获取的信息从内核获取比较方便,也有的需要获取的信息比较适合从用户空间获取,所以不同公司不同项目也可能有各种不同的做法,并且内核驱动和用户空间也没有合适的交互方式,不利于做好标准化和归一化。例如在平台软件中,首先会在内核驱动中探测器件,探测成功后就可以对应到所用器件的具体型号及厂家等信息。所以对于大部分器件,要获取定制信息的话就可以在内核驱动中定制接口。有的器件则软件流程上比较特殊(比如摄像头),因为这部分设备驱动已经有完整的流程,探测结果返回到用户空 间并且已生成有对应的字符串,这时在用户空间获取定制信息就比较方便。如果将接口做在内核驱动中,反而产生很多判断和生成字符串的重复工作(因为项目中用到几颗摄像头,每颗摄像头还可能有两家或三家供应商),代码质量也不高。Moreover, in the above-mentioned application program, it is not clear whether the interface for transmitting information corresponding to the customized module is done in the user space or the kernel space. For example, some information that needs to be obtained is more convenient to obtain from the kernel, and some information that needs to be obtained is more suitable to be obtained from user space, so different companies and projects may have different methods, and the kernel driver and user space are not suitable. The interaction method is not conducive to standardization and normalization. For example, in the platform software, the device will be detected in the kernel driver first, and after the detection is successful, the specific model and manufacturer of the device used can be corresponding to the information. So for most devices, if you want to obtain customized information, you can customize the interface in the kernel driver. Some devices have a special software process (such as a camera), because this part of the device driver already has a complete process, and the detection result is returned to the user space and a corresponding string has been generated. At this time, it is relatively easy to obtain customized information in the user space. convenient. If the interface is made in the kernel driver, it will cause a lot of repetitive work of judging and generating strings (because several cameras are used in the project, and each camera may have two or three suppliers), and the code quality is not high.
因此,对于上述方案中各厂家自己定制的模块,由于不同开发商或是应用研发商制定的对于硬件模块的信息的存储方式不统一,没有一个标准,导致每个应用程序存储硬件模块信息的标准统一化程度较低,实现的结果大多兼容性差,代码结构比较混乱。Therefore, for the modules customized by each manufacturer in the above scheme, because the storage methods for hardware module information formulated by different developers or application developers are not uniform, there is no standard, resulting in the standard for each application to store hardware module information The degree of unification is low, most of the achieved results are poor in compatibility, and the code structure is chaotic.
本公开实施例提供的信息传输方法的执行主体可以为上述的终端设备,也可以为该终端设备中能够实现该信息传输方法的功能模块和/或功能实体,具体的可以根据实际使用需求确定,本公开实施例不作限定。下面以终端设备为例,对本公开实施例提供的信息传输方法进行示例性的说明。The execution subject of the information transmission method provided by the embodiments of the present disclosure may be the above-mentioned terminal device, or may be a functional module and/or a functional entity in the terminal device capable of implementing the information transmission method, which may be specifically determined according to actual usage requirements, The embodiments of the present disclosure are not limited. The following uses a terminal device as an example to illustrate the information transmission method provided by the embodiments of the present disclosure.
为了解决上述技术中存在的问题,请参考图1,其是本公开一个或多个实施例提供的一种信息传输方法的流程示意图一。如图1所示,该信息传输方法可以包括下述步骤:In order to solve the problems existing in the above technologies, please refer to FIG. 1 , which is a first schematic flowchart of an information transmission method provided by one or more embodiments of the present disclosure. As shown in Figure 1, the information transmission method may include the following steps:
101、在用户空间中,获取第一应用程序对应的应用信息。101. In a user space, obtain application information corresponding to a first application program.
在本公开实施例中,终端设备可以在运行第一应用程序时,获取第一应用程序对应的应用信息。In this embodiment of the present disclosure, the terminal device may obtain application information corresponding to the first application program when running the first application program.
需要说明的是,由于应用程序是以文件的格式保存在用户空间中的,因此终端设备获取到的第一应用程序对应的应用信息是保存在用户空间中的。It should be noted that since the application programs are stored in the user space in a file format, the application information corresponding to the first application program acquired by the terminal device is stored in the user space.
其中,应用信息包括:器件信息和器件运行状态;该器件可以包括终端设备中的各种硬件模块,例如:显示屏、摄像头、陀螺仪、加速度传感器等;每个应用程序在运行时,可能会调用终端设备中的某个器件的功能,相应的,终端设备也可以获取该器件对应的器件信息和器件运行状态。可选的,该器件信息可包括:该硬件模块的设备号、型号、厂家等信息,该器件运行状态即为该硬件模块在运行时的状态,比如:工作状态、暂停状态等,如果出现故障,那么器件运行状态可以包括:故障类型、故障原因等。Among them, the application information includes: device information and device operating status; the device can include various hardware modules in the terminal device, such as: display screen, camera, gyroscope, acceleration sensor, etc.; when each application is running, it may Call the function of a device in the terminal device, correspondingly, the terminal device can also obtain the device information and device running status corresponding to the device. Optionally, the device information may include information such as the device number, model, and manufacturer of the hardware module. The running state of the device is the state of the hardware module during operation, such as: working state, pause state, etc. If a fault occurs , then the device operating status may include: fault type, fault cause, etc.
可选的,终端设备的内存空间包括:用户空间和内核空间,其中,用户空间就是用户进程所在的内存区域,相对的,内核空间就是操作系统占据的内存区域。用户进程和操作系统进程的所有数据都保存在内存空间中。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 user processes and operating system processes are kept in the memory space.
在终端设备启动之前,内存空间就是一块原始的物理内存。在终端设备的系统启动后,就对物理内存进行了划分。当然,这个划分都是操作系统在逻辑上的划分,物理内存条上并没有划分好的地址和空间范围,不同版本的操作系统划分的结果都是不一样的。Before the terminal device is started, the memory space is a piece of original physical memory. After the system of the terminal device is started, the physical memory is divided. Of course, this division is the logical division of the operating system. There is no well-divided address and space range on the physical memory stick, and the division results of different versions of the operating system are different.
那么划分的依据就是不同对象的数据存放在不同的地方,即操作系统的数据一般都是存放 于内核空间的,用户进程的数据一般都是存放于用户空间的,如果将操作系统的数据和用户进程的数据都存储在一起,那么就会影响到系统的运行;如果将系统的数据和用户的数据分开来存放,就可以使得系统的数据和用户的数据互不干扰,保证操作系统的稳定性。并且如果将用户的数据和系统的数据隔离开,还可以对两部分的数据的访问进行控制,确保用户程序不能随便操作系统的数据,从而防止用户程序误操作或恶意破坏系统。Then 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 user If the data of the process is stored together, it will affect the operation of the system; if the data of the system and the data of the user are stored separately, the data of the system and the data of the user can not interfere with each other, ensuring the stability of the operating system . And if the user data is separated from the system data, access to the two parts of the data can also be controlled to ensure that the user program cannot casually access the data of the operating system, thereby preventing the user program from misoperation or maliciously destroying the system.
102、通过预先设置的用户空间和内核空间之间的数据写入接口,将应用信息从用户空间传输至内核空间。102. Transmit application information from the user space to the kernel space through a preset data writing interface between the user space and the kernel space.
在本公开实施例中,终端设备可以从数据写入接口将应用信息从用户空间传输到内核空间,该数据写入接口是提前设置好的接口,该数据写入接口位于用户空间和内核空间之间,该数据写入接口是用于将用户空间中的信息传输到内核空间中的接口。In the embodiment of the present disclosure, the terminal device can transmit the application information from the user space to the kernel space through the data writing interface. The data writing interface is an interface set in advance, and the data writing interface is located between the user space and the kernel space. During the period, the data writing interface is an interface for transferring information in the user space to the kernel space.
103、将应用信息保存在内核空间中。103. Save the application information in the kernel space.
在本公开实施例中,终端设备将应用信息从用户空间传输至内核空间之后,就可以将该应用信息保存在内核空间中。In the embodiment of the present disclosure, after the terminal device transmits the application information from the user space to the kernel space, the application information can be stored in the kernel space.
可选的,终端设备将应用信息从用户空间传输至内核空间之后,可以将用户空间中的应用信息删除,即应用信息只保存在内核空间中;终端设备也可以不删除用户空间中的应用信息,即在内核空间和用户空间中均保存有应用信息。Optionally, after the terminal device transfers the application information from the user space to the kernel space, it can delete the application information in the user space, that is, the application information is only stored in the kernel space; the terminal device can also not delete the application information in the user space , that is, application information is stored in both the kernel space and the user space.
综上所述,本公开实施例中,终端设备的内存空间包括:用户空间和内核空间,终端设备可以在用户空间中,获取第一应用程序对应的应用信息,该应用信息包括:器件信息和器件运行状态;然后终端设备可以通过预先设置的用户空间和内核空间之间的数据写入接口,将应用信息从用户空间传输至内核空间,并将应用信息保存在内核空间中。通过该方案,终端设备可以预先在用户空间和内核空间中设置数据写入接口,这样终端设备就可以将在用户空间中获取到的应用信息通过该数据写入接口,传输并存储在内核空间中,这样可以保证内核空间中保存有所有应用信息,这样终端设备无论在用户空间中获取到任何应用信息都可以通过数据写入接口存储到内核空间中,也就不会出现用户空间存储部分信息,内核空间存储部分信息的情况,有效的提高了终端设备存储硬件模块信息的标准统一化程度。To sum up, in the embodiment of the present disclosure, the memory space of the terminal device includes: user space and kernel space, and the terminal device can obtain application information corresponding to the first application program in the user space, and the application information includes: device information and Device running state; then the terminal device can transfer application information from user space to kernel space through the pre-set data writing interface between user space and kernel space, and save the application information in kernel space. Through this solution, the terminal device can pre-set the data writing interface in the user space and the kernel space, so that the terminal device can write the application information obtained in the user space through the data writing interface, transmit and store it in the kernel space , 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 writing interface, and there will be no part of the information stored in the user space. Partial information is stored in the kernel space, which effectively improves the degree of standardization of terminal equipment storage hardware module information.
请参考图2,其是本公开一个或多个实施例提供的一种信息传输方法的流程示意图二,如图2所示,该信息传输方法可以包括下述步骤:Please refer to FIG. 2, which is a schematic flow diagram II of an information transmission method provided by one or more embodiments of the present disclosure. As shown in FIG. 2, the information transmission method may include the following steps:
201、在内存空间中,注册与终端设备对应的设备节点。201. In the memory space, register a device node corresponding to the terminal device.
在本公开实施例中,终端设备可以先在内存空间中注册该终端设备的设备节点。In the embodiment of the present disclosure, the terminal device may first register the device node of the terminal device in the memory space.
需要说明的是,Linux操作系统下的设备通常分为三类,分别为:字符设备,块设备和网 络设备。而设备驱动程序同样对应的也分为三类:字符设备驱动程序、块设备驱动程序和网络设备驱动程序。常见的字符设备有鼠标、键盘、串口、控制台等。常见的块设备有各种硬盘、闪存(flash)磁盘、随机存储(random access memory,RAM)磁盘等。It should be noted that devices under the Linux operating system are generally divided into three categories: character devices, block devices, and network devices. The corresponding device drivers are also divided into three categories: character device drivers, block device drivers, and network device drivers. Common character devices include mouse, keyboard, serial port, console, etc. Common block devices include various hard disks, flash disks, random access memory (RAM) disks, and the like.
设备节点被创建在/dev目录下,是连接内核空间与用户空间的枢纽,可以用来指示该终端设备是与某个接口的某个ID进行连接的,该设备节点可以相当于硬盘的索引节点(inode),记录了硬件设备的位置和信息。The device node is created in the /dev directory, which 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 can be equivalent to the index node of the hard disk (inode), which records the location and information of the hardware device.
在Linux操作系统中,所有设备都以文件的形式存放在/dev目录下,都是通过文件的方式进行访问,设备节点是Linux操作系统对设备的抽象描述,一个设备节点就是一个文件,即一个设备节点就是一个设备。应用程序通过标准化的调用函数访问设备,这些调用函数独立于任何特定的驱动程序。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 an abstract description of the device in the Linux operating system. A device node is a file, that is, a A device node is just a device. Applications access devices through standardized call functions that are independent of any particular driver.
可选的,注册与终端设备对应的设备节点,具体可以包括:在内存空间中,先根据与设备驱动加载及设备节点创建有关的设备驱动名称、设备节点名称以及相关参数,按照字符串格式生成设备驱动文件列表,然后将该设备驱动文件列表预先存储在一个独立于内存空间的设备文件存储器中;终端设备可以读取该设备驱动文件列表中的文件,并根据设备驱动文件列表创建设备节点,然后将设备节点保存在设备文件存储器中。Optionally, registering the device node corresponding to the terminal device may specifically include: in the memory space, first generate according to the string format based on the device driver name, device node name and related parameters related to device driver loading and device node creation The device driver file list, and then pre-store the device driver file list in a device file storage independent of the memory space; the terminal device can read the files in the device driver file list, and create a device node according to the device driver file list, The device node is then saved in the device file memory.
其中,该设备文件存储器可以为flash存储器,或者RAM存储器等。Wherein, the device file storage may be a flash storage, or a RAM storage, and the like.
需要说明的是,终端设备可以先从设备驱动文件列表中获取待创建的设备节点的设备节点名称,然后根据设备驱动文件列表中的设备驱动名称加载设备驱动,并获取Linux操作系统分配的设备节点号,然后终端设备就可以根据设备节点名称、相关参数以及设备节点号创建设备节点。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 allocated by the Linux operating system number, and then the terminal device can create a device node according to the device node name, related parameters, and device node number.
其中,设备节点号可以包括:主设备号和从设备号。Wherein, the device node number may include: a major device number and a slave device number.
进一步的,终端设备在读取该设备驱动文件列表中的文件之前,还可以先根据设备文件存储器上的标记来判断是否创建过设备节点,如果创建过设备节点,那么终端设备就可以直接调用存储的设备节点;如果没有创建过设备节点,那么终端设备才需要读取该设备驱动文件列表中的文件,并根据设备驱动文件列表创建设备节点,然后将设备节点保存在设备文件存储器中,以备后续需要。Furthermore, before the terminal device reads the files in the device driver file list, it can also judge whether the device node has been created according to the mark on the device file storage. If the device node has been created, then the terminal device can directly call the storage device node; if no device node has been created, then the terminal device needs to read the file in the device driver file list, and create a device node according to the device driver file list, and then save the device node in the device file memory for future use follow-up needs.
需要说明的是,如果创建过设备节点,但是设备驱动文件列表中的文件发生了更新,那么终端设备就需要先删除设备文件存储器中存储的所有设备节点,然后再读取设备文件列表,并重复根据与设备驱动加载及设备节点创建有关的设备驱动名称、设备节点名称以及相关参数,按照字符串格式生成设备驱动文件列表步骤,以得到新的设备驱动文件列表对应的设备 节点。It should be noted that if a device node has been created, but the files in the device driver file list have been updated, then the terminal device needs to delete all device nodes stored in the device file storage, and then read the device file list, and repeat According to the device driver name, device node name and related parameters related to device driver loading and device node creation, the step of generating a device driver file list in a string format is used to obtain the device node corresponding to the new device driver file list.
通过上述可选的实现方式,终端设备只需要在Linux操作系统启动的第一次创建设备节点,在设备驱动文件列表中的文件不发生更新的情况下,以后每次Linux操作系统启动的时候,终端设备就只需要调用之前存储的设备节点即可,这样既节省了设备节点创建的动态过程,又能够保证Linux操作系统的启动速度。Through the above optional implementation method, the terminal device only needs to create a device node for the first time when the Linux operating system is started. The terminal device only needs to call the previously stored device node, which not only saves the dynamic process of device node creation, but also ensures the startup speed of the Linux operating system.
202、在设备节点上,设置用户空间和内核空间之间的数据写入接口。202. On the device node, set a data writing interface between the user space and the kernel space.
在本公开实施例中,终端设备注册了设备节点之后,就可以在设备节点上设置数据写入接口,该数据写入节点就是内核空间和用户空间之间的一个数据传输通道,终端设备可以通过该数据写入接口将应用信息从用户空间传输中内核空间,该数据写入接口位于用户空间和内核空间之间。In the embodiment of the present disclosure, after the terminal device registers the device node, a data writing interface can be set on the device node. The data writing node is a data transmission channel between the kernel space and the user space. The terminal device can pass The data writing interface transfers application information from the user space to the kernel space, and the data writing interface is located between the user space and the kernel space.
示例性的,请参考图3,其是本公开一个或多个实施例提供的一种终端设备的内存空间的结构示意图,如图3所示,在终端设备的内存空间31中包括用户空间和内核空间,在用户空间和内核空间中间设置有设备节点32,在设备节点32上设置有数据写入接口321,终端设备可以通过数据写入接口321将用户空间中的应用信息写入到内核空间中。For example, please refer to FIG. 3 , which is a schematic structural diagram of a memory space of a terminal device provided by one or more embodiments of the present disclosure. As shown in FIG. 3 , the memory space 31 of the terminal device includes user space and In the kernel space, a device node 32 is set between the user space and the kernel space, and a data writing interface 321 is set on the device node 32. The terminal device can write the application information in the user space to the kernel space through the data writing interface 321 middle.
203、在用户空间中,获取第一应用程序对应的应用信息。203. In the user space, obtain application information corresponding to the first application program.
204、通过预先设置的用户空间和内核空间之间的数据写入接口,将应用信息从用户空间传输至内核空间。204. Transmit the application information from the user space to the kernel space through the preset data writing interface between the user space and the kernel space.
205、将应用信息保存在内核空间中。205. Save the application information in the kernel space.
在本公开实施例中,针对步骤203~205的描述,请参照实施例中针对步骤101~103的详细描述,本公开实施例不再赘述。In the embodiment of the present disclosure, for the description of steps 203-205, please refer to the detailed description of steps 101-103 in the embodiment, which will not be repeated in the embodiment of the present disclosure.
可选的,将应用信息保存在内核空间中,具体可以包括:将器件信息保存在第一内存区域中,以及将器件运行状态保存在第二内存区域中。Optionally, storing the application information in the kernel space may specifically include: storing the device information in the first memory area, and storing the device running state in the second memory area.
其中,第一内存区域和第二内存区域是终端设备的内核空间中的两个不同的内存区域,分别用于存放器件信息和器件运行状态。Wherein, the first memory area and the second memory area are two different memory areas in the kernel space of the terminal device, which are respectively used to store device information and device operating status.
需要说明的是,终端设备将应用信息保存在内核空间中,可以将存放器件信息和器件运行状态分开保存,即终端设备可以在内核空间中划分出两个内存区域,一个内存区域用于保存器件信息,另一个内存区域用于保存器件运行状态。It should be noted that the terminal device stores application information in the kernel space, and can store device information and device running status separately, that is, the terminal device can divide two memory areas in the kernel space, and one memory area is used to store the device information, another memory area is used to hold the device operating state.
示例性的,如图3所示,终端设备可以通过数据写入接口321将用户空间中的应用信息写入到内核空间中,并将器件信息保存在第一内存区域33中,将器件运行状态保存在第二内存区域34中。Exemplarily, as shown in FIG. 3, the terminal device can write the application information in the user space into the kernel space through the data writing interface 321, and save the device information in the first memory area 33, and save the device operating state stored in the second memory area 34.
可选的,终端设备在划分两个内存区域时,是通过申请内存的方式进行划分的;申请的内存可以包括:静态内存和动态内存。Optionally, when the terminal device divides the two memory areas, it divides by applying for memory; the applied memory may include: static memory and dynamic memory.
其中,静态内存是指在程序开始运行时由编译器分配的内存,它的分配是在程序开始编译时完成的,不占用CPU资源;而当用户无法确定空间大小,或者空间太大,栈上无法分配时,会采用动态内存分配。在本公开实施例中,终端设备可以申请静态内存来存放应用信息。Among them, static memory refers to the memory allocated by the compiler when the program starts to run. Its allocation is completed when the program starts to compile and does not occupy CPU resources; when the user cannot determine the size of the space, or the space is too large, the memory on the stack When allocation is not possible, dynamic memory allocation is used. In the embodiment of the present disclosure, the terminal device may apply for a static memory to store application information.
通过上述可选的实现方式,终端设备可以将硬件模块的器件信息和器件运行状态分开保存在内核空间中的两个内存区域中,这样终端设备可以快速进行区分调用,减少终端设备的工作量。Through the above optional implementation, the terminal device can store the device information and device running status of the hardware module separately in two memory areas in the kernel space, so that the terminal device can quickly make differentiated calls and reduce the workload of the terminal device.
进一步的,终端设备将器件信息保存在第一内存区域中,以及将器件运行状态保存在第二内存区域中,具体可以包括:Further, the terminal device saves the device information in the first memory area, and saves the device operating state in the second memory area, which may specifically include:
在内核空间中设置多个枚举变量,每个枚举变量与一个硬件模块对应;定义与每个枚举变量对应的硬件模块在内核空间中的第一位置索引和第二位置索引;将每个硬件模块的器件信息按照对应的第一位置索引保存在第一内存区域中,以及将每个硬件模块的器件运行状态按照对应的第二位置索引保存在第二内存区域中。Set a plurality of enumeration variables in the kernel space, each enumeration variable corresponds to a hardware module; define the first position index and the second position index of the hardware module corresponding to each enumeration variable in the kernel space; set each 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.
其中,第一位置索引用于定义每个硬件模块的器件信息在第一内存区域中的存放位置,第二位置索引用于定义每个硬件模块的器件运行状态在第二内存区域中的存放位置。Among them, 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 state of each hardware module in the second memory area .
需要说明的是,终端设备将内核空间划分出两个内存区域之后,可以分别将器件信息和器件运行状态保存在两个内存区域中,并且在存储时终端设备需要按照预设的位置索引进行存储,因此终端设备可以在内核空间中设置多个枚举变量,每个枚举变量对应一个硬件模块,即对应一个器件,该枚举变量可以用于标识硬件模块的位置索引,即标识硬件模块的应用信息在内存中的存放位置和存放顺序。It should be noted that after the terminal device divides the kernel space into two memory areas, it can store device information and device operating status in the two memory areas respectively, and the terminal device needs to store according to the preset location index when storing , so 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, and the enumeration variable can be used to identify the location index of the hardware module, that is, to identify the hardware module's The location and order in which application information is stored in memory.
终端设备设置好枚举变量之后,可以为每个枚举变量定义对应的硬件模块的位置索引,该位置索引可以分为:第一位置索引和第二位置索引,该第一位置索引可以用于定义每个硬件模块的器件信息在第一内存区域中的存放位置,该第二位置索引用于定义每个硬件模块的器件运行状态在第二内存区域中的存放位置,即每个硬件模块都有器件信息和器件运行状态两个参数,终端设备在将器件信息和器件运行状态存储在内核空间中时,可以按照第一位置索引将硬件模块的器件信息保存在内核空间中的第一内存区域中,以及按照第二位置索引将硬件模块的器件运行状态保存在内核空间中的第二内存区域中。After the enumeration variables are set on the terminal device, the position index of the corresponding hardware module can be defined for each enumeration variable. The position index can be divided into: a first position index and a second position index. The first position index can be used for 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 running state of each hardware module in the second memory area, that is, each hardware module has There are two parameters of device information and device operating status. When the terminal device stores the device information and device operating status in the kernel space, it can save the device information of the hardware module in the first memory area in the kernel space according to the first position index , and save the device running state of the hardware module in the second memory area in the kernel space according to the second position index.
需要说明的是,每个硬件模块都对应两个位置索引,分别指示该硬件模块的器件信息在第一内存区域中的存放位置,以及该硬件模块的器件运行状态在第二内存区域中的存放位置。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 state of the hardware module in the second memory area. Location.
其中,每个硬件模块的位置索引均不同。Wherein, the location index of each hardware module is different.
通过上述可选的实现方式,可以为每个硬件模块定义其应用信息存放在内核空间中的位置索引,这样终端设备就可以按照每个硬件模块对应的位置索引将应用信息存放在内核空间中,这样可以避免终端设备将应用信息随意保存的情况,使得内核空间中存放的应用信息更加有序。Through the above optional implementation method, the location index of its 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 prevent the terminal device from saving the application information at will, and make the application information stored in the kernel space more orderly.
206、当第二应用程序需要调用应用信息时,通过预先设置的用户空间和内核空间之间的数据读出接口,从内核空间中将应用信息传输至用户空间。206. When the second application program needs to call the application information, transmit the application information from the kernel space to the user space through the preset data readout interface between the user space and the kernel space.
在本公开实施例中,终端设备预先将应用信息保存到内核空间之后,如果用户空间内的第二应用程序需要调用该应用信息,那么终端设备就可以再将应用信息从内核空间传输至用户空间。In the embodiment of the present disclosure, after the terminal device saves the application information in the kernel space in advance, if the second application program in the user space needs to call the application information, then the terminal device can transfer the application information from the kernel space to the user space .
其中,终端设备是通过数据读出接口对应用信息进行传输的,该数据读出接口是提前设置好的接口,该数据读出接口位于用户空间和内核空间之间,该数据读出接口是用于将内核空间中的信息传输到用户空间中的。Among them, the terminal device transmits the application information through the data readout interface, the data readout interface is an interface set in advance, the data readout interface is located between the user space and the kernel space, and the data readout interface is used Used to transfer information from kernel space to user space.
需要说明的是,第一应用程序和第二应用程序为不同的应用程序,数据读出接口与数据写入接口为设置在设备节点中不同的数据接口。It should be noted that the first application program and the second application program are different application programs, and the data read interface and the data write interface are different data interfaces set in the device node.
可以理解的是,第一应用程序在运行时,终端设备可以将应用信息通过数据写入接口从用户空间保存到内核空间中;当另一个应用程序,即第二应用程序需要调用应用信息时,终端设备可以将应用信息通过数据读出接口从内核空间传输到用户空间中。It can be understood that when the first application program is running, the terminal device can save the application information from the user space to the kernel space through the data writing interface; when another application program, that is, the second application program needs to call the application information, The terminal device can transmit application information from the kernel space to the user space through the data readout interface.
可选的,当第二应用程序需要调用应用信息时,通过预先设置的用户空间和内核空间之间的数据读出接口,从内核空间中将应用信息传输至用户空间,具体可以包括:Optionally, when the second application program needs to call the application information, the application information is transferred from the kernel space to the user space through the preset data readout interface between the user space and the kernel space, which may specifically include:
当第二应用程序需要调用应用信息时,获取设备节点的权限名单;若检测到权限名单中包括第二应用程序,则通过预先设置的用户空间和内核空间之间的数据读出接口,从内核空间中将应用信息传输至用户空间。When the second application program 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 program, then through the pre-set data readout interface between the user space and the kernel space, from the kernel The application information is transferred from the user space to the user space.
在该可选的实现方式中,如果第二应用程序在运行时需要调用应用信息,那么终端设备就需要从内核空间中调用应用信息,在调用之前,需要先检查一下应用权限,因此,终端设备可以获取设备节点的权限名单,该权限名单是设备节点注册时就设置好的,如果该权限名单中包括第二应用程序,说明该第二应用程序可以从内核空间中调用应用信息,因此终端设备就可以将应用信息通过数据读出接口从内核空间传输到用户空间中;如果该权限名单中不包括第二应用程序,说明该第二应用程序不可以从内核空间中调用应用信息,那么终端设备就不需要从内核空间中调用应用信息。In this optional implementation, if the second application program needs to call the application information when it is running, then the terminal device needs to call the application information from the kernel space. Before calling, it needs to check the application permission first. Therefore, the terminal device The permission list of the device node can be obtained. The permission list is set when the device node is registered. If the permission list includes the second application program, it means that the second application program can call the application information from the kernel space. Therefore, the terminal device The application information can be transferred from the kernel space to the user space through the data readout interface; if the second application program is not included in the permission list, it means that the second application program cannot call the application information from the kernel space, then the terminal device There is no need to call application information from kernel space.
通过上述可选的实现方式,终端设备可以给设备节点设置权限,只有具有权限的应用程序才可以从内核空间中调用应用信息,这样可以避免每个应用程序都调用应用信息导致终端设备工作量增大,同时也可以保障应用信息的安全性。Through the above optional implementation, the terminal device can set permissions for the device node, and only the application program with the permission can call the application information from the kernel space. It can also guarantee the security of application information.
可选的,当第二应用程序需要调用应用信息时,通过预先设置的用户空间和内核空间之间的数据读出接口,从内核空间中将应用信息传输至用户空间,具体可以包括:Optionally, when the second application program needs to call the application information, the application information is transferred from the kernel space to the user space through the preset data readout interface between the user space and the kernel space, which may specifically include:
当第二应用程序需要调用应用信息时,通过第一数据读出接口,从内核空间的第一内存区域中读取器件信息并传输至用户空间,以及通过第二数据读出接口,从内核空间的第二内存区域中读取器件运行状态并传输至用户空间。When the second application program needs to call the application information, it reads the device information from the first memory area of the kernel space through the first data readout interface and transmits it to the user space, and through the second data readout interface, reads the device information from the kernel space The device operating state is read from the second memory area of the device and transferred to user space.
需要说明的是,由于应用信息包括:器件信息和器件运行状态,并且器件信息是保存在内核空间的第一内存区域中的,器件运行状态是保存在内核空间的第二内存区域中的,因此终端设备再从内核空间中调用应用信息时,可以通过两个数据读出接口分别读取器件信息和器件运行状态;即终端设备可以通过第一数据读出接口读取器件信息并将器件信息从内核空间的第一内存区域传输至用户空间,再通过第二数据读出接口读取器件运行状态并将器件运行状态从内核空间的第二内存区域传输至用户空间。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, therefore When the terminal device calls the application information from the kernel space, it can respectively read the device information and the device operation status through the two data readout interfaces; that is, the terminal device can read the device information through the first data readout interface and transfer the device information from the The first memory area of the kernel space is transmitted to the user space, and then the operating state of the device is read through the second data readout interface, and the operating state of the device is transferred from the second memory area of the kernel space to the user space.
其中,数据读出接口可以包括:第一数据读出接口和第二数据读出接口,该第一数据读出接口和该第二数据读出接口为设置在设备节点中不同的数据读出接口。Wherein, the data readout interface may include: a first data readout interface and a second data readout interface, the first data readout interface and the second data readout interface are different data readout interfaces set in the device node .
可选的,在本公开实施例中,设备节点上至少可以包括三个数据接口,分别为:数据写入接口,第一数据读出接口和第二数据读出接口。其中,数据写入接口是终端设备将应用信息从用户空间传输到内核空间的数据接口;第一数据读出接口是终端设备将器件信息从内核空间的第一内存区域传输到用户空间的数据接口;第二数据读出接口是终端设备将器件运行状态从内核空间的第二内存区域传输到用户空间的数据接口。Optionally, in this embodiment of the present disclosure, the device node may include at least three data interfaces, which are: a data write interface, a first data read interface, and a second data read interface. Wherein, the data writing interface is a data interface for the terminal device to transfer application information from the user space to the kernel space; the first data readout 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 readout interface is a data interface for the terminal device to transmit the operating state of the device from the second memory area of the kernel space to the user space.
示例性的,如图3所示,在用户空间和内核空间之间设置有设备节点32,在设备节点上设置有数据写入接口321,第一数据读出接口322以及第二数据读出接口323。终端设备可以通过数据写入接口321将用户空间中的应用信息写入到内核空间中,还可以通过第一数据读出接口322将器件信息从内核空间中的第一内存区域33读出到用户空间中,还可以通过第二数据读出接口323将器件运行状态从内核空间中的第二内存区域34读出到用户空间中。Exemplarily, as shown in Figure 3, 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 are provided on the device node 323. The terminal device can write the application information in the user space into the kernel space through the data writing interface 321, and can also read the device information from the first memory area 33 in the kernel space to the user space through the first data readout interface 322. In the space, the operating status of the device can also be read from the second memory area 34 in the kernel space to the user space through the second data readout interface 323 .
可选的,以终端设备的操作系统是Linux操作系统为例,上述图3中的数据写入接口321,第一数据读出接口322以及第二数据读出接口323均可以由ioctl来实现。比如,本方案可以通过kernel代码配置一个设备相关信息和操作函数,调用misc_register(&devInfo_device)注册设备节点,并实现该设备驱动的ioctl。对于驱动的ioctl来说,第一个接口是数据写入接口 321,第二个接口是第一数据读出接口322,第三个接口是第二数据读出接口323。Optionally, taking the Linux operating system as an example of the terminal device, the data writing interface 321, the first data reading interface 322 and the second data reading interface 323 in FIG. 3 above can all be implemented by ioctl. For example, this solution can configure a device-related information and operation function through the kernel code, call misc_register(&devInfo_device) to register the device node, and implement the ioctl driven by the device. For the driven ioctl, the first interface is the data write interface 321, the second interface is the first data read interface 322, and the third interface is the second data read interface 323.
其中,数据写入接口321相当于是将用户空间的字符串(即应用信息可以通过字符串的形式表示)设置到内核中的接口,并保存至devInfo模块管理的这块内存(相当于是dev目录)中,并按定义的模块索引排列好。Among them, the data writing interface 321 is equivalent to an interface for setting user space strings (that is, application information can be expressed in the form of strings) into the kernel, and saving them to the memory managed by the devInfo module (equivalent to the dev directory) , and sorted by defined module index.
第一数据读出接口322是将devInfo模块管理的存放了器件信息的内存传递到用户空间的接口。在操作系统启动时,驱动部分会完成各模块的探测,也调用devInfo的接口将探测结果的字符串写入了devInfo模块的内存,所以用户空间通过这个接口可以获取到内核里devInfo模块的内存,就获取到想要的器件信息了。The first data readout interface 322 is an interface for transferring the memory managed by the devInfo module storing device information to the user space. When the operating system starts, the driver part will complete the detection of each module, and also call the devInfo interface to write the detection result string into the memory of the devInfo module, so the user space can obtain the memory of the devInfo module in the kernel through this interface. The desired device information is obtained.
第二数据读出接口323是将devInfo模块管理的存放了器件运行状态的内存传递到用户空间的接口。这个接口与第一数据读出接口322相似。只是第一数据读出接口322存放的是器件型号、厂家等信息,这些信息在操作系统启动过程中已经完成了信息的存放。而第二数据读出接口323传出的信息是内核里devInfo模块存放的运行状态,会用于操作系统运行的整个周期的监测应用。比如,这部分逻辑一般是驱动软件运行中出现某些异常的话,就对异常进行记录并归纳,生成相应的字符串保存到分配好的内存中,通过该第二数据读出接口323也可以实现对器件运行情况的异常监测。The second data readout interface 323 is an interface for transferring the memory managed by the devInfo module and storing the operating state of the device to the user space. This interface is similar to the first data readout interface 322 . It is just that the first data readout interface 322 stores information such as device model and manufacturer, which have been stored during the startup process of the operating system. The information transmitted by the second data readout interface 323 is the running status stored in the devInfo module in the kernel, which will be used for monitoring applications during the entire cycle of operating system running. For example, this part of the logic is generally that if some abnormality occurs during the operation of the driver software, the abnormality is recorded and summarized, and a corresponding character string is generated and stored in the allocated memory, which can also be realized through the second data readout interface 323. Abnormal monitoring of device operation.
可选的,上述第一数据读出接口322与第二数据读出接口323相互独立分开设计,可以用于不同的应用程序。因此,对于一个应用程序的开发项目中这两个接口可能都需要用到,也可能只选用其中任意一个。Optionally, the first data readout interface 322 and the second data readout interface 323 are designed independently of each other and can be used for different applications. Therefore, both interfaces may be used in an application development project, or only one of them may be selected.
即,通过上述图3的内容,操作系统中某个应用或进程需要获取硬件信息或器件运行情况时,可以直接调用devInfo模块:首先需要在代码中配置好访问设备节点的权限,然后运行时在系统中打开dev/devInfo设备节点,然后调用ioctl提供的传递内存信息的接口,拿到字符串信息即可,不需要自己实现一套驱动代码来做这些工作。这样操作系统中如果有多个应用或进程要获取硬件相关信息的话,都可以直接打开dev/devInfo来用,减少相关代码工作,而且整体代码结构比较简洁。That is to say, through the content in Figure 3 above, when an application or process in the operating system needs to obtain hardware information or device operation status, it can directly call the devInfo module: first, it is necessary to configure the permission to access the device node in the code, and then run it in the Open the dev/devInfo device node in the system, and then call the interface provided by ioctl to transfer memory information to get the string information. You don’t need to implement a set of driver codes to do these tasks. In this way, if there are multiple applications or processes in the operating system that want to obtain hardware-related information, they can directly open dev/devInfo to use, reducing related code work, and the overall code structure is relatively simple.
207、通过用户空间将应用信息传输至第二应用程序。207. Transmit the application information to the second application program through the user space.
在本公开实施例中,终端设备通过数据读出接口将应用信息从内核空间中传输至用户空间之后,可以再将应用信息传输至第二应用程序,以供第二应用程序运行时调用。In the embodiment of the present disclosure, after the terminal device transmits the application information from the kernel space to the user space through the data readout interface, the application information may be transmitted to the second application program for calling when the second application program is running.
综上所述,本公开实施例中,终端设备可以先在内存空间中设置设备节点,再在设备节点上设置数据写入接口,然后在用户空间中,获取第一应用程序对应的应用信息,该应用信息包括:器件信息和器件运行状态;终端设备可以通过数据写入接口,将应用信息从用户空间 传输至内核空间,并将应用信息保存在内核空间中;之后如果第二应用程序需要调用应用信息,就可以通过数据读出接口,将应用信息从内核空间传输到用户空间,再传输至第二应用程序。通过该方案,终端设备可以预先在用户空间和内核空间中设置数据写入接口,这样终端设备就可以将在用户空间中获取到的应用信息通过该数据写入接口,传输并存储在内核空间中,如果第二应用程序还要调用该应用信息的时候,就不需要重新获取一次应用信息,直接从内核空间中获取即可;并且终端设备无论在用户空间中获取到任何应用信息都可以通过数据写入接口存储到内核空间中,也就不会出现用户空间存储部分信息,内核空间存储部分信息的情况,有效的提高了终端设备存储硬件模块信息的标准统一化程度。To sum up, in the embodiment of the present disclosure, the terminal device can first set up a device node in the memory space, and then set a data writing interface on the device node, and then obtain the application information corresponding to the first application program 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 writing interface, and save the application information in the kernel space; then if the second application program needs to call The application information can be transmitted from the kernel space to the user space through the data readout interface, and then transmitted to the second application program. Through this solution, the terminal device can pre-set the data writing interface in the user space and the kernel space, so that the terminal device can write the application information obtained in the user space through the data writing interface, transmit and store it in the kernel space , if the second application program wants to call the application information, it does not need to obtain the application information again, it can be obtained directly from the kernel space; and no matter what application information the terminal device obtains in the user space, it can pass the data The write interface is stored in the kernel space, 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 of terminal equipment storage hardware module information.
另外,本方案通过将硬件相关的信息整理成一个标准化程度较高的模块,使软件结构更清晰简洁,可以实现在归一化工作中内核空间直接取到用户空间已有的信息,避免重复混乱的代码工作,这样的结果使代码也更明确易用,提高了统一接口后软件上实现的代码的清晰程度,代码质量更高。In addition, this solution organizes hardware-related information into a highly standardized module, making the software structure clearer and more concise, enabling the kernel space to directly access the existing information in the user space during the normalization work, avoiding duplication and confusion The result is that the code is clearer and easier to use, which improves the clarity of the code implemented on the software after the unified interface, and the code quality is higher.
请参考图4,其是本公开一个或多个实施例提供的一种终端设备的结构示意图一,如图4所示,该终端设备的内存空间包括:用户空间和内核空间,该终端设备包括:Please refer to FIG. 4 , which is a schematic structural diagram of a terminal device provided by one or more embodiments of the present disclosure. As shown in FIG. 4 , the memory space of the terminal device includes: user space and kernel space, and the terminal device includes :
获取模块401,用于在用户空间中,获取第一应用程序对应的应用信息,应用信息包括:器件信息和器件运行状态;An acquisition module 401, configured to acquire application information corresponding to the first application program in user space, where the application information includes: device information and device operating status;
处理模块402,用于通过预先设置的用户空间和内核空间之间的数据写入接口,将应用信息从用户空间传输至内核空间,并将应用信息保存在内核空间中。The processing module 402 is configured 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.
可选的,处理模块402,还用于在内存空间中,注册与终端设备对应的设备节点,设备节点位于用户空间和内核空间之间;Optionally, the processing module 402 is also configured to register a device node corresponding to the terminal device in the memory space, and the device node is located between the user space and the kernel space;
处理模块402,还用于在设备节点上,设置用户空间和内核空间之间的数据写入接口。The processing module 402 is further configured to set a data writing interface between the user space and the kernel space on the device node.
可选的,处理模块402,具体用于将器件信息保存在第一内存区域中,以及将器件运行状态保存在第二内存区域中;Optionally, the processing module 402 is specifically configured to save the device information in the first memory area, and save the device operating state in the second memory area;
其中,第一内存区域和第二内存区域为内核空间中不同的内存区域。Wherein, the first memory area and the second memory area are different memory areas in the kernel space.
可选的,处理模块402,具体用于在内核空间中设置多个枚举变量,每个枚举变量与一个硬件模块对应;Optionally, the processing module 402 is specifically configured to set multiple enumeration variables in the kernel space, each enumeration variable corresponds to a hardware module;
处理模块402,具体用于定义与每个枚举变量对应的硬件模块在内核空间中的第一位置索引和第二位置索引;The processing module 402 is specifically configured to define a first position index and a second position index in the kernel space of the hardware module corresponding to each enumerated variable;
处理模块402,具体用于将每个硬件模块的器件信息按照对应的第一位置索引保存在第一内存区域中,以及将每个硬件模块的器件运行状态按照对应的第二位置索引保存在第二内存 区域中;The processing module 402 is specifically configured to save the device information of each hardware module in the first memory area according to the corresponding first location index, and save the device running state of each hardware module in the first memory area according to the corresponding second location index. In the second memory area;
其中,第一位置索引用于定义每个硬件模块的器件信息在第一内存区域中的存放位置,第二位置索引用于定义每个硬件模块的器件运行状态在第二内存区域中的存放位置。Among them, 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 state of each hardware module in the second memory area .
可选的,处理模块402,还用于当第二应用程序需要调用应用信息时,通过预先设置的用户空间和内核空间之间的数据读出接口,从内核空间中将应用信息传输至用户空间;Optionally, the processing module 402 is also used to transmit the application information from the kernel space to the user space through the preset data readout interface between the user space and the kernel space when the second application program needs to call the application information ;
处理模块402,还用于通过用户空间将应用信息传输至第二应用程序;The processing module 402 is further configured to transmit the application information to the second application program through the user space;
其中,第一应用程序和第二应用程序为不同的应用程序,数据读出接口与数据写入接口为设置在设备节点中不同的数据接口。Wherein, the first application program and the second application program are different application programs, and the data read interface and the data write interface are different data interfaces set in the device node.
可选的,获取模块401,具体用于当第二应用程序需要调用应用信息时,获取设备节点的权限名单;Optionally, the obtaining module 401 is specifically used to obtain the permission list of the device node when the second application program needs to call the application information;
处理模块402,具体用于若检测到权限名单中包括第二应用程序,则通过预先设置的用户空间和内核空间之间的数据读出接口,从内核空间中将应用信息传输至用户空间。The processing module 402 is specifically configured to transmit application information from the kernel space to the user space through a preset data readout interface between the user space and the kernel space if it is detected that the permission list includes the second application program.
可选的,处理模块402,具体用于当第二应用程序需要调用应用信息时,通过第一数据读出接口,从内核空间的第一内存区域中读取器件信息并传输至用户空间,以及通过第二数据读出接口,从内核空间的第二内存区域中读取器件运行状态并传输至用户空间;Optionally, the processing module 402 is specifically configured to read the device information from the first memory area of the kernel space and transmit it to the user space through the first data readout interface when the second application program needs to call the application information, and Read the operating state of the device from the second memory area of the kernel space and transmit it to the user space through the second data readout interface;
其中,第一数据读出接口和第二数据读出接口为设置在设备节点中不同的数据读出接口。Wherein, the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
本公开实施例中,各模块可以实现上述方法实施例提供的信息传输方法,且能达到相同的技术效果,为避免重复,这里不再赘述。In the embodiments of the present disclosure, each module can implement the information transmission method provided by the above method embodiments, and can achieve the same technical effect. To avoid repetition, details are not repeated here.
请参考图5,其是本公开一个或多个实施例提供的一种终端设备的结构示意图二,如图5所示,该终端设备的内存空间包括:用户空间和内核空间,该终端设备可以包括:Please refer to FIG. 5 , which is a second structural diagram of a terminal device provided by one or more embodiments of the present disclosure. As shown in FIG. 5 , the memory space of the terminal device includes: user space and kernel space, and the terminal device can include:
存储有可执行程序代码的存储器501;A memory 501 storing executable program codes;
与存储器501耦合的处理器502;a processor 502 coupled to the memory 501;
其中,处理器502调用存储器501中存储的可执行程序代码,执行上述各方法实施例中终端设备执行的信息传输方法。Wherein, the processor 502 invokes the executable program code stored in the memory 501 to execute the information transmission method performed by the terminal device in the foregoing method embodiments.
本公开实施例提供一种计算机可读存储介质,其存储计算机程序,其中,该计算机程序被处理器执行时实现如以上各方法实施例中的方法的部分或全部步骤。Embodiments of the present disclosure provide a computer-readable storage medium, which stores a computer program, wherein when the computer program is executed by a processor, some or all steps of the methods in the above method embodiments are implemented.
本公开实施例还提供一种计算机程序产品,其中,当计算机程序产品在计算机上运行时,实现如以上各方法实施例中的方法的部分或全部步骤。Embodiments of the present disclosure also provide a computer program product, wherein when the computer program product is run on a computer, some or all of the steps of the method in the above method embodiments are implemented.
本公开实施例还提供一种应用发布平台,其中,应用发布平台用于发布计算机程序产品,其中,当计算机程序产品在计算机上运行时,实现如以上各方法实施例中的方法的部分或全 部步骤。Embodiments of the present disclosure also provide an application distribution platform, wherein the application distribution platform is used to distribute computer program products, wherein, when the computer program products run on the computer, part or all of the methods in the above method embodiments are implemented step.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本公开的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定特征、结构或特性可以以任意适合的方式结合在一个或多个实施例中。本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本公开所必须的。It should be understood that reference throughout the specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic related to the embodiment is included in at least one embodiment of the present disclosure. Thus, appearances of "in one embodiment" or "in an embodiment" in various places throughout the specification are not necessarily referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
在本公开的各种实施例中,应理解,上述各过程的序号的大小并不意味着执行顺序的必然先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本公开实施例的实施过程构成任何限定。In various embodiments of the present disclosure, it should be understood that the sequence numbers of the above-mentioned processes do not necessarily mean the order of execution, and the execution order of each process should be determined by its functions and internal logic, and should not be used in the implementation of the present disclosure. The implementation of the examples constitutes no limitation.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物单元,即可位于一个地方,或者也可以分布到多个网络单元上。可根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, located in one place, or distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本公开各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
上述集成的单元若以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可获取的存储器中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或者部分,可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干请求用以使得一台计算机设备(可以为个人计算机、服务器或者网络设备等,具体可以是计算机设备中的处理器)执行本公开的各个实施例上述方法的部分或全部步骤。If the above-mentioned integrated units are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present disclosure, 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, and the computer software product is stored in a memory , including several requests to make a computer device (which may be a personal computer, a server, or a network device, etc., specifically, a processor in the computer device) execute part or all of the steps of the above-mentioned methods in various embodiments of the present disclosure.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质包括只读存储器(Read-Only Memory,ROM)、随机存储器(Random Access Memory,RAM)、可编程只读存储器(Programmable Read-only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、一次可编程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电子抹除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的计算机可读的任何其他介质。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned 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 read-only Memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), programmable read-only memory (Programmable Read-only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM), One-time Programmable Read-Only Memory (OTPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc (Compact Disc Read-Only Memory, CD-ROM) or other optical disk storage, magnetic disk storage, tape storage, or any other computer-readable medium that can be used to carry or store data.
工业实用性Industrial Applicability
本公开提供的信息传输方法,终端设备通过将在用户空间中获取到的应用信息通过该数据写入接口,传输并存储在内核空间中,当需要获取这些存储的信息时,可以直接从内核空间中获取即可;并且终端设备无论在用户空间中获取到任何应用信息都可以通过数据写入接口存储到内核空间中,也就不会出现用户空间存储部分信息,内核空间存储部分信息的情况,有效的提高了终端设备存储硬件模块信息的标准统一化程度,具有很强的工业实用性。In the information transmission method provided by this disclosure, the terminal device writes the application information obtained in the user space into the interface through the data, transmits and stores it in the kernel space, and when it is necessary to obtain the stored information, it can be directly obtained from the kernel space and any application information acquired by the terminal device in the user space can be stored in the kernel space through the data writing 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. It effectively improves the standard unification degree of terminal equipment storage hardware module information, and has strong industrial applicability.

Claims (16)

  1. 一种信息传输方法,应用于终端设备,所述终端设备的内存空间包括:用户空间和内核空间,所述方法包括:An information transmission method, applied to a terminal device, the memory space of the terminal device includes: user space and kernel space, the method includes:
    在所述用户空间中,获取第一应用程序对应的应用信息,所述应用信息包括:器件信息和器件运行状态;In the user space, the application information corresponding to the first application program is obtained, and the application information includes: device information and device running status;
    通过预先设置的所述用户空间和所述内核空间之间的数据写入接口,将所述应用信息从所述用户空间传输至所述内核空间,并将所述应用信息保存在所述内核空间中。Transmitting 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 saving the application information in the kernel space middle.
  2. 根据权利要求1所述的方法,其中,所述在所述用户空间中,通过第一应用程序获取应用信息之前,所述方法还包括:The method according to claim 1, wherein, before obtaining the application information through the first application program in the user space, the method further comprises:
    在所述内存空间中,注册与所述终端设备对应的设备节点,所述设备节点位于所述用户空间和所述内核空间之间;In the memory space, register a device node corresponding to the terminal device, where the device node is 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. 根据权利要求1所述的方法,其中,所述内核空间包括:第一内存区域和第二内存区域,所述将所述应用信息保存在所述内核空间中,包括:The method according to claim 1, wherein the kernel space includes: a first memory area and a second memory area, and storing the application information in the kernel space includes:
    将所述器件信息保存在所述第一内存区域中,以及将所述器件运行状态保存在所述第二内存区域中;storing the device information in the first memory area, and storing the device operating state in the second memory area;
    其中,所述第一内存区域和所述第二内存区域为所述内核空间中不同的内存区域。Wherein, the first memory area and the second memory area are different memory areas in the kernel space.
  4. 根据权利要求3所述的方法,其中,所述将所述器件信息保存在所述第一内存区域中,以及将所述器件运行状态保存在所述第二内存区域中,包括:The method according to claim 3, wherein storing the device information in the first memory area and storing the device operating state in the second memory area comprises:
    在所述内核空间中设置多个枚举变量,每个枚举变量与一个硬件模块对应;Setting a plurality of enumeration variables in the kernel space, each enumeration variable corresponding to a hardware module;
    定义与所述每个枚举变量对应的硬件模块在所述内核空间中的第一位置索引和第二位置索引;defining a first position index and a second position index in the kernel space of the hardware module corresponding to each enumerated variable;
    将每个硬件模块的器件信息按照对应的第一位置索引保存在所述第一内存区域中,以及将每个硬件模块的器件运行状态按照对应的第二位置索引保存在所述第二内存区域中;storing the device information of each hardware module in the first memory area according to the corresponding first location index, and saving the device running state of each hardware module in the second memory area according to the corresponding second location index middle;
    其中,所述第一位置索引用于定义每个硬件模块的器件信息在所述第一内存区域中的存放位置,所述第二位置索引用于定义每个硬件模块的器件运行状态在所述第二内存区域中的存放位置。Wherein, 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 device operation status of each hardware module in the The storage location in the second memory area.
  5. 根据权利要求1至4任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 4, wherein the method further comprises:
    当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间 之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间;When the second application program needs to call the application information, the application information is transmitted from the kernel space to the user through the preset data readout interface between the user space and the kernel space. space;
    通过所述用户空间将所述应用信息传输至所述第二应用程序;transmitting the application information to the second application via the user space;
    其中,所述第一应用程序和所述第二应用程序为不同的应用程序,所述数据读出接口与所述数据写入接口为设置在设备节点中不同的数据接口。Wherein, the first application program and the second application program are different application programs, and the data read interface and the data write interface are different data interfaces provided in the device node.
  6. 根据权利要求5所述的方法,其中,所述当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间,包括:The method according to claim 5, wherein, when the second application program needs to call the application information, through the preset data readout interface between the user space and the kernel space, from the The application information is transferred to the user space in the kernel space, including:
    当所述第二应用程序需要调用所述应用信息时,获取设备节点的权限名单;When the second application program 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 program, the application program is read from the kernel space through the preset data readout interface between the user space and the kernel space. Information is transferred to the user space.
  7. 根据权利要求5所述的方法,其中,所述数据读出接口包括:第一数据读出接口和第二数据读出接口,所述当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间,包括:The method according to claim 5, wherein the data readout interface comprises: a first data readout interface and a second data readout interface, and when the second application needs to call the application information, the The data readout interface between the user space and the kernel space is set, and the application information is transferred from the kernel space to the user space, including:
    当所述第二应用程序需要调用所述应用信息时,通过所述第一数据读出接口,从所述内核空间的第一内存区域中读取所述器件信息并传输至所述用户空间,以及通过所述第二数据读出接口,从所述内核空间的第二内存区域中读取所述器件运行状态并传输至所述用户空间;When the second application program needs to call the application information, the device information is read from the first memory area of the kernel space through the first data readout interface and transmitted to the user space, And through the second data readout interface, read the operating state of the device from the second memory area of the kernel space and transmit it to the user space;
    其中,所述第一数据读出接口和所述第二数据读出接口为设置在设备节点中不同的数据读出接口。Wherein, the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
  8. 一种终端设备,所述终端设备的内存空间包括:用户空间和内核空间,包括:A terminal device, 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 program in the user space, where the application information includes: device information and device operating 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 save the application information in the kernel space.
  9. 根据权利要求8所述的终端设备,其中,The terminal device according to claim 8, wherein,
    所述处理模块,还配置成在所述内存空间中,注册与所述终端设备对应的设备节点,所述设备节点位于所述用户空间和所述内核空间之间;The processing module is further configured 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;
    所述处理模块,还配置成在所述设备节点上,设置所述用户空间和所述内核空间之间的数据写入接口。The processing module is further configured to set a data writing interface between the user space and the kernel space on the device node.
  10. 根据权利要求8所述的终端设备,其中,所述内核空间包括:第一内存区域和第二内存区域;The terminal device according to claim 8, wherein the kernel space includes: a first memory area and a second memory area;
    所述处理模块,还配置成将所述器件信息保存在所述第一内存区域中,以及将所述器件运行状态保存在所述第二内存区域中;The processing module is further configured to save the device information in the first memory area, and save the device operating state in the second memory area;
    其中,所述第一内存区域和所述第二内存区域为所述内核空间中不同的内存区域。Wherein, the first memory area and the second memory area are different memory areas in the kernel space.
  11. 根据权利要求10所述的终端设备,其中,The terminal device according to claim 10, wherein,
    所述处理模块,还配置成在所述内核空间中设置多个枚举变量,每个枚举变量与一个硬件模块对应;The processing module is further configured to set a plurality of enumeration variables in the kernel space, each enumeration variable corresponds to a hardware module;
    所述处理模块,还配置成定义与所述每个枚举变量对应的硬件模块在所述内核空间中的第一位置索引和第二位置索引;The processing module is further configured to define a first location index and a second location index of the hardware module corresponding to each enumerated variable in the kernel space;
    所述处理模块,还配置成将每个硬件模块的器件信息按照对应的第一位置索引保存在所述第一内存区域中,以及将每个硬件模块的器件运行状态按照对应的第二位置索引保存在所述第二内存区域中;The processing module is further configured to save the device information of each hardware module in the first memory area according to the corresponding first location index, and store the device operating state of each hardware module according to the corresponding second location index stored in the second memory area;
    其中,所述第一位置索引用于定义每个硬件模块的器件信息在所述第一内存区域中的存放位置,所述第二位置索引用于定义每个硬件模块的器件运行状态在所述第二内存区域中的存放位置。Wherein, 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 device operation status of each hardware module in the The storage location in the second memory area.
  12. 根据权利要求8至11任一项所述的终端设备,其中,The terminal device according to any one of claims 8 to 11, wherein,
    所述处理模块,还配置成当第二应用程序需要调用所述应用信息时,通过预先设置的所述用户空间和所述内核空间之间的数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间;The processing module is further configured to, when the second application program needs to call the application information, through the preset data read interface between the user space and the kernel space, from the kernel space transmitting the application information to the user space;
    所述处理模块,还配置成通过所述用户空间将所述应用信息传输至所述第二应用程序;The processing module is further configured to transmit the application information to the second application program through the user space;
    其中,所述第一应用程序和所述第二应用程序为不同的应用程序,所述数据读出接口与所述数据写入接口为设置在设备节点中不同的数据接口。Wherein, the first application program and the second application program are different application programs, and the data read interface and the data write interface are different data interfaces provided in the device node.
  13. 根据权利要求12所述的终端设备,其中,The terminal device according to claim 12, wherein,
    所述获取模块,还配置成当所述第二应用程序需要调用所述应用信息时,获取设备节点的权限名单;The obtaining module is further configured to obtain the permission list of the device node when the second application program needs to call the application information;
    所述处理模块,还配置成若检测到所述权限名单中包括所述第二应用程序,则通过预先设置的所述用户空间和所述内核空间之间的所述数据读出接口,从所述内核空间中将所述应用信息传输至所述用户空间。The processing module is further configured to, if it is detected that the permission list includes the second application program, through the preset data read-out interface between the user space and the kernel space, read from the The application information is transmitted from the kernel space to the user space.
  14. 根据权利要求12所述的终端设备,其中,所述数据读出接口包括:第一数据读出接 口和第二数据读出接口;The terminal device according to claim 12, wherein the data readout interface comprises: a first data readout interface and a second data readout interface;
    所述处理模块,还配置成当所述第二应用程序需要调用所述应用信息时,通过所述第一数据读出接口,从所述内核空间的第一内存区域中读取所述器件信息并传输至所述用户空间,以及通过所述第二数据读出接口,从所述内核空间的第二内存区域中读取所述器件运行状态并传输至所述用户空间;The processing module is further configured to read the device information from the first memory area of the kernel space through the first data readout interface when the second application program needs to call the application information And transmit to the user space, and read the operating state of the device from the second memory area of the kernel space through the second data readout interface and transmit to the user space;
    其中,所述第一数据读出接口和所述第二数据读出接口为设置在设备节点中不同的数据读出接口。Wherein, the first data readout interface and the second data readout interface are different data readout interfaces provided in the device node.
  15. 一种终端设备,所述终端设备的内存空间包括:用户空间和内核空间,包括:A terminal device, 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;
    所述处理器调用所述存储器中存储的所述可执行程序代码,用于执行权利要求1至7任一项所述的信息传输方法。The processor invokes the executable program code stored in the memory to execute the information transmission method according to any one of claims 1 to 7.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的信息传输方法。A computer-readable storage medium storing a computer program, wherein the computer program implements the information transmission method according to any one of claims 1 to 7 when executed by a processor.
PCT/CN2022/140518 2022-01-17 2022-12-21 Information transmission method, terminal apparatus, and storage medium WO2023134411A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210051915.XA CN114416402A (en) 2022-01-17 2022-01-17 Information transmission method, terminal device and storage medium
CN202210051915.X 2022-01-17

Publications (1)

Publication Number Publication Date
WO2023134411A1 true WO2023134411A1 (en) 2023-07-20

Family

ID=81273141

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/140518 WO2023134411A1 (en) 2022-01-17 2022-12-21 Information transmission method, terminal apparatus, and storage medium

Country Status (2)

Country Link
CN (1) CN114416402A (en)
WO (1) WO2023134411A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416402A (en) * 2022-01-17 2022-04-29 闻泰通讯股份有限公司 Information transmission method, terminal device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7099866B1 (en) * 2001-11-16 2006-08-29 Hewlett-Packard Development Company, L.P. Method of generating and presenting kernel data
CN104123194A (en) * 2014-07-16 2014-10-29 上海斐讯数据通信技术有限公司 Communication structure and method for kernel mode and user mode
CN111209123A (en) * 2019-12-26 2020-05-29 天津中科曙光存储科技有限公司 Local storage IO protocol stack data interaction method and device
CN112015476A (en) * 2019-05-31 2020-12-01 龙芯中科技术有限公司 Display card driving method and device, electronic equipment and storage medium
CN113495795A (en) * 2020-04-03 2021-10-12 华为技术有限公司 Inter-process communication method and related equipment
CN114416402A (en) * 2022-01-17 2022-04-29 闻泰通讯股份有限公司 Information transmission method, terminal device and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7099866B1 (en) * 2001-11-16 2006-08-29 Hewlett-Packard Development Company, L.P. Method of generating and presenting kernel data
CN104123194A (en) * 2014-07-16 2014-10-29 上海斐讯数据通信技术有限公司 Communication structure and method for kernel mode and user mode
CN112015476A (en) * 2019-05-31 2020-12-01 龙芯中科技术有限公司 Display card driving method and device, electronic equipment and storage medium
CN111209123A (en) * 2019-12-26 2020-05-29 天津中科曙光存储科技有限公司 Local storage IO protocol stack data interaction method and device
CN113495795A (en) * 2020-04-03 2021-10-12 华为技术有限公司 Inter-process communication method and related equipment
CN114416402A (en) * 2022-01-17 2022-04-29 闻泰通讯股份有限公司 Information transmission method, terminal device and storage medium

Also Published As

Publication number Publication date
CN114416402A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
US9301164B2 (en) Method, system, and terminal for performing system update between mobile communication terminals
US8464242B2 (en) Virtualization of configuration settings
US20120124566A1 (en) Shared resource dependencies
US20150186161A1 (en) Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
US11327816B2 (en) Monitoring components in a service framework
CN109753347B (en) System and method for realizing driving
WO2023134411A1 (en) Information transmission method, terminal apparatus, and storage medium
CN110780930A (en) Method and device for starting Android system, electronic equipment and storage medium
CN112214388A (en) Memory monitoring method, device, equipment and computer readable storage medium
CN102132267B (en) Dynamic metadata
CN113342554B (en) IO multiplexing method, medium, device and operating system
CN109254856B (en) Method for providing interface to client by intelligent POS server
CN113051088B (en) Program loading method, device, equipment and computer readable medium
KR20190098516A (en) Method for managing data related to application and electronic device thereof
CN112764729A (en) Application software development method and device, computer equipment and readable storage medium
CN113420306A (en) Resource sharing method and device, computing equipment and computer readable storage medium
CN113924548A (en) Automatic hydration of a signature batch
CN113448643B (en) Configuration data management system and method
CN111767093B (en) Data processing method, apparatus and storage medium
CN117170901A (en) Hardware management method and device, storage medium and electronic equipment
Zhang et al. A Serial Port Data Filtering System
CN114154180A (en) Data sharing method and terminal equipment
CN116319905A (en) Intelligent control method, device, equipment and storage medium of Internet of things equipment
CN117971376A (en) Data processing method, device, cloud device and medium
CN115878210A (en) System configuration processing method and related equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22920042

Country of ref document: EP

Kind code of ref document: A1