POS machine detection method and POS machine
By setting up the battery meter chip in the POS machine and performing automatic detection, the abnormal state problem of battery meter caused by battery disassembly is solved, the stability and production efficiency of the power supply processing module are improved, and it is adapted to a variety of systems.
Patent Information
- Application Number
- CN202510417242.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-04
AI Technical Summary
The existing POS machine fails to effectively handle the situation where the new access to the battery after the battery is turned on and the connected battery may be disassembled, resulting in abnormal battery status and unstable system voltage.
Set up a battery meter chip in the POS machine, check the battery chip ID value through i2c reading function, load the battery chip driver, read the battery data, and process the battery data according to different states, including normal battery power-on, reconnecting the battery and battery replacement, etc., to realize automatic detection and abnormal processing.
Automatic detection and abnormal handling under different battery capacity is realized, ensuring the stability of the POS machine power processing module, reducing manpower and material investment, improving production efficiency, adapting to multiple systems, and reducing the risk of power jump.
Smart Images

Figure CN120254440A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of POS machines, and particularly to a POS machine detection method and a POS machine. Background Art
[0002] A fuel gauge is a device used to monitor and measure the battery power. It can predict the battery capacity, health, and provide safety protection. In existing POS machines, a fuel gauge is equipped. The battery of the POS machine is detachable and can be turned on normally when only connected to the charger. However, the existing POS machines do not consider the new connection of the battery after startup and the possibility that the connected battery may be disassembled, resulting in abnormal fuel gauge status and unstable system voltage. Summary of the Invention
[0003] In order to overcome the above technical defects, the present invention provides a POS machine detection method and a POS machine, which can achieve automatic detection and exception handling.
[0004] To solve the above problems, the present invention is implemented according to the following technical solutions:
[0005] A POS machine detection method, wherein a fuel gauge is provided in the POS machine, and a fuel gauge chip is provided in the fuel gauge. The POS machine detection method includes the steps of:
[0006] When the fuel gauge driver is loaded, the fuel gauge chip is verified;
[0007] If the fuel gauge chip is abnormal, the abnormal information is reported to the Android system;
[0008] If the fuel gauge chip is normal, the fuel gauge chip driver is loaded, and the battery data of the POS machine is read;
[0009] According to the battery data, different states of the POS machine are processed. The states of the POS machine include: the state of the POS machine when only connected to the charger and turned on, the state of the POS machine when the battery is reconnected after startup, and different battery replacements during the standby state of the POS machine.
[0010] As a further improvement of the present invention, the step of verifying the fuel gauge chip includes:
[0011] The ID value of the fuel gauge chip is read through the i2c read function and compared with the actual ID value of the fuel gauge chip. If they are the same, the fuel gauge chip is judged to be normal; if they are different, the fuel gauge chip is judged to be abnormal.
[0012] As a further improvement of the present invention, the step of processing different states of the POS machine according to the battery data includes:
[0013] When the POS machine is powered on normally with only the battery connected, if the battery data is normal, it is determined that the POS machine is running stably.
[0014] As a further improvement of the present invention, the step of processing different states of the POS machine according to the battery data includes:
[0015] When the POS machine is powered on with only the charger connected, if the battery data is abnormal, it is determined that the POS machine battery is not online, and the POS machine is processed to maintain power on.
[0016] As a further improvement of the present invention, the step of processing different states of the POS machine according to the battery data includes:
[0017] When the battery is reconnected to the POS machine after it is powered on, the fuel gauge chip is re-checked.
[0018] If the fuel gauge chip is normal, the battery data of the POS machine is read again.
[0019] If the battery data is normal, the battery data is reported to the Android system.
[0020] As a further improvement of the present invention, the step of processing different states of the POS machine according to the battery data includes:
[0021] When different batteries are replaced during the standby state of the POS machine, the fixed power and charging off of the battery are performed.
[0022] As a further improvement of the present invention, the battery curves corresponding to different battery capacities are stored in the POS machine, and the battery curves are made from the data obtained by charging and discharging tests of the battery.
[0023] When the POS machine is powered on, the corresponding battery curve is called according to the attributes of the POS machine.
[0024] As a further improvement of the present invention, when the POS machine detects that the battery is inserted again, the fuel gauge chip reset interface is called to reset the fuel gauge chip and re-check the fuel gauge chip.
[0025] As a further improvement of the present invention, after the fuel gauge chip reset interface is called to reset the fuel gauge chip, the following steps are further included:
[0026] According to the capacity of the battery, the battery curve is rewritten.
[0027] The present invention also provides a POS machine, which includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; the memory is used to store computer programs; when the processor executes the programs stored on the memory, the above-mentioned POS machine detection method is realized.
[0028] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention takes into account the possible disassembly of newly connected and already connected batteries after the machine is powered on, and can process different states of the POS machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a flowchart of the POS machine detection method described in the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0030] The following describes the preferred embodiments of the present invention with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0031] Embodiment 1
[0032] This embodiment provides a POS machine detection method. Among them, a fuel gauge is set in the POS machine, and a fuel gauge chip is set in the fuel gauge. As Figure 1 shown, the POS machine detection method includes the steps:
[0033] S1. Store the battery curves corresponding to different battery capacities in the POS machine. The battery curves are made from the data obtained by charging and discharging tests of the battery; when the POS machine is powered on, call the corresponding battery curve according to the attributes of the POS machine.
[0034] In actual application scenarios, the POS machine will be shipped with different battery capacity combinations. At the same time, it is also necessary to consider the compatibility of battery curves with different battery capacities in the case of newly connected batteries and the possible disassembly of already connected batteries after the machine is powered on. The battery capacities of the POS machine include: 2000 mA and 5000 mA. First, it is necessary to perform charging tests and discharging tests on the batteries in advance, make two battery curves from the charging data and discharging data respectively, pre-store them in the Android system partition of the POS machine, set the attribute flag bits, configure the boot wizard package with the battery curve attribute flag bits, and import the specified wizard package when producing the POS machine. Read the corresponding battery curve according to the attributes of the POS machine when it is powered on.
[0035] To implement subsequent functions, the POS machine is also provided with a reset interface fuel gauge chip detection thread.
[0036] S2. When the fuel gauge driver is loaded, the fuel gauge chip detection thread verifies the fuel gauge chip; reads the ID value of the fuel gauge chip through the i2c read function and compares it with the ID value actually read into its internal ID register in the fuel gauge chip. If they are the same, it is judged that the fuel gauge chip is normal; if they are different, it is judged that the fuel gauge chip is abnormal.
[0037] If the ID value of a certain fuel gauge chip is 0x15 and the value read is also 0x15, it proves that the communication of the fuel gauge chip is normal. After the fuel gauge chip is verified, the loading continues.
[0038] S3. If the fuel gauge chip is abnormal, the abnormal information is reported to the Android system, that is, if the ID value of a certain fuel gauge chip is 0x15 and the value read is not 0x15, it proves that the communication of the fuel gauge chip is abnormal.
[0039] S4. If the fuel gauge chip is normal, load the fuel gauge chip driver and read the battery data of the POS machine;
[0040] During the kernel startup process, the fuel gauge chip driver is loaded, the parameters are initialized, and the battery data is read for the first time. Accordingly, the relevant battery detection threads are started to continuously monitor the change of the battery status. At this time, different states of the POS machine are processed according to the battery data; the standard battery data can be obtained according to the chip manual, and the battery data includes: fuel gauge ID, battery voltage value, charging current, battery temperature, battery health status value, etc. By comparing the real-time obtained battery data with the standard battery data, the real-time status of the POS machine can be known, and different countermeasures are adopted based on these states. The specific situations of the POS machine during system startup and standby are as follows:
[0041] 1. When the POS machine is normally powered on with only the battery connected, after the fuel gauge starts, if the read battery data is normal, it is judged that the POS machine is running stably.
[0042] 2. When the POS machine is turned on only by connecting the charger (turning on with a single adapter), if the battery data is abnormal, it is determined that the POS machine battery is not online, and the POS machine is kept turned on. Specifically, during the process of turning on with a single adapter, the fuel gauge driver can be normally loaded, but when the battery data read, such as battery temperature, battery voltage value, and charging current, shows abnormal data or random values, it will seriously affect the normal startup of the system. At this time, it is necessary to keep the Android system of the POS machine running stably under abnormal battery conditions. During startup, it is necessary to determine whether the battery exists, read the battery temperature, battery voltage value, battery health status, etc. If the battery temperature is abnormal and always fixed at a certain negative value (usually -30 degrees), the battery voltage value remains unchanged, and the battery health value is 0, after the detection thread compares the upper and lower three groups of data, if all three conditions are met, it is determined that the battery is not online (that is, the battery is unplugged). At this time, the machine needs to be kept turned on, that is, the percentage of the battery power of the POS machine is fixed, otherwise the power may jump to 0%, and the shutdown process will be executed. At this time, the battery data obtained by the fuel gauge is abnormal, and the system power needs to fix the percentage of the battery power to keep the device turned on.
[0043] 3. When the POS machine is in the state of reconnecting the battery after startup, the fuel gauge chip is re-checked; if the fuel gauge chip is normal, the battery data of the POS machine is read again; if the battery data is normal, the battery data is reported to the Android system.
[0044] When the battery detection thread detects that the battery is inserted, it will call the chip reset interface. The fuel gauge chip will go through the initialization process again to judge the chip status and then read and calculate the battery status value, and finally report the normal battery data to the Android system.
[0045] Exemplarily, the judgment basis for battery insertion: the battery voltage value, charging current, battery temperature, etc. return to normal, for example, the battery temperature is continuously read not as a fixed negative value and there is a positive charging current value.
[0046] Specifically, the battery data is reported in the following way: the kernel subsystem reports to the Android system through the power_supply standard interface, and the reporting thread runs once every 5s. The specific steps are as follows:
[0047] ① During the insertion of the adapter, the power is not allowed to drop. When the adapter is inserted, since charging is detected, the percentage of the battery power can only be accumulated upward and is not allowed to drop. This is processed when calculating the percentage of the battery power;
[0048] ② During discharging, the power level is not allowed to increase. ③ When the charging adapter is connected, shutdown is not executed because the POS machine can draw power from the adapter to maintain the powered-on state. At this time, only by fixing the battery percentage and preventing it from jumping to 0 will the shutdown process not be executed.
[0049] ④ When the battery is not connected, the power level does not change.
[0050] 4. Considering that the battery of the POS machine is configured to be removable, during standby, the user may replace another battery while the adapter is plugged in for charging. That is, when different batteries are replaced during the standby state of the POS machine, the detection thread will detect the state of the battery being unplugged and plugged in, and battery fixed-power and charging shutdown processing are required. At this time, the POS machine can be prevented from shutting down to ensure the stability of the POS machine power processing module.
[0051] When the POS machine detects that the battery is inserted again, the power meter chip reset interface is called to reset the power meter chip and re-verify the power meter chip. That is, return to step S2 and execute again.
[0052] In addition, after calling the power meter chip reset interface to reset the power meter chip, the following steps are also included: According to the capacity of the battery, rewrite the battery curve. Since the battery curve data is newly preset in the memory partition of the android system, the power meter chip driver will create read and write interfaces for the battery curve and provide them to the android system to write the battery curve.
[0053] The present invention realizes automatic detection in three stages of the power meter usage: data preparation and presetting, chip verification and working logic processing, and battery data reporting. The present invention can achieve seamless compatibility with battery curves of different capacities without affecting the normal operation of the metering chip. It realizes automated identification operations, reduces labor and material inputs, improves production efficiency, and continuously optimizes the product. It can adapt to multiple systems and has multiple uses, and also has the following beneficial effects:
[0054] 1. Strong transplantation compatibility, using the standard power_supply subsystem interface, applicable to different android systems, and can be compatible with different interfaces.
[0055] 2. Automation, can detect the status of the battery and the power meter chip in real time, can capture the anomalies of the power meter chip and battery anomalies in a timely manner and automatically perform recovery processing.
[0056] 3. High production efficiency, automatically compatible with curves of different battery capacities, reducing manual intervention.
[0057] 4. Reliability, using a custom power interface reporting logic to reduce the risk of power level jumps.
[0058] Embodiment 2
[0059] This embodiment provides a POS machine, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus; the memory is used to store computer programs; when the processor executes the programs stored on the memory, it implements the above-mentioned POS machine detection method.
[0060] For other implementation manners of this embodiment, please refer to the prior art and will not be elaborated here one by one.
[0061] The communication bus mentioned in the above POS machine may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0062] The communication interface is used for communication between the above terminal and other devices.
[0063] The memory may include a Random Access Memory (RAM), or may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0064] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0065] Although embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the claims and their equivalents.
[0066] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising the said element.
[0067] The above has introduced in detail a POS machine detection method and a POS machine provided by the present invention. Specific examples are used in this text to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application. The above embodiments are only preferred embodiments cited to fully illustrate the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or transformations made by those skilled in the art on the basis of the present invention are within the protection scope of the present invention.
Claims
1. A method for detecting a POS machine, wherein, A power meter is provided in the POS machine, and a power meter chip is provided in the power meter. It is characterized by including the steps: When the power meter driver is loaded, the power meter chip is verified. If the power meter chip is abnormal, the abnormal information is reported to the Android system. If the power meter chip is normal, the power meter chip driver is loaded, and the battery data of the POS machine is read. According to the battery data, different states of the POS machine are processed. The states of the POS machine include: the state of the POS machine when it is turned on only with the charger connected, the state of the POS machine when the battery is reconnected after being turned on, and different battery replacements during the standby state of the POS machine.
2. The POS machine detection method according to claim 1, characterized in that, The step of verifying the power meter chip includes: Read the ID value of the power meter chip through the i2c read function and compare it with the actual ID value of the power meter chip. If they are the same, it is judged that the power meter chip is normal; if they are different, it is judged that the power meter chip is abnormal.
3. The POS machine detection method according to claim 1, characterized in that, The step of processing different states of the POS machine according to the battery data includes: When the POS machine is in the state of being turned on normally with only the battery connected, if the battery data is normal, it is judged that the POS machine is running stably.
4. The POS machine detection method according to claim 1, characterized in that, The step of processing different states of the POS machine according to the battery data includes: When the POS machine is in the state of being turned on only with the charger connected, if the battery data is abnormal, it is judged that the POS machine battery is not online, and the POS machine is kept turned on.
5. The POS machine detection method according to claim 1, characterized in that, The step of processing different states of the POS machine according to the battery data includes: When the POS machine is in the state of reconnecting the battery after being turned on, the power meter chip is verified again. If the power meter chip is normal, the battery data of the POS machine is read again. If the battery data is normal, the battery data is reported to the Android system.
6. The POS machine detection method according to claim 1, wherein, The step of processing different states of the POS machine according to the battery data includes: When different battery replacements are made during the standby state of the POS machine, the fixed power and charging off of the battery are performed.
7. The POS machine detection method according to claim 6, characterized in that The battery curves corresponding to different-capacity batteries are stored in the POS machine. The battery curves are made from the data obtained by charging and discharging tests of the battery. When the POS machine is turned on, the corresponding battery curve is called according to the attributes of the POS machine.
8. The POS machine detection method according to claim 7, wherein, When the POS machine detects that the battery is inserted again, the power meter chip reset interface is called to perform a reset process on the power meter chip, and the power meter chip is verified again.
9. According to the POS machine detection method described in claim 8, after calling the power meter chip reset interface to perform a reset process on the power meter chip, it further includes the step: According to the capacity of the battery, the battery curve is rewritten.
10. A POS machine, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; the memory is used to store computer programs; when the processor executes the programs stored on the memory, it implements the POS machine detection method described in any one of claims 1-9.
Citation Information
Cited By
Intelligent battery data simulation transmission method and device, electronic equipment and storage medium
CN121585489A