CN116743903B - Chip identification method and electronic equipment - Google Patents

Chip identification method and electronic equipment Download PDF

Info

Publication number
CN116743903B
CN116743903B CN202211105205.7A CN202211105205A CN116743903B CN 116743903 B CN116743903 B CN 116743903B CN 202211105205 A CN202211105205 A CN 202211105205A CN 116743903 B CN116743903 B CN 116743903B
Authority
CN
China
Prior art keywords
identification
chip
identifier
configuration parameters
electronic device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211105205.7A
Other languages
Chinese (zh)
Other versions
CN116743903A (en
Inventor
张亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211105205.7A priority Critical patent/CN116743903B/en
Publication of CN116743903A publication Critical patent/CN116743903A/en
Application granted granted Critical
Publication of CN116743903B publication Critical patent/CN116743903B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a chip identification method and electronic equipment, and relates to the technical field of terminals. The problem of compatibility of the third party application identification device chip is solved. The specific scheme is as follows: after determining a first configuration parameter matched with a first chip, storing the first configuration parameter in a first address, wherein the first address is a storage address in the kernel space, and the first configuration parameter is parameter information for driving the first chip; and responding to a first request triggered by a third-party application, and reading and loading the first configuration parameters from the first address, wherein the first request is request information for indicating to identify the first chip, and the third-party application is an application program only performing data interaction with a kernel space.

Description

Chip identification method and electronic equipment
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a chip identification method and an electronic device.
Background
With the development of electronic technology, device chips (chips for short) integrated in electronic devices are becoming more and more diverse. Before each chip is enabled, the electronic device is required to load configuration parameters of the chip. Of course, even for the same electronic device, the chips in each electronic device may come from different suppliers, for example, the mobile phone 1 and the mobile phone 2 are the same devices in different batches, the image sensor in the mobile phone 1 may come from the supplier 1, and the image sensor in the mobile phone 2 may come from the supplier 2.
Because of the difference between the configuration parameters corresponding to the chips provided by different suppliers, the electronic device needs to store the configuration parameters corresponding to all the suppliers. In this way, the electronic device can acquire the corresponding configuration parameters by identifying the vendor to which the chip is actually mounted.
Typically these configuration parameters are stored in user space, i.e. the running memory space of the native system program. However, for a third party application, some of which can only interact with the kernel space, the electronic device also needs to backup all configuration parameters corresponding to all suppliers in the kernel space because the configuration parameters cannot be obtained from the user space. Wherein the kernel space is a space in which kernel code runs. Thus, repeated storage not only wastes storage resources of the electronic device, but also increases the starting time consumption of the kernel layer.
Disclosure of Invention
The embodiment of the application provides a chip identification method and electronic equipment, which are used for reducing the occupation of a memory and the starting time of a kernel layer while ensuring that a third party application identifies an equipment chip.
In order to achieve the above purpose, the embodiment of the present application adopts the following technical scheme:
In a first aspect, an embodiment of the present application provides a chip identification method, which is applied to an electronic device. The electronic equipment comprises a first chip. In addition, the virtual memory space of the electronic device includes a kernel space, and the method includes: after determining a first configuration parameter matched with the first chip, storing the first configuration parameter in a first address, wherein the first address is a storage address in a kernel space, and the first configuration parameter is parameter information for driving the first chip; and responding to a first request triggered by a third-party application, and reading and loading a first configuration parameter from a first address, wherein the first request is request information for indicating to identify a first chip, and the third-party application is an application program only performing data interaction with a kernel space.
In the above embodiment, the first chip may be any one of the device chips integrated in the electronic device. The electronic device may store the first configuration parameters in the kernel space only once successfully identified during operation. After the first configuration parameters are stored in the kernel space, even a third party application which can only interact data with the kernel space can quickly obtain the first configuration parameters for driving the first chip. Therefore, the efficiency of identifying the first chip by the third party application is improved, and the occupation of kernel space can be effectively reduced. In addition, the first configuration parameter is stored after the starting-up, so that the starting-up time consumption of the kernel layer is not influenced.
In some embodiments, the virtual memory space further includes a user space, where the user space includes a first file, the first file includes a plurality of first identifiers and corresponding configuration parameters, different first identifiers indicate first chips produced by different suppliers, and the configuration parameters corresponding to the different first identifiers are applicable to the first chips produced by different suppliers; before storing the first configuration parameter at the first address, the method further includes: responding to a second request triggered by a first application, acquiring a first equipment identifier from a first chip, wherein the first equipment identifier indicates a provider corresponding to the first chip, the second request is request information for indicating identification of the first chip, and the first application is a system program in the electronic equipment; and determining a first configuration parameter from the plurality of configuration parameters in the first file according to the second identifier when the plurality of first identifiers comprise the second identifier, wherein the second identifier is matched with the first device identifier.
That is, during operation of a native system application in the electronic device, the electronic device may be triggered to determine a corresponding first configuration parameter from the user space.
In other examples, when the electronic device is initialized during the power-on period, the electronic device may be triggered to determine the corresponding first configuration parameter from the user space.
In any way, after the electronic device determines the first configuration parameter from the user space, the first configuration parameter can be written into the kernel space, so that other application programs can be conveniently called.
In other possible embodiments, the first configuration parameter in the kernel space may also be deleted when the electronic device is powered off. In addition, the first configuration parameters of the first chip are identified from the user space by triggering the electronic equipment during the starting period, and the first configuration parameters are stored into the kernel space again, so that the third party application can be conveniently called in the subsequent operation process.
In some embodiments, the electronic device includes a first detection module and a first identification module, the first detection module operates in a user space, the first identification module operates in a kernel space, and the method further includes, before acquiring the first device identifier from the first chip: the first detection module acquires a plurality of first identifications from a first file; the first detection module sends a plurality of first identifications to the first identification module; acquiring a first device identifier from a first chip, including: the first identification module responds to the received multiple first identifications and reads corresponding first equipment identifications from the first chip; the method further comprises the steps of: the first identification module determines a second identifier matched with the first equipment identifier from a plurality of first identifiers; according to the second identifier, determining a first configuration parameter from a plurality of configuration parameters in the first file, including: the first identification module sends a second identification to the first detection module; the first detection module determines corresponding first configuration parameters from the first file according to the second identifier; before storing the first configuration parameter at the first address, the method further comprises: the first detection module sends the first configuration parameters to the first identification module.
In the above embodiment, the data is transferred between the user space and the kernel space by the multiple types of software modules running in the user space and running in the kernel space, so that the identification of the first chip and the determination of the first configuration parameter are realized.
In some embodiments, the electronic device includes a first detection module and a first identification module, the first detection module operates in a user space, the first identification module operates in a kernel space, and the method further includes, before acquiring the first device identifier from the first chip: the first detection module traverses each first mark in the first file; when traversing to a first identifier, the first detection module sends the traversed first identifier and corresponding configuration parameters to the first identification module; acquiring a first device identifier from a first chip, including: the first identification module responds to the received first identification and the corresponding configuration parameters, and reads the corresponding first equipment identification from the first chip; according to the second identifier, determining a first configuration parameter from a plurality of configuration parameters in the first file, including: if the first identification received by the first identification module is matched with the first equipment identification, determining the corresponding configuration parameter as a first configuration parameter; the method further comprises the following steps: the first identification module sends a first message to the first detection module, wherein the first message indicates that the first configuration parameter is determined; the first probe module stops traversing the first identification in response to the first message.
In some embodiments, after determining the first configuration parameter, the method further comprises: the first identification module analyzes the first configuration parameters; storing the first configuration parameter at the first address, comprising: the first identification module stores the parsed first configuration parameters in the first address.
In some embodiments, the first detection modules corresponding to different first chips are different, and the corresponding first identification modules are different.
In the above embodiment, the software modules of different first chips are identified and decoupled, so that the problem that all the first chips cannot be identified normally when the software modules corresponding to a single first chip are abnormal is avoided.
In some embodiments, the first chip is a device chip that accesses the I2C bus.
In a second aspect, an electronic device provided by an embodiment of the present application includes one or more processors and a memory; the memory is coupled to the processor, the memory for storing computer program code comprising computer instructions that, when executed by the one or more processors, operate to: after determining a first configuration parameter matched with the first chip, storing the first configuration parameter in a first address, wherein the first address is a storage address in the kernel space, and the first configuration parameter is parameter information for driving the first chip; and responding to a first request triggered by a third-party application, and reading and loading the first configuration parameters from the first address, wherein the first request is request information for indicating to identify the first chip, and the third-party application is an application program only performing data interaction with a kernel space.
In some embodiments, the virtual memory space further includes a user space, where the user space includes a first file, the first file includes a plurality of first identifiers and corresponding configuration parameters, different first identifiers indicate the first chips produced by different suppliers, and different configuration parameters corresponding to the first identifiers are applicable to the first chips produced by different suppliers; the one or more processors are configured to, prior to storing the first configuration parameter at a first address: responding to a second request triggered by a first application, acquiring a first equipment identifier from the first chip, wherein the first equipment identifier indicates a provider corresponding to the first chip, the second request is request information for indicating identification of the first chip, and the first application is a system program native to the electronic equipment; and under the condition that the plurality of first identifiers comprise a second identifier, determining the first configuration parameters from a plurality of configuration parameters in the first file according to the second identifier, wherein the second identifier is matched with the first equipment identifier.
In some embodiments, the electronic device includes a first detection module and a first identification module, where the first detection module operates in the user space, and the first identification module operates in the kernel space, and before acquiring a first device identifier from the first chip, the first detection module is configured to acquire the plurality of first identifiers from the first file; the first detection module is used for sending the plurality of first identifications to the first identification module; the first identification module is further configured to read the corresponding first device identifier from the first chip in response to the received multiple first identifiers; the first identification module is used for determining the second identification matched with the first equipment identification from the plurality of first identifications; the first identification module is used for sending the second identification to the first detection module; the first detection module is used for determining the corresponding first configuration parameters from the first file according to the second identifier; the first detection module is further configured to send the first configuration parameter to a first identification module before the first configuration parameter is stored in the first address.
In some embodiments, the electronic device includes a first detection module and a first identification module, where the first detection module operates in the user space, and the first identification module operates in the kernel space, and before acquiring a first device identifier from the first chip, the first detection module is configured to traverse each of the first identifiers in the first file; when traversing to one first identifier, the first detection module is used for sending the traversed first identifier and corresponding configuration parameters to the first identification module; the first identification module is used for responding to the received first identification and the corresponding configuration parameters and reading the corresponding first equipment identification from the first chip; if the first identifier received by the first identification module is matched with the first equipment identifier, determining a corresponding configuration parameter as the first configuration parameter; the first identification module is configured to send a first message to the first detection module, where the first message indicates that the first configuration parameter has been determined; the first detection module is used for responding to the first message and stopping traversing the first identification.
In some embodiments, after determining the first configuration parameter, the first identifying module is further configured to parse the first configuration parameter; the first identification module is configured to store the parsed first configuration parameter in the first address.
In some embodiments, the first detection modules corresponding to different first chips are different, and the corresponding first identification modules are different.
In some embodiments, the first chip is a device chip that accesses an I2C bus.
In a third aspect, embodiments of the present application provide a computer storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the method of the first aspect and possible embodiments thereof.
In a fourth aspect, the application provides a computer program product for causing an electronic device to carry out the method of the first aspect and possible embodiments thereof, when the computer program product is run on the electronic device.
It will be appreciated that the electronic device, the computer storage medium and the computer program product provided in the above aspects are all applicable to the corresponding methods provided above, and therefore, the advantages achieved by the electronic device, the computer storage medium and the computer program product may refer to the advantages in the corresponding methods provided above, and are not repeated herein.
Drawings
Fig. 1 is a schematic hardware structure of an electronic device according to an embodiment of the present application;
Fig. 2 is a schematic diagram of a software and hardware structure of an electronic device according to an embodiment of the present application;
FIG. 3 is a diagram illustrating an example of the occupation of virtual memory space in the related art;
FIG. 4 is a diagram illustrating an example of the occupation of a virtual memory space according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating steps of a chip recognition method according to an embodiment of the present application;
fig. 6 is one of signaling interaction diagrams of a chip identification method according to an embodiment of the present application;
FIG. 7 is a second exemplary diagram illustrating the occupation of virtual memory space according to an embodiment of the present application;
FIG. 8 is a second signaling diagram of a chip identification method according to an embodiment of the present application;
FIG. 9 is a third exemplary diagram illustrating the occupation of virtual memory space according to an embodiment of the present application;
FIG. 10 is a second flowchart illustrating a chip recognition method according to an embodiment of the present application;
Fig. 11 is an exemplary diagram of a chip system according to an embodiment of the present application.
Detailed Description
The terms "first" and "second" are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present embodiment, unless otherwise specified, the meaning of "plurality" is two or more.
The embodiment of the application provides a chip identification method which can be applied to electronic equipment. Wherein, at least one type of device chip is integrated in the electronic device. Taking a camera module of an electronic device as an example, the camera module comprises various device chips such as an image sensor, a flash lamp, a focusing motor, optical anti-shake and the like. The chip identification method is used for determining the corresponding configuration parameters of each equipment chip and loading the corresponding configuration parameters, so that the electronic equipment can drive each equipment chip. The configuration parameters may refer to driving parameters capable of driving the device chip. It is understood that the configuration parameters corresponding to different device chips may be different, and the configuration parameters corresponding to the same type of device chips generated by different manufacturers may be different. Obviously, the configuration parameters corresponding to the equipment chips are determined, so that the corresponding equipment chips can be normally driven.
By way of example, the electronic device may be a cell phone, tablet computer, smart watch, desktop, laptop, handheld computer, notebook, ultra-mobile personal computer (UMPC), netbook, and a cell phone, personal Digital Assistant (PDA), augmented Reality (AR), virtual Reality (VR) device, or the like, including a plurality of cameras, and the embodiment of the present application is not particularly limited to the specific form of the electronic device.
The following describes in detail the implementation of the embodiment of the present application with reference to the drawings. Referring to fig. 1, a schematic structure diagram of an electronic device 100 according to an embodiment of the application is shown. As shown in fig. 1, the electronic device 100 may include: processor 110, external memory interface 120, internal memory 121, universal serial bus (universal serial bus, USB) interface 130, charge management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headset interface 170D, sensor module 180, keys 190, motor 191, indicator 192, camera 193, display 194, and subscriber identity module (subscriber identification module, SIM) card interface 195, etc.
The sensor module 180 may include a pressure sensor, a gyroscope sensor, a barometric sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.
It is to be understood that the structure illustrated in the present embodiment does not constitute a specific limitation on the electronic apparatus 100. In other embodiments, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (IMAGE SIGNAL processor, ISP), a controller, a memory, a video codec, a digital signal processor (DIGITAL SIGNAL processor, DSP), a baseband processor, and/or a neural Network Processor (NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and command center of the electronic device 100. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it may be called directly from memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-INTEGRATED CIRCUIT, I2C) interface, an integrated circuit built-in audio (inter-INTEGRATED CIRCUIT SOUND, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
It should be understood that the connection relationship between the modules illustrated in this embodiment is only illustrative, and does not limit the structure of the electronic device 100. In other embodiments, the electronic device 100 may also employ different interfaces in the above embodiments, or a combination of interfaces.
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a Liquid Crystal Display (LCD) CRYSTAL DISPLAY, an organic light-emitting diode (OLED), an active-matrix organic LIGHT EMITTING diode (AMOLED), a flexible light-emitting diode (FLED), miniled, microLed, micro-oLed, a quantum dot LIGHT EMITTING diode (QLED), or the like.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, so that the electrical signal is converted into an image visible to naked eyes. ISP can also optimize the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, electronic device 100 may include N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
In addition, as shown in fig. 2, the electronic device 100 may be divided into several layers, such as an application layer (abbreviated as an application layer), an application framework layer (abbreviated as a framework layer), a hardware abstraction layer (hardware abstraction layer, HAL), a Kernel layer (also referred to as a driver layer), and a hardware layer (Hardwork), from top to bottom, where each layer has a clear role and division of work. The layers communicate with each other through a software interface.
It is to be appreciated that fig. 2 is merely an example, that is, the layers divided in the electronic device are not limited to the layers shown in fig. 2, for example, between the application framework layer and the HAL layer, and may further include an android runtime (Android runtime) and a system library (library) layer, and the like.
The application layer may include, for example, a series of application packages. As shown in fig. 2, the application layer may include a plurality of application packages of a camera application, a gallery application, a video application, and the like.
Generally, applications are developed using the Java language by calling an application programming interface (application programming interface, API) and programming framework provided by the application framework layer. Illustratively, the application framework layer includes some predefined functions.
As shown in fig. 2, the application framework layer may include camera services that are invoked by camera applications to implement photography-related functions. Of course, the application framework layer may also include a content provider, a resource manager, a notification manager, a window manager, a view system, a phone manager, etc., as embodiments of the present application are not limited in any way.
The kernel layer is a layer between hardware and software. As shown in fig. 2, the kernel layer at least includes an identification module, a storage module and a query interface corresponding to each device chip.
Taking the device chip a as an example, the corresponding identification module a is configured to query the device identifier a of the corresponding device chip a, for example, the device identifier a written in the device chip a in advance, that is, the device identifier a, may be obtained by performing data interaction with the device chip a. In addition, the identification module a is further configured to determine a configuration parameter (e.g., referred to as configuration parameter a) that matches the device identifier a. And the storage module a corresponding to the device chip a is used for managing the storage and inquiry of the configuration parameter a, for example, after the configuration parameter a is determined, the storage space for storing the configuration parameter a is requested to be allocated, and for example, other nodes (for example, the inquiry interface a) can directly acquire the stored configuration parameter a by calling the storage module 1. The query interface a corresponding to the device chip a is an interface which can be called by a third party application, and the third party application can acquire the configuration parameter a through the query interface, so that the identification of the device chip a is completed. The configuration parameters described above may also be referred to as driving parameters, which are relevant parameter information for driving the device chip. The third party application may be an application installed in response to a user operation, unlike a system application native to the electronic device.
Of course, the kernel layer may also include a driver of the device chip, for example, an audio driver, a sensor driver, and the like, which is not limited in this embodiment of the present application.
In addition, the HAL layer can encapsulate programs in the kernel layer and provide a calling interface for the application framework layer, and shield implementation details of low-level hardware. The HAL layer may also include a probing module and a device control interface function (ioctl) corresponding to each device chip. The detection modules are used for starting the identification process for the equipment chips, and different detection modules correspond to different equipment chips, namely, different detection modules are used for starting the identification process for different equipment chips. The ioctl is a data transmission channel between the HAL layer and the kernel layer, for example, the kernel layer may read specified data from a user space occupied by the HAL layer through the ioctl, and for example, the HAL layer may send corresponding information to the kernel layer through the ioctl.
In addition, device chips that can be driven in hardware layers, such as image sensors, flash lamps, focus motors, optical anti-shake, etc., are also exemplarily shown in fig. 2.
For clarity and conciseness in the description of the embodiments below, a brief introduction to related concepts or technologies is first given:
First, the virtual memory of the electronic device is divided into user space and kernel space by the operating system. The kernel space is a memory space in which kernel codes run, and the kernel codes can be programs corresponding to the kernel layer, such as a driver, an identification module, a storage module and a query interface. The user space is a memory space in which user program code runs. The user program code may include program modules corresponding to the HAL layer, such as a probe module and a device control interface function, and may also include application programs in the application layer, such as a camera application, a gallery application, and the like.
Second, when the electronic device is powered on, the electronic device needs to analyze all data (including kernel codes and other data stored in kernel space) stored in the kernel space, so as to normally start the kernel layer. Obviously, the more data is stored in the kernel space, the longer the startup time consumption of the kernel layer.
Third, with the development of electronic technology, device chips integrated in electronic devices are becoming more and more diverse. Taking a common camera module in electronic equipment as an example, the camera module comprises a plurality of equipment chips such as an image sensor (sensor), a flash lamp (flash), a focusing motor (actuator), an optical anti-shake (ois) and the like. For manufacturers of electronic devices, various types of device chips may be purchased from other suppliers. Of course, even the same equipment chip, manufacturers can purchase from multiple suppliers, a competition mechanism is introduced, the quality of the chip is ensured, and meanwhile, the problem of monopoly of the chip is avoided. Thus, even with the same type of electronic device, device chips used in different batches may come from different suppliers. For example, the same type of electronic device, the image sensor of the previous lot is from the supplier 1, and the image sensor of the present lot is from the supplier 2.
At present, the supply from multiple suppliers is a necessary trend in industry, and the diversification of equipment chips also involves the identification of the equipment chips. The identification of the device chips may refer to determining configuration parameters of each device chip actually used by the electronic device. For example, it is determined from which vendor the device chip actually used by the electronic device comes, and then the configuration parameters of the device chip provided by the vendor are obtained.
It will be appreciated that the device chips from different suppliers have the same functionality and meet the same quality requirements. But there are differences in the configuration parameters corresponding to the device chips from different vendors. Before an electronic device enables a device chip, configuration parameters adapted to the device chip need to be loaded. The configuration parameters described above may be encapsulated in a system configuration file. It will be appreciated that the system configuration file for encapsulating the configuration parameters may be referred to as a system file, such as system file 1, encapsulating the configuration parameters of the image sensor.
Since the system configuration files of the same electronic device are the same, it is necessary to package the configuration parameters of the same type of device chips provided by all suppliers in the system file 1, so as to improve the universality of the system configuration files. For example, suppliers of image sensors include supplier 1, supplier 2, and supplier 3, with supplier 1 providing image sensor applicable configuration parameters 1, supplier 2 providing image sensor applicable configuration parameters 2, and supplier 3 providing image sensor applicable configuration parameters 3. In this scenario, configuration parameter 1, configuration parameter 2, and configuration parameter 3 may all be encapsulated in system file 1. Obviously, the more suppliers of like device chips, the larger the volume of the system file 1.
As one implementation, information that distinguishes suppliers may be configured in the device chip. For example, the image sensors from the suppliers 1 are all configured with a chip name "driver IC1" of the exclusive supplier 1, and the "driver IC1" may be information for distinguishing the suppliers 1. For example, all the image sensors from the suppliers 2 are configured with the chip name "driver IC2" of the exclusive supplier 2, which "driver IC2" may be information for distinguishing the suppliers 2. For another example, all the image sensors from the suppliers 3 are configured with the chip name "driver IC3" of the exclusive supplier 3, and the "driver IC3" may be information for distinguishing the suppliers 3.
For another example, each image sensor has a chip identity (Identity document, ID) that may include a field indicating the vendor, i.e., the chip ID of the image sensor produced by the same vendor may include the field, so that the chip ID may also be information for distinguishing the vendor. The above-described information capable of distinguishing suppliers may be referred to as device identification after being written to the image sensor.
In addition, the system file 1 preconfigured in the electronic device may include a plurality of identification identifiers and corresponding configuration parameters. Wherein each identification indicates a vendor that provides the image sensor and also corresponds to the image sensor produced by the vendor. In this way, the identification mark is matched with the device mark carried in the corresponding image sensor. For example, the identification identifier may be a chip name of a dedicated vendor, for example, the identification identifier corresponding to the vendor 1 may be "driver IC1", the identification identifier corresponding to the vendor 2 may be "driver IC2", and the identification identifier corresponding to the vendor 3 may be "driver IC3". Thus, when the device identification in the image sensor is the same as one of the identification identifications, the device identification of the image sensor is indicated to match the identification.
Also illustratively, a field in the chip ID indicating the vendor may also be written to system file 1 as an identification. Thus, when the device identifier in the image sensor contains an identification identifier, the image sensor is instructed to match the identification identifier.
Thus, after the electronic device reads the device identifier from the actually installed device chip, the corresponding configuration parameters can be queried from the system file 1. Thus, the image sensor provided by the supplier can be normally driven no matter which electronic device is actually mounted.
In some embodiments, the system file 1 may be stored in a user space. As shown in fig. 3, the suppliers of the image sensors include supplier 1, supplier 2 and supplier 3, and the configuration parameters required for the image sensors provided by supplier 1, supplier 2 and supplier 3 are included in the system file 1. In addition, the detection module and the device control interface function of the operation state occupy the user space, and thus, the detection module and the device control interface function (ioctl) are also included in the user space of fig. 3. During power-on of the electronic device, the detection module may obtain an identification contained in the system file 1, such as the identification 1, in response to a command identifying the image sensor. For example, the command for identifying the image sensor may be a command triggered by the initialization process at the start-up stage. Also illustratively, the above-described command identifying the image sensor may be a user program indicating an instruction that triggers upon initializing the image sensor.
Then, the probing module may send the plurality of identification marks 1 and I2C addresses (e.g., referred to as I2C address 1) corresponding to the image sensor to the identification module 1 running in the kernel space through ioctl. The corresponding I2C address 1 refers to an access address of the image sensor in the electronic device on the I2C bus. In this way, the identification module 1 may send, in response to the plurality of identification ids 1 and the I2C address 1 sent by the detection module, query information to the I2C address 1, where the query information is used to query a device id carried in an image sensor currently accessing the I2C address 1, such as referred to as device id 1. After obtaining the device identifier 1, the identification module 1 compares the device identifier 1 with the plurality of identification identifiers 1, and determines an identification identifier 2 from the plurality of identification identifiers 1, where the identification identifier 2 matches with the device identifier 1. In this way, the identification module 1 may send the identification 2 to the ioctl, which may find the corresponding configuration parameters from the system file 1 by means of the identification 2, so that the electronic device may be loaded with configuration parameters matching the image sensor in the electronic device.
In some embodiments, the presence of a portion of the third party applications in the electronic device is not capable of data interaction with the HAL layer. In some examples, some third party applications do not have rights to access the HAL layer because the developer of the third party application is different from the developer of the electronic device. In other examples, in order to adapt the third party application to more types of electronic devices, some third party applications do not interact with the HAL layer during their operation, but interact directly with the kernel layer, so that differences between program logic of the HAL layer of various types of electronic devices need not be considered.
Obviously, for third party applications that cannot interact with the HAL layer data, the image sensor cannot be identified by the detection module, the identification module 1, etc. In this scenario, a third party calling interface and an identification module 2 that can be called by a third party application may be set in the kernel space, where the third party calling interface may instruct the identification module 2 to identify the image sensor. In addition, since the third party application cannot call the ioctl and the probe module, the system file 1 stored in the user space cannot be acquired through the ioctl and the probe module. Thus, the electronic device also needs to store a copy of the system file 1 in the kernel space. In the case that the system file 1 is stored in the kernel space, the third party application may instruct the recognition module 2 to recognize the image sensor through the third party call interface. That is, the identification marks of the image sensors provided by the respective suppliers are acquired from the kernel space storage system file 1, that is, a plurality of identification marks 1 are obtained. Then, the identification module 2 acquires the corresponding device identifier 1 from the image sensor actually installed in the electronic device. In this way, the identification module 2 can determine the identification identifier 2 matched with the device identifier 1 from the plurality of identification identifiers 1, and obtain the corresponding configuration parameters from the system file 1 in the kernel space according to the identification identifier 2 and load the configuration parameters. The third party application can normally drive the image sensor.
Obviously, in the above embodiment, the user space stores not only the system file 1 but also the kernel space stores the system file 1. Two system files 1 occupy more virtual memory resources, and waste of memory resources is formed. In addition, after the kernel space stores the system file 1, the electronic device must parse the system file 1 at the time of starting, which affects the starting time of the kernel layer.
The above only takes the identification of the image sensor as an example, and in the actual use process, other device chips also need to be identified. That is, in the related art, not only the system file 1 but also the system files corresponding to the other device chips are repeatedly stored in the user space and the kernel space. The system files of other device chips also include identification identifiers and corresponding configuration parameters that can be used to distinguish suppliers.
Of course, there are also differences between other device chips and the image sensor, and typically the other device chips do not have corresponding detection modules. In the related art, when other device chips are identified, a detection module corresponding to the image sensor is needed. Taking the example of identifying the flash lamp, the system file 2 corresponding to the flash lamp includes identification marks indicating each provider and configuration parameters of the flash lamp provided by each provider. In addition, the system file 2 may further include an I2C address of the electronic device to which the flash is connected. In some examples, if the image sensor and the flash are provided by the same vendor, the identification of the image sensor and the flash may be different. Then, similar to the identification process of the image sensor, the detection module sends identification identifiers (e.g., referred to as a plurality of identification identifiers 3) and I2C addresses (e.g., referred to as I2C addresses 2) accessed by the flash lamps contained in the system file 2 to the identification module 1 through ioctl, and the identification module 1 obtains the device identifier configured in the device chip accessed to the I2C addresses 2, e.g., referred to as the device identifier 2, by sending query information to the I2C addresses 2. Then, from the plurality of identification marks 3, an identification mark 4 matching the device mark 2 is acquired. In this way, the identification module 1 can acquire the flash configuration parameters matched with the flash configuration parameters from the system file 2 in the user space through ioctl, so that after loading the matched flash configuration parameters, the flash in the electronic device can be normally driven.
However, since other device chips need to be identified by the detection module, the ioctl and the identification module of the image sensor, once the program data (such as the detection module, the ioctl and the identification module) corresponding to the image sensor is abnormal, all the device chips in the electronic device cannot be identified, and thus the device chips cannot be used normally.
In order to improve the above problems, the embodiment of the application provides a chip identification method which can be applied to electronic equipment.
As shown in fig. 2, the kernel layer of the electronic device includes an identification module, a storage module and a query interface corresponding to each device chip, and the HAL layer includes a detection module and a device control interface function (ioctl) corresponding to each device chip.
Taking the image sensor as an example, after the electronic device is operated, as shown in fig. 4, a detection module corresponding to the image sensor is operated on the user space of the electronic device, for example, referred to as a detection module 1, and a device control interface function corresponding to the image sensor is also operated on the user space of the electronic device, for example, referred to as a device interface function 1. In addition, an identification module 3 corresponding to the image sensor, a corresponding storage module 1 and a corresponding query interface 1 are operated in the kernel space of the electronic device. In addition, for other device chips, for example, a detection module 2 and a device control interface function 2 corresponding to a flash lamp are also operated in the user space, and an identification module 4, a storage module 2 and a query interface 2 corresponding to the flash lamp are also operated in the kernel space. In addition, the user space stores system files corresponding to the device chips, for example, a system file 1 corresponding to the image sensor and a system file 2 corresponding to the flash lamp.
The kernel space also has a third party calling interface running therein, which can interact with a third party application, so that the third party application can call the processes running in the kernel space, such as the query interface 1, the query interface 2, and the like. The above-described device chips such as the image sensor and the flash may be referred to as a first chip. In some embodiments, the system file 1 is a first file corresponding to an image sensor, and the system file 2 is a first file corresponding to a flash.
In some embodiments, in a scenario where the electronic device is turned on, or an application process of the user program triggers the identification of the device chip, as shown in fig. 5, the method may include the following steps:
S101, in response to the instruction information 1, determining an identification mark 2 matched with an image sensor in the electronic equipment.
The instruction information 1 (may also be referred to as a second request) may be an instruction capable of triggering identification of an image sensor in the electronic device. The instruction information 1 may be instruction information generated when the electronic device executes a power-on initialization procedure, or may be instruction information generated by triggering service logic when a native system application (e.g., a first application) in the electronic device runs. For example, a native camera application in the electronic device, and the instruction information generated when the application is started.
In some embodiments, the image sensor in the electronic device refers to one of the device chips actually integrated in the electronic device. The identification tag 2 matching the image sensor may indicate the provider of the image sensor and may also be used to query configuration parameters applicable to the image sensor.
In connection with fig. 4, as an implementation manner, as shown in fig. 6, S101 may include the following:
S1, the detection module 1 receives instruction information 1.
In some embodiments, after the probe module 1 receives the instruction information 1, a plurality of identification identifiers, such as identification identifier 1, may be obtained from the system file 1 stored in the user space. The plurality of identification marks 1 may be all identification marks contained in the system file 1, that is, all the identification marks corresponding to the suppliers that provide the image sensor. In some examples, the plurality of identification tags 1 may be referred to as a plurality of first tags corresponding to the system file 1. The above-described detection module 1 may be referred to as a first detection module corresponding to an image sensor.
In addition, the access address of the image sensor at the electronic device, i.e. the I2C address 1, can also be obtained from the system file 1. In this way, the detection module 1 can generate the indication information 1 according to the identification mark 1 and the I2C address 1.
S2, the detection module 1 sends indication information 1 to the equipment control interface function 1.
Wherein, the indication information 1 comprises an identification mark 1 and an I2C address 1. The device control interface function (ioctl) acts as a data interaction interface between the user space and the kernel space, and assumes the bridge responsibility of information transfer between the user space and the kernel space. That is, the probe module 1 sends the indication information 1 to the device control interface function 1, and may instruct the device control interface function 1 to transfer the indication information 1 to a program module running in the kernel space.
S3, the device control interface function 1 sends indication information 1 to the identification module 3.
In some embodiments, the identification module 3 is a program module that runs in kernel space and corresponds to an image sensor. The above-mentioned identification module 3 may be referred to as a first identification module corresponding to the image sensor.
S4, the identification module 3 responds to the indication information 1 and sends query information 1 to the image sensor according to the I2C address 1.
The image sensor refers to an equipment chip accessed to the I2C address 1, and the query information 1 is used for querying an equipment identifier carried in the equipment chip. In some embodiments, it may be that the identification module 3 sends the query information 1 to the I2C address 1 of the I2C bus.
In other examples, in a scenario where the identification module 3 corresponds to the image sensor only, it may be preset that the identification module 3 may perform data interaction with the device chip accessed at the I2C address 1, and then the indication information 1 sent by the detection module may not carry the I2C address 1, so that, in a case where the identification module 3 receives the indication information 1, data interaction may be performed directly with the image sensor accessed at the I2C address 1, for example, query information 1 may be sent to the image sensor.
S5, the image sensor responds to the query information 1 and sends the query response information 1 to the identification module 3.
The query response information carries a device identifier in the image sensor, for example, a device identifier 1. The device identifier 1 may be referred to as a first device identifier corresponding to the image sensor.
S6, the identification module 3 determines the identification mark 2 matched with the equipment mark 1 from the plurality of identification marks 1.
For example, when the device identifier is a chip name and the identification identifier is also a chip name, the identification identifier 2 may be the same identification identifier as the device identifier 1 among the plurality of identification identifiers 1. This identification mark 2 may be referred to as a second mark corresponding to the image sensor. For example, when the device identifier 1 is driver IC1, then the identification identifier 2 is also driver IC1. Also illustratively, when the device identifier is a chip ID and the identification identifier is a field indicating a vendor, the device identifier 1 includes a field having the same content as the identification identifier 2. For example, device ID 1 is a chip ID that includes a field indicating the vendor, and the value of the field is "a01", and then identification ID 2 may be an ID having a value of "a 01".
S102, the electronic equipment determines matched configuration parameters 4 from the system file 1 according to the identification mark 2 and stores the matched configuration parameters in the kernel space.
Wherein, each identification mark and configuration parameter in the system file 1 are correspondingly stored. Thus, by querying the same configuration parameters as the identification 2, the configuration parameters 4 can be obtained. When the image sensor is referred to as a first chip, this configuration parameter 4 may be referred to as a corresponding first configuration parameter.
As an implementation manner, continuing to fig. 6, the step S102 may include the following steps:
S7, the identification module 3 sends indication information 2 to the detection module 1 through the equipment control interface function 1.
The indication information 2 includes an identification mark 2, which is used for indicating to inquire a matching parameter 4 corresponding to the identification mark 2 from a user space.
S8, the detection module 1 acquires the configuration parameters 4 from the system file 1 according to the identification mark 2.
S9, the detection module 1 sends configuration parameters 4 to the identification module 3 through the equipment control interface function 1.
S10, the identification module 3 analyzes the configuration parameters 4 and sends the analyzed configuration parameters 4 to the storage module 1.
In some embodiments, details of the implementation of parsing the configuration parameters 4 may refer to related technologies, which are not described herein.
S11, the storage module 1 stores the analyzed configuration parameters 4 in the kernel space.
In some embodiments, the storage module 1 may request a block of storage area in the kernel space for storing the configuration parameters 4. In this way, configuration parameters 4 may be written into the kernel space.
Thus, as shown in fig. 7, after the electronic device completes the identification of the image sensor, the configuration parameter 4 is newly added in the kernel space occupied by the storage module 1. Compared with the method that configuration parameters of all suppliers are stored in the kernel space, in the embodiment of the application, only the configuration parameters 4 are stored in the kernel space, so that repeated occupation of the virtual memory is effectively reduced.
In addition, after the electronic device completes the identification of the image sensor in the starting-up stage, the configuration parameters 4 obtained by the identification are stored in the kernel space, and the storage is in the starting-up process or after the starting-up, so that the starting time of the kernel layer is not influenced. Of course, in other possible embodiments, the configuration parameters in the kernel space occupied by the storage module 1 may be emptied during the shutdown of the electronic device. Thus, the starting time of the next kernel layer is not influenced.
S103, responding to the instruction information 2 sent by the third party application, acquiring the configuration parameters 4 in the kernel space, and loading.
In some embodiments, the third party application may be an application program that is installed as instructed by the user, as opposed to a native system application, for example, the third party application may be a beauty shooting application that is installed in response to the user instruction. The instruction information 2 is an instruction issued by a third party application, and instructs recognition for the image sensor. The instruction information 2 described above may also be referred to as a first request.
Illustratively, as shown in fig. 6, the step S103 may include the following substeps:
s12, the third party application sends the identification information 1 to the query interface 1 through the third party calling interface.
S13, the query interface 1 sends the query information 2 to the storage module 1 in response to the identification information 1.
S14, the storage module 1 responds to the query information 2 and sends the configuration parameters 4 to the third party application through the query interface 1 and the third party calling interface.
Therefore, even if the third party application does not have the authority to access the HAL layer, the identification of the image sensor in the electronic equipment can be realized, and the compatibility of different platform applications can be realized.
In summary, after the electronic device is powered on, or after a user has enabled a system application (e.g., a camera application) that is native to the electronic device, configuration parameters 4 that match the image sensor may be stored in the kernel space of the electronic device. Thus, when a third party application (such as a beauty shooting application) is started and run, if the camera module needs to be started, the beauty shooting application can quickly read the configuration parameters 4 matched with the image sensor from the kernel layer. In this way, the beauty image shooting application can not only successfully drive the image sensor, but also reduce the time consumption for identifying the image sensor. That is, the recognition efficiency is improved while ensuring compatibility of the third party application. In addition, the kernel space only needs to store the configuration parameters 4, so that the occupation of the kernel space is effectively reduced compared with the related art. In addition, whether the configuration parameters of the image sensor are triggered from the user space during the starting process or the configuration parameters of the image sensor are triggered from the user space during the starting process of the native system application, the configuration parameters are written into the kernel space after the starting process, and therefore the starting time of the kernel layer in the starting stage is not influenced.
In some embodiments, in a scenario where the electronic device is powered on, or the user program instructs to initialize the device chip, as shown in fig. 8, the method may include the following steps:
s201, the detection module 2 receives the instruction information 2.
In some embodiments, the instruction information 2 (which may also be referred to as a second request) may be an instruction capable of triggering the identification of a flash in the electronic device. The instruction information 2 is similar to the instruction information 1, and will not be described here.
In some embodiments, after the detection module 2 receives the instruction information 2, a plurality of identification marks, such as identification mark 3, may be obtained from the system file 2 stored in the user space. The plurality of identification marks 3 may be all identification marks contained in the system file 2, that is, all the identification marks corresponding to the suppliers providing the flash. In some examples, the plurality of identification tags 3 may be referred to as a plurality of first tags corresponding to the system file 2.
In addition, the access address of the flash lamp at the electronic device, i.e. the I2C address 2, can also be obtained from the system file 2. In this way, the detection module 2 can generate the indication information 3 according to the identification mark 3 and the I2C address 2.
S202, the detection module 2 sends the indication information 3 to the device control interface function 2.
Wherein, the indication information 3 comprises an identification mark 3 and an I2C address 2. The device control interface function (ioctl) acts as a data interaction interface between the user space and the kernel space, and serves as a bridge for information transfer between the user space and the kernel space. That is, the probe module 2 sends the indication information 3 to the device control interface function 2, and may instruct the device control interface function 2 to transfer the indication information 3 to a program module running in the kernel space.
S203, the device control interface function 2 sends the instruction information 3 to the identification module 4.
S204, the identification module 4 responds to the indication information 3 and sends query information 3 to the flash lamp according to the I2C address 2.
The flash lamp refers to an equipment chip accessed to the I2C address 2, and the query information 3 is used for querying an equipment identifier carried in the equipment chip. In some embodiments, it may be that the identification module 4 sends the query information 3 to the I2C address 2 of the I2C bus.
S205, the flash transmits the inquiry response information 2 to the identification module 4 in response to the inquiry information 3.
The inquiry response information 2 carries a device identifier in the flash lamp, for example, the device identifier 2 is called. This device identification 2 may be referred to as a first device identification corresponding to a flash.
S206, the identification module 4 determines the identification 4 matching the device identification 2 from the plurality of identifications 3.
For example, when the device identifier is a chip name and the identification identifier is also a chip name, the identification identifier 4 may be the same identification identifier as the device identifier 2 in the plurality of identification identifiers 3, and the identification identifier 4 may be referred to as a second identifier corresponding to the flash lamp. Also illustratively, when the device identifier is a chip ID and the identification identifier is a field indicating a vendor, the device identifier 2 includes a field having the same content as the identification identifier 4.
S207, the identification module 4 sends the indication information 4 to the detection module 2 through the device control interface function 2.
The indication information 4 includes an identification mark 4, and indicates that a matching parameter 5 corresponding to the identification mark 4 needs to be queried from the user space.
S208, the detection module 2 acquires the configuration parameters 5 from the system file 2 according to the identification mark 4.
S209, the detection module 2 sends the configuration parameters 5 to the identification module 4 through the device control interface function 2.
S210, the identification module 4 analyzes the configuration parameters 5 and sends the analyzed configuration parameters 5 to the storage module 2.
In some embodiments, details of the implementation of parsing the configuration parameters 5 may refer to related technologies, which are not described herein.
S211, the storage module 2 stores the analyzed configuration parameters 5 in the kernel space.
Thus, as shown in fig. 9, after the electronic device completes the identification of the flash, the configuration parameter 5 is newly added in the kernel space occupied by the memory module 2. After that, when the third party application is to identify the flash, the corresponding configuration parameters 5 may be directly obtained from the storage module 2 and loaded. That is, the third party application obtains the corresponding configuration parameters 5 from the storage module 2 through the third party calling interface and the query interface 2, and the specific process can refer to the process of identifying the image sensor by the third test application, which is not described herein.
When the flash is referred to as a first chip, this configuration parameter 5 may be referred to as a corresponding first configuration parameter. In some embodiments, the memory address in kernel space for storing the first configuration parameter may be referred to as a first address. Of course, the first addresses corresponding to different first chips may be different.
The above is an example of the identification process of two device chips, and in the embodiment of the present application, software modules for identifying different device chips are independent of each other and are not coupled, so that the robustness of the identification software can be improved. The identification process of the other device chips may also refer to the identification of the image sensor and the flash lamp in the foregoing embodiment, which is not described herein.
As another implementation, referring to fig. 10, the process of chip recognition is as follows: the user process (application process corresponding to the user program) running in the user space can initiate the identification of the device chip, and then traverse the identification identifier and the configuration parameters of the device chip provided by each provider. For example, in the system file corresponding to the device chip, the identification identifier and the configuration parameter corresponding to each provider are traversed. Thus, the traversed identification mark, the configuration parameters and the I2C address of the device chip in the electronic device corresponding to the provider are put into a data packet. That is, the data packet includes an identification identifier, a configuration parameter and an I2C address corresponding to a provider. The data packet is then passed to the kernel space identification module through the device control interface function. And the identification module acquires the equipment identification of the actually installed equipment chip in the electronic equipment according to the I2C address in the data packet. If the obtained device identification matches the identification in the data packet, the configuration parameters are parsed and stored in kernel space. In addition, the identification module may send a first message to the corresponding detection module, the first message indicating that the first configuration parameter has been determined for informing the detection module to stop traversing. Then, a corresponding call interface (i.e., the query interface in the foregoing) is set, so that the third party application can query the configuration parameters corresponding to the device chip through the interface. If the obtained equipment identifier is not matched with the identifier in the data packet, the traversed identifier and the traversed configuration parameter of the next provider are transmitted, then a data packet is transmitted according to the traversed identifier, the traversed configuration parameter and the I2C address, and the identification module is repeatedly called for identification, so that the details are not repeated.
The embodiment of the application also provides electronic equipment, which can comprise: a memory and one or more processors. The memory is coupled to the processor. The memory is for storing computer program code, the computer program code comprising computer instructions. The computer instructions, when executed by the processor, cause the electronic device to perform the steps performed by the handset in the embodiments described above. Of course, the electronic device includes, but is not limited to, the memory and the one or more processors described above.
The embodiment of the application also provides a chip system which can be applied to the terminal equipment in the embodiment. As shown in fig. 11, the system-on-chip includes at least one processor 2201 and at least one interface circuit 2202. The processor 2201 may be a processor in an electronic device as described above. The processor 2201 and the interface circuit 2202 may be interconnected by wires. The processor 2201 may receive and execute computer instructions from the memory of the electronic device described above through the interface circuit 2202. The computer instructions, when executed by the processor 2201, cause the electronic device to perform the steps performed by the handset in the embodiments described above. Of course, the system-on-chip may also include other discrete devices, which are not particularly limited in accordance with embodiments of the present application.
In some embodiments, it will be clearly understood by those skilled in the art from the foregoing description of the embodiments, for convenience and brevity of description, only the division of the above functional modules is illustrated, and in practical application, the above functional allocation may be implemented by different functional modules, that is, the internal structure of the apparatus is divided into different functional modules to implement all or part of the functions described above. The specific working processes of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which are not described herein.
The functional units in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the embodiments of the present application may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: flash memory, removable hard disk, read-only memory, random access memory, magnetic or optical disk, and the like.
The foregoing is merely a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited to this, and any changes or substitutions within the technical scope disclosed in the embodiment of the present application should be covered in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiments of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A chip identification method, which is applied to an electronic device, wherein the electronic device comprises a first chip, and a virtual memory space of the electronic device comprises a kernel space, the method comprising:
After determining a first configuration parameter matched with the first chip, storing the first configuration parameter in a first address, wherein the first address is a storage address in the kernel space, and the first configuration parameter is parameter information for driving the first chip;
and responding to a first request triggered by a third-party application, and reading and loading the first configuration parameters from the first address, wherein the first request is request information for indicating to identify the first chip, and the third-party application is an application program only performing data interaction with a kernel space.
2. The method of claim 1, wherein the virtual memory space further comprises a user space, the user space comprising a first file, the first file comprising a plurality of first identifiers and corresponding configuration parameters, different ones of the first identifiers indicating the first chips produced by different suppliers, different ones of the configuration parameters corresponding to the first identifiers being applicable to the first chips produced by different suppliers; the method further comprises, prior to storing the first configuration parameter at the first address:
Responding to a second request triggered by a first application, acquiring a first equipment identifier from the first chip, wherein the first equipment identifier indicates a provider corresponding to the first chip, the second request is request information for indicating identification of the first chip, and the first application is a system program native to the electronic equipment;
And under the condition that the plurality of first identifiers comprise a second identifier, determining the first configuration parameters from a plurality of configuration parameters in the first file according to the second identifier, wherein the second identifier is matched with the first equipment identifier.
3. The method of claim 2, wherein the electronic device comprises a first detection module and a first identification module, the first detection module operating in the user space, the first identification module operating in the kernel space, the method further comprising, prior to obtaining a first device identification from the first chip:
The first detection module acquires the plurality of first identifications and access addresses corresponding to the first identifications from the first file;
the first detection module sends the plurality of first identifications and the access address to the first identification module;
The obtaining the first device identifier from the first chip includes: the first identification module responds to the received multiple first identifiers, and reads the corresponding first equipment identifiers from the first chip according to the access address;
The method further comprises the steps of: the first identification module determines the second identification matched with the first equipment identification from the plurality of first identifications;
and determining the first configuration parameter from a plurality of configuration parameters in the first file according to the second identifier, including: the first identification module sends the second identification to the first detection module; the first detection module determines the corresponding first configuration parameters from the first file according to the second identifier;
Before said storing the first configuration parameter at the first address, the method further comprises: the first detection module sends the first configuration parameters to a first identification module.
4. The method of claim 2, wherein the electronic device comprises a first detection module and a first identification module, the first detection module operating in the user space, the first identification module operating in the kernel space, the method further comprising, prior to obtaining a first device identification from the first chip:
The first detection module traverses each first identifier in the first file, wherein the plurality of first identifiers in the first file comprise second identifiers;
When traversing to the second identifier, the first detection module sends the traversed second identifier and corresponding configuration parameters to the first identification module;
Acquiring a first device identifier from the first chip, including: the first identification module responds to the received second identification and the corresponding configuration parameters, and reads the corresponding first equipment identification from the first chip;
and determining the first configuration parameter from a plurality of configuration parameters in the first file according to the second identifier, including: if the second identifier received by the first identification module is matched with the first equipment identifier, determining a corresponding configuration parameter as the first configuration parameter;
the method further comprises the steps of: the first identification module sends a first message to a first detection module, wherein the first message indicates that the first configuration parameter is determined;
The first detection module stops traversing the first identification in response to the first message.
5. The method according to claim 3 or 4, wherein after determining the first configuration parameter, the method further comprises:
The first identification module analyzes the first configuration parameters;
The storing the first configuration parameter at a first address includes: and the first identification module stores the parsed first configuration parameters in the first address.
6. The method of any of claims 3-4, wherein different ones of the first chips have different corresponding first detection modules and different corresponding first identification modules.
7. The method of any of claims 1-4, wherein the first chip is a device chip that accesses an I2C bus.
8. An electronic device comprising one or more processors and memory; the memory being coupled to a processor, the memory being for storing computer program code comprising computer instructions which, when executed by one or more processors, are for performing the method of any of claims 1-7.
9. A computer storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the method of any of claims 1-7.
10. A computer program product, characterized in that the computer program product comprises a computer program which, when run on a computer, causes the computer to perform the method according to any of claims 1-7.
CN202211105205.7A 2022-09-09 2022-09-09 Chip identification method and electronic equipment Active CN116743903B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211105205.7A CN116743903B (en) 2022-09-09 2022-09-09 Chip identification method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211105205.7A CN116743903B (en) 2022-09-09 2022-09-09 Chip identification method and electronic equipment

Publications (2)

Publication Number Publication Date
CN116743903A CN116743903A (en) 2023-09-12
CN116743903B true CN116743903B (en) 2024-05-14

Family

ID=87912067

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211105205.7A Active CN116743903B (en) 2022-09-09 2022-09-09 Chip identification method and electronic equipment

Country Status (1)

Country Link
CN (1) CN116743903B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462006A (en) * 2015-01-05 2015-03-25 华为技术有限公司 Method and device for synchronizing configuration between multiple processor cores in system-level chip
CN110347475A (en) * 2019-06-19 2019-10-18 东软集团股份有限公司 Service calling method, service call device and service calling system
CN110399726A (en) * 2019-06-25 2019-11-01 苏州浪潮智能科技有限公司 TPM phy chip detection method, device, equipment and readable storage medium storing program for executing
WO2020062981A1 (en) * 2018-09-26 2020-04-02 Oppo广东移动通信有限公司 Method and apparatus for tracking file caching efficiency, and storage medium and terminal
WO2020062980A1 (en) * 2018-09-26 2020-04-02 上海瑾盛通信科技有限公司 File access tracking method, device, storage medium and terminal
CN112783564A (en) * 2019-11-01 2021-05-11 华为技术有限公司 Method for accelerating starting of application program and electronic equipment
CN114281467A (en) * 2020-09-28 2022-04-05 中科寒武纪科技股份有限公司 System method, device and storage medium for realizing heat migration

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462006A (en) * 2015-01-05 2015-03-25 华为技术有限公司 Method and device for synchronizing configuration between multiple processor cores in system-level chip
WO2020062981A1 (en) * 2018-09-26 2020-04-02 Oppo广东移动通信有限公司 Method and apparatus for tracking file caching efficiency, and storage medium and terminal
WO2020062980A1 (en) * 2018-09-26 2020-04-02 上海瑾盛通信科技有限公司 File access tracking method, device, storage medium and terminal
CN110347475A (en) * 2019-06-19 2019-10-18 东软集团股份有限公司 Service calling method, service call device and service calling system
CN110399726A (en) * 2019-06-25 2019-11-01 苏州浪潮智能科技有限公司 TPM phy chip detection method, device, equipment and readable storage medium storing program for executing
CN112783564A (en) * 2019-11-01 2021-05-11 华为技术有限公司 Method for accelerating starting of application program and electronic equipment
CN114281467A (en) * 2020-09-28 2022-04-05 中科寒武纪科技股份有限公司 System method, device and storage medium for realizing heat migration

Also Published As

Publication number Publication date
CN116743903A (en) 2023-09-12

Similar Documents

Publication Publication Date Title
WO2021052311A1 (en) Method for displaying user interface according to color of rear case, and electronic device
WO2021151350A1 (en) Method and apparatus for loading dynamic link library
CN115687035A (en) Memory leak detection method and electronic equipment
CN113326498A (en) Authority multiplexing method, resource access method based on authority multiplexing and related equipment
CN113656089B (en) Class verification method and device in application program
CN116743903B (en) Chip identification method and electronic equipment
CN117130541B (en) Storage space configuration method and related equipment
CN114741121B (en) Method and device for loading module and electronic equipment
CN111381996A (en) Memory exception handling method and device
CN116048771B (en) Resource scheduling method and related equipment
CN116048955B (en) Test method and electronic equipment
CN115291951A (en) UEFI (unified extensible firmware interface) starting method and device, electronic equipment and storage medium
US20230350738A1 (en) Method for Reusing Shared Library and Electronic Device
WO2021238376A1 (en) Function pack loading method and apparatus, and server and electronic device
US11934853B2 (en) Electronic device and operating method thereof
CN115061702B (en) IDE management method and electronic equipment
CN111984343B (en) Plug-in resource searching method, device, equipment and readable storage medium
CN116048829B (en) Interface calling method, device and storage medium
WO2024083114A1 (en) Software distribution method, electronic device, and system
CN116048562B (en) Data updating method, electronic equipment and storage medium
CN117130680A (en) Calling method of chip resources and electronic equipment
WO2024061036A1 (en) Inter-engine communication method and related device
WO2024046260A1 (en) Hotfix method and related apparatus
CN116701238A (en) Drive file processing method and related device
CN117724828A (en) Management method of memory manager and electronic equipment

Legal Events

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