Universal serial bus interface driving method, device, electronic device, storage medium and computer program product

By configuring a non-standard Type-C interface driver in the OTG device and using power and data signals for plug-in and unplug detection, the plug-in and unplugging problems of the non-standard USB Type-C interface are solved, and the normal use of USB functions is achieved in the absence of configuration channel signal lines, reducing iteration costs and the impact on the original driver architecture.

CN118819647BActive Publication Date: 2025-09-26SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410825621.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2025-09-26
Estimated Expiration
2044-06-24

AI Technical Summary

Technical Problem

Existing technologies cannot effectively identify and use non-standard USB Type-C interfaces, especially when the configuration channel signal line is missing, resulting in plug-in detection failure, inability to use USB functions normally, and requiring special hardware design and high iteration costs.

Method used

By configuring a non-standard Type-C interface driver in the OTG device, the power signal and data signal are used to implement plug-in detection at the driver level, set the working mode, and perform information processing through the standard Type-C interface driver to achieve normal use of USB functions.

Benefits of technology

When the external USB device lacks the configuration channel signal line, plug-in detection can be implemented at the driver level, and the USB function can be used normally, avoiding special hardware design and low iteration cost, and maintaining the integrity of the original driver architecture and functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819647B_ABST
    Figure CN118819647B_ABST
Patent Text Reader

Abstract

The present application relates to a driving method, device, electronic device, storage medium and computer program product for a universal serial bus interface. The driving method of the universal serial bus interface is applied to an OTG device, and the OTG device includes a first USB Type-C interface. The method includes: when the OTG device is connected to an external USB device, the working mode of the OTG device is set according to the enable state of the power signal, the power signal and the configuration signal through a non-standard Type-C interface driver; when the second USB Type-C interface of the external USB device is a standard USB Type-C interface, there is a configuration signal, and when it is a non-standard USB Type-C interface, there is no configuration signal; the OTG device attempts to establish a connection with the external USB device at the connection layer; the non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device based on the data signal. The technical solution of the present application can enable the OTG device to implement plug-in detection at the driver level when the external USB device lacks a configuration channel signal line, thereby using the USB function normally.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic technology, and in particular to a driving method, device, electronic equipment, storage medium and computer program product of a universal serial bus interface. Background Art

[0002] With the continuous evolution of the USB (Universal Serial Bus) protocol and the technological advancements of the information age, the USB Type-C interface has gradually become mainstream due to its high bandwidth and reversible plug-in support. Type-C is now gradually replacing the original Type-A / B interfaces in both the consumer and industrial sectors. The European Parliament has even passed a bill to standardize the interfaces of all electronic devices to Type-C starting in 2024. However, the existing Type-A / B interfaces have a large market share. To adapt to the Type-C interface, many manufacturers have implemented non-standard Type-C interfaces based on their existing software and hardware designs. These interfaces only connect the data line, VBUS (power signal line), and GND (ground line), eliminating the CC (configuration channel signal line) and plug detection. Alternatively, they have simply used non-standard Type-A / B to Type-C cables available on the market. Summary of the Invention

[0003] The purpose of this application is to provide a driving method, device, electronic device, storage medium and computer program product for a universal serial bus interface, which can enable the OTG device to implement plug-in detection at the driver level when the external USB device lacks the configuration channel signal line, thereby allowing the USB function to be used normally.

[0004] According to a first aspect of an embodiment of the present application, a method for driving a universal serial bus interface is provided, which is applied to an OTG device, wherein the OTG device includes a first universal serial bus USB Type-C interface and a non-standard Type-C interface driver is configured in the OTG device; the method comprising:

[0005] When the OTG device is connected to an external USB device, the non-standard Type-C interface driver sets the operating mode of the OTG device according to the enable state of the power signal, the power signal, and the configuration signal; wherein the external USB device includes a second USB Type-C interface, the second USB Type-C interface is connected to the first USB Type-C interface, and when the second USB Type-C interface is a standard USB Type-C interface, the configuration signal is present, and when the second USB Type-C interface is a non-standard USB Type-C interface, the configuration signal is not present;

[0006] After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer;

[0007] The non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device according to a data signal; the data signal is used to query a connection status indicator bit in a specified first register.

[0008] In one embodiment, the OTG device is further configured with a standard Type-C interface driver and a USB driver; after the non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device according to the data signal, the non-standard Type-C interface driver further includes:

[0009] When the connection state is connected, determining that the second USB Type-C interface is a non-standard USB Type-C interface, and determining an operating mode of the external USB device;

[0010] The non-standard Type-C interface driver converts the connection state into a first state signal, and outputs the power signal and the first state signal to the standard Type-C interface driver; the first state signal indicates that the configuration channel signal line is connected;

[0011] The standard Type-C interface driver performs information processing according to the power signal and the first status signal in accordance with the USB communication connection establishment process to obtain a first processing result, and sends the first processing result to the USB driver; wherein, the first processing result indicates that the OTG device and the external USB device are connected.

[0012] In one embodiment, the non-standard Type-C interface driver sets the operating mode of the OTG device according to the enable state of the power signal, the power signal, and the configuration signal, including:

[0013] The non-standard Type-C interface driver determines whether the power signal is enabled according to an enable state of the power signal;

[0014] After determining that the power signal is not enabled, the operating mode of the OTG device is set according to the power signal and the configuration signal.

[0015] In one embodiment, after determining that the power signal is not enabled, setting the operating mode of the OTG device according to the power signal and the configuration signal includes:

[0016] After determining that the power signal is not enabled, after determining that a high-level interrupt signal is received according to the power signal, and after determining that a configuration channel interrupt signal is not received according to the configuration signal, setting the working mode of the OTG device to a slave mode.

[0017] In one embodiment, the method further comprises:

[0018] After determining that the power signal is not enabled, after determining that the high-level interrupt signal is received according to the power signal, and after determining that the configuration channel interrupt signal is received according to the configuration signal, outputting the power signal and the configuration signal to the standard Type-C interface driver;

[0019] The standard Type-C interface driver performs information processing according to the power signal and the configuration signal in accordance with the USB communication connection establishment process to obtain a second processing result, and sends the second processing result to the USB driver; wherein the second processing result indicates that the OTG device and the external USB device are connected.

[0020] In one embodiment, after setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer, including:

[0021] After setting the working mode of the OTG device, setting the configuration parameters of the USB controller to the first configuration parameters;

[0022] Based on the first configuration parameter, the OTG device attempts to establish a connection with the external USB device at a connection layer through the USB controller.

[0023] In one embodiment, when the connection state is connected, determining that the second USB Type-C interface is a non-standard USB Type-C interface and determining the operating mode of the external USB device include:

[0024] When the connection state is connected, it is determined that the second USB Type-C interface is a non-standard USB Type-C interface, and the operating mode of the external USB device is determined to be a host mode.

[0025] In one embodiment, the method further comprises:

[0026] When the connection state is unconnected, transmitting the power signal to the standard Type-C interface driver;

[0027] The standard Type-C interface driver performs information processing according to the power signal in accordance with the USB communication connection establishment process to obtain a third processing result, and sends the third processing result to the USB driver; wherein, the third processing result indicates that the OTG device is not connected to the external USB device.

[0028] In one embodiment, the non-standard Type-C interface driver converts the connection state into a first state signal, and outputs the power signal and the first state signal to the standard Type-C interface driver, including:

[0029] The non-standard Type-C interface driver converts the connection state into the first state signal;

[0030] Set the configuration parameters of the USB controller to the second configuration parameters;

[0031] The power signal and the first status signal are output to the standard Type-C interface driver; wherein, the USB controller enables the standard Type-C interface driver to perform information processing according to the USB communication connection establishment process based on the second configuration parameter.

[0032] In one embodiment, the standard Type-C interface driver performs information processing according to the power signal and the first status signal according to the USB communication connection establishment process to obtain a first processing result, and sends the first processing result to the USB driver, further comprising:

[0033] After determining that the low-level interrupt signal is received according to the power signal, determining that the external USB device has been unplugged, and generating a second status signal; wherein the second status signal indicates that the configuration channel signal line is disconnected;

[0034] Passing the second status signal and the power signal to the standard Type-C interface driver;

[0035] The standard Type-C interface driver performs information processing according to the second status signal and the power signal in accordance with the USB communication connection establishment process to obtain a fourth processing result, and sends the fourth processing result to the USB driver; wherein the fourth processing result indicates that the external USB device has been unplugged;

[0036] Restore the enabled state of the power signal.

[0037] In one embodiment, when the enable state of the power signal is enabled, the power signal is a periodic square wave signal, each cycle of the power signal includes a first level signal and a second level signal, the first level value of the first level signal is less than the second level value of the second level signal, the first level value is zero, and the second level signal is used to power the external USB device.

[0038] In one embodiment, the non-standard Type-C interface driver sets the operating mode of the OTG device according to the enable state of the power signal, the power signal, and the configuration signal, further comprising:

[0039] After determining that the power signal is enabled, the operating mode of the OTG device is set to a host mode.

[0040] In one embodiment, after setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer, including:

[0041] After setting the working mode of the OTG device, setting the configuration parameters of the USB controller to the first configuration parameters;

[0042] Based on the first configuration parameter, the OTG device attempts to establish a connection with the external USB device at a connection layer through the USB controller.

[0043] In one embodiment, when the connection state is connected, determining that the second USB Type-C interface is a non-standard USB Type-C interface and determining the operating mode of the external USB device include:

[0044] When the connection state is connected, it is determined that the second USB Type-C interface is a non-standard USB Type-C interface, and the operating mode of the external USB device is determined to be a slave device mode.

[0045] In one embodiment, the non-standard Type-C interface driver converts the connection state into a first state signal, and outputs the power signal and the first state signal to the standard Type-C interface driver, including:

[0046] The non-standard Type-C interface driver converts the connection state into the first state signal;

[0047] Set the configuration parameters of the USB controller to the second configuration parameters;

[0048] The power signal and the first status signal are output to the standard Type-C interface driver; wherein, the USB controller enables the standard Type-C interface driver to perform information processing according to the USB communication connection establishment process based on the second configuration parameter.

[0049] In one embodiment, the standard Type-C interface driver performs information processing according to the power signal and the first status signal according to the USB communication connection establishment process to obtain a first processing result, and sends the first processing result to the USB driver, further comprising:

[0050] Polling the connection status indication bit in the first register to determine the connection status;

[0051] When the connection state is disconnected, determining that the external USB device has been unplugged, and generating a second state signal; wherein the second state signal indicates that the configuration channel signal line has been disconnected;

[0052] Passing the second status signal and the power signal to the standard Type-C interface driver;

[0053] The standard Type-C interface driver performs information processing according to the second status signal and the power signal in accordance with the USB communication connection establishment process to obtain a fifth processing result, and sends the fifth processing result to the USB driver; wherein the fifth processing result indicates that the external USB device has been unplugged;

[0054] Restore the enabled state of the power signal.

[0055] In one embodiment, the first USB Type-C interface includes a first power signal line, a first configuration channel signal line, and a first data signal line;

[0056] The second USB Type-C interface includes a second power signal line and a second data signal line;

[0057] The second power signal line is connected to the first power signal line, and the power signal is a signal on the first power signal line and the second power signal line;

[0058] The first data signal line is connected to the second data signal line, and the data signal is a signal on the first data signal line and the second data signal line;

[0059] When the second USB Type-C interface is a standard USB Type-C interface, the second USB Type-C interface further includes a second configuration channel signal line, the first configuration channel signal line is connected to the second configuration channel signal line, and the configuration signal is a signal on the first configuration channel signal line and the second configuration channel signal line;

[0060] When the second USB Type-C interface is a non-standard USB Type-C interface, the second configuration channel signal line is missing from the second USB Type-C interface, and the configuration signal does not exist on the first configuration channel signal line.

[0061] According to a second aspect of an embodiment of the present application, a driver for a universal serial bus interface is provided, which is applied to an OTG device, wherein the OTG device includes a first universal serial bus USB Type-C interface; the OTG device is configured with a non-standard Type-C interface driver; the device includes:

[0062] a setting module configured to set an operating mode of the OTG device according to an enable state of a power signal, the power signal, and a configuration signal through the non-standard Type-C interface driver when the OTG device is connected to an external USB device; wherein the external USB device includes a second USB Type-C interface, the second USB Type-C interface is connected to the first USB Type-C interface, the configuration signal is present when the second USB Type-C interface is a standard USB Type-C interface, and the configuration signal is not present when the second USB Type-C interface is a non-standard USB Type-C interface;

[0063] a connection module configured to, after setting the working mode of the OTG device, enable the OTG device to attempt to establish a connection with the external USB device at a connection layer;

[0064] The first determination module is configured to determine the connection status between the OTG device and the external USB device according to a data signal through the non-standard Type-C interface driver; the data signal is used to query the connection status indicator bit in the specified first register.

[0065] In one embodiment, the device further comprises:

[0066] a second determining module configured to, when the connection state is connected, determine that the second USB Type-C interface is a non-standard USB Type-C interface, and determine an operating mode of the external USB device;

[0067] a conversion module configured to convert the connection state into a first state signal through the non-standard Type-C interface driver, and output the power signal and the first state signal to the standard Type-C interface driver; the first state signal indicates that the configuration channel signal line is connected;

[0068] The information processing module is configured to perform information processing according to the USB communication connection establishment process based on the power signal and the first status signal through the standard Type-C interface driver, obtain a first processing result, and send the first processing result to the USB driver; wherein the first processing result indicates that the OTG device and the external USB device are connected.

[0069] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store a computer program executable by the processor; and the processor is used to execute the computer program in the memory to implement the above method.

[0070] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the executable computer program in the storage medium is executed by a processor, the above method can be implemented.

[0071] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising a computer program, which implements the above method when executed by a processor.

[0072] Compared with the prior art, the beneficial effects of the present application are as follows: the OTG device includes a first USB Type-C interface, the first USB Type-C interface is a standard USB Type-C interface, the OTG device is configured with a non-standard Type-C interface driver, and when the OTG device is connected to an external USB device, the non-standard Type-C interface driver sets the working mode of the OTG device according to the enable state of the power signal, the power signal, and the configuration signal. Wherein, the external USB device includes a second USB Type-C interface, the second USB Type-C interface is connected to the first USB Type-C interface, when the second USB Type-C interface is a standard USB Type-C interface, there is a configuration signal, and when the second USB Type-C interface is a non-standard USB Type-C interface, there is no configuration signal. After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer, and the non-standard Type-C interface driver performs plug-in detection based on the data signal to determine the connection status of the OTG device and the external USB device. Wherein, the data signal is used to query the connection status indicator bit in the specified first register. Therefore, when an external USB device lacks a configuration channel signal line, the OTG device can use data signals to implement plug-in detection at the driver level instead of using configuration signals to perform plug-in detection, thereby allowing the USB function to function normally. In summary, the technical solution of the present application can enable the OTG device to implement plug-in detection at the driver level when an external USB device lacks a configuration channel signal line, thereby allowing the USB function to function normally. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 This is a structural diagram of a USB type-C interface according to related art.

[0074] Figure 2 This is a schematic diagram of a driver for a type-C interface according to related art.

[0075] Figure 3 The figure is a flowchart showing a method for driving a universal serial bus interface according to an exemplary embodiment.

[0076] Figure 4 The present invention is a schematic diagram of a driver for a Type-C interface according to an exemplary embodiment.

[0077] Figure 5 The figure is a flowchart showing a method for driving a universal serial bus interface according to another exemplary embodiment.

[0078] Figure 6 The figure is a flowchart showing a method for driving a universal serial bus interface according to another exemplary embodiment.

[0079] Figure 7 is a schematic diagram showing a power supply signal according to an exemplary embodiment.

[0080] Figure 8 The figure is a flowchart showing a method for driving a universal serial bus interface according to another exemplary embodiment.

[0081] Figure 9 The figure is a flowchart showing a method for driving a universal serial bus interface according to another exemplary embodiment.

[0082] Figure 10 The figure is a flowchart showing a method for driving a universal serial bus interface according to another exemplary embodiment.

[0083] Figure 11 The figure is a flowchart showing a method for driving a universal serial bus interface according to another exemplary embodiment.

[0084] Figure 12 The figure is a flowchart showing a method for driving a universal serial bus interface according to another exemplary embodiment.

[0085] Figure 13 The figure is a block diagram showing a driving device of a universal serial bus interface according to an exemplary embodiment.

[0086] Figure 14 is a block diagram showing a driving device for a universal serial bus interface according to another exemplary embodiment.

[0087] Figure 15 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0088] Unless otherwise defined, the technical or scientific terms used in this specification and claims shall have the ordinary meanings understood by persons having ordinary skills in the technical field to which the invention belongs. Specific embodiments of the present invention will be described below in conjunction with the accompanying drawings. It should be noted that in the specific description of these embodiments, for the sake of clarity and clarity, this specification cannot provide a detailed description of all features of the actual embodiments. Without departing from the spirit and scope of the present invention, those skilled in the art may modify and replace the embodiments of the present invention, and the resulting embodiments are also within the scope of protection of the present invention.

[0089] Explanation of terms:

[0090] USB: Universal Serial Bus, universal serial bus;

[0091] USB Host: USB host device;

[0092] USB peripheral: USB slave device;

[0093] Host Mode: Host mode;

[0094] Peripheral Mode: slave mode;

[0095] OTG: on-the-go, OTG devices can be connected to USB peripherals as a USB host, or as USB peripherals to other USB hosts;

[0096] DP: D+, data signal line +;

[0097] DM: D-, data signal line-;

[0098] CC: configuration channel signal line;

[0099] SBU: Sideband use, auxiliary signal line;

[0100] ID: Device working mode identification signal line;

[0101] vbus: power signal;

[0102] cc: configuration signal;

[0103] TX: transmit data signal line;

[0104] RX: Receive data signal line.

[0105] In the related art, although many devices or data cables are USB type-C interfaces, they only lead the USB data signal lines (DP and DM, or TX and RX), VBUS and GND to the type-C interface, and do not implement the plug-in identification function of the type-C interface, that is, the CC function on the type-C interface is missing, such as Figure 1 The two configuration channel signal lines CC1 and CC2 are not connected. For such non-standard Type-C interface devices, the existing Type-C interface CC detection solution cannot identify plugging and unplugging, and thus cannot be used normally.

[0106] in, Figure 1The figure shows a USB Type-C interface in related art. The interface includes 24 pins A1-A12 and B1-B12. Twelve pins A1-A12 are distributed on the first side A of the interface, and 12 pins B1-B12 are distributed on the second side B of the interface. The names of the signal lines connected to the 24 pins A1-A12 and B1-B12 are shown in Table 1 below.

[0107] Table 1

[0108]

[0109]

[0110] In addition, it is agreed in this article that the signal line names are represented by uppercase English letters, and the signals transmitted on the signal lines are represented by corresponding lowercase English letters. For example, the power signal line is represented by uppercase English letters "VBUS", and the power signal transmitted on the power signal line is represented by lowercase English letters "vbus".

[0111] The mainstream operating systems in related technologies, such as Android, directly use the driver of the type-C interface to manage the interface, such as Figure 2 shown. Figure 2 In the example, conn is the control signal used to establish a connection. This solution directly transmits the external VBUS and the signals vbus and cc on CC to the driver of the type-C interface, and then determines whether the device is plugged in or unplugged in the driver of the type-C interface. After processing the interface, it is reported to the USB driver. Under this general solution, if the non-standard signal line does not implement the CC part, only the signal vbus on VBUS is transmitted to the driver of the type-C interface. Under this condition, the general driver of the type-C interface cannot determine whether there is plugging or unplugging, and thus cannot implement subsequent functions. To address this phenomenon, the general solution on the market is to change the logic of the driver of the type-C interface, so that the USB always works in Host Mode and keeps trying to connect to the downstream interface. Or a special hardware design is used to design the SBU as an ID for identifying the device working mode, and to identify plugging and unplugging through the OTG solution.

[0112] The inventors of this application discovered that the solutions in the related art lacked the ability to proactively identify non-standard scenarios and required specialized hardware design, resulting in high iteration costs. Furthermore, they always operated in Host Mode, making it impossible to switch to OTG or achieve low power consumption, significantly impacting the original driver architecture, functionality, and performance.

[0113] In order to solve the above technical problems, the present application proposes a driving method, device, electronic device, storage medium and computer program product of a universal serial bus interface, which can enable the OTG device to implement plug-in detection at the driver level when the external USB device lacks the configuration channel signal line, thereby using the USB function normally, without the need for special hardware design, and with low iteration cost. Moreover, OTG switching can be realized, low power consumption can also be achieved, and the original driver architecture, function and performance have little impact.

[0114] An embodiment of the present application provides a method for driving a universal serial bus interface. The method for driving a universal serial bus interface is applied to an OTG device. The OTG device includes a first USB Type-C interface, which is a standard USB Type-C interface and includes a first power signal line and a first configuration channel signal line. The OTG device is configured with a non-standard Type-C interface driver. Figure 3 The driving method of the universal serial bus interface may include the following steps 301 to 303:

[0115] Step 301: When the OTG device is connected to an external USB device, the non-standard Type-C interface driver sets the working mode of the OTG device according to the enable state of the power signal, the power signal, and the configuration signal.

[0116] In this embodiment, the external USB device includes a second USB Type-C interface. When the OTG device is connected to the external USB device, the first USB Type-C interface is connected to the second USB Type-C interface. The second USB Type-C interface includes a second power signal line, the second power signal line is connected to the first power signal line, and the power signal is the signal between the first power signal line and the second power signal line. When the second USB Type-C interface is a standard USB Type-C interface, the second USB Type-C interface also includes a second configuration channel signal line, the first configuration channel signal line is connected to the second configuration channel signal line, and the configuration signal is the signal between the first configuration channel signal line and the second configuration channel signal line. When the second USB Type-C interface is a non-standard USB Type-C interface, the second configuration channel signal line is missing in the second USB Type-C interface, and the configuration signal does not exist on the first configuration channel signal line.

[0117] In this embodiment, the enable state of the power signal includes enabled and disabled. For example, when the enable state of the power signal is enabled, the operating mode of the OTG device can be set to the host mode. When the enable state of the power signal is disabled, whether to set the operating mode of the OTG device to the slave mode can be determined based on the power signal and the configuration signal.

[0118] Step 302: After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer.

[0119] In this embodiment, the OTG device attempts to establish a connection with the external USB device at the connection layer through the USB controller.

[0120] Step 303: The non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device according to the data signal.

[0121] In this embodiment, the first USB Type-C interface also includes a first data signal line, and the second USB Type-C interface also includes a second data signal line. The first data signal line is connected to the second data signal line. The data signal is a signal on the first data signal line and the second data signal line, which is used to query the connection status indication bit in the specified first register.

[0122] When both the first and second USB Type-C interfaces are USB 2.0 interfaces, the first and second data signal lines include DP and DM, respectively. When both the first and second USB Type-C interfaces are USB 3.0 interfaces, the first and second data signal lines include TX and RX, respectively.

[0123] In this embodiment, the designated first register is a register corresponding to the USB controller, and is used to store a connection status indicator bit. For example, when the connection status indicator bit is 0, it indicates that the connection status between the OTG device and the external USB device is disconnected, and when the connection status indicator bit is 1, it indicates that the connection status between the OTG device and the external USB device is connected.

[0124] In this embodiment, an OTG device includes a first USB Type-C interface, which is a standard USB Type-C interface and includes a first power signal line and a first configuration channel signal line. The OTG device is configured with a non-standard Type-C interface driver. When the OTG device is connected to an external USB device, the non-standard Type-C interface driver sets the operating mode of the OTG device based on the enabled state of the power signal, the power signal, and the configuration signal. The external USB device includes a second USB Type-C interface, which includes a second power signal line, which is connected to the first power signal line, and the power signal is a signal between the first power signal line and the second power signal line. When the second USB Type-C interface is a standard USB Type-C interface, the second USB Type-C interface also includes a second configuration channel signal line, which is connected to the second configuration channel signal line, and the configuration signal is a signal between the first configuration channel signal line and the second configuration channel signal line. When the second USB Type-C interface is a non-standard USB Type-C interface, the second configuration channel signal line is missing from the second USB Type-C interface, and the configuration signal is not present on the first configuration channel signal line. After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer, and the non-standard Type-C interface driver performs plug-in detection based on the data signal to determine the connection status between the OTG device and the external USB device. Among them, the first USB Type-C interface also includes a first data signal line, and the second USB Type-C interface also includes a second data signal line. The first data signal line is connected to the second data signal line, and the data signal is a signal on the first data signal line and the second data signal line, which is used to query the connection status indicator bit in the specified first register. Therefore, in this embodiment, when the external USB device lacks the configuration channel signal line, the OTG device can not use the power signal and the configuration signal for plug-in detection, but use the data signal to implement plug-in detection at the driver level to use the USB function normally. Therefore, the technical solution of the present application can enable the OTG device to implement plug-in detection at the driver level when the external USB device lacks the configuration channel signal line, so as to use the USB function normally.

[0125] Another embodiment of the present application also provides a method for driving a universal serial bus interface. Based on the above embodiment, in this embodiment, after the non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device based on the data signal, it also converts the connection status into an input signal for the standard Type-C interface driver and passes it to the standard Type-C interface driver, following the universal USB process.

[0126] In this example, see Figure 4 , the OTG device is also configured with a standard Type-C interface driver and a USB driver. The input signals of the non-standard Type-C interface driver are signals from the hardware (power signal line, configuration channel signal line, data signal line (DP and DM or TX and RX)): power signal vbus, configuration signal cc, data signal tx and rx or data signal dp and dm. The data signal dp is the signal on DP, and the data signal dm is the signal on DM. The data signal tx is the signal on TX, and the data signal rx is the signal on RX. The non-standard Type-C interface driver processes the signals based on the signals from the hardware, obtains the input signals that meet the input requirements of the standard Type-C interface driver, and outputs them to the standard Type-C interface driver, so that the standard Type-C interface driver and the USB driver can execute the general USB process. The solution architecture provided by this application can retain the original software architecture and functions to the greatest extent and reduce performance loss.

[0127] In this example, see Figure 5 The driving method of the universal serial bus interface may include the following steps 501 to 506:

[0128] Step 501: When the OTG device is connected to an external USB device, the non-standard Type-C interface driver sets the working mode of the OTG device according to the enable state of the power signal, the power signal, and the configuration signal.

[0129] In this embodiment, if Figure 6 As shown, step 501 may further include the following steps 601 to 603:

[0130] In step 601 , the non-standard Type-C interface driver determines whether the power signal is enabled according to the enable state of the power signal.

[0131] In this embodiment, the enable state of the power signal includes enabled and disabled. The enable state indication bit of the power signal is stored in a designated second register. The non-standard Type-C interface driver obtains the enable state of the power signal by querying the enable state indication bit in the second register and determines whether the power signal is enabled based on the enable state of the power signal.

[0132] In this embodiment, when the power signal is enabled, Figure 7As shown, the power signal vbus is a periodic square wave signal. Each period T of the power signal vbus includes a first level signal vbus1 and a second level signal vbus2. The first level value of the first level signal vbus1 is less than the second level value of the second level signal vbus2. The first level value is zero, and the second level signal is used to power an external USB device.

[0133] In this embodiment, a sufficient proportion of the second level signal vbus2 can be configured to enable the power signal vbus to power the external USB device in a period T. The proportion of the second level signal vbus2 can be determined according to specific circumstances, thereby minimizing power consumption.

[0134] Step 602: After determining that the power signal is not enabled, set the operating mode of the OTG device according to the power signal and the configuration signal.

[0135] In this embodiment, after determining that the power signal is not enabled, after determining that a high-level interrupt signal is received based on the power signal, and after determining that a configuration channel interrupt signal is not received based on the configuration signal, the operating mode of the OTG device is set to slave mode. That is, after determining that the power signal is not enabled, if a high-level interrupt signal of the power signal is received, but a configuration channel interrupt signal is not received, it is considered that a host device with a non-standard Type-C interface may be inserted, and therefore the operating mode of the OTG device is set to slave mode.

[0136] In this embodiment, after determining that the power signal is not enabled, after determining that a high-level interrupt signal has been received based on the power signal, and after determining that a configuration channel interrupt signal has been received based on the configuration signal, the power signal and the configuration signal are output to the standard Type-C interface driver. Specifically, after determining that the power signal is not enabled, if both a high-level interrupt signal for the power signal and a configuration channel interrupt signal are received, i.e., the configuration channel interrupt is reported normally, then the external USB device is deemed to have a standard Type-C interface, and the normal processing flow is then followed, i.e., the power signal and the configuration signal are output to the standard Type-C interface driver.

[0137] The standard Type-C interface driver performs information processing according to the power signal and the configuration signal in accordance with the general USB communication connection establishment process to obtain a second processing result, and sends the second processing result to the USB driver; wherein the second processing result indicates that the OTG device and the external USB device are connected.

[0138] Step 603: After determining that the power signal is enabled, set the working mode of the OTG device to the host mode.

[0139] In this embodiment, after determining that the power signal is enabled, the operating mode of the OTG device is actively set to the host mode.

[0140] Step 502: After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer.

[0141] In this embodiment, if Figure 8 As shown, step 502 may include the following steps 801 to 802:

[0142] Step 801: After setting the working mode of the OTG device, set the configuration parameters of the USB controller to first configuration parameters.

[0143] Step 802: Based on the first configuration parameter, the OTG device attempts to establish a connection with the external USB device at the connection layer through the USB controller.

[0144] In this embodiment, the USB controller's configuration parameters default to the second configuration parameters. Based on the second configuration parameters, the USB controller enables the standard Type-C interface driver to process information according to the general USB communication connection establishment process. Therefore, after setting the operating mode of the OTG device, the USB controller's configuration parameters are adjusted to the first configuration parameters. Based on the first configuration parameters, the OTG device attempts to establish a connection with the external USB device at the link layer through the USB controller.

[0145] In this embodiment, the USB connection is limited to the connection layer and does not involve tedious software processes such as subsequent enumeration. Therefore, the amount of code and time cost are very small, achieving the goal of minimizing the impact on original performance.

[0146] Step 503: The non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device according to the data signal.

[0147] Step 503 in this embodiment is similar to step 303 in the above embodiment and will not be described again here.

[0148] Step 504 : When the connection status is connected, determine that the second USB Type-C interface is a non-standard USB Type-C interface, and determine the operating mode of the external USB device.

[0149] In this embodiment, when the non-standard Type-C interface driver determines, based on the data signal, that the connection state between the OTG device and the external USB device is connected, the second USB Type-C interface is determined to be a non-standard USB Type-C interface, and the operating mode of the external USB device is determined. Specifically, when the operating mode of the OTG device is host mode, the operating mode of the external USB device is slave mode; and when the operating mode of the OTG device is slave mode, the operating mode of the external USB device is host mode.

[0150] Specifically, after determining that the power signal is not enabled, after determining that a high-level interrupt signal has been received based on the power signal, and after determining that a configuration channel interrupt signal has not been received based on the configuration signal, the operating mode of the OTG device is set to slave mode. The OTG device then attempts to establish a connection with the external USB device at the connection layer. The non-standard Type-C interface driver then determines the connection status between the OTG device and the external USB device based on the data signal. When the connection status is connected, the second USB Type-C interface is determined to be a non-standard USB Type-C interface, and the operating mode of the external USB device is determined to be host mode.

[0151] When the connection state between the OTG device and the external USB device at the connection layer is disconnected, the power signal is passed to the standard Type-C interface driver, and the standard Type-C interface driver processes information according to the power signal in accordance with the general USB communication connection establishment process to obtain a third processing result, and sends the third processing result to the USB driver; wherein the third processing result indicates that the OTG device and the external USB device are not connected.

[0152] After determining that the power signal is enabled, the OTG device's operating mode is proactively set to host mode. The OTG device then attempts to establish a connection with the external USB device at the connection layer. The non-standard Type-C interface driver then determines the connection status between the OTG device and the external USB device based on the data signal. If the connection status is connected, the second USB Type-C interface is determined to be a non-standard USB Type-C interface, and the operating mode of the external USB device is set to slave mode.

[0153] When the connection state between the OTG device and the external USB device at the connection layer is not connected, the judgment of this software process is terminated.

[0154] In step 505, the non-standard Type-C interface driver converts the connection status into a first status signal and outputs the power signal and the first status signal to the standard Type-C interface driver, wherein the first status signal indicates that the configuration channel signal line is connected.

[0155] In this embodiment, if Figure 4 As shown, the non-standard Type-C interface driver converts the connection state into a first state signal cc' and outputs the power signal and the first state signal cc' to the standard Type-C interface driver, wherein the first state signal cc' indicates that the corresponding configuration channel signal line is connected. The corresponding configuration channel signal line being connected means that the first configuration channel signal line of the first USB Type-C interface and the second configuration channel signal line of the second USB Type-C interface are connected.

[0156] In this embodiment, the first status signal cc' is not a signal from hardware (the first configuration channel signal line and the second configuration channel signal line), but is a signal generated based on the connection status that simulates the configuration signal on the configuration channel signal line. The purpose is to comply with the input signal standard of the standard Type-C interface driver without changing the original working logic of the standard Type-C interface driver.

[0157] In this embodiment, if Figure 9 As shown, step 505 may include the following steps 901 to 903:

[0158] Step 901: The non-standard Type-C interface driver converts the connection state into a first state signal.

[0159] Step 902: Set the configuration parameters of the USB controller to second configuration parameters.

[0160] Step 903: Output the power signal and the first status signal to the standard Type-C interface driver. The USB controller enables the standard Type-C interface driver to process information according to the USB communication connection establishment process based on the second configuration parameter.

[0161] In this embodiment, the non-standard Type-C interface driver first converts the connection state into a first state signal, and then sets the configuration parameters of the USB controller to the second configuration parameters. The USB controller, based on the second configuration parameters, enables the standard Type-C interface driver to perform information processing according to a common USB communication connection establishment process. The power signal and the first state signal are then output to the standard Type-C interface driver. Before outputting the power signal and the first state signal to the standard Type-C interface driver, the configuration parameters of the USB controller are first set to the second configuration parameters. This allows the standard Type-C interface driver to perform information processing according to the USB communication connection establishment process after receiving the power signal and the first state signal.

[0162] In step 506, the standard Type-C interface driver processes the power signal and the first status signal according to the USB communication connection establishment process to obtain a first processing result, and sends the first processing result to the USB driver. The first processing result indicates that the OTG device is connected to the external USB device.

[0163] In this embodiment, the standard Type-C interface driver performs information processing according to the power signal and the first status signal cc' in accordance with the general USB communication connection establishment process, obtains a first processing result, and sends the first processing result to the USB driver; wherein the first processing result indicates that the OTG device and the external USB device are connected.

[0164] In this embodiment, the signal from the hardware can be processed by the non-standard Type-C interface driver to obtain a standard input signal that conforms to the standard Type-C interface driver. The hardware conditions and the working logic of the original standard Type-C interface driver and the USB driver can be kept unchanged, thereby realizing the driver adaptation of the OTG device to the non-standard Type-C interface, and reducing the cost of the OTG device running the standard Type-C interface driver to be compatible with the host device and the slave device with the non-standard Type-C interface.

[0165] In this embodiment, after determining that the power signal is not enabled, after determining that a high-level interrupt signal is received according to the power signal, and determining that a configuration channel interrupt signal is not received according to the configuration signal, the working mode of the OTG device is set to slave mode. Then, the OTG device attempts to establish a connection with the external USB device at the connection layer. Then, the non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device based on the data signal. When the connection status is connected, it is determined that the second USB Type-C interface is a non-standard USB Type-C interface, and the working mode of the external USB device is determined to be host mode. Then, the non-standard Type-C interface driver converts the connection status into a first status signal, and outputs the power signal and the first status signal to the standard Type-C interface driver. Then, the standard Type-C interface driver performs information processing according to the USB communication connection establishment process based on the power signal and the first status signal, obtains a first processing result, and sends the first processing result to the USB driver. As Figure 10 As shown, after sending the first processing result to the USB driver, the following steps 1001 to 1004 may be further included:

[0166] Step 1001: After determining that a low-level interrupt signal has been received based on the power signal, determine that the external USB device has been unplugged and generate a second status signal, wherein the second status signal indicates that the configuration channel signal line has been disconnected.

[0167] Step 1002: transmit the second status signal and the power signal to a standard Type-C interface driver.

[0168] In step 1003, the standard Type-C interface driver processes the second status signal and the power signal according to the USB communication connection establishment process to obtain a fourth processing result, and sends the fourth processing result to the USB driver. The fourth processing result indicates that the external USB device has been unplugged.

[0169] Step 1004: Restore the enabled state of the power signal.

[0170] In this embodiment, if a low-level interrupt signal of the power signal is received, it is determined that the external USB device has been unplugged, and a second status signal is generated. The second status signal indicates that the configuration channel signal line is disconnected. The second status signal is not a signal from hardware (the configuration channel signal line), but is a signal generated in accordance with the input signal standards of the standard Type-C interface driver, used to indicate that the corresponding configuration channel signal line is disconnected. The second status signal and the power signal are then transmitted to the standard Type-C interface driver. The standard Type-C interface driver processes the second status signal and the power signal according to the general USB communication connection establishment process, obtains a fourth processing result, and sends the fourth processing result to the USB driver. The fourth processing result indicates that the external USB device has been unplugged. The power signal is then restored to its enabled state. If the power signal's enabled state is disabled by default, the power signal's enabled state is restored to disabled. If the power signal's enabled state is enabled by default, the power signal's enabled state is restored to enabled.

[0171] In this embodiment, after determining that the power signal is enabled, the working mode of the OTG device is actively set to the host mode. Then, the OTG device attempts to establish a connection with the external USB device at the connection layer. Then, the non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device based on the data signal. When the connection status is connected, the second USB Type-C interface is determined to be a non-standard USB Type-C interface, and the working mode of the external USB device is determined to be a slave mode. Then, the non-standard Type-C interface driver converts the connection status into a first status signal, and outputs the power signal and the first status signal to the standard Type-C interface driver. Then, the standard Type-C interface driver performs information processing according to the USB communication connection establishment process based on the power signal and the first status signal, obtains a first processing result, and sends the first processing result to the USB driver. As Figure 11 As shown, after sending the first processing result to the USB driver, the following steps 1101 to 1105 may be further included:

[0172] Step 1101: poll the connection status indicator bit in the first register to determine the connection status.

[0173] Step 1102: When the connection state is disconnected, determine that the external USB device has been unplugged and generate a second state signal, wherein the second state signal indicates that the configuration channel signal line has been disconnected.

[0174] Step 1103: transmit the second status signal and the power signal to the standard Type-C interface driver.

[0175] In step 1104, the standard Type-C interface driver processes the second status signal and the power signal according to the USB communication connection establishment process to obtain a fifth processing result, and sends the fifth processing result to the USB driver. The fifth processing result indicates that the external USB device has been unplugged.

[0176] Step 1105: Restore the enabled state of the power signal.

[0177] In this embodiment, during normal communication, the connection status is determined by polling the connection status indicator bit in the first register. If the connection status is disconnected, the external USB device is determined to be unplugged, and a second status signal is generated. The second status signal indicates that the configuration channel signal line is disconnected. The second status signal is not a signal from hardware (the configuration channel signal line), but is a signal generated to meet the input signal standards of the standard Type-C interface driver and is used to indicate that the corresponding configuration channel signal line is disconnected. The second status signal and the power signal are then transmitted to the standard Type-C interface driver. The standard Type-C interface driver processes the second status signal and the power signal according to the general USB communication connection establishment process, obtains a fifth processing result, and transmits the fifth processing result to the USB driver. The fifth processing result indicates that the external USB device is unplugged. The power signal is then restored to its enabled state. If the power signal's enabled state is disabled by default, the power signal's enabled state is restored to disabled. If the power signal's enabled state is enabled by default, the power signal's enabled state is restored to enabled.

[0178] Another exemplary embodiment of the present application also provides a method for driving a universal serial bus interface. Figure 12 As shown, in this embodiment, the driving method of the universal serial bus interface may include the following steps 1201 to 1220:

[0179] Step 1201: Determine whether the power signal is enabled. If not, proceed to step 1202; if so, proceed to step 1203.

[0180] In this step, the non-standard Type-C interface driver determines whether the power signal is enabled according to the enable state of the power signal. This step is similar to the above step 601 and will not be repeated here.

[0181] Step 1202: Determine whether a high-level interrupt signal is received. If yes, execute step 1204; if no, execute step 1201.

[0182] In this step, it is determined whether a high-level interrupt signal of the power signal is received.

[0183] Step 1204: Determine whether a configuration channel interrupt signal is received. If yes, execute step 1205; if no, execute step 1206.

[0184] In this step, it is determined whether a configuration channel interrupt signal is received according to the configuration signal.

[0185] Step 1205: Execute the USB general process.

[0186] In this step, the power signal and the configuration signal are passed to the standard Type-C interface driver, which processes the information according to the USB communication connection establishment process that is common to the power signal and the configuration signal.

[0187] That is, after determining that the power signal is not enabled, if a high-level interrupt signal of the power signal and a configuration channel interrupt signal are received, that is, the configuration channel interrupt is reported normally, it is considered that the external USB device has a standard Type-C interface, and then the normal processing flow is followed, that is, the power signal and configuration signal are output to the standard Type-C interface driver.

[0188] The standard Type-C interface driver performs information processing according to the power signal and the configuration signal in accordance with the general USB communication connection establishment process to obtain a second processing result, and sends the second processing result to the USB driver; wherein the second processing result indicates that the OTG device and the external USB device are connected.

[0189] Step 1206: Set the working mode of the OTG device to slave mode.

[0190] After determining that the power signal is not enabled, if a high-level interrupt signal of the power signal is received, but no configuration channel interrupt signal is received, it is considered that a host device with a non-standard Type-C interface may be inserted. Therefore, the working mode of the OTG device is set to slave mode.

[0191] Step 1207: The OTG device attempts to establish a connection with the external USB device at the connection layer.

[0192] In this step, the OTG device attempts to establish a connection with the external USB device at the connection layer.

[0193] This step is similar to the above-mentioned step 502 and will not be described again here.

[0194] Step 1208 , determine whether the OTG device is connected to the external USB device. If so, execute step 1209 ; if not, execute step 1205 .

[0195] In this step, the OTG device determines whether the OTG device is connected to the external USB device by querying the connection status indication bit in the first register corresponding to the USB controller.

[0196] This step is similar to the above-mentioned step 303 and will not be described again here.

[0197] Step 1209 : Determine whether the external USB device is a host device having a non-standard USB Type-C interface.

[0198] Step 1210: Output the power signal and the first status signal to a standard Type-C interface driver.

[0199] In this step, the non-standard Type-C interface driver converts the connection status into a first status signal and outputs the power signal and the first status signal to the standard Type-C interface driver. The standard Type-C interface driver then processes the power signal and the first status signal according to the USB communication connection establishment process, obtains a first processing result, and sends the first processing result to the USB driver.

[0200] Step 1211, determine whether a low-level interrupt signal is received.

[0201] In this step, it is determined whether a low-level interrupt signal of the power signal is received. If so, step 1212 is executed; if not, step 1211 is executed.

[0202] Step 1212: transmit the second status signal and the power signal to the standard Type-C interface driver.

[0203] Upon receiving a low-level interrupt signal for the power signal, the external USB device is deemed to have been unplugged, a second status signal is generated, and the second status signal and the power signal are transmitted to the standard Type-C interface driver. The standard Type-C interface driver processes the second status signal and the power signal according to the USB communication connection establishment process, obtains a fourth processing result, and transmits the fourth processing result to the USB driver. The fourth processing result indicates that the external USB device has been unplugged.

[0204] The above mainly introduces the software process when the power signal is not enabled. The following describes the software process when the power signal is enabled.

[0205] Step 1203: Set the working mode of the OTG device to host mode.

[0206] After determining that the power signal is enabled, the working mode of the OTG device is actively set to host mode.

[0207] Step 1213: The OTG device attempts to establish a connection with the external USB device at the connection layer.

[0208] In this step, the OTG device attempts to establish a connection with the external USB device at the connection layer.

[0209] This step is similar to the above-mentioned step 502 and will not be described again here.

[0210] Step 1214: Determine whether the OTG device is connected to the external USB device. If so, execute step 1215; if not, execute step 1219.

[0211] In this step, the OTG device determines whether the OTG device is connected to the external USB device by querying the connection status indicator bit in the first register corresponding to the USB controller. If so, step 1215 is executed. If not, the software process ends.

[0212] This step is similar to the above-mentioned step 303 and will not be described again here.

[0213] Step 1215 , determining that the external USB device is a slave device having a non-standard USB Type-C interface.

[0214] Step 1216: Output the power signal and the first status signal to the standard Type-C interface driver.

[0215] In this step, the non-standard Type-C interface driver converts the connection status into a first status signal and outputs the power signal and the first status signal to the standard Type-C interface driver. The standard Type-C interface driver then processes the power signal and the first status signal according to the USB communication connection establishment process, obtains a first processing result, and sends the first processing result to the USB driver.

[0216] Step 1217: Determine whether the OTG device is connected to the external USB device. If yes, execute step 1217; if not, execute step 1218.

[0217] In this scenario, during normal communication, the connection status indication bit in the first register is polled to determine whether the OTG device is connected to the external USB device.

[0218] Step 1218: transmit the second status signal and the power signal to the standard Type-C interface driver.

[0219] When the connection state is disconnected, it is determined that the external USB device has been unplugged, a second status signal is generated, and the second status signal and the power signal are transmitted to the standard Type-C interface driver. The second status signal indicates that the configuration channel signal line is disconnected. The standard Type-C interface driver processes the second status signal and the power signal according to a common USB communication connection establishment process to obtain a fifth processing result, and transmits the fifth processing result to the USB driver. The fifth processing result indicates that the external USB device has been unplugged.

[0220] Step 1219, end the process.

[0221] The above is the detailed solution in this application. Through this solution, the driver adaptation of the OTG device to the non-standard Type-C interface can be achieved through software post-installation without changing the hardware. With minimal performance loss, the OTG device running the universal Type-C driver (standard Type-C driver) can be compatible with the host / peripheral of the non-standard Type-C interface, greatly expanding the actual application scenarios and retaining the original driver architecture and low power consumption function.

[0222] The solution in this application can actively identify non-standard scenarios without the need for special hardware design; it can realize plug-in and unplug detection of non-standard Type-C interfaces in OTG mode; it is based on Type-C software post-installation, retaining the original driver architecture and low-power consumption function.

[0223] Figure 13 : This is a block diagram of a driver for a universal serial bus interface according to an exemplary embodiment. In this embodiment, the driver for a universal serial bus interface is applied to an OTG device, which includes a first universal serial bus USB Type-C interface and a non-standard Type-C interface driver configured in the OTG device; Figure 13 As shown, the device includes:

[0224] A setting module 131 is configured to set an operating mode of the OTG device according to an enable state of a power signal, the power signal, and a configuration signal through the non-standard Type-C interface driver when the OTG device is connected to an external USB device; wherein the external USB device includes a second USB Type-C interface, the second USB Type-C interface is connected to the first USB Type-C interface, the configuration signal is present when the second USB Type-C interface is a standard USB Type-C interface, and the configuration signal is not present when the second USB Type-C interface is a non-standard USB Type-C interface;

[0225] The connection module 132 is configured to, after setting the working mode of the OTG device, enable the OTG device to attempt to establish a connection with the external USB device at the connection layer;

[0226] The first determination module 133 is configured to determine the connection status between the OTG device and the external USB device according to a data signal through the non-standard Type-C interface driver; the data signal is used to query the connection status indicator bit in the specified first register.

[0227] In one embodiment, the first USB Type-C interface includes a first power signal line, a first configuration channel signal line, and a first data signal line; the second USB Type-C interface includes a second power signal line and a second data signal line; the second power signal line is connected to the first power signal line, and the power signal is the signal between the first power signal line and the second power signal line; the first data signal line is connected to the second data signal line, and the data signal is the signal between the first data signal line and the second data signal line; when the second USB Type-C interface is a standard USB Type-C interface, the second USB Type-C interface further includes a second configuration channel signal line, the first configuration channel signal line is connected to the second configuration channel signal line, and the configuration signal is the signal between the first configuration channel signal line and the second configuration channel signal line; when the second USB Type-C interface is a non-standard USB Type-C interface, the second configuration channel signal line is missing in the second USB Type-C interface, and the configuration signal does not exist on the first configuration channel signal line.

[0228] In one embodiment, Figure 14 As shown, the driving device of the universal serial bus interface further includes:

[0229] A second determining module 134 is configured to determine, when the connection state is connected, that the second USB Type-C interface is a non-standard USB Type-C interface, and determine an operating mode of the external USB device;

[0230] The conversion module 135 is configured to convert the connection state into a first state signal through the non-standard Type-C interface driver, and output the power signal and the first state signal to the standard Type-C interface driver; the first state signal indicates that the configuration channel signal line is connected;

[0231] The information processing module 136 is configured to perform information processing according to the USB communication connection establishment process based on the power signal and the first status signal through the standard Type-C interface driver, obtain a first processing result, and send the first processing result to the USB driver; wherein the first processing result indicates that the OTG device and the external USB device are connected.

[0232] An embodiment of the present application also proposes an electronic device, including a processor and a memory; the memory is used to store a computer program executable by the processor; the processor is used to execute the computer program in the memory to implement the driving method of the universal serial bus interface of any of the above embodiments.

[0233] The embodiments of the present application further provide a computer-readable storage medium, which, when the executable computer program in the storage medium is executed by a processor, can implement the driving method of the universal serial bus interface of any of the above embodiments.

[0234] An embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the driving method of the universal serial bus interface of any of the above embodiments.

[0235] Regarding the apparatus in the above embodiment, the specific manner in which the processor performs operations has been described in detail in the embodiment of the method, and will not be elaborated on here.

[0236] Figure 15 9 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 900 can be provided as a server. Figure 15 The device 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions executable by the processing component 922, such as an application. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute the instructions to perform the above-mentioned driving method for the universal serial bus interface.

[0237] The device 900 may also include a power supply component 926 configured to perform power management of the device 900, a wired or wireless network interface 950 configured to connect the device 900 to a network, and an input / output (I / O) interface 958. The device 900 may operate based on an operating system stored in the memory 932, such as Windows Server™, MacOS X™, Unix™, Linux™, FreeBSD™, or the like.

[0238] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 932 including instructions, which can be executed by the processing component 922 of the device 900 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0239] In the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The term "plurality" refers to two or more, unless otherwise clearly defined.

[0240] The above description of the embodiments is intended to facilitate understanding and application of the present application by those skilled in the art. It will be apparent that those skilled in the art can readily make various modifications to these embodiments and apply the general principles described herein to other embodiments without expending any creative effort. Therefore, the present application is not limited to the embodiments described herein, and improvements and modifications made by those skilled in the art based on the disclosure of this application without departing from the scope and spirit of this application are within the scope of this application.

Claims

1. A method for driving a universal serial bus interface, characterized in that: Applied to an OTG device, the OTG device includes a first universal serial bus USB Type-C interface, and the OTG device is configured with a non-standard Type-C interface driver; the method includes: When the OTG device is connected to an external USB device, the non-standard Type-C interface driver sets the operating mode of the OTG device according to the enable state of the power signal, the power signal, and the configuration signal; wherein the external USB device includes a second USB Type-C interface, the second USB Type-C interface is connected to the first universal serial bus USB Type-C interface, when the second USB Type-C interface is a standard USB Type-C interface, the configuration signal is present, and when the second USB Type-C interface is a non-standard USB Type-C interface, the configuration signal is not present; After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer; The non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device according to a data signal; the data signal is used to query a connection status indicator bit in a specified first register.

2. The method for driving a universal serial bus interface according to claim 1, wherein: The OTG device is further configured with a standard Type-C interface driver and a USB driver; after the non-standard Type-C interface driver determines the connection status between the OTG device and the external USB device according to the data signal, the non-standard Type-C interface driver further includes: When the connection state is connected, determining that the second USB Type-C interface is a non-standard USB Type-C interface, and determining an operating mode of the external USB device; The non-standard Type-C interface driver converts the connection state into a first state signal, and outputs the power signal and the first state signal to the standard Type-C interface driver; the first state signal indicates that the configuration channel signal line is connected; The standard Type-C interface driver performs information processing according to the power signal and the first status signal in accordance with the USB communication connection establishment process to obtain a first processing result, and sends the first processing result to the USB driver; wherein, the first processing result indicates that the OTG device and the external USB device are connected.

3. The method for driving a universal serial bus interface according to claim 2, wherein: The non-standard Type-C interface driver sets the working mode of the OTG device according to the enable state of the power signal, the power signal and the configuration signal, including: The non-standard Type-C interface driver determines whether the power signal is enabled according to an enable state of the power signal; After determining that the power signal is not enabled, the operating mode of the OTG device is set according to the power signal and the configuration signal.

4. The method for driving a universal serial bus interface according to claim 3, wherein: After determining that the power signal is not enabled, setting the operating mode of the OTG device according to the power signal and the configuration signal includes: After determining that the power signal is not enabled, after determining that a high-level interrupt signal is received according to the power signal, and after determining that a configuration channel interrupt signal is not received according to the configuration signal, setting the working mode of the OTG device to a slave mode.

5. The method for driving a universal serial bus interface according to claim 4, wherein: Also includes: After determining that the power signal is not enabled, after determining that the high-level interrupt signal is received according to the power signal, and after determining that the configuration channel interrupt signal is received according to the configuration signal, outputting the power signal and the configuration signal to the standard Type-C interface driver; The standard Type-C interface driver performs information processing according to the power signal and the configuration signal in accordance with the USB communication connection establishment process to obtain a second processing result, and sends the second processing result to the USB driver; wherein the second processing result indicates that the OTG device and the external USB device are connected.

6. The method for driving a universal serial bus interface according to claim 4, wherein: After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer, including: After setting the working mode of the OTG device, setting the configuration parameters of the USB controller to the first configuration parameters; Based on the first configuration parameter, the OTG device attempts to establish a connection with the external USB device at a connection layer through the USB controller.

7. The method for driving a universal serial bus interface according to claim 4, wherein: When the connection state is connected, determining that the second USB Type-C interface is a non-standard USB Type-C interface, and determining the operating mode of the external USB device, includes: When the connection state is connected, it is determined that the second USB Type-C interface is a non-standard USB Type-C interface, and the operating mode of the external USB device is determined to be a host mode.

8. The method for driving a universal serial bus interface according to claim 4, wherein: Also includes: When the connection state is unconnected, transmitting the power signal to the standard Type-C interface driver; The standard Type-C interface driver performs information processing according to the power signal in accordance with the USB communication connection establishment process to obtain a third processing result, and sends the third processing result to the USB driver; wherein, the third processing result indicates that the OTG device is not connected to the external USB device.

9. The method for driving a universal serial bus interface according to claim 7, wherein: The non-standard Type-C interface driver converts the connection state into a first state signal, and outputs the power signal and the first state signal to the standard Type-C interface driver, including: The non-standard Type-C interface driver converts the connection state into the first state signal; Set the configuration parameters of the USB controller to the second configuration parameters; The power signal and the first status signal are output to the standard Type-C interface driver; wherein, the USB controller enables the standard Type-C interface driver to perform information processing according to the USB communication connection establishment process based on the second configuration parameter.

10. The driving method of a universal serial bus interface according to claim 9, wherein: The standard Type-C interface driver performs information processing according to the power signal and the first status signal in accordance with the USB communication connection establishment process to obtain a first processing result, and sends the first processing result to the USB driver, further comprising: After determining that a low-level interrupt signal is received according to the power signal, determining that the external USB device has been unplugged, and generating a second status signal; wherein the second status signal indicates that the configuration channel signal line is disconnected; Passing the second status signal and the power signal to the standard Type-C interface driver; The standard Type-C interface driver performs information processing according to the second status signal and the power signal in accordance with the USB communication connection establishment process to obtain a fourth processing result, and sends the fourth processing result to the USB driver; wherein the fourth processing result indicates that the external USB device has been unplugged; Restore the enabled state of the power signal.

11. The method for driving a universal serial bus interface according to claim 1, wherein: When the enable state of the power signal is enabled, the power signal is a periodic square wave signal, each cycle of the power signal includes a first level signal and a second level signal, the first level value of the first level signal is less than the second level value of the second level signal, the first level value is zero, and the second level signal is used to power the external USB device.

12. The method for driving a universal serial bus interface according to claim 3, wherein: The non-standard Type-C interface driver sets the working mode of the OTG device according to the enable state of the power signal, the power signal and the configuration signal, and further includes: After determining that the power signal is enabled, the operating mode of the OTG device is set to a host mode.

13. The driving method of a universal serial bus interface according to claim 12, wherein: After setting the working mode of the OTG device, the OTG device attempts to establish a connection with the external USB device at the connection layer, including: After setting the working mode of the OTG device, setting the configuration parameters of the USB controller to the first configuration parameters; Based on the first configuration parameter, the OTG device attempts to establish a connection with the external USB device at a connection layer through the USB controller.

14. The method for driving a universal serial bus interface according to claim 13, wherein: When the connection state is connected, determining that the second USB Type-C interface is a non-standard USB Type-C interface, and determining the operating mode of the external USB device, includes: When the connection state is connected, it is determined that the second USB Type-C interface is a non-standard USB Type-C interface, and the operating mode of the external USB device is determined to be a slave device mode.

15. The method for driving a universal serial bus interface according to claim 14, wherein: The non-standard Type-C interface driver converts the connection state into a first state signal, and outputs the power signal and the first state signal to the standard Type-C interface driver, including: The non-standard Type-C interface driver converts the connection state into the first state signal; Set the configuration parameters of the USB controller to the second configuration parameters; The power signal and the first status signal are output to the standard Type-C interface driver; wherein, the USB controller enables the standard Type-C interface driver to perform information processing according to the USB communication connection establishment process based on the second configuration parameter.

16. The method for driving a universal serial bus interface according to claim 15, wherein: The standard Type-C interface driver performs information processing according to the power signal and the first status signal in accordance with the USB communication connection establishment process to obtain a first processing result, and sends the first processing result to the USB driver, further comprising: Polling the connection status indication bit in the first register to determine the connection status; When the connection state is disconnected, determining that the external USB device has been unplugged, and generating a second state signal; wherein the second state signal indicates that the configuration channel signal line has been disconnected; Passing the second status signal and the power signal to the standard Type-C interface driver; The standard Type-C interface driver performs information processing according to the second status signal and the power signal in accordance with the USB communication connection establishment process to obtain a fifth processing result, and sends the fifth processing result to the USB driver; wherein the fifth processing result indicates that the external USB device has been unplugged; Restore the enabled state of the power signal.

17. The method for driving a universal serial bus interface according to claim 1, wherein: The first USB Type-C interface includes a first power signal line, a first configuration channel signal line and a first data signal line; The second USB Type-C interface includes a second power signal line and a second data signal line; The second power signal line is connected to the first power signal line, and the power signal is a signal on the first power signal line and the second power signal line; The first data signal line is connected to the second data signal line, and the data signal is a signal on the first data signal line and the second data signal line; When the second USB Type-C interface is a standard USB Type-C interface, the second USB Type-C interface further includes a second configuration channel signal line, the first configuration channel signal line is connected to the second configuration channel signal line, and the configuration signal is a signal on the first configuration channel signal line and the second configuration channel signal line; When the second USB Type-C interface is a non-standard USB Type-C interface, the second configuration channel signal line is missing from the second USB Type-C interface, and the configuration signal does not exist on the first configuration channel signal line.

18. A driver for a universal serial bus interface, characterized in that: Applicable to an OTG device, the OTG device includes a first universal serial bus USB Type-C interface; the OTG device is configured with a non-standard Type-C interface driver; the apparatus includes: a setting module configured to set an operating mode of the OTG device according to an enable state of a power signal, the power signal, and a configuration signal through the non-standard Type-C interface driver when the OTG device is connected to an external USB device; wherein the external USB device includes a second USB Type-C interface, the second USB Type-C interface is connected to the first Universal Serial Bus USB Type-C interface, the configuration signal is present when the second USB Type-C interface is a standard USB Type-C interface, and the configuration signal is not present when the second USB Type-C interface is a non-standard USB Type-C interface; a connection module configured to, after setting the working mode of the OTG device, enable the OTG device to attempt to establish a connection with the external USB device at a connection layer; The first determination module is configured to determine the connection status between the OTG device and the external USB device according to a data signal through the non-standard Type-C interface driver; the data signal is used to query the connection status indicator bit in the specified first register.

19. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is used to store a computer program executable by the processor; and the processor is used to execute the computer program in the memory to implement the method according to any one of claims 1 to 17.

20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the executable computer program in the storage medium is executed by a processor, the method according to any one of claims 1 to 17 can be implemented.

21. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 17 is implemented.

Citation Information

Patent Citations

  • Data interaction method, charging base, equipment and medium

    CN115686184A

  • Method and apparatus for determining direction of power delivery

    US20150293514A1