Camera upgrading method and system, electronic equipment and storage medium
Through the universal serial bus interface connection between the camera and the upgraded device, the upgrade data packet is transmitted based on the universal serial bus communication device protocol, which solves the problem of inconvenient upgrade of the camera software and realizes a convenient upgrade process.
Patent Information
- Application Number
- CN202510074280.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-06-20
AI Technical Summary
When upgrading software, existing cameras are not convenient to obtain upgrade packages from other devices, resulting in a relatively inconvenient upgrade process.
Connected to the upgraded device through a universal serial bus interface, transmitting data related to software upgrade based on the universal serial bus communication device type protocol. The camera receives the data packets sent by the upgraded device in sequence, and stores them in non-volatile memory after successful reception.
It realizes the camera to easily obtain upgrade data packets, simplifies the software upgrade process, and meets the camera upgrade needs.
Smart Images

Figure CN120179271A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cameras, and in particular to a camera upgrade method, system, electronic device, and storage medium. Background Art
[0002] A camera is a video input device with functions such as video acquisition / transmission and static image capture. Software programs can run in the camera, and the running software programs need to be updated and upgraded.
[0003] In order to upgrade the software program, the camera needs to obtain an upgrade package first. However, currently, it is not convenient for the camera to obtain the software upgrade package from other devices, making it relatively inconvenient to upgrade the camera software. Summary of the Invention
[0004] The main technical problem to be solved by this application is to provide a camera upgrade method, system, electronic device, and storage medium, which can enable the camera to conveniently obtain the upgrade data packet and meet the camera upgrade requirements.
[0005] To solve the above technical problem, a technical solution adopted by this application is: to provide a camera upgrade method, where the camera is connected to an upgrade device through a Universal Serial Bus (USB) interface; both the camera and the upgrade device support the USB Communication Device Class (CDC) protocol; data related to software upgrade is transmitted between the camera and the upgrade device based on the CDC protocol; the method includes: the camera sequentially receives at least one data packet sent by the upgrade device related to the target software upgrade, and the at least one data packet includes the upgrade data packet of the target software; for each received data packet, a response message corresponding to the data packet is sent to the upgrade device, and the response message is used to notify whether the data packet is received successfully; when the received upgrade data packet meets the upgrade implementation condition, the upgrade data packet is stored in a non-volatile memory.
[0006] Wherein, before sending the response message corresponding to the data packet to the upgrade device, the method further includes: performing a first verification on the data packet to obtain a first verification result of the data packet; sending the response message corresponding to the data packet to the upgrade device includes at least one of the following steps: in response to the first verification result being verification successful, sending a response message indicating that the data packet is received successfully to the upgrade device; in response to the first verification result being verification failed, sending a response message indicating that the data packet is received failed to the upgrade device, so that the upgrade device takes the data packet as the next data packet and resends it.
[0007] Wherein, in response to the first verification result being successful verification, the method further includes: in the case where the currently successfully verified data packet is an upgrade data packet, storing the upgrade data packet in a volatile memory; storing the upgrade data packet in a non-volatile memory, including: reading the upgrade data packet from the volatile memory and storing it in the non-volatile memory.
[0008] Wherein, at least one data packet further includes an upgrade command packet; in response to the first verification result being successful verification, the method further includes: in the case where the currently successfully verified data packet is an upgrade command packet, performing data processing corresponding to the upgrade command packet, wherein the data processing corresponding to the upgrade command packet is used to determine whether the received upgrade data packet meets the upgrade implementation conditions.
[0009] Wherein, the upgrade command packet includes at least one of a start upgrade command packet and an end upgrade command packet, and the software upgrade implementation conditions include: all upgrade data packets of the target software are successfully received, and the received upgrade data packets pass the second verification; performing the data processing corresponding to the upgrade command packet includes at least one of the following steps: in the case where the currently successfully verified upgrade command packet is a start upgrade command packet, extracting total verification information from the start upgrade command packet and storing the total verification information in a volatile memory, and the total verification information in the volatile memory is used to perform a second verification on the received upgrade data packets; in the case where the currently successfully verified upgrade command packet is an end upgrade command packet, determining that all currently received upgrade data packets of the target software have been successfully received, and performing a second verification on the received upgrade data packets using the total verification information to obtain a second verification result, wherein, in the case where the second verification result is passed, performing the step of storing the upgrade data packet in the non-volatile memory.
[0010] Wherein, the total verification information includes at least one of length verification information and content verification information.
[0011] Wherein, the method further includes: upgrading the target software in the non-volatile memory based on the upgrade data packet.
[0012] To solve the above technical problems, a technical solution adopted by this application is: to provide a camera upgrade system, which includes a camera and an upgrade device; the camera and the upgrade device are connected through a Universal Serial Bus (USB) interface; both the camera and the upgrade device support the USB Communication Device Class (CDC) protocol; data related to software upgrade is transmitted between the camera and the upgrade device based on the CDC protocol; the camera sequentially receives at least one data packet sent by the upgrade device related to the target software upgrade, and the at least one data packet includes the upgrade data packet of the target software; each time the camera receives a data packet, it sends a response message corresponding to the data packet to the upgrade device, and the response message is used to notify whether the data packet is received successfully; when the received upgrade data packet meets the upgrade implementation condition, the camera stores the upgrade data packet in a non-volatile memory.
[0013] To solve the above technical problems, another technical solution adopted by this application is: to provide an electronic device, which includes a memory and a processor coupled to each other, and the processor is used to execute program instructions stored in the memory to implement any of the above camera upgrade methods.
[0014] To solve the above technical problems, another technical solution adopted by this application is: to provide a computer-readable storage medium, on which program instructions are stored, and when the program instructions are executed by a processor, any of the above camera upgrade methods is implemented.
[0015] In the above solution, the camera and the upgrade device are connected through a USB interface, and based on the CDC protocol, receive data related to software upgrade sent by the upgrade device and make a response, so as to conveniently obtain upgrade data packets from a device connected through the USB interface to meet the camera upgrade needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings here are incorporated into the specification and form a part of this specification. These drawings show embodiments consistent with this application and are used together with the specification to illustrate the technical solutions of this application.
[0017] Figure 1 is a schematic flowchart of an embodiment of the camera upgrade method of this application;
[0018] Figure 2 is a schematic diagram of an embodiment of the camera upgrade system of this application;
[0019] Figure 3 is a schematic flowchart of another embodiment of the camera upgrade method of this application;
[0020] Figure 4 is a schematic flowchart of still another embodiment of the camera upgrade method of this application;
[0021] Figure 5 It is a schematic framework diagram of an embodiment of an electronic device of the present application;
[0022] Figure 6 It is a schematic framework diagram of an embodiment of a computer-readable storage medium of the present application. Detailed implementation manners
[0023] The following will combine with the accompanying drawings of the specification to elaborate on the solutions of the embodiments of the present application in detail.
[0024] In the following description, specific details such as specific subsystem structures, interfaces, and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the present application.
[0025] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after. In addition, "multiple" in this article means two or more. In addition, the term "at least one" in this article represents any one of multiple types or any combination of at least two of multiple types. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set composed of A, B, and C.
[0026] Please refer to Figure 1 , Figure 1 It is a schematic flowchart of an embodiment of a camera upgrade method of the present application.
[0027] The camera upgrade method provided by the present application can be applied to a camera and an upgrade device with a Universal Serial Bus (USB) interface. The camera and the upgrade device can be connected through the USB interface. Both the camera and the upgrade device support the Communication Device Class (CDC) protocol. Data related to software upgrade is transmitted between the camera and the upgrade device based on the Communication Device Class protocol of the Universal Serial Bus.
[0028] The following takes the steps executed by the camera as an example for illustration. The method includes:
[0029] Step S110: Sequentially receive at least one data packet sent by the upgrade device related to the target software upgrade.
[0030] Among them, the number of data packets is one or more. All data packets include the upgrade data packet of the target software.
[0031] It is understandable that the camera and the upgrade device can be connected through a USB interface. The upgrade device recognizes the camera as a USB virtual serial port device, and through this virtual serial port, the upgrade device and the camera can communicate. The upgrade device sequentially sends at least one data packet related to the target software upgrade to the camera.
[0032] In some embodiments, all data packets further include an upgrade command packet. Further, the upgrade command may include at least one of a start upgrade command packet and an end upgrade command packet.
[0033] In a specific application scenario, all data packets include an upgrade data packet, a start upgrade command packet, and an end upgrade command packet. The number of upgrade data packets is one or more. The start upgrade command packet and the end upgrade command packet are one each.
[0034] Step S120: Send a response message corresponding to the data packet to the upgrade device.
[0035] Each time the camera receives a data packet, it can execute step S120. Among them, the response message can be used to notify whether the data packet is received successfully.
[0036] When the received upgrade data packet meets the upgrade implementation condition, step S130 is executed. The execution order of step S130 is not limited to after sending the response message.
[0037] Step S130: Store the upgrade data packet in the non-volatile memory.
[0038] Among them, the upgrade data packet can be used to upgrade the target software. After storing the upgrade data packet in the non-volatile memory, the upgrade data packet will not be lost even after the camera is powered off.
[0039] In the above solution, the camera and the upgrade device are connected through a universal serial bus interface. Based on the universal serial bus communication device class protocol, it receives data related to software upgrade sent by the upgrade device and makes a response, realizing the convenient acquisition of upgrade data packets from the device connected through the universal serial bus interface to meet the camera upgrade needs.
[0040] In some embodiments, both the camera and the upgrade device also support the universal serial bus video class protocol (UVC, USB Video Class), and the camera can send video class data to the upgrade device based on the UVC protocol.
[0041] In the above solution, one interface can simultaneously realize the transmission of video data of the camera and the transmission of data related to the upgrade. And the two data transmissions can be carried out simultaneously, and the upgrade data transmission will not affect the normal use of the camera.
[0042] Refer to Figure 2, Figure 2 It is a schematic diagram of an embodiment of the camera upgrade system of the present application.
[0043] The camera upgrade system 20 includes a camera 21 and an upgrade device 22. Among them, the camera 21 and the upgrade device 22 are connected through a universal serial bus interface. Both the camera 21 and the upgrade device 22 support the universal serial bus communication device class protocol.
[0044] The upgrade device 22 can enumerate and recognize the camera 21 as two functional devices, an image device and a USB-to-serial port. Among them, the image device can be used to implement the function of video data transmission, and the USB-to-serial port can be used to implement the upgrade function.
[0045] For the upgrade device 22, a virtual serial port is created in software. Through this virtual serial port, the upgrade device 22 can interact as if it were using a real serial port.
[0046] The upgrade device 22 sequentially sends at least one data packet related to the target software upgrade to the camera 21. The at least one data packet includes the upgrade data packet of the target software. The camera 21 sequentially receives the data packets sent by the upgrade device 22. Each time the camera 21 receives a data packet, it sends a response message corresponding to the data packet to the upgrade device 22. The response message is used to notify whether the data packet has been received successfully;
[0047] When the received upgrade data packet meets the upgrade implementation condition, the camera 21 stores the upgrade data packet in the non-volatile memory.
[0048] In some embodiments, the upgrade device 22 can be a computer. In some embodiments, the camera 21 can be a thermal imaging camera.
[0049] In some cases, the camera 21 and the upgrade device 22 also support the universal serial bus video class protocol.
[0050] In some specific application scenarios, the camera 21 and the upgrade device 22 can simultaneously transmit video data and upgrade-related data.
[0051] In some embodiments, before sending the response message corresponding to the data packet to the upgrade device, the method may further include: performing a first verification on the data packet to obtain a first verification result of the data packet.
[0052] It can be understood that the camera can perform the first verification on any received data packet.
[0053] In some implementation scenarios, information corresponding to the first verification is attached to the upgrade data packet. The camera calculates using the data of the original upgrade data packet to obtain the information to be compared, and compares the information to be compared with the attached information. If the two are consistent, it can be determined that the first verification result is successful verification.
[0054] Further, sending a response message corresponding to the data packet to the upgrade device may include at least one of the following steps: in response to the first verification result being successful verification, sending a response message indicating successful reception of the data packet to the upgrade device; in response to the first verification result being failed verification, sending a response message indicating failed reception of the data packet to the upgrade device.
[0055] Among them, the response message indicating failed reception can be used to prompt the upgrade device to take the data packet with failed reception as the next data packet and resend it.
[0056] In some embodiments, in response to the first verification result being successful verification, the method may further include: in the case where the currently verified successful data packet is an upgrade data packet, storing the upgrade data packet in a volatile memory.
[0057] In a specific application scenario, the camera receives a data packet sent by the upgrade device, performs the first verification on the data packet to obtain the first verification result of the data packet. In the case where the first verification result is successful verification, if the data packet is an upgrade data packet, the upgrade data packet is stored in a volatile memory.
[0058] Further, after storing the upgrade data packet in the volatile memory, a response message indicating successful reception of the data packet is sent to the upgrade device.
[0059] In some embodiments, after the camera determines that the first verification result of the received data packet is successful verification, it can determine the type of the verified successful data packet. If it is an upgrade data packet, the upgrade data packet is stored in a volatile memory.
[0060] In some specific application scenarios, the upgrade data packet can be stored in the memory.
[0061] In some implementation scenarios, storing the upgrade data packet in a non-volatile memory may include: reading the upgrade data packet from the volatile memory and storing it in the non-volatile memory.
[0062] In some specific application scenarios, the upgrade data packet can be read from the memory and stored in a Flash memory.
[0063] In some embodiments, the upgrade implementation condition may include that all upgrade data packets of the target software are successfully received. Thus, all successfully received upgrade data packets can be stored in the non-volatile memory.
[0064] In some implementation scenarios, a data packet sent by the upgrade device can indicate that all upgrade data packets have been sent. The camera can determine whether the current conditions for upgrade implementation are met after receiving this data packet. Exemplarily, identification information is added to the last upgrade data packet to identify it as the last one. Exemplarily, an additional data packet is sent after the last upgrade data packet to indicate that all upgrade data packets have been sent.
[0065] In some embodiments, the upgrade device is configured to send the next data packet after receiving the acknowledgment message indicating that the previous data packet has been successfully received. Therefore, when the camera receives the last data packet, it can be considered that all upgrade data packets have been successfully received.
[0066] In some specific application scenarios, if the camera successfully receives the upgrade data packet with identification information, i.e., the last upgrade data packet, it can be determined that all upgrade data packets for the target software have been successfully received.
[0067] In some specific application scenarios, if the camera successfully receives the additional data packet after the last upgrade data packet, it can be determined that all upgrade data packets for the target software have been successfully received.
[0068] In some embodiments, the upgrade device can send a data packet before sending the upgrade data packet to indicate that the sending of upgrade data packets is about to start.
[0069] In some embodiments, the upgrade device can attach information for verifying all upgrade data packets when sending data packets for validating the data.
[0070] In some implementation scenarios, the verification information for all the foregoing upgrade data packets can be sent in any data packet so that the camera can perform verification. Among them, any data packet can be an upgrade data packet or a data packet sent before sending the upgrade data packet to indicate that the sending is about to start.
[0071] In some embodiments, the data packet sent by the upgrade device can also include an upgrade command packet.
[0072] In some implementation scenarios, the upgrade command packet can include at least one of a start upgrade command packet and an end upgrade command packet. Among them, the upgrade device can send the start upgrade command packet before sending the upgrade data packet, and / or send the end upgrade command packet after sending all upgrade data packets.
[0073] In some embodiments, the start upgrade command packet can be used to provide information for performing a second verification on the upgrade data packets. In the case where the received data packet includes the start upgrade command packet, the upgrade implementation condition can further include passing the second verification.
[0074] Among them, the second verification is a verification for all upgrade data packets, and can be used to determine whether all the currently received upgrade data packets are valid. The method of the second verification is similar to that of the first verification, and reference can be made to the content related to the foregoing first verification, which will not be elaborated here.
[0075] In some implementation scenarios, after receiving the start upgrade command packet, the camera has the information for performing the second verification. This information can be used to perform the second verification on all the received upgrade data packets, and passing the second verification can be used as an upgrade implementation condition.
[0076] Among them, the second verification can be triggered when it is determined that all the upgrade data packets of the target software have been successfully received.
[0077] In some embodiments, after receiving the upgrade command packet, the camera can execute the data processing corresponding to the upgrade command packet, and the data processing corresponding to the upgrade command packet can be used to determine whether the received upgrade data packets meet the upgrade implementation conditions.
[0078] Among them, the data processing corresponding to the start upgrade command packet includes: extracting the total verification information from the start upgrade command packet and storing the total verification information in the volatile memory. The total verification information in the volatile memory is used to perform the second verification on the received upgrade data packets.
[0079] Among them, the data processing corresponding to the end upgrade command packet includes: determining that all the currently received upgrade data packets of the target software have been successfully received, and using the total verification information to perform the second verification on all the received upgrade data packets to obtain a second verification result.
[0080] Furthermore, the camera can, in response to the first verification result being verification success and in the case where the currently verified successful data packet is an upgrade command packet, execute the data processing corresponding to the upgrade command packet.
[0081] In some specific application scenarios, after the camera receives a data packet, it performs the first verification on the data packet. If the verification is successful, it determines the type of the data packet. If it is an upgrade command packet, it executes the data processing corresponding to the upgrade command packet.
[0082] In some specific application scenarios, after receiving a data packet, the camera performs a first verification on the data packet. If the verification is successful and it is determined that the data packet is an end upgrade command packet, it can be determined that all the upgrade data packets of the target software have been successfully received. And the second verification can be triggered. In the case where the result of the second verification passes, the step of storing the upgrade data packet into the non-volatile memory is executed. Further, after the step of storing into the non-volatile memory is completed, a reception success response message corresponding to the end upgrade command packet is sent to the upgrade device.
[0083] Among them, after the step of storing into the non-volatile memory is completed, a reception success response message corresponding to the end upgrade command packet is sent. Thus, the reception success response message can indicate that both the first verification and the second verification pass, which also means that the upgrade data packets of the target software have been successfully transmitted. And, the success response message corresponding to the end upgrade command packet can be used as a flag for powering off the camera. Since the data has been stored in the non-volatile memory, powering off will not cause the loss of the upgrade data packets.
[0084] In the case where the result of the second verification fails, a reception failure response message corresponding to the end upgrade command packet is directly sent to the upgrade device.
[0085] Among them, the reception failure response message corresponding to the end upgrade command packet can indicate that the first verification or the second verification fails. Further, two different response messages can be set for the end command packet, one for feedback to the upgrade device when the first verification fails and the other for feedback to the upgrade device when the second verification fails, so that the upgrade device can determine the specific failure situation.
[0086] If only the first verification fails, the end upgrade command packet can be resent. If the second verification fails, it means that there is an abnormality in the upgrade data packet and resending can be attempted.
[0087] In some embodiments, the total verification information may include at least one of length verification information and content verification information.
[0088] Among them, the length verification information can be used to verify the lengths of all upgrade data packets and determine whether the total length is abnormal. Exemplarily, the length verification information may include the number of upgrade data packets.
[0089] Among them, the content verification information can be used to verify the contents of all upgrade data packets and determine whether the contents are abnormal.
[0090] In some embodiments, the method may further include: upgrading the target software in the non-volatile memory based on the upgrade data packet.
[0091] The target software runs after being loaded into the memory. Receiving data packets and responses will not affect the operation of the target software. Moreover, when upgrading the target software in the non-volatile memory, it will not affect the operation of the target software either, and the upgrade can be achieved while the software is running.
[0092] See Figure 3 , Figure 3 which is a schematic flowchart of another embodiment of the camera upgrade method of the present application.
[0093] In this embodiment, the method steps executed by the camera are taken as an example for illustration.
[0094] After the camera receives a data packet, it performs a first verification on the data packet. If the verification fails, it directly feedbacks a response message indicating reception failure. If the verification is successful, it determines the type of the data packet. If it is an upgrade data packet, it stores the data packet in the volatile memory and then sends a response message indicating successful reception. If it is a start upgrade command packet, it reads the total verification information from it and stores it in the volatile memory, and then sends a response message indicating successful reception. If it is an end upgrade command packet, it uses the total verification information stored in the volatile memory to perform a second verification on all upgrade data packets. If the verification is successful, it stores the upgrade data packets in the non-volatile memory. If the verification fails, it sends a response message indicating reception failure.
[0095] In some embodiments, the data stored in the non-volatile memory may include all received data, not limited to upgrade data packets.
[0096] See Figure 4 , Figure 4 which is a schematic flowchart of yet another embodiment of the camera upgrade method of the present application.
[0097] In this embodiment, the method steps executed by the upgrade device are taken as an example for illustration. In this embodiment, the upgrade device can be configured to send the next data packet after receiving a successful response message, and re-send the data packet corresponding to the failure response message after receiving a failure response message.
[0098] The upgrade package of the target software is divided into multiple upgrade data packets. The upgrade device first sends a start upgrade command packet, and then sequentially and cyclically sends upgrade data packets. After all the upgrade data packets are sent, it sends an end upgrade command packet.
[0099] Please refer to Figure 5 , Figure 5 which is a schematic framework diagram of an embodiment of the electronic device of the present application.
[0100] In this embodiment, the electronic device 50 includes a memory 51 and a processor 52, where the memory 51 is coupled to the processor 52. Specifically, the components of the electronic device 50 can be coupled together through a bus, or the processor 52 of the electronic device 50 is respectively connected to other components one by one. The electronic device 50 can be a camera, or can be any device with processing capabilities, and is used as an upgrade device.
[0101] The memory 51 is used to store program instructions executed by the processor 52 and data during the processing of the processor 52, etc. For example, an upgrade command packet, an upgrade data packet, etc. Among them, the memory 51 includes a non-volatile storage part for storing the above program instructions.
[0102] The processor 52 controls the operation of the electronic device 50. The processor 52 can also be called a CPU (Central Processing Unit, central processing unit). The processor 52 may be an integrated circuit chip with signal processing capabilities. The processor 52 can also be a general-purpose processor, 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. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 52 can be implemented by multiple integrated circuit chips together.
[0103] The processor 52 is used to execute instructions to implement any of the above camera upgrade methods by calling the program instructions stored in the memory 51.
[0104] Please refer to Figure 6 , Figure 6 is a schematic framework diagram of an embodiment of the computer-readable storage medium of the present application.
[0105] In this embodiment, the computer-readable storage medium 60 stores program instructions 61 that can be run by the processor. The program instructions 61 can be executed to implement any of the above camera upgrade methods.
[0106] The computer-readable storage medium 60 can specifically be a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc, etc., which can store program instructions, or can also be a server storing the program instructions. The server can send the stored program instructions to other devices for running, or can also run the stored program instructions by itself.
[0107] In some embodiments, the computer-readable storage medium 60 can also be a memory as shown in Figure 5 Figure.
[0108] The descriptions of the various embodiments above tend to emphasize the differences between the various embodiments. Their similarities or resemblances can be referred to each other. For the sake of brevity, they will not be elaborated herein again.
[0109] In several embodiments provided in this application, it should be understood that the disclosed methods and apparatuses can be implemented in other ways. For example, the apparatus implementation manners described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division manners. For example, units or components can be combined or integrated into another subsystem, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the apparatuses or units can be in electrical, mechanical or other forms.
[0110] In addition, each functional unit in the various embodiments of this application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. If the integrated units are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that makes a contribution to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in the various implementation manners of this application. And the aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs and other various media that can store program codes.
Claims
1. A camera upgrade method, characterized in that: The camera is connected to the upgrade device via a universal serial bus interface; both the camera and the upgrade device support the universal serial bus communication device class protocol; The camera and the upgrade device transmit data related to the software upgrade based on the universal serial bus communication device class protocol; The method comprises: The camera sequentially receives at least one data packet related to the target software upgrade sent by the upgrade device, wherein the at least one data packet includes the upgrade data packet of the target software; Each time the data packet is received, a response message corresponding to the data packet is sent to the upgrade device, wherein the response message is used to notify whether the data packet is received successfully; When the received upgrade data packet meets the upgrade implementation condition, the upgrade data packet is stored in a non-volatile memory.
2. The method according to claim 1, characterized in that Before sending a response message corresponding to the data packet to the upgrade device, the method further includes: Performing a first check on the data packet to obtain a first check result of the data packet; The step of sending a response message corresponding to the data packet to the upgrade device comprises at least one of the following steps: In response to the first verification result being a successful verification, sending a response message indicating that the data packet is successfully received to the upgrade device; In response to the first verification result being a verification failure, a response message indicating a failure to receive the data packet is sent to the upgrade device, so that the upgrade device takes the data packet as a next data packet and resends it.
3. The method according to claim 2, characterized in that In response to the first verification result being a successful verification, the method further includes: If the data packet that has been successfully verified is the upgrade data packet, storing the upgrade data packet in a volatile memory; The step of storing the upgrade data package in a non-volatile memory comprises: The upgrade data package is read from the volatile memory and stored in the non-volatile memory.
4. The method according to claim 2, characterized in that: The at least one data packet further includes an upgrade command packet; In response to the first verification result being a successful verification, the method further includes: In the case that the data packet that has been successfully verified is the upgrade command packet, data processing corresponding to the upgrade command packet is performed, wherein the data processing corresponding to the upgrade command packet is used to determine whether the received upgrade data packet meets the upgrade implementation condition.
5. The method according to claim 4, characterized in that The upgrade command packet includes at least one of a start upgrade command packet and an end upgrade command packet, and the software upgrade implementation condition includes: the upgrade data packets of the target software are all successfully received and the received upgrade data packets pass the second check; The executing of the data processing corresponding to the upgrade command package includes at least one of the following steps: In the case that the upgrade command packet that has been successfully verified is a start upgrade command packet, extracting total verification information from the start upgrade command packet, and storing the total verification information in a volatile memory, wherein the total verification information in the volatile memory is used to perform a second verification on the received upgrade data packet; In the case where the current verification succeeds and the upgrade command packet is the end upgrade command packet, it is determined that the upgrade data packets of the target software have been successfully received, and a second verification is performed on the received upgrade data packets using the total verification information to obtain a second verification result, wherein, in the case where the second verification result is passed, the step of storing the upgrade data packet in the non-volatile memory is executed.
6. The method according to claim 5, characterized in that The total check information includes at least one of length check information and content check information.
7. The method according to claim 1, characterized in that The method further comprises: The target software in the non-volatile memory is upgraded based on the upgrade data package.
8. A camera upgrade system, characterized in that: It includes a camera and an upgrade device; the camera and the upgrade device are connected via a universal serial bus interface; the camera and the upgrade device both support a universal serial bus communication device class protocol; The camera and the upgrade device transmit data related to the software upgrade based on the universal serial bus communication device class protocol; The camera sequentially receives at least one data packet related to the target software upgrade sent by the upgrade device, wherein the at least one data packet includes the upgrade data packet of the target software; Each time the camera receives the data packet, it sends a response message corresponding to the data packet to the upgrade device, where the response message is used to notify whether the data packet is received successfully; When the received upgrade data packet meets the upgrade implementation condition, the camera stores the upgrade data packet in a non-volatile memory.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores program instructions, and when the program instructions are executed by the processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.