A vehicle-mounted software development and debugging method and device based on a USB switching device

By generating key pairs and certificates in the USB adapter device and switching USB modes using the MCU, the problems of complex operation and permission leakage during the development and debugging of vehicle software are solved, and efficient ADB debugging is achieved by plugging and debugging and disconnecting when the adapter is removed.

CN122179111APending Publication Date: 2026-06-09JIANGSU BDSTAR AUTOMOTIVE ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JIANGSU BDSTAR AUTOMOTIVE ELECTRONICS CO LTD
Filing Date
2026-03-04
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

The existing in-vehicle software development and debugging process is complex, requiring a series of specific operations and password input. Furthermore, password leakage can easily lead to permission leaks, making it difficult to quickly obtain and release ADB permissions, resulting in low debugging efficiency.

Method used

By developing a key tool to generate a key pair and performing local signing, the MCU writes the key pair and certificate into the secure storage area of ​​the target USB adapter. When the vehicle's infotainment system detects the target USB adapter and verifies the key, it switches to USB mode, realizing a plug-and-play ADB debugging channel that disconnects when the adapter is unplugged.

Benefits of technology

It simplifies the operation process, improves debugging efficiency, avoids permission leakage problems caused by password leakage, and can dynamically and quickly acquire and release ADB permissions, expanding the coverage of debugging scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122179111A_ABST
    Figure CN122179111A_ABST
Patent Text Reader

Abstract

The application provides a vehicle-mounted software development and debugging method and device based on a USB adapter, the method comprising: in response to inserting a target USB adapter developed in advance into a computer, identifying the target USB adapter through a preset development key tool, generating a corresponding key pair through the development key tool, obtaining a new certificate after local signing, and notifying an MCU to write the key pair and the certificate into a secure storage area in the target USB adapter; in response to the target USB adapter being inserted into an in-vehicle infotainment system, a USB tool built in the in-vehicle infotainment system detects the target USB adapter, and switches a USB mode of the in-vehicle infotainment system to an ADB mode after verifying a key of the key pair.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software development technology, and more specifically, to a method and apparatus for developing and debugging in-vehicle software based on a USB adapter. Background Technology

[0002] With the evolution of automotive electronic and electrical architecture towards centralization and the in-depth practice of the "software-defined vehicle" concept, in-vehicle software systems have developed into comprehensive software platforms integrating high-performance computing, complex operating systems, and diversified applications. Accordingly, it is necessary to debug the development process.

[0003] Currently, the development and debugging process of in-vehicle software is implemented by using the ADB function. To enable the ADB function, you need to wait for the system to start up, perform a series of specific operations in the in-vehicle central control system and enter the password before it can be started. At the same time, depending on the needs at different development stages, the switch status will be remembered or reset after restarting.

[0004] However, current ADB debugging requires performing a series of specific operations and entering a password, which is complex and generally inefficient. Furthermore, once the password is leaked, there are no additional measures to prevent users from gaining ADB privileges, which can easily lead to privilege leaks. In addition, it is difficult to quickly acquire and release ADB privileges, resulting in limited coverage of scenarios and further reducing debugging efficiency. Summary of the Invention

[0005] In view of this, the purpose of this application is to provide a method and apparatus for developing and debugging in-vehicle software based on a USB adapter. A corresponding key pair is generated using a development key tool and locally signed to obtain a certificate. The key pair and certificate are then written to the secure storage area of ​​the target USB adapter via an MCU. When the built-in USB tool in the vehicle's infotainment system detects the target USB adapter and verifies the key, it switches to USB mode. This achieves a plug-and-play ADB debugging channel that disconnects upon adapter removal, eliminating the need for a series of specific operations and password input. This simplifies operation, improves debugging efficiency, and avoids permission leaks caused by password disclosure. Furthermore, it allows for dynamic and rapid acquisition and release of ADB permissions, increasing the coverage of various scenarios and further improving debugging efficiency.

[0006] In a first aspect, embodiments of this application provide a method for developing and debugging in-vehicle software based on a USB adapter, the method comprising: In response to inserting a pre-developed target USB adapter into a computer, the target USB adapter is identified using a pre-defined development key tool; wherein the target USB adapter has a built-in MCU and a secure storage area; the secure storage area can only be rewritten by the development key tool; After generating the corresponding key pair using the development key tool, performing local signing to obtain a new certificate, and notifying the MCU to write the key pair and the certificate into the secure storage area of ​​the target USB adapter; In response to the target USB adapter being inserted into the vehicle infotainment system, the built-in USB tool of the vehicle infotainment system detects the target USB adapter and switches the USB mode of the vehicle infotainment system to ADB mode after verifying the key of the key pair.

[0007] In one possible implementation, generating the corresponding key pair through the development key tool includes: The development key tool uses a preset elliptic curve algorithm to create the corresponding private key through a secure random number generator; The development key tool uses the elliptic curve algorithm to derive the corresponding public key from the private key and exports the public key for application in the OEM integration built into the vehicle's infotainment system.

[0008] In one possible implementation, notifying the MCU to write the key pair and the certificate to the secure storage area in the target USB adapter includes: The development key tool signs the data input through the target USB adapter using the private key, and sends a write key command to the target USB adapter through the USB-CDC interface; In response to the MCU in the target USB adapter verifying and unlocking the write key instruction based on a pre-agreed command, the secure storage area is erased and the certificate and the private key are written.

[0009] In one possible implementation, the method further includes: The MCU sends a successful write command back to the development key tool; When the development key tool receives the successful write instruction, it displays the corresponding key rewrite completion indication and immediately invalidates the corresponding public key.

[0010] In one possible implementation, detecting the target USB adapter and switching the vehicle's USB mode to ADB mode after verifying the key includes: After the built-in USB tool in the vehicle uses the standard USB descriptor to determine that the device type of the inserted USB adapter is the target USB adapter, it establishes a serial communication connection with the target USB adapter through the USB-CDC interface. The USB tool reads data from the target USB adapter based on the specified address and performs signature verification based on the public key in the OEM. After the verification is passed, the vehicle's USB mode will be changed to ADB mode.

[0011] In one possible implementation, the signature verification based on the public key in the OEM includes: Calculate the first hash value corresponding to the read data, and decrypt the read data using the public key pre-integrated in the OEM to obtain the second hash value of the decryption signature; The first hash value is compared with the second hash value of the decrypted signature, and the signature verification is confirmed to be successful when the first hash value and the second hash value are the same.

[0012] In one possible implementation, the method further includes: If the first hash value and the second hash value are different, the signature verification is confirmed to have failed.

[0013] Secondly, embodiments of this application also provide an in-vehicle software development and debugging device based on a USB adapter, the device comprising: An identification module is used to identify the target USB adapter device by means of a preset development key tool in response to inserting a pre-developed target USB adapter device into a computer; wherein the target USB adapter device has a built-in MCU and a secure storage area; the secure storage area can only be rewritten by the development key tool; The signature module is used to generate a corresponding key pair through the development key tool, perform local signing to obtain a new certificate, and then notify the MCU to write the key pair and the certificate into the secure storage area of ​​the target USB adapter. A switching module is used to respond to the insertion of the target USB adapter into the vehicle infotainment system. The built-in USB tool of the vehicle infotainment system detects the target USB adapter and switches the USB mode of the vehicle infotainment system to ADB mode after verifying the key of the key pair.

[0014] In one possible implementation, the signature module is specifically used for: The development key tool uses a preset elliptic curve algorithm to create the corresponding private key through a secure random number generator; The development key tool uses the elliptic curve algorithm to derive the corresponding public key from the private key and exports the public key for application in the OEM integration built into the vehicle's infotainment system.

[0015] In one possible implementation, the signature module is specifically used for: The development key tool signs the data input through the target USB adapter using the private key, and sends a write key command to the target USB adapter through the USB-CDC interface; In response to the MCU in the target USB adapter verifying and unlocking the write key instruction based on a pre-agreed command, the secure storage area is erased and the certificate and the private key are written.

[0016] In one possible implementation, the device further includes: The feedback module is used by the MCU to send a successful write instruction back to the development key tool; The receiving module is used to display a corresponding key rewriting completion indication and immediately invalidate the corresponding public key when the development key tool receives the write success instruction.

[0017] In one possible implementation, the switching module is specifically used for: After the built-in USB tool in the vehicle uses the standard USB descriptor to determine that the device type of the inserted USB adapter is the target USB adapter, it establishes a serial communication connection with the target USB adapter through the USB-CDC interface. The USB tool reads data from the target USB adapter based on the specified address and performs signature verification based on the public key in the OEM. After the verification is passed, the vehicle's USB mode will be changed to ADB mode.

[0018] In one possible implementation, the switching module is specifically used for: Calculate the first hash value corresponding to the read data, and decrypt the read data using the public key pre-integrated in the OEM to obtain the second hash value of the decryption signature; The first hash value is compared with the second hash value of the decrypted signature, and the signature verification is confirmed to be successful when the first hash value and the second hash value are the same.

[0019] In one possible implementation, the device further includes: The confirmation module is used to confirm the signature verification failure when the first hash value and the second hash value are different.

[0020] Thirdly, embodiments of this application provide an electronic device, including: a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the vehicle software development and debugging method based on a USB adapter as described in any of the first aspects.

[0021] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the vehicle software development and debugging method based on a USB adapter as described in any one of the first aspects.

[0022] This application provides a method and apparatus for developing and debugging in-vehicle software based on a USB adapter. In response to inserting a pre-developed target USB adapter into a computer, the target USB adapter is identified using a preset development key tool. A corresponding key pair is generated using the development key tool, and a new certificate is obtained through local signing. The MCU is then notified to write the key pair and certificate into the secure storage area of ​​the target USB adapter. In response to inserting the target USB adapter into the vehicle's infotainment system, the built-in USB tool of the vehicle's infotainment system detects the target USB adapter and, after verifying the key pair, switches the vehicle's USB mode to ADB mode. This application generates a corresponding key pair and obtains a certificate by developing a key tool and performing local signing. The key pair and certificate are then written to the secure storage area of ​​the target USB adapter device via the MCU. When the built-in USB tool on the vehicle's infotainment system detects the target USB adapter device and verifies the key, it switches to USB mode, realizing a plug-and-play ADB debugging channel that disconnects when the adapter is removed. This eliminates the need for a series of specific operations and password input, simplifying operation, improving debugging efficiency, and avoiding permission leakage issues caused by password leaks. In addition, it allows for dynamic and rapid acquisition and release of ADB permissions, increasing the coverage of scenarios and further improving debugging efficiency.

[0023] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 This is a flowchart of a method for developing and debugging in-vehicle software based on a USB adapter, according to an embodiment of this application. Figure 2 This is a connection diagram of the target USB adapter, the vehicle infotainment system, and the PC; Figure 3 This is a schematic diagram of the structure of an in-vehicle software development and debugging device based on a USB adapter provided in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.

[0027] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0028] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0029] Considering the evolution of automotive electronic and electrical architecture towards centralization and the in-depth practice of the "software-defined vehicle" concept, in-vehicle software systems have developed into comprehensive software platforms integrating high-performance computing, complex operating systems, and diversified applications. Accordingly, it is necessary to debug their development process.

[0030] Currently, the development and debugging process of in-vehicle software is implemented by using the ADB function. To enable the ADB function, you need to wait for the system to start up, perform a series of specific operations in the in-vehicle central control system and enter the password before it can be started. At the same time, depending on the needs at different development stages, the switch status will be remembered or reset after restarting.

[0031] However, current ADB debugging requires performing a series of specific operations and entering a password, which is complex and generally inefficient. Furthermore, once the password is leaked, there are no additional measures to prevent users from gaining ADB privileges, which can easily lead to privilege leaks. In addition, it is difficult to quickly acquire and release ADB privileges, resulting in limited coverage of scenarios and further reducing debugging efficiency.

[0032] To address this issue, this application provides a method and apparatus for developing and debugging in-vehicle software based on a USB adapter. A key pair is generated using a development key tool and locally signed to obtain a certificate. The key pair and certificate are then written to the secure storage area of ​​the target USB adapter via an MCU. When the built-in USB tool in the vehicle's infotainment system detects the target USB adapter and verifies the key, it switches to USB mode. This achieves a plug-and-play ADB debugging channel that disconnects upon adapter removal, eliminating the need for a series of specific operations and password input. This simplifies operation, improves debugging efficiency, and avoids permission leaks caused by password breaches. Furthermore, it allows for dynamic and rapid acquisition and release of ADB permissions, expanding the scope of scenarios and further improving debugging efficiency.

[0033] Figure 1 This is a flowchart illustrating a method for developing and debugging in-vehicle software based on a USB adapter, according to an embodiment of this application. Figure 1 As shown in the embodiments of this application, the in-vehicle software development and debugging method based on a USB adapter may specifically include: S101. In response to inserting a pre-developed target USB adapter into a computer, the target USB adapter is identified using a pre-defined development key tool.

[0034] S102. Generate the corresponding key pair through the development key tool, perform local signing to obtain the new certificate, and then notify the MCU to write the key pair and certificate to the secure storage area in the target USB adapter device.

[0035] S103. In response to the target USB adapter being inserted into the vehicle infotainment system, the built-in USB tool of the vehicle infotainment system detects the target USB adapter and switches the vehicle infotainment system's USB mode to ADB mode after verifying the key of the key pair.

[0036] In the above-mentioned in-vehicle software development and debugging method based on USB adapter devices, a corresponding key pair is generated by a development key tool and a certificate is obtained by local signing. The key pair and certificate are then written to the secure storage area of ​​the target USB adapter device by the MCU. When the built-in USB tool on the vehicle terminal detects the target USB adapter device and verifies the key, it switches to USB mode, realizing a plug-and-play ADB debugging channel that disconnects when the adapter is unplugged. This eliminates the need to perform a series of specific operations and enter a password, making the operation simple, improving debugging efficiency, and avoiding permission leakage problems caused by password leakage. In addition, ADB permissions can be dynamically and quickly acquired and released, increasing the coverage of scenarios and further improving debugging efficiency.

[0037] The exemplary steps described above in the embodiments of this application are illustrated below with specific examples: S101, in response to inserting a pre-developed target USB adapter into a computer, identifies the target USB adapter using a preset development key tool; wherein the target USB adapter has a built-in MCU and a secure storage area.

[0038] In this embodiment, the target USB adapter is a USB adapter specifically developed in advance for this application. The target USB adapter has a built-in main control MCU and a secure storage area. The target USB adapter includes a USB-A female connector for connecting to a computer and a USB-A male connector for connecting to a vehicle infotainment system. The computer and vehicle infotainment system are connected via USB, i.e., a standard USB-A female connector (for personal computers) and a USB-A male connector (for vehicle infotainment systems). For example, ... Figure 2 As shown, the secure storage area can only be modified by the development key tool, which is the accompanying key tool (e.g., DevKeyTool). When the target USB adapter is plugged into the computer, the development key tool identifies the target USB adapter for subsequent processing. For example, as... Figure 2 As shown, the project key administrator inserts the target USB adapter into the PC, while the development key tool DevKeyTool identifies the hardware ID of the target USB adapter.

[0039] It should be noted that the target USB adapter comes with a USB-A male and female connector, which can be directly connected between the car's infotainment system and a PC.

[0040] S102 generates the corresponding key pair through the development key tool, performs local signing to obtain a new certificate, and then notifies the MCU to write the key pair and certificate to the secure storage area in the target USB adapter device.

[0041] In this embodiment, the key pair includes a public key and a private key. After the development key tool identifies the target USB adapter device, it generates the corresponding key pair and performs local signing to obtain a new certificate. Subsequently, the MCU writes the key pair and certificate into the secure storage area of ​​the target USB adapter device for further processing.

[0042] Optionally, when generating the corresponding key pair through the development key tool, the development key tool uses a preset elliptic curve algorithm to create the corresponding private key through a secure random number generator; the development key tool uses the elliptic curve algorithm to derive the corresponding public key from the private key and exports the public key for application in the OEM integration built into the vehicle's infotainment system.

[0043] Specifically, the development key tool uses the secp256r1 elliptic curve algorithm to create a random private key through a secure random number generator, derives a public key from the private key based on elliptic curve mathematical operations, and exports the public key for OEM integration, that is, generates a new ECC key pair locally and issues certificates using the local CA private key.

[0044] Optionally, when instructing the MCU to write the key pair and certificate to the secure storage area in the target USB adapter, the development key tool signs the data input through the target USB adapter using the private key and sends a write key command to the target USB adapter via the USB-CDC interface; in response, the MCU in the target USB adapter verifies the unlock write key command based on the pre-agreed command, erases the secure storage area and writes the certificate and private key.

[0045] Specifically, the development key tool signs the input data (e.g., project data) with a private key and sends a "write key" command via USB-CDC. After the MCU verifies the unlock write key command with the agreed-upon command, it erases the old certificate and private key in the secure storage area and writes the new certificate and private key mentioned above.

[0046] In some implementations, the MCU sends a write success command back to the development key tool; upon receiving the write success command, the development key tool displays the corresponding key rewriting completion indication and immediately invalidates the corresponding public key.

[0047] Specifically, the MCU sends back a "Write Success" command, and DevKeyTool displays "KeyUpdate Finished," immediately invalidating the corresponding vehicle system's public key. It's worth noting that the public key can be updated in the OEM.

[0048] It should be noted that the standard USB-CDC offline burning method is used to achieve "offline, multiple, and secure" key updates.

[0049] S103, in response to the target USB adapter being plugged into the vehicle infotainment system, the built-in USB tool of the vehicle infotainment system detects the target USB adapter and switches the vehicle infotainment system's USB mode to ADB mode after verifying the key of the key pair.

[0050] It should be noted that the vehicle's infotainment system has a built-in USB Tool that performs certificate verification and USB mode switching without sending any active commands.

[0051] In this embodiment, the target USB adapter is inserted into the vehicle's infotainment system. The system's built-in USB Tool detects the target USB adapter and, after verifying the key of the key pair, switches the system's USB to ADB mode. For example, ... Figure 2 As shown.

[0052] In some implementations, when detecting the target USB adapter and switching the vehicle's USB mode to ADB mode after verifying the key, the built-in USB tool in the vehicle uses a standard USB descriptor to determine that the inserted USB adapter is the target USB adapter. Then, it establishes a serial communication connection with the target USB adapter via the USB-CDC interface. The USB tool reads data from the target USB adapter according to the specified address and performs signature verification based on the public key in the OEM. After successful signature verification, the vehicle's USB mode is switched to ADB mode.

[0053] Optionally, when verifying signatures based on the public key in the OEM, a first hash value is calculated for the read data, and the read data is decrypted using the public key pre-integrated in the OEM to obtain a second hash value for the decrypted signature. The first hash value and the second hash value are compared, and if the first hash value and the second hash value are the same, the signature verification is confirmed to be successful. It should be noted that if the first hash value and the second hash value are different, the signature verification is confirmed to be unsuccessful.

[0054] Specifically, the USB Tool on the vehicle's infotainment system determines the device type as the target USB adapter device of this application by using a standard USB descriptor, establishes a serial communication connection through the USB-CDC interface, reads data according to the specified address, then verifies the signature using the built-in OEM public key, and sets the vehicle's USB mode to ADB mode after successful verification; otherwise, it continues to start normally.

[0055] The vehicle software development and debugging method based on a USB adapter provided in this application embodiment responds to inserting a pre-developed target USB adapter into a computer, identifying the target USB adapter through a preset development key tool, generating a corresponding key pair through the development key tool, obtaining a new certificate through local signing, and notifying the MCU to write the key pair and certificate into the secure storage area of ​​the target USB adapter. Response to inserting the target USB adapter into the vehicle's infotainment system, the built-in USB tool of the vehicle's infotainment system detects the target USB adapter and switches the vehicle's USB mode to ADB mode after verifying the key pair. The in-vehicle software development and debugging method based on USB adapter devices disclosed in this application generates corresponding key pairs through a development key tool and obtains certificates through local signing. The key pairs and certificates are then written to the secure storage area of ​​the target USB adapter device via the MCU. When the built-in USB tool on the vehicle's terminal detects the target USB adapter device and verifies the key, it switches to USB mode, realizing a plug-and-play ADB debugging channel that disconnects when the adapter is removed. This eliminates the need to perform a series of specific operations and enter a password, simplifying operation, improving debugging efficiency, and avoiding permission leakage issues caused by password leaks. In addition, it allows for dynamic and rapid acquisition and release of ADB permissions, increasing the coverage of scenarios and further improving debugging efficiency.

[0056] In summary, this application creates a novel USB adapter device, namely the target USB adapter device, which has a built-in MCU and a rewritable secure storage area. The key can be rewritten by the accompanying desktop tool (DevKeyTool). The built-in software (USB Tool) on the vehicle's infotainment system detects the target USB adapter device and verifies the key, and then switches to USB mode. The other end of the target USB adapter device is a standard USB-A female connector, which can accept personal computer connections and realize a plug-and-play ADB debugging channel that disconnects when the adapter is removed.

[0057] Therefore, this application requires no cloud or TEE, making it suitable for network-free environments such as EMC anechoic chambers and underground parking lots, and can be rewritten offline; the certificate validity period and project information can be rewritten arbitrarily, with zero hardware recycling and a flexible lifecycle; the use of the device requires the use of a specified certificate and key to avoid direct access and achieve security and controllability; in addition, once the target USB adapter device passes the vehicle's USBTool certification, the vehicle's system immediately switches to "USB Device" mode; developers can connect their PC to the target USB adapter device's -A port via a USB cable, and then use standard adb tools (adb shell, adb logcat, adb push / pull, etc.) on the PC to establish a high-speed debugging channel with the vehicle's system, achieving "plug and play, disconnect when adapter is removed", and enabling direct connection of the personal computer to ADB.

[0058] Figure 3This is a schematic diagram of the structure of an in-vehicle software development and debugging device based on a USB adapter provided in an embodiment of this application; as shown below. Figure 3 As shown in the figure, the in-vehicle software development and debugging device 300 based on a USB adapter according to an embodiment of this application may specifically include: The identification module 301 is used to identify the target USB adapter device by means of a preset development key tool in response to inserting the pre-developed target USB adapter device into the computer; wherein the target USB adapter device has a built-in MCU and a secure storage area; the secure storage area can only be rewritten by the development key tool.

[0059] The signature module 302 is used to generate the corresponding key pair through the development key tool, perform local signing to obtain a new certificate, and then notify the MCU to write the key pair and certificate to the secure storage area in the target USB adapter device.

[0060] The switching module 303 is used to respond to the insertion of a target USB adapter into the vehicle's infotainment system. The built-in USB tool of the vehicle's infotainment system detects the target USB adapter and switches the vehicle's USB mode to ADB mode after verifying the key of the key pair.

[0061] In one possible implementation, the signature module is specifically used for: The key development tool uses a preset elliptic curve algorithm to create the corresponding private key through a secure random number generator; The key development tool uses an elliptic curve algorithm to derive the corresponding public key from the private key and exports the public key for use in OEM integration within the vehicle's infotainment system.

[0062] In one possible implementation, the signature module is specifically used for: The development key tool signs the data input through the target USB adapter using a private key and sends a write key command to the target USB adapter via the USB-CDC interface; In response to the MCU in the target USB adapter, the system verifies the unlock write key instruction based on a pre-agreed command, erases the secure storage area, and writes the certificate and private key.

[0063] In one possible implementation, the apparatus further includes: The feedback module is used by the MCU to send back a successful write command to the development key tool; The receiving module is used to develop key tools. When the write success command is received, it displays the corresponding key rewriting completion indication and immediately invalidates the corresponding public key.

[0064] In one possible implementation, the switching module is specifically used for: The built-in USB tool in the vehicle uses the standard USB descriptor to determine that the device type of the inserted USB adapter is the target USB adapter, and then establishes a serial communication connection with the target USB adapter through the USB-CDC interface. The USB tool reads data from the target USB adapter based on the specified address and performs signature verification based on the public key in the OEM. After the verification is passed, switch the vehicle's USB mode to ADB mode.

[0065] In one possible implementation, the switching module is specifically used for: Calculate the first hash value corresponding to the read data, and decrypt the read data using the public key pre-integrated in the OEM to obtain the second hash value of the decryption signature; The first hash value is compared with the second hash value of the decrypted signature, and the signature verification is confirmed to be successful if the first hash value and the second hash value are the same.

[0066] In one possible implementation, the apparatus further includes: The confirmation module is used to confirm the signature verification failure when the first hash value and the second hash value are different.

[0067] The vehicle software development and debugging device based on a USB adapter provided in this application embodiment responds to the following: when a pre-developed target USB adapter is inserted into a computer, the target USB adapter is identified through a preset development key tool, a corresponding key pair is generated through the development key tool, a new certificate is obtained through local signing, and the MCU is notified to write the key pair and certificate into the secure storage area of ​​the target USB adapter. When the target USB adapter is inserted into the vehicle's infotainment system, the built-in USB tool of the vehicle's infotainment system detects the target USB adapter and switches the vehicle's USB mode to ADB mode after verifying the key of the key pair. This application discloses an in-vehicle software development and debugging device based on a USB adapter. It generates a corresponding key pair using a development key tool and obtains a certificate through local signing. The MCU then writes the key pair and certificate to the secure storage area of ​​the target USB adapter. When the built-in USB tool in the vehicle's infotainment system detects the target USB adapter and verifies the key, it switches to USB mode. This achieves a plug-and-play ADB debugging channel that disconnects upon adapter removal, eliminating the need for a series of specific operations and password input. This simplifies operation, improves debugging efficiency, and avoids permission leaks caused by password disclosure. Furthermore, it allows for dynamic and rapid acquisition and release of ADB permissions, increasing the coverage of various scenarios and further improving debugging efficiency.

[0068] like Figure 4As shown in the embodiment of this application, an electronic device 400 includes a processor 401, a memory 402, and a bus. The memory 402 stores machine-readable instructions executable by the processor 401. When the electronic device is running, the processor 401 communicates with the memory 402 via the bus. The processor 401 executes the machine-readable instructions to perform the steps of the above-described vehicle software development and debugging method based on a USB adapter device.

[0069] Specifically, the memory 402 and processor 401 mentioned above can be general-purpose memory and processor, without any specific limitations. When the processor 401 runs the computer program stored in the memory 402, it can execute the above-mentioned vehicle software development and debugging method based on the USB adapter.

[0070] Corresponding to the above-described method for developing and debugging in-vehicle software based on a USB adapter, this application also provides a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the above-described method for developing and debugging in-vehicle software based on a USB adapter.

[0071] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.

[0072] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0073] In addition, 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.

[0074] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the 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 to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the deployment 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, ROM, RAM, magnetic disks, or optical disks.

[0075] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology 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 for developing and debugging in-vehicle software based on a USB adapter, characterized in that, The method includes: In response to inserting a pre-developed target USB adapter into a computer, the target USB adapter is identified using a pre-defined development key tool; wherein the target USB adapter has a built-in MCU and a secure storage area; the secure storage area can only be rewritten by the development key tool; After generating the corresponding key pair using the development key tool, performing local signing to obtain a new certificate, and notifying the MCU to write the key pair and the certificate into the secure storage area of ​​the target USB adapter; In response to the target USB adapter being inserted into the vehicle infotainment system, the built-in USB tool of the vehicle infotainment system detects the target USB adapter and switches the USB mode of the vehicle infotainment system to ADB mode after verifying the key of the key pair.

2. The method according to claim 1, characterized in that, The step of generating the corresponding key pair through the development key tool includes: The development key tool uses a preset elliptic curve algorithm to create the corresponding private key through a secure random number generator; The development key tool uses the elliptic curve algorithm to derive the corresponding public key from the private key and exports the public key for application in the OEM integration built into the vehicle's infotainment system.

3. The method according to claim 2, characterized in that, The step of notifying the MCU to write the key pair and the certificate to the secure storage area in the target USB adapter includes: The development key tool signs the data input through the target USB adapter using the private key, and sends a write key command to the target USB adapter through the USB-CDC interface; In response to the MCU in the target USB adapter verifying and unlocking the write key instruction based on a pre-agreed command, the secure storage area is erased and the certificate and the private key are written.

4. The method according to claim 3, characterized in that, The method further includes: The MCU sends a successful write command back to the development key tool; When the development key tool receives the successful write instruction, it displays the corresponding key rewrite completion indication and immediately invalidates the corresponding public key.

5. The method according to claim 3, characterized in that, The step of detecting the target USB adapter and switching the vehicle's USB mode to ADB mode after verifying the key includes: After the built-in USB tool in the vehicle uses the standard USB descriptor to determine that the device type of the inserted USB adapter is the target USB adapter, it establishes a serial communication connection with the target USB adapter through the USB-CDC interface. The USB tool reads data from the target USB adapter based on the specified address and performs signature verification based on the public key in the OEM. After the verification is passed, the vehicle's USB mode will be changed to ADB mode.

6. The method according to claim 5, characterized in that, The signature verification based on the public key in the OEM includes: Calculate the first hash value corresponding to the read data, and decrypt the read data using the public key pre-integrated in the OEM to obtain the second hash value of the decryption signature; The first hash value is compared with the second hash value of the decrypted signature, and the signature verification is confirmed to be successful when the first hash value and the second hash value are the same.

7. The method according to claim 6, characterized in that, The method further includes: If the first hash value and the second hash value are different, the signature verification is confirmed to have failed.

8. A vehicle-mounted software development and debugging device based on a USB adapter, characterized in that, The device includes: An identification module is used to identify the target USB adapter device by means of a preset development key tool in response to inserting a pre-developed target USB adapter device into a computer; wherein the target USB adapter device has a built-in MCU and a secure storage area; the secure storage area can only be rewritten by the development key tool; The signature module is used to generate a corresponding key pair through the development key tool, perform local signing to obtain a new certificate, and then notify the MCU to write the key pair and the certificate into the secure storage area of ​​the target USB adapter. A switching module is used to respond to the insertion of the target USB adapter into the vehicle infotainment system. The built-in USB tool of the vehicle infotainment system detects the target USB adapter and switches the USB mode of the vehicle infotainment system to ADB mode after verifying the key of the key pair.

9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the in-vehicle software development and debugging method based on a USB adapter as described in any one of claims 1 to 7 are performed.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the in-vehicle software development and debugging method based on a USB adapter as described in any one of claims 1 to 7.