A method for loading a resource file of a motor, an electronic device, and a storage medium
By obtaining motor attribute information and power chip manufacturer information, the loading path is determined, which solves the problem of incompatibility in loading resource files for different motor models, enabling normal motor operation and improving user experience.
Patent Information
- Application Number
- CN202410007287.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-02
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-01-02
AI Technical Summary
In the prior art, electronic devices use the same motor framework to load motor resource files when they are powered on, and cannot adaptively load motor resource files of different models, which causes the motor to malfunction and affects the user experience.
By acquiring motor attribute information, including power chip manufacturer information and resonant frequency information, when the electronic device starts up, the target path for loading the motor resource file is determined, enabling adaptive loading.
Ensure that resource files for different motor models can be loaded correctly to improve user experience.
Smart Images

Figure CN119248362B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart terminals, and more particularly to a method for loading resource files of a motor, an electronic device, and a storage medium. Background Technology
[0002] Currently, vibration alerts in electronic devices are achieved through motor vibration. When an electronic device powers on, it needs to load the motor's resource files to ensure proper motor control during operation. Typically, the same motor framework (or motor service) is used to load the motor's resource files during startup. However, when different electronic devices use motors from different manufacturers, of different types, and / or of different sizes, this motor framework cannot adaptively load the motor resource files for each model. This can lead to motor malfunction and negatively impact the user experience. Summary of the Invention
[0003] In related technologies, the same motor framework is used to load motor resource files when electronic devices are powered on and started. This makes it impossible to adaptively load motor resource files for different models of electronic devices, which may cause the motors of electronic devices to malfunction and affect the user experience.
[0004] This application provides a method for loading motor resource files, an electronic device, and a storage medium, which can meet the requirement of loading motor resource files according to motor attribute information, so that the performance of the motor can be fully utilized and the user experience can be improved.
[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0006] In a first aspect, this application provides a method for loading a motor resource file, applied to an electronic device, the method comprising:
[0007] When the electronic device starts up, obtain the motor attribute information and determine the validity of the motor attribute information;
[0008] If the motor's attribute information is valid, obtain the power chip manufacturer information for the motor.
[0009] Based on the motor's power chip manufacturer information and motor attribute information, the first target loading path for loading the motor's resource files is determined.
[0010] Based on the technical solution provided in the above embodiments, motor attribute information is obtained when the electronic device starts up, and if the motor attribute information is valid, the power chip manufacturer information of the motor is obtained. Then, based on the power chip manufacturer information and the motor attribute information, a first target loading path for loading the motor's resource files is determined. Since the determination of this first target loading path includes the motor attribute information, motor resource files for different models of electronic devices can be adaptively loaded according to the first target loading path, preventing the motor of the electronic device from malfunctioning and improving the user experience.
[0011] In one possible design approach of the first aspect, determining the validity of the motor attribute information includes:
[0012] When the motor attribute information includes motor manufacturer information, motor type information, and motor size information, the validity of the motor attribute information is determined.
[0013] Based on the above scheme, the legitimacy of motor attribute information can be accurately determined by judging whether the motor attribute information includes motor manufacturer information, motor type information, and motor size information.
[0014] In one possible design approach of the first aspect, when the electronic device is started, motor attribute information is acquired, including:
[0015] When the electronic device starts up, the motor kernel driver is loaded;
[0016] Read the motor model from the motor device description file, parse the motor model, and obtain the motor attribute information.
[0017] Based on the above scheme, when the motor model is included in the motor device description file of the electronic device, the motor kernel driver is loaded when the electronic device starts up, and the motor model is read from the motor device description file and parsed when the motor kernel driver is loaded, so as to accurately obtain the motor attribute information.
[0018] In one possible design of the first aspect, before obtaining the power chip manufacturer information of the motor, the method further includes: when loading the motor core driver, the motor core driver obtains the power chip manufacturer information of the motor from the motor auxiliary driver.
[0019] Provided the motor's attribute information is valid, obtain the motor's power chip manufacturer information, including:
[0020] If the motor attribute information is valid, obtain the motor's power chip manufacturer information from the motor core driver.
[0021] Based on the above solution, before obtaining the motor's power chip manufacturer information, the motor kernel driver obtains the motor's power chip manufacturer information from the motor auxiliary driver during the loading of the motor kernel driver. In this way, the motor kernel driver can obtain the motor's power chip manufacturer information from the motor kernel driver, provided the motor attribute information is valid.
[0022] In one possible design approach of the first aspect, based on the motor's power chip manufacturer information and motor attribute information, the first target loading path for loading the motor's resource files is determined, including:
[0023] Obtain multiple sets of first loading paths; the path name of the first loading path includes motor attribute information;
[0024] Based on the motor's power chip manufacturer information and motor attribute information, the first target loading path for loading the motor's resource files is determined from multiple sets of first loading paths.
[0025] Based on the above scheme, when multiple first loading paths include the first loading path corresponding to the motor's power chip manufacturer information and motor attribute information, the first loading path corresponding to the motor's power chip manufacturer information and motor attribute information can be accurately determined as the first target loading path.
[0026] In one possible design approach for the first aspect, the method also includes:
[0027] When loading the motor kernel driver, the motor kernel driver obtains the motor's resonant frequency information from the motor auxiliary driver;
[0028] If the motor attribute information is invalid, obtain the motor's resonant frequency information and the motor's power chip manufacturer information from the motor core driver.
[0029] Based on the motor's resonant frequency information and the motor's power chip manufacturer information, a second target loading path for loading the motor's resource files is determined.
[0030] Based on the above scheme, when loading the motor kernel driver, the motor kernel driver obtains the motor's resonant frequency information from the motor auxiliary driver. This ensures that even if the motor attribute information is invalid, the motor's resonant frequency information and the motor's power supply chip manufacturer information can still be obtained from the motor kernel driver. Furthermore, based on the motor's resonant frequency information and the motor's power supply chip manufacturer information, a second target loading path for loading the motor's resource files can be determined, thereby completing the loading of the resource files under the second loading path.
[0031] In one possible design approach of the first aspect, based on the motor's resonant frequency information and the motor's power chip manufacturer information, a second target loading path for loading the motor's resource files is determined, including:
[0032] Based on the motor's resonant frequency information, the type of motor is determined;
[0033] Based on the type of motor and the power chip manufacturer information of the motor, a second target loading path for loading the motor's resource files is determined.
[0034] Based on the above technical solution, the specific type of motor can be determined according to the motor's resonance yield information. Then, based on the specific type of motor and the power chip manufacturer information of the motor, the second target loading path for loading the motor's resource files can be accurately determined, thereby completing the loading of the resource files under the second loading path.
[0035] In one possible design approach of the first aspect, based on the type of motor and the power supply chip manufacturer information of the motor, a second target loading path for loading the motor's resource files is determined, including:
[0036] Retrieve multiple sets of secondary loading paths; the names of the secondary loading paths do not include motor attribute information.
[0037] Based on the type of motor and the power chip manufacturer information of the motor, a second target loading path for loading the motor's resource files is determined from multiple sets of second loading paths.
[0038] Based on the above technical solution, when multiple sets of second loading paths include the second loading path corresponding to the motor type and the motor power chip manufacturer information, the second loading path corresponding to the motor type and the motor power chip manufacturer information can be accurately determined as the first target loading path.
[0039] In one possible design approach of the first aspect, the method further includes, before obtaining the motor attribute information:
[0040] Determine the validity of motor frequency files in electronic devices;
[0041] Obtain motor attribute information, including:
[0042] If the motor frequency file is valid, obtain the motor attribute information.
[0043] Based on the above technical solution, the validity of the motor frequency file in the electronic device can be determined first. If the motor frequency file is valid, the motor attribute information can be obtained to avoid unnecessary overhead caused by obtaining the motor attribute information when the motor frequency file in the electronic device is invalid.
[0044] In a second aspect, this application provides an electronic device comprising: a display screen, a memory, and one or more processors; the display screen, the memory, and the processors are coupled; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform a method for loading a motor resource file as provided in the first aspect and any possible design thereof.
[0045] Thirdly, this application provides a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform a method for loading a motor resource file as provided in the first aspect and any possible design thereof.
[0046] Fourthly, this application provides a computer program product containing executable instructions that, when the computer program product is run on an electronic device, cause the electronic device to perform a method for loading a motor resource file as provided in the first aspect and any of its possible design embodiments.
[0047] Fifthly, an apparatus (e.g., a system-on-a-chip) is provided, comprising a processor for supporting an electronic device in performing the functions described in the second aspect above. In one possible design, the apparatus further comprises a memory for storing program instructions and data necessary for the electronic device. When the apparatus is a system-on-a-chip, it may be composed of chips or may include chips and other discrete devices.
[0048] Understandably, the beneficial effects that the technical solutions provided in the second to fifth aspects described above can be achieved can be referred to the beneficial effects in the first aspect and any of its possible design methods, which will not be repeated here. Attached Figure Description
[0049] Figure 1 A schematic block diagram of a loading motor resource file provided in an embodiment of this application;
[0050] Figure 2 A schematic block diagram of another loading motor resource file provided in an embodiment of this application;
[0051] Figure 3 A schematic diagram of the hardware architecture of an electronic device provided in an embodiment of this application;
[0052] Figure 4 A schematic diagram of the software architecture of an electronic device provided in an embodiment of this application;
[0053] Figure 5A flowchart illustrating a method for loading motor resource files provided in an embodiment of this application;
[0054] Figure 6 A flowchart illustrating another method for loading motor resource files provided in this application embodiment;
[0055] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0056] Figure 8 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation
[0057] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that “ / ” means “or,” for example, A / B can mean A or B; “and / or” in the text is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can mean: A alone, A and B simultaneously, and B alone.
[0058] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.
[0059] The terms "first" and "second" in the following embodiments of this application are for descriptive purposes only and should not be construed as implying relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0060] With the development of electronic device technology, motors of various types, manufacturers, and sizes have been widely used in electronic devices to achieve vibration alert functions. Typically, when an electronic device is powered on, resource files for different types, manufacturers, or sizes of motors are loaded according to different resource file loading paths to enable the vibration alert function.
[0061] Currently, motor resource files can include vibration description files, motor algorithm files, and vibration sequence files for the entire system. The vibration description file includes information about the motor's power chip manufacturer, product customization attributes, and motor algorithm parameters. In some examples, if the motor type is an x-axis linear motor, the vibration description file includes x-axis motor algorithm parameters; if the motor type is a z-axis linear motor, the vibration description file includes z-axis motor algorithm parameters.
[0062] In some examples, the power chip manufacturer information for the motor can determine the loading path of the motor's resource files within the electronic device. Descriptive information about partial motor vibration data can be generated based on product customization attributes, motor algorithm parameters, and the motor algorithm library within the motor framework.
[0063] In some embodiments, if the motor type is an x-axis linear motor and the motor chip manufacturer is vendor1, the vibration description file includes vendor1 / vibrator_desc_x.xml; if the motor type is an x-axis linear motor and the motor chip manufacturer is vendor2, the vibration description file may include vendor2 / vibrator_desc_x.xml. The vendor1 directory in vendor1 / vibrator_desc_x.xml identifies the power chip manufacturer as vendor1. The vendor2 directory in vendor2 / vibrator_desc_x.xml identifies the power chip manufacturer as vendor2. By parsing the vibrator_desc_x.xml file in vendor1 / vibrator_desc_x.xml and / or vendor2 / vibrator_desc_x.xml, product customization attributes and motor algorithm parameters can be obtained.
[0064] In some embodiments, if the motor type is a Z-axis linear motor and the motor chip manufacturer is vendor1, the vibration description file may include vendor1 / vibrator_desc_z.xml; if the motor type is a Z-axis linear motor and the motor chip manufacturer is vendor2, the vibration description file may include vendor2 / vibrator_desc_z.xml. The vendor1 directory in vendor1 / vibrator_desc_z.xml identifies the power chip manufacturer as vendor1. The vendor2 directory in vendor2 / vibrator_desc_z.xml identifies the power chip manufacturer as vendor2. By parsing the vibrator_desc_z.xml in vendor1 / vibrator_desc_z.xml and / or vendor2 / vibrator_desc_z.xml, product customization attributes and motor algorithm parameters can be obtained. This application does not limit the motor type; it only uses vibration description files containing both X-axis and Z-axis linear motors as examples for illustrative purposes.
[0065] In some embodiments, if the motor type is an x-axis linear motor, the vibration sequence file containing the x-axis whole system vibration may include vibrator_slices_config_x.xml; the algorithm file containing the x-axis motor may include libHapticPlayerTwoKit_x.so and libHapticPlayerOneKit_x.so. If the motor type is a z-axis linear motor, the vibration sequence file containing the z-axis whole system vibration may include vibrator_slices_config_z.xml; the file containing the z-axis motor algorithm may include libHapticPlayerTwoKit_z.so and libHapticPlayerOneKit_z.so. This application does not limit the motor type; it only uses the vibration sequence file containing the x-axis whole system vibration, the vibration sequence file containing the z-axis whole system vibration, the algorithm file containing the x-axis motor, and the algorithm file containing the z-axis motor as examples for illustrative purposes.
[0066] Figure 1 This is a schematic block diagram of a resource file for loading a motor, provided as an embodiment of this application. Figure 1 As shown, the loading of motor resource files can be achieved through the interaction between the motor framework 10 in the HAL layer (hardware abstraction layer) (user space) and the first motor kernel driver 11 and the second motor kernel driver 12 in the kernel layer.
[0067] The motor frame 10 includes a parsing module 101 and a vibration algorithm library 102. The parsing module 101 parses the corresponding resource file according to the loading path of the motor's resource file and interacts with the vibration algorithm library 102 to output the parsed product customization attributes and motor algorithm calculation parameters to the vibration algorithm library 102. The vibration algorithm library 102 processes the product customization attributes and motor algorithm calculation parameters and outputs descriptive information of some motor vibration data to the parsing module 101. The first motor kernel driver 11 can be a motor kernel driver developed in-house by the electronic equipment manufacturer, and when loading the first motor kernel driver 11, it can read the motor's resonant frequency information and the motor's power chip manufacturer information from the second motor kernel driver 12. The second motor kernel driver 12 can be a third-party motor kernel driver that stores the motor's resonant frequency information and the motor's power chip manufacturer information. The second motor kernel driver 12 includes a description of the motor's resonant frequency and the motor's power chip manufacturer information.
[0068] The following is combined with Figure 1 An example is provided to illustrate the method for loading the motor's resource files.
[0069] In this embodiment of the disclosure, when the electronic device is powered on and the first motor kernel driver 11 is loaded, the first motor kernel driver 11 reads the power chip manufacturer information and the resonant frequency information of the motor from the second motor kernel driver 12 (the interaction corresponding to ②). When the motor frame 10 starts, the motor frame 10 reads the power chip manufacturer information and the resonant frequency information of the motor from the first motor kernel driver 11 (the interaction corresponding to ①), and determines the loading path for the motor's resource files based on the power chip manufacturer information and the resonant frequency information, so as to load the resource files under that loading path.
[0070] In this embodiment, the HAL layer in the electronic device can store loading paths for multiple sets of resource files. A corresponding loading path can be selected from these multiple sets of resource file loading paths based on the motor's power chip manufacturer information and the motor's resonant frequency information. In some examples, the HAL layer in the electronic device may include the following three sets of resource file loading paths.
[0071] Loading path for the first set of resource files:
[0072] / odm / etc / vibrator / vendor1 / vibrator_desc_x.xml
[0073] / odm / etc / vibrator / vendor2 / vibrator_desc_x.xml
[0074] / odm / etc / vibrator / vibrator_slices_config_x.xml
[0075] / odm / lib64 / libHapticPlayerTwoKit_x.so
[0076] / odm / lib64 / libHapticPlayerOneKit_x.so
[0077] Loading path for the second set of resource files:
[0078] / odm / etc / vibrator / vendor1 / vibrator_desc_z.xml
[0079] / odm / etc / vibrator / vendor2 / vibrator_desc_z.xml
[0080] / odm / etc / vibrator / vibrator_slices_config_z.xml
[0081] / odm / lib64 / libHapticPlayerTwoKit_z.so
[0082] / odm / lib64 / libHapticPlayerOneKit_z.so
[0083] Loading path for the third set of resource files:
[0084] / odm / etc / vibrator / vibrator_desc.xml
[0085] / odm / etc / vibrator / vibrator_effect_config.xml
[0086] In this embodiment, the type of motor can be determined based on the motor's resonant frequency information. The loading path for the first group of resource files, the second group of resource files, or the third group of resource files can then be selected based on the motor type.
[0087] If the motor type is an x-axis linear motor, select the loading path of the first group of resource files; if the motor type is a z-axis linear motor, select the loading path of the second group of resource files; if the motor type is a flat motor, select the loading path of the third group of resource files.
[0088] In some embodiments, the loading paths of the first set of resource files and the second set of resource files are both loading paths of the linear motor's resource files. Since the linear motor has two power chip manufacturers, and both the loading paths of the first and second sets of resource files include vibration description files corresponding to the power chip manufacturers of the two motors (e.g., vendor1 and vendor2), after determining the loading path of the first set of resource files based on whether the linear motor is an x-axis linear motor, or the loading path of the second set of resource files based on whether the linear motor is a z-axis linear motor, it is also necessary to determine the loading path of the vibration description files in the motor's resource files based on the motor's power chip manufacturer information.
[0089] If the motor is an X-axis linear motor and the power supply chip manufacturer is vendor1, then the motor's description file is loaded at ` / odm / etc / vibrator / vendor1 / vibrator_desc_x.xml`. If the motor is a Z-axis linear motor and the power supply chip manufacturer is vendor1, then the motor's description file is loaded at ` / odm / etc / vibrator / vendor1 / vibrator_desc_z.xml`. If the motor is an X-axis linear motor and the power supply chip manufacturer is vendor2, then the motor's description file is loaded at ` / odm / etc / vibrator / vendor2 / vibrator_desc_x.xml`. If the motor is a Z-axis linear motor and the power supply chip manufacturer is vendor2, then the motor's description file is loaded at ` / odm / etc / vibrator / vendor2 / vibrator_desc_z.xml`.
[0090] pass Figure 1 As the above analysis shows, for various electronic devices (which may include motors from different manufacturers, of different types, and / or of different sizes), when the electronic device is powered on, the same motor framework determines the loading path of the corresponding resource file based on the motor's resonant frequency information and the power chip manufacturer information, and loads the corresponding motor resource file. However, when different models of electronic devices use motors from different manufacturers, of different types, and / or of different sizes, the motor framework cannot adaptively load the motor resource files of different models of electronic devices, which may cause the motor of the electronic device to malfunction and affect the user experience.
[0091] To address the aforementioned problems, this application provides a method for loading motor resource files, which can be applied to electronic devices. In this technical solution, the motor kernel driver (such as...) of the electronic device can be used... Figure 1When the first motor kernel driver (11) loads, it reads the motor's power chip manufacturer information, the motor's resonant frequency information, and the pre-stored motor model number representing motor attributes, and parses the motor model number to obtain the motor attribute information. When the electronic device's motor framework starts, it retrieves the motor kernel driver's information and, based on the motor attribute information, the motor's power chip manufacturer information, and the motor's resonant frequency, determines the loading path for the motor's resource files, and thus loads the corresponding resource files. This not only meets the requirement of adaptively loading motor resource files based on motor attribute information but also ensures compatibility with loading resource files from motors that do not have attribute requirements. This prevents the electronic device's motor from malfunctioning and improves the user experience.
[0092] The technical solutions provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0093] Figure 2 This is a schematic block diagram of another resource file for a loading motor provided in an embodiment of this application. For example... Figure 2 As shown, the loading of motor resource files can be achieved through the interaction between the motor framework 10 in the HAL layer, the first motor kernel driver 11, the second motor kernel driver 12 in the kernel layer, and the motor device description file 13.
[0094] Among them, and Figure 1 Similarly, the motor frame 10 includes a parsing module 101 and a vibration algorithm library 102. The parsing module 101 parses the corresponding resource file according to the loading path of the motor's resource file and interacts with the vibration algorithm library 102 to output the parsed product customization attributes and motor algorithm calculation parameters to the vibration algorithm library 102. The vibration algorithm library 102 processes the product customization attributes and motor algorithm calculation parameters and outputs descriptive information of some motor vibration data to the parsing module 101. The first motor kernel driver 11 can be a motor kernel driver developed in-house by the electronic equipment manufacturer. The second motor kernel driver 12 can be a third-party motor kernel driver that stores the motor's resonant frequency information and the motor's power chip manufacturer information. The second motor kernel driver 12 includes a description of the motor's resonant frequency and the motor's power chip manufacturer information. The motor device description file 13 may include the motor model (which can be composed of a motor size description, a motor type description, and a motor manufacturer description).
[0095] In some examples, the motor model number may be x_manufacturer1_0809.
[0096] In the motor model x_manufacturer1_0809, 'x' indicates that the motor type is an x-axis linear motor; 'manufacturer1' indicates the manufacturer name; and '0809' indicates the size.
[0097] In other examples, the motor model may be z_manufacturer2_9595.
[0098] In the motor model z_manufacturer2_9595, z indicates that the motor type is a z-axis linear motor; in the motor model z_manufacturer2_9595, manufacturer2 indicates the manufacturer name corresponding to manufacturer2; in the motor model x_manufacturer1_0809, 0809 indicates the size of the motor corresponding to 0809.
[0099] In this embodiment of the disclosure, when loading the first motor core driver 11, not only can the resonant frequency information of the motor and the power chip manufacturer information of the motor be read from the second motor core driver 12, but the motor model can also be read from the motor core description file 13.
[0100] The following is combined with Figure 2 An example is provided to illustrate the method for loading the motor's resource files.
[0101] In this embodiment, when the electronic device is powered on and the first motor kernel driver 11 is loaded, the first motor kernel driver 11 reads the power chip manufacturer information and the resonant frequency information of the motor from the second motor kernel driver 12 (interaction corresponding to ②), reads the motor model from the motor device description file 13 (interaction corresponding to ④), and parses the motor model to obtain the motor's attribute information (including the motor's size information, motor manufacturer information, and motor type information). When the motor frame 10 starts, the motor frame 10 reads the power chip manufacturer information, resonant frequency information, size information, manufacturer information, and type information of the motor from the first motor kernel driver 11, and determines the loading path for the motor's resource files based on these information, in order to load the corresponding resource files. Among them, ① corresponds to the interaction of the motor frame 10 reading the power chip manufacturer information and the resonant frequency information of the motor from the motor core driver 11; ③ corresponds to the interaction of the motor frame 10 reading the size information, manufacturer information and type information of the motor from the motor core driver 11.
[0102] pass Figure 2 It is evident that during motor frame loading, the loading path for the corresponding resource files can be determined based on the motor's resonant frequency information, power chip manufacturer information, and motor attribute information, thereby loading the appropriate motor resource files. This not only satisfies the requirement to load motor resource files based on motor attribute information but also ensures compatibility with loading resource files from motors without specific attribute requirements. Consequently, the motor's performance can be fully utilized, improving the user experience.
[0103] In this application, the aforementioned electronic devices may be mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), and other devices that use a multi-battery series system to supply power. The embodiments of this application do not impose any restrictions on the specific type of electronic device.
[0104] Take mobile phones as an example of electronic devices. Figure 3 A schematic diagram of the structure of the electronic device provided in this application is shown.
[0105] Reference Figure 3As shown, the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a display screen 193, a subscriber identification module (SIM) card interface 194, and a camera 195, etc. The sensor module 180 may include pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, proximity sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.
[0106] Processor 110 may include one or more processing units, such as an access point (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0107] A controller can be the nerve center and command center of an electronic device. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.
[0108] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. In this embodiment, the processor can be a System-on-a-Chip (SoC).
[0109] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an I2C interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0110] The charging management module 140 is used to receive charging input from a power supply device (e.g., a charger, a laptop, etc.). The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via a USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device.
[0111] While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141. Specifically, the battery 142 can be composed of multiple batteries connected in series. The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110.
[0112] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 193, camera 195, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as the voltage, current, battery cycle count, and battery health status (leakage current, impedance) of the battery 142. In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device; for example, the power management module 141 and the charging management module 140 may be different functional modules within the same chip.
[0113] In this embodiment, the power management module 141 and / or the charging management module 140 may include a fast charging chip. The power management module 141 and / or the charging management module 140 can utilize the fast charging chip to achieve high-power charging of the battery. The fast charging chip has multiple registers for storing corresponding ADC data for different types of data.
[0114] The external memory interface 120 can be used to connect to external non-volatile memory, thereby expanding the storage capacity of the electronic device. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to perform data storage functions. For example, music, video, and other files can be stored in the external non-volatile memory.
[0115] Internal memory 121 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM). The RAM can be directly read and written by the processor 110 and can be used to store executable programs (e.g., machine instructions) of the operating system or other running programs, as well as user and application data. The NVM can also store executable programs and user and application data, and can be pre-loaded into the RAM for direct read and write operations by the processor 110.
[0116] A touch sensor, also known as a "touch device," can be located on the display screen 193. The touch sensor and the display screen 193 together form a touchscreen, also called a "touchscreen." The touch sensor detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 193. In other embodiments, the touch sensor may also be located on the surface of the electronic device, in a different position than the display screen 193.
[0117] A pressure sensor is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor may be located on the display screen 193. There are many types of pressure sensors, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. When a touch operation is applied to the display screen 193, the electronic device monitors the intensity of the touch operation based on the pressure sensor. The electronic device can also calculate the touch location based on the monitoring signal from the pressure sensor. In some embodiments, touch operations applied to the same touch location but with different intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS message is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS message is executed.
[0118] A temperature sensor is a device used to measure the temperature of an environment or object. It converts temperature into an electrical or digital signal, allowing the temperature to be read and processed by a computer or other electronic device.
[0119] A gyroscope (GYRO-sensor), also known as a ground sensor or gyroscope sensor, traditionally consists of an internal gyroscope. A three-axis gyroscope can simultaneously measure position, trajectory, and acceleration in six directions. A single-axis gyroscope can only measure quantities in two directions, meaning a system typically requires three gyroscopes, while a single three-axis gyroscope can replace three single-axis gyroscopes. The working principle of a three-axis gyroscope is to measure the angle between the vertical axis of the gyroscope rotor and the device in a three-dimensional coordinate system, and calculate the angular velocity. The angle and angular velocity are used to determine the object's motion state in three-dimensional space. A three-axis gyroscope can simultaneously measure six directions: up, down, left, right, forward, and backward (the composite direction can also be decomposed into three-axis coordinates), ultimately determining the device's trajectory and acceleration. In other words, a three-axis gyroscope determines the device's current motion state by measuring its own rotation, such as forward, backward, up, down, left, or right; and whether it is accelerating (angular velocity) or decelerating (angular velocity). In this embodiment, the gyroscope sensor in the electronic device is a three-axis gyroscope sensor. Based on the detection data from the gyroscope sensor, the electronic device can determine the location or area on the electronic device corresponding to the user's thermal feedback operation.
[0120] The electronic device implements display functions through a GPU, a display screen 193, and an application processor. The GPU is a microprocessor for image editing, connected to the display screen 193 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0121] Electronic devices can achieve shooting functions through ISP, camera 195, video codec, GPU, display 193 and application processor.
[0122] The Information Service Provider (ISP) is used to process data fed back from the camera 195. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization on image noise and brightness. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 195. The camera 195 is used to capture still images or videos. In some embodiments, the electronic device may include one or N cameras, where N is a positive integer greater than 1. The camera 195 can be a front-facing camera or a rear-facing camera.
[0123] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when an electronic device is selecting a frequency, a DSP can perform a Fourier transform on the frequency energy.
[0124] Display screen 193 is used to display images, videos, etc. Display screen 193 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniled LED, a microLED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include one or N displays 193, where N is a positive integer greater than 1.
[0125] In this embodiment of the application, the display screen 193 can be used to display the interface of an electronic device (e.g., a camera preview interface, a video preview interface, a final preview interface, etc.), and display images captured by any one or more cameras 195 in the interface.
[0126] The wireless communication function of electronic devices can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem, and baseband processor.
[0127] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in an electronic device can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization.
[0128] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use in electronic devices. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 can be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be housed in the same device.
[0129] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 193. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0130] The wireless communication module 160 can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0131] The SIM card interface 194 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 194 to make contact with and detach from the electronic device. The electronic device can support one or more SIM card interfaces. The SIM card interface 194 supports Nano SIM cards, Micro SIM cards, and other SIM cards. Multiple cards can be inserted into the same SIM card interface 194 simultaneously. The SIM card interface 194 is also compatible with external memory cards. The electronic device interacts with the network through the SIM card to achieve functions such as calls and data communication. One SIM card corresponds to one user number.
[0132] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0133] Of course, this is understandable. Figure 4 The illustration shown is merely an example when the electronic device is in the form of a mobile phone. If the electronic device is a tablet, handheld computer, personal computer (PC), PDA, wearable device (such as a smartwatch, smart bracelet), or other device form factor, the structure of the electronic device may include more... Figure 3 The fewer structures shown can also include more than Figure 3 The structures shown are not limited here.
[0134] It is understandable that, generally speaking, the realization of functions in electronic devices requires not only hardware support but also software cooperation. The software system of electronic devices can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application's embodiment uses a layered architecture... Taking the system as an example, the software structure of the electronic device is illustrated.
[0135] Figure 4 This is a schematic diagram of the layered architecture of the software system of the electronic device provided in the embodiments of this application. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces (e.g., APIs).
[0136] In some examples, refer to Figure 5 As shown in the embodiments of this application, the software of the electronic device is divided into five layers, from top to bottom: application layer, framework layer (or application framework layer), system library and Android runtime, HAL layer (hardware abstraction layer), and driver layer (or kernel layer).
[0137] The application layer can include a series of applications. For example... Figure 5 As shown, the application layer can include applications (APPs) such as camera, gallery, calendar, map, WLAN, Bluetooth, music, video, SMS, call, contacts, and live streaming. Among them, the call application and contacts can be pre-installed on the electronic device or third-party applications for user calls provided by the app store.
[0138] The framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer includes predefined functions. For example, it may include an activity manager, window manager, audio service, camera service, content provider, view system, phone manager, resource manager, notification manager, etc., but this embodiment does not impose any limitations on these.
[0139] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0140] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0141] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0142] A phone manager is used to provide communication functionality for electronic devices. For example, a phone manager can manage the call status of a calling application (including initiation, connection, and termination).
[0143] The resource manager provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more. The notification manager allows applications to display notifications in the status bar, which can be used to convey informational messages and can disappear automatically after a short pause without user interaction. For example, the notification manager can be used to notify of download completion or message alerts. The notification manager can also display notifications as icons or scrolling text in the system's top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0144] The system library can include multiple functional modules, such as: a surface manager, media libraries, OpenGL ES, and SGL. The surface manager manages the display subsystem and provides 2D and 3D layer blending for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The media libraries support various audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. OpenGL ES is used for 3D graphics drawing, image rendering, compositing, and layer processing. SGL is a 2D graphics engine.
[0145] The Android runtime consists of the core libraries and the ART virtual machine. The Android runtime is responsible for scheduling and managing the Android system. The core libraries comprise two parts: one part contains the functionalities that Java code needs to call, and the other part consists of the Android core libraries. The application layer and application framework layer run in the ART virtual machine. The ART virtual machine executes the Java files of the application layer and application framework layer into binary files. The ART virtual machine is used for managing object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0146] The Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and the hardware circuitry, its purpose being to abstract the hardware. It hides the platform-specific hardware interface details, providing the operating system with a virtual hardware platform, making it hardware-independent and portable across multiple platforms. The HAL provides a standard interface that exposes device hardware functionality to the higher-level Java API framework (i.e., the framework layer). The HAL contains multiple library modules, each implementing an interface for a specific type of hardware component, such as: audio HAL (audio module), Bluetooth HAL (Bluetooth module), camera HAL (camera module), and sensors HAL (sensor module, or Isensor service).
[0147] In this embodiment of the application, the HAL layer may include, for example: Figure 1 or Figure 2 The motor frame 10 shown is used to determine the absolute path of the motor's resource file when the motor frame 10 is started, so as to load the resource file under that absolute path.
[0148] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, sensor drivers, battery drivers, etc., but this application does not limit this.
[0149] In this embodiment of the application, reference is made to Figure 2 As shown, the kernel layer may further include a motor kernel driver 11, a motor kernel driver 12, and a product customization module 13. For example, the motor kernel driver 11 may be a kernel driver developed in-house by the electronic device manufacturer, and the motor kernel driver 12 may be a third-party kernel driver. This application embodiment does not limit this.
[0150] The methods described in the following embodiments can all be implemented in an electronic device with the above-described hardware structure.
[0151] Based on the above hardware and software architecture, a method for loading motor resource files provided in this application embodiment will be introduced.
[0152] Based on the above hardware architecture and software structure, the following combines... Figure 5 This application provides a detailed description of a method for loading a motor resource file, which can be used in electronic devices. (Refer to...) Figure 5 As shown, the method for loading motor resource files provided in this application embodiment may include steps S501 to S505:
[0153] In step S501, when the electronic device starts up and the motor kernel driver in the electronic device is loaded, the motor kernel driver obtains the motor loading information.
[0154] For example, refer to Figure 1 or Figure 2 As shown, the motor kernel driver can correspond to the first motor kernel driver 11, that is, the motor kernel driver is a kernel driver developed by the electronic device manufacturer.
[0155] For example, motor loading information refers to the information required to determine the loading path of the motor's resource files. In some examples, motor loading information may be determined based on the loading requirements of the motor's resource files. For instance, if the loading requirements of the motor's resource files do not require loading the motor's resource files based on motor attribute information, then the motor loading information may include the motor's resonant frequency information and the motor's power supply chip manufacturer information. As another example, if the loading requirements of the motor's resource files require loading the motor's resource files based on motor attribute information, then the motor loading information may include motor attribute information corresponding to the motor model, the motor's resonant frequency information, and the motor's power supply chip manufacturer information.
[0156] For example, refer to Figure 2 As shown, the loading requirement for the motor's resource files can be determined based on whether a motor model has been set (or added) in the motor device description file 13 of the electronic device. In some examples, if the motor model is not set in the motor device description file 13 of the electronic device, it can be determined that the loading requirement for the motor's resource files is not to load the motor's resource files based on the motor attribute information; if the motor model is set in the motor device description file 13 of the electronic device, it can be determined that the loading requirement for the motor's resource files is to load the motor's resource files based on the motor attribute information.
[0157] For example, the motor model can be added to the motor device description file before the electronic device leaves the factory, and the motor model in the motor description file can be read when the motor kernel driver is loaded.
[0158] For example, refer to Figure 2 As shown, when the electronic device starts up and the first motor kernel driver 11 is loaded (the electronic device is running in kernel mode), the motor model can be obtained from the motor device description file 13 (corresponding to the third-party motor kernel driver), and the motor signals can be parsed to obtain the motor's attribute information. The power chip manufacturer information and the resonant frequency information of the motor are then obtained from the second motor kernel driver 12 to obtain the motor loading information.
[0159] Step S502: When the motor frame in the electronic device is loaded, determine whether the electronic device includes a motor frequency file.
[0160] If the electronic device does not contain a motor frequency file, proceed to step S505 to determine that the motor type is a flat motor; if the electronic device does contain a motor frequency file, proceed to step S503 to determine that the motor type is a linear motor.
[0161] For example, the motor frequency file could be a file used to store the resonant frequency of the motor. In some examples, the motor frequency file could be located in an electronic device and accessible when the electronic device is operating in user mode.
[0162] For example, refer to Figure 1 or Figure 2 As shown, when the first motor kernel driver 11 is loaded, the motor frame 10 can be loaded. While loading the motor frame 10, a query command is used to check whether the electronic device includes a motor frequency file.
[0163] In some examples, if the query command returns information indicating that the electronic device does not include a motor frequency file, the motor type is determined to be a flat motor, and step S505 is executed to obtain the motor's power chip manufacturer information. Based on the motor type and the motor's power chip manufacturer information, the loading path of the motor's resource file is determined. If the query command returns information indicating that the electronic device includes a motor frequency file, the motor type is determined to be a linear motor, and step S503 is executed to determine the validity of the motor attribute information in the motor loading information. If the motor attribute information is invalid, the loading path of the motor's resource file is determined based on the read motor's power chip manufacturer information and the motor's resonant frequency information. If the motor attributes are valid, the loading path of the motor's resource file is determined based on the read motor loading information and the motor's power chip manufacturer information.
[0164] In other examples, if the query command returns information indicating that the electronic device includes a file on the motor's resonant frequency, the current resonant frequency of the motor can be further read, and its validity can be determined. If the current resonant frequency is invalid, the motor type is determined to be a flat motor; if the current resonant frequency is valid, the motor type is determined to be a linear motor.
[0165] Step S503: Determine that the motor type is a linear motor, obtain the motor attribute information from the motor loading information in the motor core driver, and determine the validity of the motor attribute information.
[0166] If the motor attribute information is invalid, proceed to step S504 to read the motor's resonant frequency information; if the motor attribute information is valid, proceed to step S506 to obtain the motor's power chip manufacturer information from the motor loading information in the motor core driver.
[0167] For example, refer to Figure 2As shown, the validity of motor attribute information refers to whether the motor device description file 13 of the electronic device includes the motor model. In some examples, if the motor device description file 13 includes the motor model, the motor attribute information is determined to be valid; if the motor device description file 13 does not include the motor model, the motor attribute information is determined to be invalid. In other examples, if the motor device description file 13 does not include the motor model, the motor attribute information is determined to be valid; if the motor device description file 13 includes the motor model, the motor attribute information is determined to be invalid. The embodiments in this application are not specifically limited. This application embodiment uses the example of the motor device description file including the motor model, thus determining the motor attribute information to be valid; and the motor device description file not including the motor model, thus determining the motor attribute information to be invalid, as an example for illustrative purposes.
[0168] For example, refer to Figure 2 As shown, when the motor frame 10 determines that the motor type is a linear motor, motor attribute information can be read from the first motor core driver 11, and the validity of the motor attribute information can be determined based on the reading result. In some examples, if the reading result shows that motor attribute information can be read from the first motor core driver 11, the motor attribute information is determined to be valid, that is, the motor device description file 13 includes the motor model; if the reading result shows that motor attribute information cannot be read from the first motor core driver 11, the motor attribute information is determined to be invalid, that is, the motor device description file 13 does not include the motor model.
[0169] Step S504: Read the resonant frequency information of the motor and determine the type of motor based on the resonant frequency information of the motor.
[0170] For example, when the motor frame determines that the motor attribute information is invalid, it can continue to read the motor's resonant frequency information from the motor core driver, and determine the target frequency range of the motor's resonant frequency based on the read motor resonant frequency information, and determine the type of motor based on the target frequency range of the motor's resonant frequency.
[0171] In some examples, the resonant frequency ranges of different types of linear motors may differ. For instance, the resonant frequency range of an x-axis linear motor may be frequency range 1; the resonant frequency range of a y-axis linear motor may be frequency range 2; and the resonant frequency range of a z-axis linear motor may be frequency range 3. Frequency ranges 1, 2, and 3 do not overlap.
[0172] For example, the implementation of determining the target frequency range of the motor's resonant frequency based on the read motor resonant frequency information can be as follows: determine multiple resonant frequency ranges corresponding to multiple types of linear motors, determine the frequency range of the motor's resonant frequency within these multiple resonant frequency ranges as the target frequency range, and determine the type of motor corresponding to the target frequency slope range as the motor type.
[0173] Step S505: Determine that the motor type is a flat motor, read the motor's power chip manufacturer information, and determine the target loading path of the motor's resource files based on the motor type and the motor's power chip manufacturer information.
[0174] In some examples, multiple sets of resource file loading paths can be set in the HAL layer of the electronic device before it leaves the factory. These multiple sets of resource file loading paths may include multiple first loading paths and multiple second loading paths. The path names of the first loading paths include motor attribute information; the names of the second loading paths do not include motor attribute information.
[0175] In some examples, due to the large number of motor manufacturers and the varying sizes of the motors, the number of groups in the second loading path is much greater than the number of groups in the first loading path. For example, the number of groups in the first loading path may be 3, and the number of groups in the second loading path may be 100. This application embodiment does not limit this.
[0176] For example, the first loading path may correspond to the loading path of the first group of resource files to the recording path of the third group of resource files. The second loading path may correspond to the loading path that includes the motor model corresponding to the motor attribute information.
[0177] In some examples, the second loading path may include a new filename formed by concatenating the motor model and the base file name. For instance, let's take a motor model of x_manufacturer1_0809 as an example. If the base name is vibrator_desc.xml, then the base name can be adjusted according to the motor model x_manufacturer1_0809 to obtain the new filename vibrator_desc_x_manufacturer1_0809.xml.
[0178] If the base name is libHapticPlayerTwoKit.so, then the corresponding new file name is libHapticPlayerTwoKit_x_manufacturer1_0809.so;
[0179] If the base name is libHapticPlayerOneKit.so, then the corresponding new file name is libHapticPlayerOneKit_x_manufacturer1_0809.so;
[0180] If the base name is vibrator_slices_config.xml, then the corresponding new file name is vibrator_slices_config_x_manufacturer1_0809.xml.
[0181] In some examples, the second load path, which includes the new filename for the motor model x_manufacturer1_0809, may include:
[0182] / odm / etc / vibrator / vendor1 / vibrator_desc_x_manufacturer1_0809.xml;
[0183] / odm / etc / vibrator / vendor2 / vibrator_desc_x_manufacturer1_0809.xml;
[0184] / odm / etc / vibrator / vibrator_slices_config_x_manufacturer1_0809.xml;
[0185] / odm / lib64 / libHapticPlayerTwoKit_x_manufacturer1_0809.so;
[0186] / odm / lib64 / ibHapticPlayerOneKit_x_manufacturer1_0809.so;
[0187] In other examples, the second load path, including the new filename of the motor model z_manufacturer2_9595, may include:
[0188] / odm / etc / vibrator / vendor1 / vibrator_desc_z_manufacturer2_9595.xml;
[0189] / odm / etc / vibrator / vendor2 / vibrator_desc_z_manufacturer2_9595.xml;
[0190] / odm / etc / vibrator / vibrator_slices_config_z_manufacturer2_9595.xml;
[0191] / odm / lib64 / libHapticPlayerTwoKit_z_manufacturer2_9595.so;
[0192] / odm / lib64 / ibHapticPlayerOneKit_z_manufacturer2_9595.so;
[0193] In this embodiment, multiple sets of second loading paths may include loading paths for each set of resource files corresponding to the motor models of all motors used in the electronic device. This embodiment uses only one set of second loading paths corresponding to motor models x_manufacturer1_0809 and z_manufacturer2_9595 as an example for illustrative purposes.
[0194] For example, refer to Figure 2 As shown, the motor frame 10 can read the power chip manufacturer information of the motor from the first motor core driver 11, and select a corresponding first loading path from multiple first loading paths according to the type of the motor and the power chip manufacturer information of the motor, and use the first loading path as the target loading path of the motor's resource files.
[0195] Step S506: Read the motor power chip manufacturer information from the motor loading information, and determine the target loading path of the motor resource file based on the motor power chip manufacturer information and motor attribute information.
[0196] For example, refer to Figure 2 As shown, the motor frame 10 can read the motor's power chip manufacturer information from the first motor core driver 11, and select a corresponding first loading path from multiple sets of second loading paths based on the motor attribute information and the motor's power chip manufacturer information, and use this first loading path as the target loading path for the motor's resource files. In this way, the target loading path for the corresponding resource files can be adaptively selected for different motor models.
[0197] In this embodiment, when the electronic device starts up and the motor kernel driver loads, the motor kernel driver reads the motor's power chip manufacturer information, the motor's resonant frequency, and the motor model, and parses the motor model to obtain motor attribute information. When the motor frame starts up, it first determines whether the motor is a flat motor or a linear motor. If the motor is a linear motor, the validity of the motor attribute information is determined. If the motor attribute information is valid, the target loading path for the resource files is adaptively determined based on the motor's power chip manufacturer information and motor attribute information. This allows for the loading of resource files for motors with specific motor resource attribute requirements. If the motor attribute information is invalid, the specific type of the linear motor is obtained and determined based on the motor's resonant frequency, and the loading path for the resource files is determined based on the specific type of the linear motor and the motor's power chip manufacturer information. Thus, based on the first target loading path, motor resource files for different models of electronic devices can be adaptively loaded, preventing motor malfunctions and improving the user experience.
[0198] Figure 6 A flowchart illustrating another method for loading motor resource files provided in this application embodiment is shown below. Figure 5 As shown, the method includes steps S601 to S603.
[0199] Step S601: When the electronic device is started, obtain motor attribute information and determine the validity of the motor attribute information.
[0200] For example, the electronic device can be started in response to a user's input start command. This application embodiment will not describe in detail the implementation methods for obtaining motor attribute information and determining the legality of the motor attribute information; please refer to the aforementioned step S503 for details.
[0201] For example, determining the validity of motor attribute information may include: determining the validity of motor attribute information when the motor attribute information includes motor manufacturer information, motor type information, and motor size information.
[0202] For example, when an electronic device starts up, obtaining motor attribute information includes: loading the motor kernel driver when the electronic device starts up; reading the motor model from the motor device description file and parsing the motor model to obtain the motor attribute information.
[0203] Step S602: If the motor attribute information is valid, obtain the power chip manufacturer information of the motor.
[0204] The implementation method for obtaining the power chip manufacturer information of the motor when the motor attribute information is valid will not be described in detail in this application embodiment. For details, please refer to the aforementioned step S506.
[0205] For example, before obtaining the power chip manufacturer information of the motor, the method further includes: when loading the motor kernel driver, the motor kernel driver obtains the power chip manufacturer information of the motor from the motor auxiliary driver. Obtaining the power chip manufacturer information of the motor when the motor attribute information is valid includes: obtaining the power chip manufacturer information of the motor from the motor kernel driver when the motor attribute information is valid.
[0206] Step S603: Based on the motor's power chip manufacturer information and motor attribute information, determine the first target loading path for loading the motor's resource files.
[0207] The implementation method for determining the first target loading path of the motor resource file based on the motor power chip manufacturer information and motor attribute information in this embodiment will not be described in detail. For details, please refer to the aforementioned step S506.
[0208] For example, determining a first target loading path for loading the motor's resource file based on the motor's power chip manufacturer information and motor attribute information includes: obtaining multiple sets of first loading paths; the path name of the first loading path includes motor attribute information; and determining the first target loading path for loading the motor's resource file from the multiple sets of first loading paths based on the motor's power chip manufacturer information and motor attribute information.
[0209] For example, the method further includes: when loading the motor kernel driver, the motor kernel driver obtains the resonant frequency information of the motor from the motor auxiliary driver; if the motor attribute information is invalid, the motor resonant frequency information and the power chip manufacturer information of the motor are obtained from the motor kernel driver; based on the motor resonant frequency information and the power chip manufacturer information of the motor, a second target loading path for loading the motor resource file is determined.
[0210] In some examples, a second target loading path for loading the motor's resource files is determined based on the motor's resonant frequency information and the motor's power chip manufacturer information. This includes: determining the motor type based on the motor's resonant frequency information; and determining the second target loading path for loading the motor's resource files based on the motor type and the motor's power chip manufacturer information.
[0211] In some examples, a second target loading path for loading the motor's resource files is determined based on the motor type and the motor's power chip manufacturer information. This includes: obtaining multiple sets of second loading paths; the names of the second loading paths do not include motor attribute information; and determining the second target loading path for loading the motor's resource files from the multiple sets of second loading paths based on the motor type and the motor's power chip manufacturer information.
[0212] For example, before obtaining the motor attribute information, the method further includes: determining the validity of a motor frequency file in the electronic device. Obtaining the motor attribute information includes: if the motor frequency file is valid, obtaining the motor attribute information.
[0213] It is understood that, in order to achieve the aforementioned functions, the electronic device includes corresponding hardware structures and / or software modules for performing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in a hardware-driven or software-driven manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments of this application.
[0214] This application embodiment can divide the above-described electronic device into functional modules based on the method example described above. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0215] When dividing each function into modules according to its corresponding function, refer to Figure 7 As shown, this application embodiment provides an electronic device that can implement the motor resource file loading method provided in the foregoing embodiments. The electronic device 700 may include a first determining module 701, a first acquiring module 702, and a second determining module 703.
[0216] The first determining module 701 is used to obtain motor attribute information and determine the legality of the motor attribute information when the electronic device is started.
[0217] The first acquisition module 702 is used to acquire the power chip manufacturer information of the motor when the motor attribute information is valid.
[0218] The second determining module 703 is used to determine the first target loading path for loading the motor's resource files based on the motor's power chip manufacturer information and motor attribute information.
[0219] In some embodiments, the first determining module 701 is specifically used to determine the validity of the motor attribute information when the motor attribute information includes motor manufacturer information, motor type information and motor size information.
[0220] In some embodiments, the first determining module 701 is specifically used to load the motor kernel driver when the electronic device starts up;
[0221] Read the motor model from the motor device description file, parse the motor model, and obtain the motor attribute information.
[0222] In some embodiments, the electronic device 700 further includes:
[0223] The second acquisition module 704 is used to obtain the power chip manufacturer information of the motor from the motor auxiliary driver when the motor kernel driver is loaded.
[0224] The first acquisition module 702 is specifically used to obtain the power chip manufacturer information of the motor from the motor core driver when the motor attribute information is valid.
[0225] In some embodiments, the second determining module 703 is specifically used to obtain multiple sets of first loading paths; the path name of the first loading path includes motor attribute information; based on the power chip manufacturer information of the motor and the motor attribute information, a first target loading path for loading the motor resource file is determined from the multiple sets of first loading paths.
[0226] In some embodiments, the electronic device 700 further includes:
[0227] The third determining module 705 is used to, when loading the motor kernel driver, obtain the motor's resonant frequency information from the motor auxiliary driver; if the motor attribute information is invalid, obtain the motor's resonant frequency information and the motor's power chip manufacturer information from the motor kernel driver; and determine the second target loading path for loading the motor's resource file based on the motor's resonant frequency information and the motor's power chip manufacturer information.
[0228] In some embodiments, the third determining module 705 is specifically used to determine the type of motor based on the motor's resonant frequency information; and to determine the second target loading path for loading the motor's resource files based on the motor's type and the motor's power chip manufacturer information.
[0229] In some embodiments, the third determining module 705 is specifically used to obtain multiple sets of second loading paths; the names of the second loading paths do not include motor attribute information; based on the type of motor and the power chip manufacturer information of the motor, a second target loading path for loading the motor's resource files is determined from the multiple sets of second loading paths.
[0230] In some embodiments, the electronic device 700 further includes:
[0231] The fourth determining module 706 is used to determine the validity of the motor frequency file in the electronic device.
[0232] The first determining module 701 is specifically used to obtain motor attribute information when the motor frequency file is valid.
[0233] Regarding the electronic devices in the above embodiments, the specific methods by which each module performs its operations have been described in detail in the embodiments of the information display method described above, and will not be elaborated here. The related beneficial effects can also be referred to the related beneficial effects of the aforementioned information display method, and will not be repeated here.
[0234] This application also provides an electronic device, which includes a display screen, a memory, and one or more processors; the display screen, the memory, and the processors are coupled; wherein the memory stores computer program code, which includes computer instructions, and when the computer instructions are executed by the processor, the electronic device performs the motor resource file loading method provided in the foregoing embodiments. The specific structure of this electronic device can be referred to... Figure 3 The structure of the electronic device shown is illustrated.
[0235] This application also provides a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the motor resource file loading method provided in the foregoing embodiments.
[0236] This application also provides a computer program product containing executable instructions that, when run on an electronic device, cause the electronic device to execute the motor resource file loading method provided in the foregoing embodiments.
[0237] This application also provides a chip system, such as... Figure 8 As shown, the chip system 800 includes at least one processor 801 and at least one interface circuit 802. The processor 801 and the interface circuit 802 are interconnected via lines. For example, the interface circuit 802 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 802 can be used to send signals to other devices (e.g., the processor 801).
[0238] For example, interface circuit 802 can read instructions stored in memory and send those instructions to processor 801. When the instructions are executed by processor 801, the electronic device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, and this application embodiment does not specifically limit this.
[0239] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0240] In the several embodiments provided in this application, it should be understood that the disclosed apparatus / device and method can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0241] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0242] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0243] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0244] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method of loading a resource file of a motor, characterized by, The method is applied to an electronic device, and comprises: When the electronic device starts and loads a motor kernel driver of the electronic device, motor attribute information is acquired, and legality of the motor attribute information is determined; In the case that the motor attribute information is legal, power chip manufacturer information of the motor is acquired from the motor kernel driver; wherein the power chip manufacturer information of the motor is information acquired by the motor kernel driver from a motor auxiliary driver; Based on the power chip manufacturer information of the motor and the motor attribute information, a first target loading path of a resource file of the motor is determined.
2. The method of claim 1, wherein, The determination of the legality of the motor attribute information comprises: In the case that the motor attribute information comprises motor manufacturer information, motor type information and motor size information, it is determined that the motor attribute information is legal.
3. The method of claim 1, wherein, The acquisition of the motor attribute information comprises: A motor model is read from a motor device description file, and the motor model is parsed to obtain the motor attribute information.
4. The method of claim 1, wherein, The determination of the first target loading path of the resource file of the motor based on the power chip manufacturer information of the motor and the motor attribute information comprises: A plurality of first loading paths are acquired; the path name of the first loading path comprises the motor attribute information; Based on the power chip manufacturer information of the motor and the motor attribute information, a first target loading path of a resource file of the motor is determined from a plurality of the first loading paths.
5. The method of claim 2, wherein, The method further comprises: When the motor kernel driver is loaded, the motor kernel driver acquires resonance frequency information of the motor from a motor auxiliary driver; In the case that the motor attribute information is not legal, resonance frequency information of the motor and power chip manufacturer information of the motor are acquired from the motor kernel driver; Based on the resonance frequency information of the motor and the power chip manufacturer information of the motor, a second target loading path of a resource file of the motor is determined.
6. The method of claim 5, wherein, The determination of the second target loading path of the resource file of the motor based on the resonance frequency information of the motor and the power chip manufacturer information of the motor comprises: Based on the resonance frequency information of the motor, the type of the motor is determined; Based on the type of the motor and the power chip manufacturer information of the motor, a second target loading path of a resource file of the motor is determined.
7. The method of claim 6, wherein, The determination of the second target loading path of the resource file of the motor based on the type of the motor and the power chip manufacturer information of the motor comprises: A plurality of second loading paths are acquired; the name of the second loading path does not comprise the motor attribute information; Based on the type of the motor and the power chip manufacturer information of the motor, a second target loading path of a resource file of the motor is determined from a plurality of the second loading paths.
8. The method of claim 5, wherein, Before the acquisition of the motor attribute information, the method further comprises: The effectiveness of a motor frequency file in the electronic device is determined; The acquisition of the motor attribute information comprises: In the case that the motor frequency file is effective, the motor attribute information is acquired.
9. An electronic device, comprising: An electronic device comprising a display, a memory, and one or more processors; the display, the memory, and the processors coupled; wherein the memory has computer program code stored therein, the computer program code comprising computer instructions that, when executed by the processors, cause the electronic device to perform the method of loading a resource file of a motor according to any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, Computer instructions that, when executed on an electronic device, cause the electronic device to perform the method of loading a resource file of a motor according to any one of claims 1-8.
Citation Information
Patent Citations
Waveform library construction method and device, equipment and computer storage medium
CN116662300A