Identification method and device for audio equipment based on USB interface, electronic equipment and storage medium

By implementing the host device request waiting and configuring the descriptor recognition module in a USB device, the problems of complexity and high cost of hardware recognition are solved, and the reliability of the recognition results and the stability of the normal operation of the equipment are improved.

CN119046212APending Publication Date: 2024-11-29SHENZHEN JIAYZ PHOTO IND LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411129304.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

When existing USB devices realize the judgment of connecting devices through hardware identification, the requirements for charging cables are high, the circuit is complex, the cost is high, and it may affect the normal operation of slave devices and host devices.

Method used

By implementing the host device request waiting module, charging device identification module and non-charging device identification module in the slave device, we wait for the host device to request it and establish a communication connection with the host device, and send a configuration descriptor to identify the host device type to avoid hardware circuit complexity and charging mode impact.

Benefits of technology

It reduces the cost of hardware circuit design, avoids the impact of the power consumption and charging mode of the host device on the device, and improves the reliability of the identification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046212A_ABST
    Figure CN119046212A_ABST
Patent Text Reader

Abstract

The invention discloses an identification method and device of audio equipment based on a USB interface, electronic equipment and a storage medium. The method is applied to slave equipment with a USB protocol, and comprises the following steps: waiting for a request of host equipment under the condition that the slave equipment is connected with the host equipment; identifying the host device as a charging device when the request of the host device is not waited; in the case of waiting for a request of the host device, a communication connection is established with the host device, the configuration descriptor is sent to the host device, and the non-charging device type to which the host device belongs is identified according to the configuration descriptor. According to the technical scheme, the design cost of a hardware circuit is reduced, the electric quantity of the host equipment is prevented from being consumed, the charging mode is prevented from influencing normal work of the slave equipment and the host equipment, and the reliability of an identification result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for identifying a USB interface audio device. Background Art

[0002] There are more and more electronic devices that are accessories for mobile phones, computers, etc., such as USB (Universal Serial Bus) microphones, USB fans, and USB night lights. Some of these USB devices have their own power supply and do not need power from mobile phones or computers when working, while some electronic devices need to obtain power from mobile phones or computers to work normally. When a USB device that does not need to obtain power from a mobile phone or computer is connected, the reverse charging function of the mobile phone or computer will cause the connected USB device to enter the charging mode, affecting the normal operation of the USB device.

[0003] When an existing USB device with power supply is connected to a mobile phone or computer, the USB device usually uses hardware recognition to distinguish whether it is a mobile phone, a computer or a charger, so that when it is connected to a mobile phone or a computer, the charging mode is turned off and it works normally, and when it is connected to a charger, it enters the charging mode. However, hardware recognition to determine the connected device has requirements for the charging cable, the circuit is also complex, and the cost is high. Summary of the invention

[0004] The present invention provides a method, device, electronic device and storage medium for identifying an audio device based on a USB interface, so as to reduce the design cost of the hardware circuit, avoid consuming the power of the host device, avoid the charging mode affecting the normal operation of the slave device and the host device, and improve the reliability of the identification result.

[0005] According to one aspect of the present invention, a method for identifying an audio device based on a USB interface is provided, the method being applied to a slave device having a USB protocol, the method comprising:

[0006] When the slave device is connected to the host device, waiting for a request from the host device;

[0007] Without waiting for a request from the host device, identifying the host device as a charging device;

[0008] When the host device requests, a communication connection is established with the host device, and a configuration descriptor is sent to the host device. According to the configuration descriptor, the type of non-charging device to which the host device belongs is identified.

[0009] According to another aspect of the present invention, there is provided a device for identifying an audio device based on a USB interface, the device being configured in a slave device having a USB protocol, the device comprising:

[0010] A host device request waiting module, used for waiting for a host device request when the slave device is connected to the host device;

[0011] A charging device identification module, used for identifying the host device as a charging device without waiting for a request from the host device;

[0012] The non-charging device identification module is used to establish a communication connection with the host device when the host device requests it, and send a configuration descriptor to the host device, and identify the type of non-charging device to which the host device belongs according to the configuration descriptor.

[0013] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the USB interface audio device identification method described in any embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for identifying an audio device based on a USB interface as described in any embodiment of the present invention when executed.

[0018] The technical solution of the embodiment of the present invention is applied to a slave device with a USB protocol. When the slave device is connected to a host device, it waits for a request from the host device; when the request from the host device is not received, it identifies the host device as a charging device; when the request from the host device is received, it establishes a communication connection with the host device and sends a configuration descriptor to the host device. According to the configuration descriptor, the type of non-charging device to which the host device belongs is identified. The technical means of sending the configuration descriptor through a communication connection between the slave device and the host device to identify the type of the host device solves the problem that the prior art USB device realizes the judgment of the connected device through hardware identification, has requirements for the charging cable, and has a complex circuit and a high cost. The design cost of the hardware circuit is reduced, the power consumption of the host device is avoided, and the charging mode is avoided to affect the normal operation of the slave device and the host device, thereby improving the reliability of the identification result.

[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A flowchart of a method for identifying a USB interface audio device provided in the first embodiment of the present invention;

[0022] Figure 2a A schematic diagram of the overall process of a method for identifying a USB interface audio device provided in this embodiment;

[0023] Figure 2b A detailed flow chart of a method for identifying a USB interface audio device is provided for this embodiment;

[0024] Figure 2c A structural schematic diagram of a USB interface audio device recognition system is provided for this embodiment;

[0025] Figure 3 A schematic diagram of the structure of a USB interface audio device recognition device provided in the second embodiment of the present invention;

[0026] Figure 4 The present invention is a schematic diagram of the structure of an electronic device that implements the method for identifying a USB interface audio device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] Embodiment 1

[0030] Figure 1 This is a flowchart of a method for identifying a USB interface audio device provided in the first embodiment of the present invention. This embodiment is applicable to the case of identifying a connected device of a slave device with a USB protocol. The method can be applied to a slave device with a USB protocol. The method can be executed by an identification device based on a USB interface audio device. The identification device based on a USB interface audio device can be implemented in the form of hardware and / or software. The identification device based on a USB interface audio device can be configured in a control unit of a slave device with a USB protocol. Figure 1 As shown, the method includes:

[0031] S110 . When the slave device is connected to the host device, wait for a request from the host device.

[0032] Among them, the slave device can refer to a device that receives information. It passively accepts the request from the host device and completes the corresponding task according to the request. The slave device is in a subordinate position during the communication process, responds to the request of the host device and performs corresponding operations. The slave device can be a microphone, headset, speaker, mixer, etc., including but not limited to wireless microphones, dynamic microphones, conference microphones, desktop microphones, conference treasures, head-mounted wireless headphones, in-ear headphones, portable mixers, digital mixers and other audio devices. The slave device can be various devices with USB protocol.

[0033] The host device can refer to the device that sends information. It has initiative and control rights, and can actively initiate requests and control slave devices to complete tasks. The host device is in a dominant position in the communication process, responsible for initiating communication requests, managing the communication process, and can actively control the slave devices to perform corresponding tasks. For example, in the computer field, the host device can be a computer; in the mobile phone field, the host device can be a mobile phone; in the fields of smart home and the Internet of Things, the host device can be responsible for connecting and managing other devices.

[0034] The host device request may refer to a control request of the host device to the slave device.

[0035] In this embodiment, the slave device is connected to the host device, and the slave device access device is detected to be powered on. The MCU (Micro Control Unit) of the slave device can initialize the hardware IO (Input / Output) port of the slave device to make it available, so that it can wait for the host device request.

[0036] S120: Without waiting for a request from the host device, identify the host device as a charging device.

[0037] In this embodiment, if the slave device does not wait for a request from the host device within a certain period of time, the host device may be identified as a charger.

[0038] Optionally, identifying the host device as a charging device without receiving a request from the host device may include: if no request from the host device is received within a first preset time period, setting the charging flag of the slave device to a first flag and continuing to wait for a request from the host device; if no request from the host device is received within a second preset time period, setting the charging flag to a second flag and identifying the host device as a charging device.

[0039] The first preset time period may be 0-1 seconds. The second preset time period may be 1-3 seconds. The charging mark may be a charging identifier on the slave device side. The first identifier may be used to indicate that the slave device preliminarily identifies the host device as a charging device. The second identifier may be used to indicate that the slave device identifies the host device as a charging device.

[0040] In this embodiment, if the slave device has not received a request from the host device after waiting for a first preset period of time, the charging flag of the slave device can be set to a first flag, and the connected host device can be preliminarily determined to be a charging device (for example, a charger), and continue to wait for the host device request. If the host device request is not received after waiting for a second preset period of time, the charging flag can be set to a second flag to identify the host device as a charging device.

[0041] Optionally, after the slave device identifies the host device as a charging device, charging management may be configured for the slave device so that charging starts at the charging port of the slave device.

[0042] In this embodiment, charging management may be configured for the slave device so that charging starts from the charging IO port of the slave device.

[0043] Optionally, when a request from the host device is received within the first preset time period or the second preset time period, an operation of establishing a communication connection with the host device when a request from the host device is received is triggered.

[0044] In this embodiment, if the slave device receives a request from the host device within the first preset period of time or the second preset period of time, operation S130 may be executed.

[0045] In this embodiment, the advantage of setting a waiting period (a first preset period and a second preset period) is that it can provide a buffer time for receiving host device requests, thereby avoiding missing host device requests due to communication delays and the like. The advantage of setting a shorter waiting period is that it can avoid spending a long time waiting for receiving host device requests, thereby saving waiting time and improving the efficiency of host device identification.

[0046] S130: When a request is received from the host device, a communication connection is established with the host device, and a configuration descriptor is sent to the host device. According to the configuration descriptor, the type of non-charging device to which the host device belongs is identified.

[0047] In this embodiment, if the slave device waits for a request from the host device within a certain period of time, it can establish a communication channel with the host device and send a configuration descriptor to the host device according to the needs of the host device to achieve device enumeration, thereby identifying the non-charging device type of the host device (such as a computer or mobile phone, etc.) based on the differences in the configuration descriptors sent to different host devices.

[0048] In an optional embodiment, establishing a communication connection with a host device may include: sending a device descriptor to the host device in response to a first acquisition request for the device descriptor sent by the host device; receiving a data confirmation packet fed back by the host device, and receiving address information assigned by the host device, wherein the data confirmation packet is fed back by the host device after determining that the data packet of the device descriptor is correct.

[0049] Among them, the device descriptor can be used to represent the overall information of the slave device, and may include information such as the USB specification version number, product ID (Identity document), vendor ID, device version number, etc. The information in the USB device descriptor is completely valid for the entire device, regardless of the configuration and the number of interfaces. The first acquisition request may refer to the acquisition request sent by the host device for the first time to the device descriptor of the slave device. The data confirmation packet may be, for example, an ACK (Acknowledgement) data packet or the like, which is used to confirm the receipt of a message. The address information may be the address for the slave device to communicate with the host device, and the address information may be unique address information, through which the host device can access the slave device.

[0050] In this embodiment, the host device can send a standard device descriptor request (i.e., the first acquisition request of the device descriptor) to the slave device. After receiving the request, the slave device can send the device descriptor to the host device according to the request parameters. The host device determines that there is no error in the device descriptor data packet and returns a data confirmation packet to the slave device. Then, the host device can reset the slave device, enter the address setting, and assign a unique address (i.e., address information) to the slave device, so that the host device can access the slave device through the unique address. That is, a communication channel can be established between the slave device and the host device.

[0051] In an optional implementation, sending a configuration descriptor to a host device and identifying the type of non-charging device to which the host device belongs based on the configuration descriptor may include: sending a device descriptor to the host device in response to a second acquisition request for the device descriptor sent by the host device; sending a configuration descriptor to the host device in response to a configuration descriptor acquisition request sent by the host device; sending a target configuration set to the host device in response to a configuration set acquisition request sent by the host device, the configuration set acquisition request being sent by the host device based on the total length of the configuration set in the configuration descriptor, the second acquisition request, the configuration descriptor acquisition request and the configuration set acquisition request being sent by the host device to the slave device via address information; identifying the type of non-charging device to which the host device belongs based on the target configuration set.

[0052] The second acquisition request may refer to an acquisition request sent again by the host device to the device descriptor of the slave device. The configuration descriptor may be used to describe the configuration information of the slave device, and may include the number of interfaces supported by the device, the alternate settings of the interfaces, the endpoint information, etc. The configuration descriptor may provide necessary information for the communication between the host device and the slave device, so that the host device can correctly identify and manage the slave device. The target configuration set may be a configuration set that matches the requirements of the host device, and the target configuration set may be a part of the configuration information of the slave device.

[0053] In this embodiment, the host device can obtain the device descriptor from the slave device again through the unique address information set for the slave device, and then obtain the configuration descriptor (the configuration descriptor is 9 bytes in total). After the host device obtains the configuration descriptor, it obtains the target configuration set from the slave device based on the total length of the configuration set in the configuration descriptor; the slave device can then distinguish the type of host device (computer or mobile phone, etc.) based on the data difference of the target configuration set corresponding to the configuration descriptor.

[0054] Optionally, after identifying the non-charging device type to which the host device belongs, the method may further include: setting the charging mark of the slave device to a third mark, and configuring charging management for the slave device to close the charging port of the slave device to stop charging.

[0055] The third identifier may be used to indicate that the host device is identified as a non-charging device.

[0056] In this embodiment, after identifying the non-charging device type to which the host device belongs, the charging mark can be set to the third mark, and the charging management can be configured to stop charging from the charging port of the device.

[0057] The technical solution of the embodiment of the present invention is applied to a slave device with a USB protocol. When the slave device is connected to a host device, it waits for a request from the host device; when the request from the host device is not received, it identifies the host device as a charging device; when the request from the host device is received, it establishes a communication connection with the host device and sends a configuration descriptor to the host device. According to the configuration descriptor, the type of non-charging device to which the host device belongs is identified. The technical means of sending the configuration descriptor through a communication connection between the slave device and the host device to identify the type of the host device solves the problem that the prior art USB device realizes the judgment of the connected device through hardware identification, has requirements for the charging cable, and has a complex circuit and a high cost. The design cost of the hardware circuit is reduced, the power consumption of the host device is avoided, and the charging mode is avoided to affect the normal operation of the slave device and the host device, thereby improving the reliability of the identification result.

[0058] In order to enable those skilled in the art to better understand the identification method of the USB interface audio device of this embodiment, Figure 2a The overall flow chart of a method for identifying a USB interface audio device provided in this embodiment is as follows: the slave device is connected to the host device to power on, the type of the connected host device is identified to determine whether to charge, charging is turned on if the host device is a charger, and charging is turned off if the host device is not an electrical appliance.

[0059] Figure 2b A detailed flow chart of a method for identifying a USB interface audio device is provided for this embodiment. The MCU of the slave device detects the access of the host device, initializes the IO port of the slave device, and performs device enumeration when the host device requests it, and sends a descriptor to the host device to determine whether the host device type is a charger or a non-charger, so as to perform charging management configuration.

[0060] Figure 2c The present embodiment provides a structural schematic diagram of a USB interface audio device recognition system, which may include an MCU control module, a USB connection module, a host device, and a charging management module, wherein the USB connection module is connected to the host device via a USB protocol.

[0061] Embodiment 2

[0062] Figure 3The structure diagram of a USB interface audio device recognition device provided in the second embodiment of the present invention. The device can be configured in a slave device with a USB protocol, such as Figure 3 As shown, the device includes: a host device request waiting module 310, a charging device identification module 320 and a non-charging device identification module 330. Among them:

[0063] A host device request waiting module 310, configured to wait for a host device request when the slave device is connected to the host device;

[0064] A charging device identification module 320, configured to identify the host device as a charging device without waiting for a request from the host device;

[0065] The non-charging device identification module 330 is used to establish a communication connection with the host device when the host device requests it, and send a configuration descriptor to the host device, and identify the type of non-charging device to which the host device belongs according to the configuration descriptor.

[0066] The technical solution of the embodiment of the present invention is applied to a slave device with a USB protocol. When the slave device is connected to a host device, it waits for a request from the host device; when the request from the host device is not received, it identifies the host device as a charging device; when the request from the host device is received, it establishes a communication connection with the host device and sends a configuration descriptor to the host device. According to the configuration descriptor, the type of non-charging device to which the host device belongs is identified. The technical means of sending the configuration descriptor through a communication connection between the slave device and the host device to identify the type of the host device solves the problem that the prior art USB device realizes the judgment of the connected device through hardware identification, has requirements for the charging cable, and has a complex circuit and a high cost. The design cost of the hardware circuit is reduced, the power consumption of the host device is avoided, and the charging mode is avoided to affect the normal operation of the slave device and the host device, thereby improving the reliability of the identification result.

[0067] Optionally, the charging device identification module 320 may specifically include:

[0068] A first identification unit, configured to set the charging flag of the slave device to a first flag and continue to wait for the request from the host device if no request from the host device is received within a first preset time period;

[0069] The second identification unit is used to set the charging mark to a second identification and identify the host device as a charging device if no request from the host device is received within a second preset time period.

[0070] Optionally, the USB interface audio device recognition device may further include an operation triggering module for:

[0071] When the host device requests the communication within the first preset period of time or the second preset period of time, an operation of establishing a communication connection with the host device when the host device requests the communication is triggered.

[0072] Optionally, the USB interface audio device identification device may further include a charging start module, which is used to: after identifying the host device as a charging device:

[0073] The charging management is configured for the slave device so that the charging port of the slave device starts charging.

[0074] Optionally, the non-charging device identification module 330 may be specifically used for:

[0075] In response to a first acquisition request for a device descriptor sent by the host device, sending a device descriptor to the host device;

[0076] The data confirmation packet fed back by the host device is received, and the address information assigned by the host device is received. The data confirmation packet is fed back by the host device after confirming that the data packet of the device descriptor is correct.

[0077] Optionally, the non-charging device identification module 330 may also be used for:

[0078] In response to a second acquisition request for a device descriptor sent by the host device, sending a device descriptor to the host device;

[0079] In response to a configuration descriptor acquisition request sent by the host device, sending a configuration descriptor to the host device;

[0080] In response to a configuration set acquisition request sent by the host device, sending a target configuration set to the host device, wherein the configuration set acquisition request is sent by the host device according to the total length of the configuration set in the configuration descriptor, and the second acquisition request, the configuration descriptor acquisition request and the configuration set acquisition request are all sent by the host device to the slave device through the address information;

[0081] According to the target configuration set, the non-charging device type to which the host device belongs is identified.

[0082] Optionally, the USB interface audio device identification device may further include a charging stop module, which is used to: after identifying the non-charging device type to which the host device belongs:

[0083] The charging mark of the slave device is set to a third mark, and charging management is configured for the slave device so that the charging port of the slave device is closed to stop charging.

[0084] The USB interface audio device identification device provided in the embodiment of the present invention can execute the USB interface audio device identification method provided in any embodiment of the present invention and applied to a slave device with a USB protocol, and has the corresponding functional modules and beneficial effects of the execution method.

[0085] Embodiment 3

[0086] Figure 4 A schematic diagram of an electronic device 400 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers or various forms of mobile devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0087] like Figure 4 As shown, the electronic device 400 includes at least one processor 401, and a memory connected to the at least one processor 401 in communication, such as a read-only memory (ROM) 402, a random access memory (RAM) 403, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 401 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 402 or the computer program loaded from the storage unit 408 to the random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0088] Multiple components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0089] The processor 401 may be a variety of general and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 401 performs the various methods and processes described above, such as a method for identifying a USB interface audio device based on a slave device having a USB protocol.

[0090] In some embodiments, the identification method of the USB interface audio device based on the slave device with the USB protocol can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the processor 401, one or more steps of the identification method of the USB interface audio device based on the slave device with the USB protocol described above can be performed. Alternatively, in other embodiments, the processor 401 can be configured to execute the identification method of the USB interface audio device based on the slave device with the USB protocol by any other appropriate means (for example, by means of firmware).

[0091] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0092] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0093] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0094] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0095] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0096] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0097] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0098] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for identifying an audio device based on a USB interface, applied to a slave device with a universal serial bus (USB) protocol, characterized in that: include: When the slave device is connected to the host device, waiting for a request from the host device; Without waiting for a request from the host device, identifying the host device as a charging device; When the host device requests, a communication connection is established with the host device, and a configuration descriptor is sent to the host device. According to the configuration descriptor, the type of non-charging device to which the host device belongs is identified.

2. The method according to claim 1, characterized in that In the case of not waiting for a request from the host device, identifying the host device as a charging device includes: If no request from the host device is received within a first preset period of time, setting the charging flag of the slave device to a first flag and continuing to wait for a request from the host device; In the case that no request is received from the host device within a second preset time period, the charging mark is set to a second identifier, and the host device is identified as a charging device.

3. The method according to claim 2, characterized in that Also includes: When the host device requests the communication within the first preset period of time or the second preset period of time, an operation of establishing a communication connection with the host device when the host device requests the communication is triggered.

4. The method according to claim 2, characterized in that: After identifying the host device as a charging device, the method further includes: The charging management is configured for the slave device so that the charging port of the slave device starts charging.

5. The method according to claim 1, characterized in that Establishing a communication connection with the host device, comprising: In response to a first acquisition request for a device descriptor sent by the host device, sending a device descriptor to the host device; The data confirmation packet fed back by the host device is received, and the address information assigned by the host device is received. The data confirmation packet is fed back by the host device after confirming that the data packet of the device descriptor is correct.

6. The method according to claim 5, characterized in that Sending a configuration descriptor to the host device, and identifying the type of non-charging device to which the host device belongs according to the configuration descriptor, includes: In response to a second acquisition request for a device descriptor sent by the host device, sending a device descriptor to the host device; In response to a configuration descriptor acquisition request sent by the host device, sending a configuration descriptor to the host device; In response to a configuration set acquisition request sent by the host device, sending a target configuration set to the host device, wherein the configuration set acquisition request is sent by the host device according to the total length of the configuration set in the configuration descriptor, and the second acquisition request, the configuration descriptor acquisition request and the configuration set acquisition request are all sent by the host device to the slave device through the address information; According to the target configuration set, the non-charging device type to which the host device belongs is identified.

7. The method according to claim 6, characterized in that After identifying the type of non-charging device to which the host device belongs, the method further includes: The charging mark of the slave device is set to a third mark, and charging management is configured for the slave device so that the charging port of the slave device is closed to stop charging.

8. A device for identifying an audio device based on a USB interface, configured in a slave device with a USB protocol, characterized in that: include: A host device request waiting module, used for waiting for a host device request when the slave device is connected to the host device; A charging device identification module, used for identifying the host device as a charging device without waiting for a request from the host device; The non-charging device identification module is used to establish a communication connection with the host device when the host device requests it, and send a configuration descriptor to the host device, and identify the type of non-charging device to which the host device belongs according to the configuration descriptor.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a method for identifying a USB interface audio device according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a method for identifying a USB interface audio device according to any one of claims 1 to 7 when executed.