WO2016179944A1 - Function multiplexing method and apparatus for communication interface - Google Patents

Function multiplexing method and apparatus for communication interface Download PDF

Info

Publication number
WO2016179944A1
WO2016179944A1 PCT/CN2015/090950 CN2015090950W WO2016179944A1 WO 2016179944 A1 WO2016179944 A1 WO 2016179944A1 CN 2015090950 W CN2015090950 W CN 2015090950W WO 2016179944 A1 WO2016179944 A1 WO 2016179944A1
Authority
WO
WIPO (PCT)
Prior art keywords
function
external device
communication interface
host
usb
Prior art date
Application number
PCT/CN2015/090950
Other languages
French (fr)
Chinese (zh)
Inventor
马伟伟
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016179944A1 publication Critical patent/WO2016179944A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0036Small computer system interface [SCSI]

Definitions

  • This document relates to but not limited to the field of computers, and in particular relates to a function multiplexing method and device for a communication interface.
  • the communication interface is an interface for connecting and interacting between a computer and an external system.
  • a more common Universal Serial Bus (USB) interface uses a serial bus standard for communication between a host computer and peripheral devices.
  • USB Universal Serial Bus
  • Most wireless network cards on the market today are based on the USB interface.
  • the wireless network card device based on the USB interface often needs to enumerate multiple interfaces at the same time, and according to different functions implemented on different interfaces, the USB interface is further divided into the following multiple interfaces: the multiple interfaces include:
  • Diag interface for outputting device diagnostic information, device control, etc.
  • MODEM modem interface for PPP (point-to-point protocol) dialing
  • SIM-reader interface for implementing smart card access
  • GPS Global Positioning System
  • Mass-Storage interface for implementing large-capacity storage devices
  • NDIS Network Drive Interface Specification
  • each of the above USB interfaces is composed of a certain number of Endpoints, and the protocol stipulates that the USB interface can provide up to 16 pairs of endpoints.
  • USB controllers often provide a limited number of endpoints, which is insufficient for wireless card devices to enumerate multiple interfaces and implement multiple functions.
  • the related technology adopts the method of letting the hardware power off and restart, or the hardware is continuously powered by USB.
  • the re-enumeration method realizes the function switching.
  • the disadvantage of these two methods is that the switching process is bound to cause the entire wireless network card device to be unavailable in a short time.
  • the embodiments of the present invention provide a method and a device for multiplexing functions of a communication interface, so as to solve the technical problem of how to implement dynamic switching of multiple functions in one communication interface.
  • the embodiment of the invention provides a function multiplexing method for a communication interface, including:
  • each function belonging to the same drive type supported by the communication interface of the external device is notified to the host;
  • the external device comprises a universal serial bus USB device
  • the communication interface comprises a USB interface
  • the setting instructions comprise a USB setting instruction
  • the notifying the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
  • the indication information of each function belonging to the same driving type supported by the communication interface of the external device is carried in a string descriptor, and the string descriptor is sent to the host.
  • the notifying the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
  • the position of the indication information of the function in the setting instruction in the sequence indicates the selected function.
  • the indication information of the function is a keyword corresponding to the function.
  • a functional multiplexing method for a communication interface comprising:
  • the host receives the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type, selecting one function among the plurality of functions belonging to the same driving type, and notifying the selected function by the setting instruction The external device;
  • the host connects the data receiving channel and/or the data transmitting channel connected to the communication interface to a protocol stack corresponding to the selected function according to the selected function.
  • the external device comprises a universal serial bus USB device
  • the communication interface comprises a USB interface
  • the setting instructions comprise a USB setting instruction
  • the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
  • the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
  • the host receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
  • the location of the indication information in the sequence indicated by the host in the setting instruction indicates the selected function.
  • the indication information of the function is a keyword corresponding to the function.
  • a function multiplexing device for a communication interface which is disposed in an external device, and includes:
  • the configuration reporting module is configured to notify, when the external device is connected to the host, each function belonging to the same driving type supported by the communication interface of the external device to the host;
  • a function configuration module configured to receive a setting instruction sent by the host, determine a function selected by the host according to the setting instruction, and receive a data receiving channel and/or data of the communication interface
  • the transmit channel is connected to the protocol stack corresponding to the selected function.
  • the external device comprises a universal serial bus USB device
  • the communication interface comprises a USB interface
  • the setting instructions comprise a USB setting instruction
  • the configuration reporting module notifying the host that each function belonging to the same driving type supported by the communication interface of the external device is:
  • the configuration reporting module carries the indication information of each function belonging to the same driving type supported by the communication interface of the external device in a string descriptor, and sends the string descriptor to the host.
  • the configuration reporting module notifying the host that each function belonging to the same driving type supported by the communication interface of the external device is:
  • the position of the indication information of the function in the setting instruction in the sequence indicates the selected function.
  • the indication information of the function is a keyword corresponding to the function.
  • a function multiplexing device for a communication interface is disposed in a host, and includes:
  • a function selection module configured to: when receiving an external device notifying that the communication interface of the external device supports multiple functions belonging to the same drive type, selecting one of the plurality of functions belonging to the same drive type, and selecting the function The function notifies the external device by setting a command;
  • the interface function configuration module is configured to connect the data receiving channel and/or the data sending channel connected to the communication interface to a protocol stack corresponding to the selected function according to the function selected by the function selecting module.
  • the external device comprises a universal serial bus USB device
  • the communication interface comprises a USB interface
  • the setting instructions comprise a USB setting instruction
  • the function selection module receives an external device that notifies the communication interface of the external device to support multiple functions belonging to the same drive type, that is:
  • the function selection module receives a string descriptor sent by the external device, where the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
  • the function selection module receives an external device that notifies the communication interface of the external device to support multiple functions belonging to the same drive type, that is:
  • the function selection module receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
  • the function selection module indicates, in the setting instruction, the selected function by the position indication information of the function in the sequence.
  • the indication information of the function is a keyword corresponding to the function.
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the above method.
  • the solution of the embodiment of the present invention can perform function reconfiguration on a communication interface without affecting other interfaces and without restarting, so that the communication interface can select the currently implemented ones among multiple functions with the same drive type as needed.
  • Function which means that the functions of the same communication interface can be dynamically switched, and different functions can be provided in different time periods, realizing the time-sharing multiplexing of the functions of the communication interface.
  • FIG. 1 is a schematic flowchart of a function multiplexing method of a communication interface according to Embodiment 1;
  • FIG. 2 is a schematic flowchart of a function multiplexing method of a communication interface according to Embodiment 2;
  • FIG. 3 is a schematic structural diagram of a device for functional multiplexing of a communication interface according to Embodiment 3;
  • FIG. 4 is a schematic structural diagram of a device for functional multiplexing of a communication interface according to Embodiment 4;
  • FIG. 5 is a schematic flowchart of a function multiplexing method of a USB interface according to Embodiment 5;
  • FIG. 6 is a schematic flow chart of multiplexing a USB interface by the DIAG function, the AT function, and the VOUSB function of the wireless network card type device of the first embodiment.
  • Embodiment 1 A function multiplexing method of a communication interface, as shown in FIG. 1 , includes:
  • the external device receives a setting instruction sent by the host, determines a function selected by the host according to the setting instruction, and connects a data receiving channel and/or a data sending channel of the communication interface to the selected function.
  • Corresponding protocol stack corresponds to
  • the data receiving channel and/or the data sending channel of the communication interface are connected to the protocol stack corresponding to the selected function, and the data sent by the communication interface is encapsulated and processed by the connected protocol stack, and the received data is passed.
  • the connected protocol stack is parsed.
  • the manner of notification may include any one of the following or any combination thereof:
  • the external device sends the indication information of the function supported by the communication interface to the host;
  • the external device sends specific information (such as all 0 information) indicating that the communication interface supports the default one or more functions to the host;
  • the external device sends the identifier corresponding to the combination of the functions supported by the communication interface to the host, for example, the corresponding 001 is supported when the functions A and B are supported, and the 010 is supported when the functions A, B, and C are supported.
  • the host selects among the functions supported by the communication interface according to needs or predetermined conditions; the needs include the needs of the user and the needs of the host itself, such as selecting according to user operations, or according to The host currently needs to select a function completed by the communication interface; the predetermined condition can be set and changed by the user, for example, setting the GPS function of the USB interface when the host runs the navigation program.
  • the external device is a universal serial bus USB device
  • the communication interface is a USB interface
  • the setting instruction is a USB setting instruction
  • notifying the host that each function supported by the communication interface of the external device is:
  • the indication information of each function belonging to the same driving type supported by the communication interface of the external device is carried in a string descriptor, and the string descriptor is sent to the host.
  • notifying the host that each function supported by the communication interface of the external device is:
  • the determined indication information of each function is formed into a sequence and sent to the host.
  • the order of the indication information of the function may be random in the sequence, or may be sorted according to a predetermined rule, for example, the first letter of the indication information according to the function is sorted in the order of the alphabet, or according to the priority of each function. Sort by level.
  • the indication information of the function may be, but is not limited to, a keyword corresponding to the function.
  • the functions of the same driving type supported by the USB interface include a Diag function, an AT function, and a VOUSB function, and the three functions are determined.
  • the keywords are Diag, AT, VOUSB; Connect the three keywords with the separator " ⁇ " to form the sequence Diag ⁇ AT ⁇ VOUSB.
  • the indication information of the function may further include other forms of indication information, such as a value or an identifier corresponding to the function, where the correspondence between each function and the value/identification is saved in the host and the external device, and according to the correspondence, the external The device can obtain a value/identification sequence corresponding to the function, and the host can determine each function corresponding to the value/identification sequence. It is also possible to use the value of each bit in the binary sequence as the indication information. For example, if there are 5 functions belonging to the same drive type, a 5-bit binary sequence is used, and each bit corresponds to each function one-to-one, and is “1”. This means that the function is supported. When it is "0", it means that the function is not supported.
  • the position of the indication information of the function in the setting instruction in the sequence indicates the selected function.
  • the position of the Diag is the first
  • the position of the AT is the second
  • the position of the VOUSB is the third (or the first to the last).
  • the location may be, but is not limited to, represented by a serial number.
  • the Diag serial number is 1, the AT serial number is 2, and the VOUSB serial number is 3.
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the above method.
  • Embodiment 2 A function multiplexing method of a communication interface, as shown in FIG. 2, includes:
  • the host receives an external device, and when the communication interface of the external device supports multiple functions belonging to the same driving type, select one function among the plurality of functions belonging to the same driving type, and set the selected function by setting. Instructing the external device to be notified;
  • the host connects the data receiving channel and/or the data sending channel connected to the communication interface to a protocol stack corresponding to the selected function according to the selected function.
  • the external device is a universal serial bus USB device
  • the communication interface is a USB interface
  • the setting instruction is a USB setting instruction
  • the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
  • the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
  • the host receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
  • the location of the indication information in the sequence indicated by the host in the setting instruction indicates the selected function.
  • the location may be, but is not limited to, represented by a serial number.
  • the indication information of the function may be, but is not limited to, a keyword corresponding to the function.
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the above method.
  • Embodiment 3 A function multiplexing device of a communication interface is disposed in an external device, as shown in FIG. 3, and includes:
  • the configuration reporting module 101 is configured to notify, when the external device is connected to the host, each function belonging to the same driving type supported by the communication interface to the host;
  • the function configuration module 102 is configured to receive a setting instruction sent by the host, determine a function selected by the host according to the setting instruction, and connect a data receiving channel and/or a data sending channel of the communication interface to and select The function corresponds to the protocol stack.
  • the external device is a universal serial bus USB device
  • the communication interface is a USB interface
  • the setting instruction is a USB setting instruction
  • the configuration reporting module 101 notifying the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
  • the configuration reporting module supports the same driver class supported by the communication interface of the external device.
  • the indication of each function of the type is carried in a string descriptor, which is sent to the host.
  • the configuration reporting module 101 notifies the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
  • the configuration reporting module 101 determines each function of the same driving type supported by the communication interface of the external device; forming a sequence of the indication information of each function, and carrying it in a string descriptor of the communication interface The host.
  • the position of the indication information of the function in the setting instruction in the sequence indicates the selected function.
  • the location may be, but is not limited to, represented by a serial number.
  • the indication information of the function may be, but is not limited to, a keyword corresponding to the function.
  • Embodiment 4 A function multiplexing device of a communication interface is disposed in a host, as shown in FIG. 4, and includes:
  • the function selection module 104 is configured to: when the external device is notified that the communication interface of the external device supports multiple functions belonging to the same driving type, select one function among the plurality of functions belonging to the same driving type, and The selected function notifies the external device by setting a command;
  • the interface function configuration module 103 is configured to connect the data receiving channel and/or the data transmitting channel connected to the communication interface to a protocol stack corresponding to the selected function according to the function selected by the function selecting module 104.
  • the external device is a universal serial bus USB device
  • the communication interface is a USB interface
  • the setting instruction is a USB setting instruction
  • the function selection module 104 receives an external device that notifies the communication interface of the external device to support multiple functions that belong to the same drive type, including:
  • the function selection module 104 receives the string descriptor sent by the external device, and the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
  • the function selection module 104 receives an external device that notifies the communication interface of the external device to support multiple functions that belong to the same drive type, including:
  • the function selection module 104 is a function that is set to indicate the selected function in the sequence by the indication information of the function in the setting instruction.
  • the location may be, but is not limited to, represented by a serial number.
  • the indication information of the function may be, but is not limited to, a keyword corresponding to the function.
  • Embodiment 5 A function multiplexing method of a USB interface.
  • the operating system of the computer issues an instruction for acquiring a descriptor to request a device descriptor, a configuration descriptor, an interface descriptor of the USB device. (interface descriptor) and endpoint descriptor.
  • the three fields of the class bInterfaceClass, the subclass bInterfaceSubClass and the protocol code bInterfaceProtocol in the interface descriptor determine the function attribute of the interface and the PC driver type to be loaded; and the String descriptor corresponding to the iInterface field in the interface descriptor.
  • the character is a string description of the interface; the bInterfaceNumber field in the interface descriptor corresponds to the number of the interface.
  • the first thing to achieve is the function information reporting of the USB interface of the USB device: after the USB device reports the device descriptor, configuration descriptor, interface descriptor, and endpoint descriptor, if a USB interface supports function multiplexing, the generated support is generated. a sequence of keywords corresponding to functions of the same drive type, carried in a string descriptor and reported to the host;
  • the USB protocol stipulates that the USB setting command of the manufacturer can be sent to a certain USB interface.
  • the host obtains the sequence of the functions of the same driving type supported by the USB interface. , with the function corresponding to the keyword in the sequence
  • the position in the parameter is a parameter, and a USB setting instruction is sent to the USB device to set the function of the USB interface; the position may be, but is not limited to, represented by a serial number, for example, the sequence of keywords of the function is function A ⁇ function B ⁇ function C, the sequence number corresponding to function A is 1, the number corresponding to function B is 2, the number corresponding to function C is 3, and so on.
  • USB interface function after the USB interface function is set, the host and the device simultaneously connect the USB data receiving channel and/or the data sending channel of the USB interface to and select according to the selected function.
  • the function corresponds to the protocol stack, after which normal data transmission and reception and processing begin.
  • the whole system in this embodiment is mainly composed of a configuration reporting module, a function configuration module, an interface function configuration module and a function selection module located at the USB device end, and detailed functions thereof will be described below.
  • FIGS. 3 and 4 The schematic diagram of the structure between the modules in this embodiment is shown in FIGS. 3 and 4, and includes:
  • the device-side configuration reporting module 101 is configured to set the currently valid configuration information, and after receiving the GET_DESCRIPTOR command, each descriptor information is reported to the host, and a key sequence corresponding to the supported function is generated and carried in the host. The string descriptor is reported to host;
  • the device-side function configuration module 102 is configured to receive a USB setting instruction of the host, and configure a protocol stack matched with the current USB interface according to the function indicated in the setting instruction;
  • the interface function configuration module 103 on the host side is configured to communicate with the device configuration reporting module, complete the receiving and sending of the USB command, and report the function supported by the USB interface to the function selection module;
  • the function selection module 104 on the host side is configured to configure the management host interface function configuration module to complete the selection of the USB interface function, and configure the module through the interface function or directly notify the selected function of the device.
  • FIG. 5 is a flowchart of implementing a policy in this embodiment, including steps 201-210:
  • Step 201 The USB device is inserted into the host
  • Step 202 The device is configured to report each descriptor information of the device, including a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, and the like.
  • Step 203 If the USB interface of the device supports multi-function multiplexing, the configuration of the device is reported.
  • the block generates a sequence by using a keyword combination corresponding to the function of the same driver type, and is carried in the string descriptor and reported to the host;
  • Step 204 The function selection module of the host obtains a string descriptor reported by the device from the host USB configuration module, and obtains a function sequence of the same drive type supported by the USB interface of the USB device after parsing;
  • Step 205 The function selection module of the host determines whether to select the default USB interface function, if yes, proceed to 206, if not, proceed to 207;
  • Step 206 The function selection module of the host does not send an additional USB command, and only the protocol stack corresponding to the default function is configured to send and receive and process data of the USB interface, and the process ends;
  • Step 207 The function selection module of the host selects another USB interface function, and sends a USB setting instruction containing the serial number corresponding to the selected function to the device;
  • Step 208 Determine whether the device function setting is successful; if it fails, proceed to 209; if successful, proceed to 210;
  • Step 209 Abnormally exiting, and notifying the result to the host side USB configuration module, and entering the abnormal processing flow, the process ends;
  • Step 210 The function configuration module on the device side and the interface function configuration module on the host side start working on each protocol stack corresponding to the self selection, and the process ends.
  • Step 301 After the USB device is inserted into the host computer, the configuration reporting module of the device starts to report each descriptor information of the device.
  • Step 303 The function selection module of the host parses the string descriptor of the USB interface as follows: the interface supports three functions multiplexing, which are DIAG (#1), AT (#2), and VOUSB (#3).
  • the function selection module of the host selects a function to be supported. If the DIAG function is required at this time, steps 303a and 304a are performed; if the AT function is required, steps 303b and 304b are performed; if the VOUSB function is required, steps 303c and 304c are performed;
  • Step 304a the function configuration module of the device, and the interface function configuration module of the host respectively start data transmission and service processing according to the protocol stack corresponding to the DIAG function and the data receiving channel and/or the data transmission channel of the USB interface.
  • step 304b the function configuration module of the device and the interface function configuration module of the host respectively connect the data receiving channel and/or the data sending channel of the USB interface according to the protocol stack corresponding to the AT function, and start data transmission and service processing.
  • This implementation example demonstrates the functional reuse scheme of the USB interface, which can effectively solve the problem of not being able to use multiple functions at the same time due to insufficient Endpoint resources on a low-cost hardware platform. Further, this scheme can also be used in implementation. Function switching to avoid scenes such as hardware power loss.
  • the host device in this embodiment may be a computer, and the USB device may be a wireless network card, a wireless data card, or the like.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • each device/function module/functional unit in the above embodiment When each device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the above technical solution realizes dynamic switching of functions of the same communication interface, and can provide different functions in different time periods, and realizes time division multiplexing of functions of the communication interface.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

A function multiplexing method and apparatus for a communication interface, the method comprising: after an external device is connected to a host, notifying the host of each of the functions supported by a communication interface of the external device and belonging to the same drive type (S110); and the external device receiving a setting instruction sent by the host, determining, according to the setting instruction, a function selected by the host, and connecting a data receiving channel and/or a data sending channel of the communication interface to a protocol stack corresponding to the selected function (S120). The above-mentioned technical solution can realize dynamic switching of multiple functions at one communication interface.

Description

一种通信接口的功能复用方法及装置Function multiplexing method and device for communication interface 技术领域Technical field
本文涉及但不限于计算机领域,具体涉及一种通信接口的功能复用方法及装置。This document relates to but not limited to the field of computers, and in particular relates to a function multiplexing method and device for a communication interface.
背景技术Background technique
通信接口是计算机和外部系统进行连接、交互的接口,比如较为常见的通用串行总线(Universal Serial Bus,USB)接口,采用让计算机主机和外设设备进行通讯的串行总线标准。目前市场上大部分无线网卡都是基于USB接口。而基于USB接口的无线网卡设备往往需要同时枚举(enumeration)多个接口(interface),并根据不同接口上实现的不同功能,所述USB接口又分为以下多个接口:所述多个接口包括:The communication interface is an interface for connecting and interacting between a computer and an external system. For example, a more common Universal Serial Bus (USB) interface uses a serial bus standard for communication between a host computer and peripheral devices. Most wireless network cards on the market today are based on the USB interface. The wireless network card device based on the USB interface often needs to enumerate multiple interfaces at the same time, and according to different functions implemented on different interfaces, the USB interface is further divided into the following multiple interfaces: the multiple interfaces include:
Diag接口,用以实现设备诊断信息的输出、设备控制等;Diag interface for outputting device diagnostic information, device control, etc.
AT接口,用以实现发送和接收AT指令;AT interface for implementing sending and receiving AT commands;
MODEM(调制解调器)接口,用以实现PPP(点对点协议)拨号;MODEM (modem) interface for PPP (point-to-point protocol) dialing;
VOUSB接口,用以实现语音数据传输;VOUSB interface for voice data transmission;
SIM-reader接口,用以实现智能卡访问;SIM-reader interface for implementing smart card access;
GPS(全球定位系统)接口,用以实现定位数据接收;GPS (Global Positioning System) interface for receiving positioning data;
Mass-Storage接口,用以实现大容量存储设备;Mass-Storage interface for implementing large-capacity storage devices;
NDIS(网络驱动接口规范)接口,用以实现虚拟以太网卡。NDIS (Network Drive Interface Specification) interface for implementing virtual Ethernet cards.
根据USB协议,上述每个USB接口都由一定数量的端点(Endpoint)组成,协议规定USB接口最多可以提供16对端点。而在一些低成本的硬件平台上,USB控制器为了节约成本,往往提供的端点数量会非常有限,不足以满足无线网卡设备同时枚举多个接口、实现多个功能的需求。要解决这个问题,相关技术采用的做法是让硬件断电重启、或者硬件不断电而通过USB 重枚举的方式实现功能的切换,这两种方式的弊端在于其切换过程势必会造成整个无线网卡设备在短时间内无法使用。According to the USB protocol, each of the above USB interfaces is composed of a certain number of Endpoints, and the protocol stipulates that the USB interface can provide up to 16 pairs of endpoints. On some low-cost hardware platforms, in order to save costs, USB controllers often provide a limited number of endpoints, which is insufficient for wireless card devices to enumerate multiple interfaces and implement multiple functions. To solve this problem, the related technology adopts the method of letting the hardware power off and restart, or the hardware is continuously powered by USB. The re-enumeration method realizes the function switching. The disadvantage of these two methods is that the switching process is bound to cause the entire wireless network card device to be unavailable in a short time.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提供一种通信接口的功能复用方法及装置,以解决如何实现在一个通信接口实现多个功能动态切换的技术问题。The embodiments of the present invention provide a method and a device for multiplexing functions of a communication interface, so as to solve the technical problem of how to implement dynamic switching of multiple functions in one communication interface.
本发明实施例提供了一种通信接口的功能复用方法,包括:The embodiment of the invention provides a function multiplexing method for a communication interface, including:
当外部设备连接主机后,将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机;After the external device is connected to the host, each function belonging to the same drive type supported by the communication interface of the external device is notified to the host;
所述外部设备接收所述主机发送的设置指令,按照所述设置指令确定所述主机所选择的功能,将所述通信接口的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。Receiving, by the external device, a setting instruction sent by the host, determining a function selected by the host according to the setting instruction, and connecting a data receiving channel and/or a data sending channel of the communication interface to the selected function Protocol stack.
可选地,所述外部设备包括通用串行总线USB设备,所述通信接口包括USB接口,所述设置指令包括USB设置指令。Optionally, the external device comprises a universal serial bus USB device, the communication interface comprises a USB interface, and the setting instructions comprise a USB setting instruction.
可选地,所述将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机包括:Optionally, the notifying the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能的指示信息携带在字符串描述符中,将所述字符串描述符发送给所述主机。The indication information of each function belonging to the same driving type supported by the communication interface of the external device is carried in a string descriptor, and the string descriptor is sent to the host.
可选地,所述将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机包括:Optionally, the notifying the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
确定所述外部设备的通信接口所支持的属于同一驱动类型的每个功能;将每个功能的指示信息形成序列发送给所述主机。Determining each function of the same drive type supported by the communication interface of the external device; transmitting an indication information forming sequence of each function to the host.
可选地,所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。Optionally, the position of the indication information of the function in the setting instruction in the sequence indicates the selected function.
可选地,所述功能的指示信息为功能对应的关键字。 Optionally, the indication information of the function is a keyword corresponding to the function.
一种通信接口的功能复用方法,包括:A functional multiplexing method for a communication interface, comprising:
主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能时,在所述多个属于同一驱动类型的功能中选择一个功能,并将所选择的功能通过设置指令通知所述外部设备;When the host receives the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type, selecting one function among the plurality of functions belonging to the same driving type, and notifying the selected function by the setting instruction The external device;
所述主机根据所选择的功能,将与所述通信接口连接的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。The host connects the data receiving channel and/or the data transmitting channel connected to the communication interface to a protocol stack corresponding to the selected function according to the selected function.
可选地,所述外部设备包括通用串行总线USB设备,通信接口包括USB接口,所述设置指令包括USB设置指令。Optionally, the external device comprises a universal serial bus USB device, the communication interface comprises a USB interface, and the setting instructions comprise a USB setting instruction.
可选地,所述主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括:Optionally, the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
所述主机收到所述外部设备发送的字符串描述符,所述字符串描述符中携带了所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息。And receiving, by the host, a string descriptor sent by the external device, where the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
可选地,所述主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括:Optionally, the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
所述主机收到所述外部设备发送的序列,所述序列是由所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息形成的序列。The host receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
可选地,所述主机在所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。Optionally, the location of the indication information in the sequence indicated by the host in the setting instruction indicates the selected function.
可选地,所述功能的指示信息为功能对应的关键字。Optionally, the indication information of the function is a keyword corresponding to the function.
一种通信接口的功能复用装置,设置于外部设备中,包括:A function multiplexing device for a communication interface, which is disposed in an external device, and includes:
配置上报模块,设置为当所述外部设备连接主机后,将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机;The configuration reporting module is configured to notify, when the external device is connected to the host, each function belonging to the same driving type supported by the communication interface of the external device to the host;
功能配置模块,设置为接收所述主机发送的设置指令,按照所述设置指令确定所述主机所选择的功能,将所述通信接口的数据接收通道和/或数据 发送通道连接到与所选择的功能对应的协议栈。a function configuration module, configured to receive a setting instruction sent by the host, determine a function selected by the host according to the setting instruction, and receive a data receiving channel and/or data of the communication interface The transmit channel is connected to the protocol stack corresponding to the selected function.
可选地,所述外部设备包括通用串行总线USB设备,通信接口包括USB接口,所述设置指令包括USB设置指令。Optionally, the external device comprises a universal serial bus USB device, the communication interface comprises a USB interface, and the setting instructions comprise a USB setting instruction.
可选地,所述配置上报模块将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机是指:Optionally, the configuration reporting module notifying the host that each function belonging to the same driving type supported by the communication interface of the external device is:
所述配置上报模块将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能的指示信息携带在字符串描述符中,将所述字符串描述符发送给所述主机。The configuration reporting module carries the indication information of each function belonging to the same driving type supported by the communication interface of the external device in a string descriptor, and sends the string descriptor to the host.
可选地,所述配置上报模块将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机是指:Optionally, the configuration reporting module notifying the host that each function belonging to the same driving type supported by the communication interface of the external device is:
所述配置上报模块确定所述外部设备的通信接口所支持的属于同一驱动类型的每个功能;将每个功能的指示信息形成序列,发送给所述主机。The configuration reporting module determines each function of the same driving type supported by the communication interface of the external device; the indication information of each function is formed into a sequence and sent to the host.
可选地,所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。Optionally, the position of the indication information of the function in the setting instruction in the sequence indicates the selected function.
可选地,所述功能的指示信息为功能对应的关键字。Optionally, the indication information of the function is a keyword corresponding to the function.
一种通信接口的功能复用装置,设置于主机中,包括:A function multiplexing device for a communication interface is disposed in a host, and includes:
功能选择模块,设置为当收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能时,在所述多个属于同一驱动类型的功能中选择一个功能,并将所选择的功能通过设置指令通知所述外部设备;a function selection module, configured to: when receiving an external device notifying that the communication interface of the external device supports multiple functions belonging to the same drive type, selecting one of the plurality of functions belonging to the same drive type, and selecting the function The function notifies the external device by setting a command;
接口功能配置模块,设置为根据所述功能选择模块所选择的功能,将与所述通信接口连接的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。The interface function configuration module is configured to connect the data receiving channel and/or the data sending channel connected to the communication interface to a protocol stack corresponding to the selected function according to the function selected by the function selecting module.
可选地,所述外部设备包括通用串行总线USB设备,通信接口包括USB接口,所述设置指令包括USB设置指令。Optionally, the external device comprises a universal serial bus USB device, the communication interface comprises a USB interface, and the setting instructions comprise a USB setting instruction.
可选地,所述功能选择模块收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能是指: Optionally, the function selection module receives an external device that notifies the communication interface of the external device to support multiple functions belonging to the same drive type, that is:
所述功能选择模块收到所述外部设备发送的字符串描述符,所述字符串描述符中携带了所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息。The function selection module receives a string descriptor sent by the external device, where the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
可选地,所述功能选择模块收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能是指:Optionally, the function selection module receives an external device that notifies the communication interface of the external device to support multiple functions belonging to the same drive type, that is:
所述功能选择模块收到所述外部设备发送的序列,所述序列是由所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息形成的序列。The function selection module receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
可选地,所述功能选择模块在所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。Optionally, the function selection module indicates, in the setting instruction, the selected function by the position indication information of the function in the sequence.
可选地,所述功能的指示信息为功能对应的关键字。Optionally, the indication information of the function is a keyword corresponding to the function.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行上述的方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the above method.
本发明实施例的方案能够在不影响其它接口且无需重启的情况下,对一通信接口进行功能重新配置,从而使得该通信接口可以根据需要在驱动类型相同的多个功能中选择当前要实现的功能,这就意味着同一个通信接口的功能可以动态切换,而且在不同时间段能够提供不同的功能,实现了通信接口的功能的分时复用。The solution of the embodiment of the present invention can perform function reconfiguration on a communication interface without affecting other interfaces and without restarting, so that the communication interface can select the currently implemented ones among multiple functions with the same drive type as needed. Function, which means that the functions of the same communication interface can be dynamically switched, and different functions can be provided in different time periods, realizing the time-sharing multiplexing of the functions of the communication interface.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1是实施例一的通信接口的功能复用方法的流程示意图;1 is a schematic flowchart of a function multiplexing method of a communication interface according to Embodiment 1;
图2是实施例二的通信接口的功能复用方法的流程示意图;2 is a schematic flowchart of a function multiplexing method of a communication interface according to Embodiment 2;
图3是实施例三的通信接口的功能复用方法装置的结构示意图;3 is a schematic structural diagram of a device for functional multiplexing of a communication interface according to Embodiment 3;
图4是实施例四的通信接口的功能复用方法装置的结构示意图; 4 is a schematic structural diagram of a device for functional multiplexing of a communication interface according to Embodiment 4;
图5是实施例五的USB接口的功能复用方法流程示意图;5 is a schematic flowchart of a function multiplexing method of a USB interface according to Embodiment 5;
图6是实施示例一的无线网卡类设备DIAG功能、AT功能和VOUSB功能复用一个USB接口的流程示意图。6 is a schematic flow chart of multiplexing a USB interface by the DIAG function, the AT function, and the VOUSB function of the wireless network card type device of the first embodiment.
本发明的实施方式Embodiments of the invention
下面将结合附图及实施例对本发明的技术方案进行更详细的说明。The technical solution of the present invention will be described in more detail below with reference to the accompanying drawings and embodiments.
需要说明的是,如果不冲突,本发明实施例以及实施例中的各个特征可以相互结合,均在本发明的保护范围之内。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。It should be noted that, if not conflicting, the embodiments of the present invention and the various features of the embodiments may be combined with each other, and are all within the protection scope of the present invention. Additionally, although logical sequences are shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than the ones described herein.
本发明实施例是针对通信接口上驱动类型相同、数据格式不同的功能进行复用,比如无线网卡的USB接口,其AT、MODEM、Diag、VOUSB、SIM-reader、GPS功能等同属于串口类型,加载同样类型的串口PC(个人电脑)驱动,区别在于传输的数据格式不同,因此可以采用本发明实施例的方案进行复用。The embodiment of the present invention is to multiplex the functions of the same type and different data formats on the communication interface, such as the USB interface of the wireless network card, and the AT, MODEM, Diag, VOUSB, SIM-reader, and GPS functions are equivalent to the serial port type, and the loading is performed. The same type of serial port PC (Personal Computer) driver differs in that the data format of the transmission is different, so that the scheme of the embodiment of the present invention can be used for multiplexing.
实施例一、一种通信接口的功能复用方法,如图1所示,包括:Embodiment 1 A function multiplexing method of a communication interface, as shown in FIG. 1 , includes:
S110、当外部设备连接主机后,将所述外部设备的通信接口支持的属于同一驱动类型的每个功能通知给所述主机;S110. After the external device is connected to the host, notify each host of each function that belongs to the same driving type supported by the communication interface of the external device;
S120、所述外部设备接收所述主机发送的设置指令,按照所述设置指令确定所述主机选择的功能,将所述通信接口的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。S120. The external device receives a setting instruction sent by the host, determines a function selected by the host according to the setting instruction, and connects a data receiving channel and/or a data sending channel of the communication interface to the selected function. Corresponding protocol stack.
其中,将通信接口的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈包括,所述通信接口发送的数据通过所连接的协议栈进行封装处理,所接收的数据通过所连接的协议栈进行解析处理。The data receiving channel and/or the data sending channel of the communication interface are connected to the protocol stack corresponding to the selected function, and the data sent by the communication interface is encapsulated and processed by the connected protocol stack, and the received data is passed. The connected protocol stack is parsed.
其中,通知的方式可以包括以下任一种或其任意组合:The manner of notification may include any one of the following or any combination thereof:
外部设备发送通信接口所支持的功能的指示信息给主机; The external device sends the indication information of the function supported by the communication interface to the host;
外部设备发送实现约定的、表示通信接口支持默认的一个或多个功能的特定信息(比如全0信息)给主机;The external device sends specific information (such as all 0 information) indicating that the communication interface supports the default one or more functions to the host;
外部设备发送通信接口所支持的功能的组合对应的标识给主机,比如支持功能A和B时对应001,支持功能A、B、C时对应010等。The external device sends the identifier corresponding to the combination of the functions supported by the communication interface to the host, for example, the corresponding 001 is supported when the functions A and B are supported, and the 010 is supported when the functions A, B, and C are supported.
其中,当通信接口支持多个功能时,主机根据需要或预定条件在通信接口所支持的功能中进行选择;所述需要包括用户的需要和主机本身的需要,比如根据用户操作进行选择,或根据主机当前需要通信接口完成的功能进行选择;所述预定条件可以由用户设置和更改,比如设置当主机运行导航程序时,选择USB接口的GPS功能。Wherein, when the communication interface supports multiple functions, the host selects among the functions supported by the communication interface according to needs or predetermined conditions; the needs include the needs of the user and the needs of the host itself, such as selecting according to user operations, or according to The host currently needs to select a function completed by the communication interface; the predetermined condition can be set and changed by the user, for example, setting the GPS function of the USB interface when the host runs the navigation program.
本实施例通过由外部设备通知主机通信接口所支持的属于同一驱动类型的功能,并按主机的选择连接到相应的协议栈,从而可以在无需下电的情况下切换通信接口的功能。In this embodiment, the function of the same driving type supported by the host communication interface is notified by the external device, and is connected to the corresponding protocol stack according to the selection of the host, so that the function of the communication interface can be switched without powering off.
可选地,所述外部设备为通用串行总线USB设备,所述通信接口为USB接口,所述设置指令为USB设置指令。Optionally, the external device is a universal serial bus USB device, the communication interface is a USB interface, and the setting instruction is a USB setting instruction.
可选地,将所述外部设备的通信接口所支持的每个功能通知给所述主机包括:Optionally, notifying the host that each function supported by the communication interface of the external device is:
将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能的指示信息携带在字符串描述符中,将所述字符串描述符发送给所述主机。The indication information of each function belonging to the same driving type supported by the communication interface of the external device is carried in a string descriptor, and the string descriptor is sent to the host.
可选地,将所述外部设备的通信接口所支持的每个功能通知给所述主机包括:Optionally, notifying the host that each function supported by the communication interface of the external device is:
确定通信接口所支持的属于同一驱动类型的每个功能;Determining each function of the same drive type supported by the communication interface;
将所确定的每个功能的指示信息形成序列,发送给所述主机。The determined indication information of each function is formed into a sequence and sent to the host.
其中,功能的指示信息在所述序列中的排列顺序可以随机,也可以根据预定的规则排序,比如按照功能的指示信息的首字母在字母表中的顺序进行排序,或按照每个功能的优先级进行排序。Wherein, the order of the indication information of the function may be random in the sequence, or may be sorted according to a predetermined rule, for example, the first letter of the indication information according to the function is sorted in the order of the alphabet, or according to the priority of each function. Sort by level.
可选地,所述功能的指示信息可以但不限于为功能对应的关键字,比如USB接口所支持的属于同一驱动类型的功能包括Diag功能、AT功能、VOUSB功能,确定这三个功能对应的关键字分别为Diag、AT、VOUSB; 将三个关键字以分隔符“\”连接,形成序列Diag\AT\VOUSB。Optionally, the indication information of the function may be, but is not limited to, a keyword corresponding to the function. For example, the functions of the same driving type supported by the USB interface include a Diag function, an AT function, and a VOUSB function, and the three functions are determined. The keywords are Diag, AT, VOUSB; Connect the three keywords with the separator "\" to form the sequence Diag\AT\VOUSB.
所述功能的指示信息还可以包括其它形式的指示信息,比如功能对应的数值或标识,所述主机和外部设备中均保存每个功能和数值/标识的对应关系,根据所述对应关系,外部设备可以得到和功能对应的数值/标识序列,所述主机可以确定数值/标识序列对应的每个功能。还可以用二进制序列中每个位的数值作为指示信息,比如属于同一驱动类型共有5种功能,则采用5位的二进制序列,其中每一位和每一种功能一一对应,为“1”时表示支持该功能,为“0”时表示不支持该功能。The indication information of the function may further include other forms of indication information, such as a value or an identifier corresponding to the function, where the correspondence between each function and the value/identification is saved in the host and the external device, and according to the correspondence, the external The device can obtain a value/identification sequence corresponding to the function, and the host can determine each function corresponding to the value/identification sequence. It is also possible to use the value of each bit in the binary sequence as the indication information. For example, if there are 5 functions belonging to the same drive type, a 5-bit binary sequence is used, and each bit corresponds to each function one-to-one, and is “1”. This means that the function is supported. When it is "0", it means that the function is not supported.
可选地,所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。比如序列Diag\AT\VOUSB中,Diag的位置是第一,AT的位置是第二,VOUSB的位置是第三(或倒数第一)。Optionally, the position of the indication information of the function in the setting instruction in the sequence indicates the selected function. For example, in the sequence Diag\AT\VOUSB, the position of the Diag is the first, the position of the AT is the second, and the position of the VOUSB is the third (or the first to the last).
所述位置可以但不限于以序号表示。The location may be, but is not limited to, represented by a serial number.
比如上例中的Diag序号为1,AT序号为2,VOUSB序号为3。For example, in the above example, the Diag serial number is 1, the AT serial number is 2, and the VOUSB serial number is 3.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行上述的方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the above method.
实施例二、一种通信接口的功能复用方法,如图2所示,包括:Embodiment 2: A function multiplexing method of a communication interface, as shown in FIG. 2, includes:
S210、主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能时,在所述多个属于同一驱动类型的功能中选择一个功能,并将所选择的功能通过设置指令通知所述外部设备;S210. The host receives an external device, and when the communication interface of the external device supports multiple functions belonging to the same driving type, select one function among the plurality of functions belonging to the same driving type, and set the selected function by setting. Instructing the external device to be notified;
S220、所述主机根据所选择的功能,将与所述通信接口连接的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。S220. The host connects the data receiving channel and/or the data sending channel connected to the communication interface to a protocol stack corresponding to the selected function according to the selected function.
可选地,所述外部设备为通用串行总线USB设备,所述通信接口为USB接口,所述设置指令为USB设置指令。Optionally, the external device is a universal serial bus USB device, the communication interface is a USB interface, and the setting instruction is a USB setting instruction.
可选地,所述主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括: Optionally, the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
所述主机收到所述外部设备发送的字符串描述符,所述字符串描述符中携带了所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息。And receiving, by the host, a string descriptor sent by the external device, where the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
可选地,所述主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括:Optionally, the receiving, by the host, the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type includes:
所述主机收到所述外部设备发送的序列,所述序列是由所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息形成的序列。The host receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
可选地,所述主机在所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。Optionally, the location of the indication information in the sequence indicated by the host in the setting instruction indicates the selected function.
所述位置可以但不限于以序号表示。The location may be, but is not limited to, represented by a serial number.
可选地,所述功能的指示信息可以但不限于为功能对应的关键字。Optionally, the indication information of the function may be, but is not limited to, a keyword corresponding to the function.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行上述的方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the above method.
实施例三、一种通信接口的功能复用装置,设置于外部设备中,如图3所示,包括:Embodiment 3: A function multiplexing device of a communication interface is disposed in an external device, as shown in FIG. 3, and includes:
配置上报模块101,设置为当所述外部设备连接主机后,将通信接口所支持的属于同一驱动类型的每个功能通知给所述主机;The configuration reporting module 101 is configured to notify, when the external device is connected to the host, each function belonging to the same driving type supported by the communication interface to the host;
功能配置模块102,设置为接收所述主机发送的设置指令,按照所述设置指令确定所述主机所选择的功能,将所述通信接口的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。The function configuration module 102 is configured to receive a setting instruction sent by the host, determine a function selected by the host according to the setting instruction, and connect a data receiving channel and/or a data sending channel of the communication interface to and select The function corresponds to the protocol stack.
可选地,所述外部设备为通用串行总线USB设备,所述通信接口为USB接口,所述设置指令为USB设置指令。Optionally, the external device is a universal serial bus USB device, the communication interface is a USB interface, and the setting instruction is a USB setting instruction.
可选地,所述配置上报模块101将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机包括:Optionally, the configuration reporting module 101 notifying the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
所述配置上报模块将所述外部设备的通信接口所支持的属于同一驱动类 型的每个功能的指示信息携带在字符串描述符中,将所述字符串描述符发送给所述主机。The configuration reporting module supports the same driver class supported by the communication interface of the external device. The indication of each function of the type is carried in a string descriptor, which is sent to the host.
可选地,配置上报模块101将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机包括:Optionally, the configuration reporting module 101 notifies the host that each function belonging to the same driving type supported by the communication interface of the external device includes:
所述配置上报模块101确定所述外部设备的通信接口所支持的属于同一驱动类型的每个功能;将每个功能的指示信息形成序列,携带在所述通信接口的字符串描述符中发送给所述主机。The configuration reporting module 101 determines each function of the same driving type supported by the communication interface of the external device; forming a sequence of the indication information of each function, and carrying it in a string descriptor of the communication interface The host.
可选地,所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。Optionally, the position of the indication information of the function in the setting instruction in the sequence indicates the selected function.
所述位置可以但不限于以序号表示。The location may be, but is not limited to, represented by a serial number.
可选地,所述功能的指示信息可以但不限于为功能对应的关键字。Optionally, the indication information of the function may be, but is not limited to, a keyword corresponding to the function.
实施例四、一种通信接口的功能复用装置,设置于主机中,如图4所示,包括:Embodiment 4: A function multiplexing device of a communication interface is disposed in a host, as shown in FIG. 4, and includes:
功能选择模块104,设置为当收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能时,在所述多个属于同一驱动类型的功能中选择一个功能,并将所选择的功能通过设置指令通知所述外部设备;The function selection module 104 is configured to: when the external device is notified that the communication interface of the external device supports multiple functions belonging to the same driving type, select one function among the plurality of functions belonging to the same driving type, and The selected function notifies the external device by setting a command;
接口功能配置模块103,设置为根据所述功能选择模块104所选择的功能,将与所述通信接口连接的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。The interface function configuration module 103 is configured to connect the data receiving channel and/or the data transmitting channel connected to the communication interface to a protocol stack corresponding to the selected function according to the function selected by the function selecting module 104.
可选地,所述外部设备为通用串行总线USB设备,所述通信接口为USB接口,所述设置指令为USB设置指令。Optionally, the external device is a universal serial bus USB device, the communication interface is a USB interface, and the setting instruction is a USB setting instruction.
可选地,所述功能选择模块104收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括:Optionally, the function selection module 104 receives an external device that notifies the communication interface of the external device to support multiple functions that belong to the same drive type, including:
所述功能选择模块104收到所述外部设备发送的字符串描述符,所述字符串描述符中携带了所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息。 The function selection module 104 receives the string descriptor sent by the external device, and the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
可选地,所述功能选择模块104收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括:Optionally, the function selection module 104 receives an external device that notifies the communication interface of the external device to support multiple functions that belong to the same drive type, including:
所述功能选择模块104收到所述外部设备发送的序列,所述序列是由所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息形成的序列。The function selection module 104 receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
可选地,所述功能选择模块104是设置为在所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。Optionally, the function selection module 104 is a function that is set to indicate the selected function in the sequence by the indication information of the function in the setting instruction.
所述位置可以但不限于以序号表示。The location may be, but is not limited to, represented by a serial number.
可选地,所述功能的指示信息可以但不限于为功能对应的关键字。Optionally, the indication information of the function may be, but is not limited to, a keyword corresponding to the function.
实施例五、一种USB接口的功能复用方法。Embodiment 5: A function multiplexing method of a USB interface.
根据USB协议的规定,当USB设备插入计算机后,计算机的操作系统下发用于获取描述符的指令来索要USB设备的设备描述符(device descriptor)、配置描述符(configuration descriptor)、接口描述符(interface descriptor)以及端点描述符(endpoint descriptor)。其中接口描述符中的类bInterfaceClass、子类bInterfaceSubClass和协议码bInterfaceProtocol三个字段决定了该接口的功能属性以及所要加载的PC驱动类型;而接口描述符中的iInterface字段对应的String descriptor(字符串描述符)则是对该接口的字符串描述;接口描述符中的bInterfaceNumber字段则对应这个接口的编号,在所述计算机向此接口发送命令时,需要以该编号来填充命令。本方案基于上述USB协议规范实现同一个USB接口上的多个功能复用。According to the provisions of the USB protocol, when the USB device is inserted into the computer, the operating system of the computer issues an instruction for acquiring a descriptor to request a device descriptor, a configuration descriptor, an interface descriptor of the USB device. (interface descriptor) and endpoint descriptor. The three fields of the class bInterfaceClass, the subclass bInterfaceSubClass and the protocol code bInterfaceProtocol in the interface descriptor determine the function attribute of the interface and the PC driver type to be loaded; and the String descriptor corresponding to the iInterface field in the interface descriptor. The character is a string description of the interface; the bInterfaceNumber field in the interface descriptor corresponds to the number of the interface. When the computer sends a command to the interface, the command needs to be filled with the number. The solution implements multiple function multiplexing on the same USB interface based on the above USB protocol specification.
首先要实现的是USB设备的USB接口的功能信息上报:在USB设备上报设备描述符、配置描述符、接口描述符、端点描述符之后,如果某个USB接口支持功能复用,则生成所支持的属于同一驱动类型的功能对应的关键字的序列,携带在字符串描述符中上报给主机;The first thing to achieve is the function information reporting of the USB interface of the USB device: after the USB device reports the device descriptor, configuration descriptor, interface descriptor, and endpoint descriptor, if a USB interface supports function multiplexing, the generated support is generated. a sequence of keywords corresponding to functions of the same drive type, carried in a string descriptor and reported to the host;
其次要实现USB接口功能的选择和设定:USB协议规定可以发送厂商自定义的USB设置指令到某一USB接口,本实施例中主机获得USB接口所支持的属于同一驱动类型的功能的序列后,以功能对应的关键字在所述序列 中的位置为参数,向USB设备发送USB设置指令,设置所述USB接口的功能;所述位置可以但不限于用序号表示,比如所述功能的关键字的序列为功能A\功能B\功能C,则功能A对应的序号为1,功能B对应的序号为2,功能C对应的序号为3,以此类推。Secondly, it is necessary to realize the selection and setting of the USB interface function: the USB protocol stipulates that the USB setting command of the manufacturer can be sent to a certain USB interface. In this embodiment, the host obtains the sequence of the functions of the same driving type supported by the USB interface. , with the function corresponding to the keyword in the sequence The position in the parameter is a parameter, and a USB setting instruction is sent to the USB device to set the function of the USB interface; the position may be, but is not limited to, represented by a serial number, for example, the sequence of keywords of the function is function A\function B\function C, the sequence number corresponding to function A is 1, the number corresponding to function B is 2, the number corresponding to function C is 3, and so on.
最后实现USB接口上对应功能的配置和运行:在USB接口功能设置后,主机和设备同时根据所选择的功能,将所述USB接口的USB数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈,之后开始正常的数据收发和处理。Finally, the configuration and operation of the corresponding functions on the USB interface are realized: after the USB interface function is set, the host and the device simultaneously connect the USB data receiving channel and/or the data sending channel of the USB interface to and select according to the selected function. The function corresponds to the protocol stack, after which normal data transmission and reception and processing begin.
与之对应的,本实施例中整个系统主要由位于USB设备端的配置上报模块、功能配置模块和位于主机端的接口功能配置模块、功能选择模块四个模块组成,其详细的功能将在下面阐述。Correspondingly, the whole system in this embodiment is mainly composed of a configuration reporting module, a function configuration module, an interface function configuration module and a function selection module located at the USB device end, and detailed functions thereof will be described below.
本实施例中模块间的结构示意图如图3、4所示,包括:The schematic diagram of the structure between the modules in this embodiment is shown in FIGS. 3 and 4, and includes:
设备侧的配置上报模块101,设置为设置当前有效的配置信息,收到GET_DESCRIPTOR等指令后将每种描述符信息上报给主机(host),并生成所支持的功能对应的关键字序列,携带在字符串描述符中上报给host;;The device-side configuration reporting module 101 is configured to set the currently valid configuration information, and after receiving the GET_DESCRIPTOR command, each descriptor information is reported to the host, and a key sequence corresponding to the supported function is generated and carried in the host. The string descriptor is reported to host;
设备侧的功能配置模块102,设置为接收主机的USB设置指令,并根据所述设置指令中所指示的功能配置与当前USB接口配套的协议栈;The device-side function configuration module 102 is configured to receive a USB setting instruction of the host, and configure a protocol stack matched with the current USB interface according to the function indicated in the setting instruction;
是主机侧的接口功能配置模块103,设置为与设备配置上报模块通信,完成USB命令的接收发送,并上报USB接口所支持的功能到功能选择模块;The interface function configuration module 103 on the host side is configured to communicate with the device configuration reporting module, complete the receiving and sending of the USB command, and report the function supported by the USB interface to the function selection module;
主机侧的功能选择模块104,设置为配置管理主机接口功能配置模块,完成USB接口功能的选择,并通过所述接口功能配置模块或直接通知设备所选择的功能。The function selection module 104 on the host side is configured to configure the management host interface function configuration module to complete the selection of the USB interface function, and configure the module through the interface function or directly notify the selected function of the device.
图5是本实施例中实施策略流程图,包括步骤201~210:FIG. 5 is a flowchart of implementing a policy in this embodiment, including steps 201-210:
步骤201:USB设备插入主机;Step 201: The USB device is inserted into the host;
步骤202:设备的配置上报模块上报设备的每种描述符信息,包含设备描述符、配置描述符、接口描述符、端点描述符等;Step 202: The device is configured to report each descriptor information of the device, including a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, and the like.
步骤203:如果设备的USB接口支持多功能复用,则设备的配置上报模 块使用所支持的属于同一驱动类型的功能对应的关键字组合生成序列,携带在字符串描述符中,上报给主机;Step 203: If the USB interface of the device supports multi-function multiplexing, the configuration of the device is reported. The block generates a sequence by using a keyword combination corresponding to the function of the same driver type, and is carried in the string descriptor and reported to the host;
步骤204:主机的功能选择模块从主机USB配置模块中获得设备上报的字符串描述符,解析后获得该USB设备的USB接口支持的属于同一驱动类型的功能序列;Step 204: The function selection module of the host obtains a string descriptor reported by the device from the host USB configuration module, and obtains a function sequence of the same drive type supported by the USB interface of the USB device after parsing;
步骤205:主机的功能选择模块判断是否选择默认的USB接口功能,是则进行206,不是则进行207;Step 205: The function selection module of the host determines whether to select the default USB interface function, if yes, proceed to 206, if not, proceed to 207;
步骤206、主机的功能选择模块不发送额外的USB指令,仅配置所述默认功能对应的协议栈用于USB接口数据的收发和处理,流程结束;Step 206: The function selection module of the host does not send an additional USB command, and only the protocol stack corresponding to the default function is configured to send and receive and process data of the USB interface, and the process ends;
步骤207:主机的功能选择模块选择其它USB接口功能,发送含有所选功能对应的序号的USB设置指令给设备;Step 207: The function selection module of the host selects another USB interface function, and sends a USB setting instruction containing the serial number corresponding to the selected function to the device;
步骤208:判断设备功能设置是否成功;如果失败,则进行209;如果成功则进行210;Step 208: Determine whether the device function setting is successful; if it fails, proceed to 209; if successful, proceed to 210;
步骤209:异常退出,并通知结果给主机侧USB配置模块,同时进入异常处理流程,流程结束;Step 209: Abnormally exiting, and notifying the result to the host side USB configuration module, and entering the abnormal processing flow, the process ends;
步骤210:设备侧的功能配置模块和主机侧的接口功能配置模块则每个自选择对应的协议栈开始工作,流程结束。Step 210: The function configuration module on the device side and the interface function configuration module on the host side start working on each protocol stack corresponding to the self selection, and the process ends.
实施示例一:Implementation example 1:
典型地,在USB无线网卡领域,设备通常枚举多个USB接口,其中一个USB接口使用上述方案实现了DIAG\AT\VOUSB功能复用,即此USB接口可以同时支持这三个功能,图6是本实施示例的示意流程图,详细步骤说明如下:Typically, in the field of USB wireless network cards, devices usually enumerate multiple USB interfaces, one of which uses the above scheme to implement DIAG\AT\VOUSB function multiplexing, that is, the USB interface can simultaneously support these three functions, Figure 6 Is a schematic flow chart of this embodiment example, the detailed steps are as follows:
步骤301、USB设备插入计算机主机后设备的配置上报模块开始上报设备的每种描述符信息;Step 301: After the USB device is inserted into the host computer, the configuration reporting module of the device starts to report each descriptor information of the device.
步骤302、设备的配置上报模块生成所连接的USB接口“Diag\AT\VOUSB USB Interface”的字符串描述符,并上报给主机的接口功能配置模块;其中,Diag\AT\VOUSB为功能的关键字序列;三个功能的关 键字Diag、AT、VOUSB之间用“\”隔开;Step 302: The device configuration reporting module generates a string descriptor of the connected USB interface “Diag\AT\VOUSB USB Interface”, and reports the interface function configuration module to the host; wherein Diag\AT\VOUSB is the key function Word sequence; three functions The keys Diag, AT, and VOUSB are separated by "\";
步骤303主机的功能选择模块解析USB接口的字符串描述符为:该接口支持三种功能复用,依次为DIAG(#1),AT(#2),VOUSB(#3)。主机的功能选择模块选择需要支持的功能,如果此时需要DIAG功能,则进行步骤303a和304a;如果需要AT功能,则进行步骤303b和304b;如果需要VOUSB功能,则进行步骤303c和304c;Step 303: The function selection module of the host parses the string descriptor of the USB interface as follows: the interface supports three functions multiplexing, which are DIAG (#1), AT (#2), and VOUSB (#3). The function selection module of the host selects a function to be supported. If the DIAG function is required at this time, steps 303a and 304a are performed; if the AT function is required, steps 303b and 304b are performed; if the VOUSB function is required, steps 303c and 304c are performed;
303a、以#1为参数,下发自定义的USB设置指令到设备,将USB接口功能设置为DIAG功能,执行304a;303a, using #1 as a parameter, issuing a custom USB setting command to the device, setting the USB interface function to the DIAG function, executing 304a;
303b、以#2为参数,下发自定义的USB设置指令到设备,将USB接口功能设置为AT功能,执行304b;303b, using #2 as a parameter, issuing a custom USB setting command to the device, setting the USB interface function to the AT function, executing 304b;
303c、以#2为参数,下发自定义的USB设置指令到设备,将USB接口功能设置为VOUSB功能,执行304c;303c, using #2 as a parameter, issuing a custom USB setting command to the device, setting the USB interface function to the VOUSB function, executing 304c;
步骤304a、设备的功能配置模块和主机的接口功能配置模块分别根据将对应于DIAG功能的协议栈与USB接口的数据接收通道和/或数据发送通道相连,开始数据传输和业务处理。 Step 304a, the function configuration module of the device, and the interface function configuration module of the host respectively start data transmission and service processing according to the protocol stack corresponding to the DIAG function and the data receiving channel and/or the data transmission channel of the USB interface.
步骤304b、设备的功能配置模块和主机的接口功能配置模块分别根据将对应于AT功能的协议栈与USB接口的数据接收通道和/或数据发送通道相连,开始数据传输和业务处理。In step 304b, the function configuration module of the device and the interface function configuration module of the host respectively connect the data receiving channel and/or the data sending channel of the USB interface according to the protocol stack corresponding to the AT function, and start data transmission and service processing.
步骤304c、设备的功能配置模块和主机的接口功能配置模块分别根据将对应于VOUSB功能的协议栈与USB接口的数据接收通道和/或数据发送通道相连,开始数据传输和业务处理。 Step 304c: The function configuration module of the device and the interface function configuration module of the host respectively start data transmission and service processing according to the protocol stack corresponding to the VOUSB function and the data receiving channel and/or the data transmission channel of the USB interface.
通过上述步骤,可以完成USB接口的功能复用实施。Through the above steps, the function multiplexing implementation of the USB interface can be completed.
此实施示例展示了USB接口的功能复用方案,可以有效解决低成本硬件平台上,由于Endpoint资源不足带来的无法同时使用多个功能的问题,更进一步地,这种方案也可以用在实现功能切换,避免硬件掉电等场景。This implementation example demonstrates the functional reuse scheme of the USB interface, which can effectively solve the problem of not being able to use multiple functions at the same time due to insufficient Endpoint resources on a low-cost hardware platform. Further, this scheme can also be used in implementation. Function switching to avoid scenes such as hardware power loss.
本实施例所述的主机(host)可以为计算机,所述的USB设备可以为无线网卡、无线数据卡等。 The host device in this embodiment may be a computer, and the USB device may be a wireless network card, a wireless data card, or the like.
以上内容是结合具体的实施方式对本发明所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。The above is a further detailed description of the present invention in connection with the specific embodiments, and the specific embodiments of the present invention are not limited to the description.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。One of ordinary skill in the art will appreciate that all or a portion of the steps of the above-described embodiments can be implemented using a computer program flow, which can be stored in a computer readable storage medium, such as on a corresponding hardware platform (eg, The system, device, device, device, etc. are executed, and when executed, include one or a combination of the steps of the method embodiments.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。Alternatively, all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When each device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. The above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
工业实用性Industrial applicability
上述技术方案实现了同一个通信接口的功能动态切换,而且在不同时间段能够提供不同的功能,实现了通信接口的功能的分时复用。 The above technical solution realizes dynamic switching of functions of the same communication interface, and can provide different functions in different time periods, and realizes time division multiplexing of functions of the communication interface.

Claims (26)

  1. 一种通信接口的功能复用方法,包括:A functional multiplexing method for a communication interface, comprising:
    当外部设备连接主机后,将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机;After the external device is connected to the host, each function belonging to the same drive type supported by the communication interface of the external device is notified to the host;
    所述外部设备接收所述主机发送的设置指令,按照所述设置指令确定所述主机所选择的功能,将所述通信接口的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。Receiving, by the external device, a setting instruction sent by the host, determining a function selected by the host according to the setting instruction, and connecting a data receiving channel and/or a data sending channel of the communication interface to the selected function Protocol stack.
  2. 如权利要求1所述的方法,其中,The method of claim 1 wherein
    所述外部设备包括通用串行总线USB设备,所述通信接口包括USB接口,所述设置指令包括USB设置指令。The external device includes a universal serial bus USB device, the communication interface includes a USB interface, and the setting instructions include a USB setting instruction.
  3. 如权利要求1所述的方法,其中,所述将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机包括:The method of claim 1, wherein the notifying the host of each function belonging to the same drive type supported by the communication interface of the external device comprises:
    将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能的指示信息携带在字符串描述符中,将所述字符串描述符发送给所述主机。The indication information of each function belonging to the same driving type supported by the communication interface of the external device is carried in a string descriptor, and the string descriptor is sent to the host.
  4. 如权利要求1所述的方法,其中,所述将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机包括:The method of claim 1, wherein the notifying the host of each function belonging to the same drive type supported by the communication interface of the external device comprises:
    确定所述外部设备的通信接口所支持的属于同一驱动类型的每个功能;将每个功能的指示信息形成序列发送给所述主机。Determining each function of the same drive type supported by the communication interface of the external device; transmitting an indication information forming sequence of each function to the host.
  5. 如权利要求4所述的方法,其中,The method of claim 4, wherein
    所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。The position of the indication information through the function in the setting instruction in the sequence indicates the selected function.
  6. 如权利要求2~5中任一项所述的方法,其中,The method according to any one of claims 2 to 5, wherein
    所述功能的指示信息包括功能对应的关键字。The indication information of the function includes a keyword corresponding to the function.
  7. 一种通信接口的功能复用方法,包括: A functional multiplexing method for a communication interface, comprising:
    主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能时,在所述多个属于同一驱动类型的功能中选择一个功能,并将所选择的功能通过设置指令通知所述外部设备;When the host receives the external device notifying that the communication interface of the external device supports multiple functions belonging to the same driving type, selecting one function among the plurality of functions belonging to the same driving type, and notifying the selected function by the setting instruction The external device;
    所述主机根据所选择的功能,将与所述通信接口连接的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。The host connects the data receiving channel and/or the data transmitting channel connected to the communication interface to a protocol stack corresponding to the selected function according to the selected function.
  8. 如权利要求7所述的方法,其中,The method of claim 7 wherein
    所述外部设备包括通用串行总线USB设备,通信接口包括USB接口,所述设置指令包括USB设置指令。The external device includes a universal serial bus USB device, the communication interface includes a USB interface, and the setting instructions include a USB setting instruction.
  9. 如权利要求7所述的方法,其中,所述主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括:The method of claim 7, wherein the receiving, by the host, the external device notifying that the communication interface of the external device supports a plurality of functions belonging to the same drive type comprises:
    所述主机收到所述外部设备发送的字符串描述符,所述字符串描述符中携带了所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息。And receiving, by the host, a string descriptor sent by the external device, where the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
  10. 如权利要求7所述的方法,其中,所述主机收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能包括:The method of claim 7, wherein the receiving, by the host, the external device notifying that the communication interface of the external device supports a plurality of functions belonging to the same drive type comprises:
    所述主机收到所述外部设备发送的序列,所述序列是由所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息形成的序列。The host receives a sequence sent by the external device, and the sequence is a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
  11. 如权利要求10所述的方法,其中,The method of claim 10, wherein
    所述主机在所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。The position of the indication in the sequence by the indication of the function in the setting instruction by the host indicates the selected function.
  12. 如权利要求7~11中任一项所述的方法,其中,The method according to any one of claims 7 to 11, wherein
    所述功能的指示信息包括功能对应的关键字。The indication information of the function includes a keyword corresponding to the function.
  13. 一种设置于外部设备中的通信接口的功能复用装置,包括:A function multiplexing device for a communication interface disposed in an external device, comprising:
    配置上报模块,设置为当所述外部设备连接主机后,将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机; The configuration reporting module is configured to notify, when the external device is connected to the host, each function belonging to the same driving type supported by the communication interface of the external device to the host;
    功能配置模块,设置为接收所述主机发送的设置指令,按照所述设置指令确定所述主机所选择的功能,将所述通信接口的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。a function configuration module, configured to receive a setting instruction sent by the host, determine a function selected by the host according to the setting instruction, and connect a data receiving channel and/or a data sending channel of the communication interface to the selected one The protocol stack corresponding to the function.
  14. 如权利要求13所述的装置,其中,The device of claim 13 wherein
    所述外部设备包括通用串行总线USB设备,通信接口包括USB接口,所述设置指令包括USB设置指令。The external device includes a universal serial bus USB device, the communication interface includes a USB interface, and the setting instructions include a USB setting instruction.
  15. 如权利要求13所述的装置,其中,所述配置上报模块是设置为通过如下方式实现将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机:The apparatus of claim 13, wherein the configuration reporting module is configured to notify the host of each function belonging to the same driving type supported by the communication interface of the external device by:
    将所述外部设备的通信接口所支持的属于同一驱动类型的每个功能的指示信息携带在字符串描述符中,将所述字符串描述符发送给所述主机。The indication information of each function belonging to the same driving type supported by the communication interface of the external device is carried in a string descriptor, and the string descriptor is sent to the host.
  16. 如权利要求13所述的装置,其中,所述配置上报模块是设置为通过如下方式实现将外部设备的通信接口所支持的属于同一驱动类型的每个功能通知给所述主机:The apparatus of claim 13, wherein the configuration reporting module is configured to notify the host of each function belonging to the same driving type supported by the communication interface of the external device by:
    确定所述外部设备的通信接口所支持的属于同一驱动类型的每个功能;将每个功能的指示信息形成序列,发送给所述主机。Determining each function belonging to the same driving type supported by the communication interface of the external device; forming the sequence of indication information of each function to the host.
  17. 如权利要求16所述的装置,其中,The device of claim 16 wherein
    所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。The position of the indication information through the function in the setting instruction in the sequence indicates the selected function.
  18. 如权利要求13~17中任一项所述的方法,其中,The method according to any one of claims 13 to 17, wherein
    所述功能的指示信息包括功能对应的关键字。The indication information of the function includes a keyword corresponding to the function.
  19. 一种设置于主机中的通信接口的功能复用装置,包括:A function multiplexing device for a communication interface disposed in a host, comprising:
    功能选择模块,设置为当收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能时,在所述多个属于同一驱动类型的功能中选择一个功能,并将所选择的功能通过设置指令通知所述外部设备; a function selection module, configured to: when receiving an external device notifying that the communication interface of the external device supports multiple functions belonging to the same drive type, selecting one of the plurality of functions belonging to the same drive type, and selecting the function The function notifies the external device by setting a command;
    接口功能配置模块,设置为根据所述功能选择模块所选择的功能,将与所述通信接口连接的数据接收通道和/或数据发送通道连接到与所选择的功能对应的协议栈。The interface function configuration module is configured to connect the data receiving channel and/or the data sending channel connected to the communication interface to a protocol stack corresponding to the selected function according to the function selected by the function selecting module.
  20. 如权利要求19所述的装置,其中,The device according to claim 19, wherein
    所述外部设备包括通用串行总线USB设备,通信接口包括USB接口,所述设置指令包括USB设置指令。The external device includes a universal serial bus USB device, the communication interface includes a USB interface, and the setting instructions include a USB setting instruction.
  21. 如权利要求19所述的装置,其中,所述功能选择模块是设置为通过如下方式实现收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能:The apparatus according to claim 19, wherein said function selection module is configured to implement a function of receiving an external device to notify said external device that said communication interface supports a plurality of functions belonging to the same drive type:
    收到所述外部设备发送的字符串描述符,所述字符串描述符中携带了所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息。Receiving a string descriptor sent by the external device, where the string descriptor carries indication information of multiple functions belonging to the same driving type supported by the communication interface of the external device.
  22. 如权利要求19所述的装置,其中,所述功能选择模块是设置为通过如下方式实现收到外部设备通知所述外部设备的通信接口支持多个属于同一驱动类型的功能:The apparatus according to claim 19, wherein said function selection module is configured to implement a function of receiving an external device to notify said external device that said communication interface supports a plurality of functions belonging to the same drive type:
    收到所述外部设备发送的序列,所述序列是由所述外部设备的通信接口所支持的属于同一驱动类型的多个功能的指示信息形成的序列。Receiving a sequence transmitted by the external device, the sequence being a sequence formed by indication information of a plurality of functions belonging to the same driving type supported by a communication interface of the external device.
  23. 如权利要求22所述的装置,其中:The device of claim 22 wherein:
    所述功能选择模块在所述设置指令中通过功能的指示信息在所述序列中的位置指示所选择的功能。The function selection module indicates, in the setting instruction, the selected function by the position of the indication information of the function in the sequence.
  24. 如权利要求19~23中任一项所述的装置,其中:A device according to any one of claims 19 to 23, wherein:
    所述功能的指示信息包括功能对应的关键字。The indication information of the function includes a keyword corresponding to the function.
  25. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1~6中任一项所述的方法。A computer storage medium having stored therein computer executable instructions for performing the method of any one of claims 1 to 6.
  26. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求7~12中任一项所述的方法。 A computer storage medium having stored therein computer executable instructions for performing the method of any one of claims 7-12.
PCT/CN2015/090950 2015-05-12 2015-09-28 Function multiplexing method and apparatus for communication interface WO2016179944A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510240533.1A CN106294237A (en) 2015-05-12 2015-05-12 A kind of multiplexing functions method and device of communication interface
CN201510240533.1 2015-05-12

Publications (1)

Publication Number Publication Date
WO2016179944A1 true WO2016179944A1 (en) 2016-11-17

Family

ID=57247654

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/090950 WO2016179944A1 (en) 2015-05-12 2015-09-28 Function multiplexing method and apparatus for communication interface

Country Status (2)

Country Link
CN (1) CN106294237A (en)
WO (1) WO2016179944A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108021524A (en) * 2017-12-29 2018-05-11 北京海泰方圆科技股份有限公司 A kind of switching method of USB device and its data transmission port
CN114253891A (en) * 2021-12-15 2022-03-29 北京云迹科技股份有限公司 Configuration method, device, equipment and storage medium
CN114253892B (en) * 2021-12-20 2023-02-07 深圳市拔超科技股份有限公司 USB HID signal prolonged transmission method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882116A (en) * 2010-06-13 2010-11-10 中兴通讯股份有限公司 Method for realizing audio transmission and mobile terminal
CN102725744A (en) * 2010-01-14 2012-10-10 微软公司 Extensions for usb driver interface functions
CN105094880A (en) * 2014-05-23 2015-11-25 中兴通讯股份有限公司 USB driving method, computer and compound equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7675932B2 (en) * 2006-11-09 2010-03-09 Rosemount Inc. Adapter for providing digital communication between a field device and a computer
CN101452435B (en) * 2008-12-12 2010-09-08 华为终端有限公司 USB terminal mode switching method and terminal
CN102902518B (en) * 2012-08-17 2017-06-06 中兴通讯股份有限公司 A kind of changing method of active USB device and its mode of operation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102725744A (en) * 2010-01-14 2012-10-10 微软公司 Extensions for usb driver interface functions
CN101882116A (en) * 2010-06-13 2010-11-10 中兴通讯股份有限公司 Method for realizing audio transmission and mobile terminal
CN105094880A (en) * 2014-05-23 2015-11-25 中兴通讯股份有限公司 USB driving method, computer and compound equipment

Also Published As

Publication number Publication date
CN106294237A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
US8650332B2 (en) Method for switching working mode, USB device, and host device
US20050204072A1 (en) Communication system, communication apparatus, communication method, and computer program thereof
US6957437B1 (en) Selecting a device driver for a peripheral device adapted to operate on a network and simplifying secondary printer installation
US20130132613A1 (en) Receiver configured to pair to multiple wireless devices
EP2320328B1 (en) Operation mode switching of data card and its control method, device and data card
KR20060048103A (en) Electronic device, method for controlling the same, information processing apparatus, and computer program
US9645952B2 (en) USB device communication system and working mode switching method to prevent USB device from adopting power interruption when reconfiguring firmware programs
WO2016179944A1 (en) Function multiplexing method and apparatus for communication interface
CN101645780B (en) Method and device for restoring allocation after power off and power on of power over Ethernet (POE) system
US20200026504A1 (en) Method, device, and storage medium for processing driver on terminal device side
US8891105B2 (en) Data printing method and system using the same
CN113268358B (en) Data communication method, device and system and multi-equipment cascade system
CN111061355B (en) Power supply data acquisition method and equipment
JP2001356885A (en) Control method and electronic equipment
US20130198548A1 (en) Apparatus and method for saving power of usb device
CN113867787A (en) Switching system and method between server network cards
EP3322130B1 (en) Communications device configuration method and communications device
US9390041B2 (en) Method for processing device connection, combination device and host device
EP2703988A2 (en) Storage device, control method for storage device and control program
KR200420506Y1 (en) Network switching apparatus for providing security function about mobile storage device and security computer system using by the network switching apparatus
WO2024066857A1 (en) Electronic device, processor, and data transmission method and apparatus
CN110505136B (en) Layered MODBUS communication system and method
EP3886368A1 (en) Control device, execution device, device management method, and device management system
EP4354307A1 (en) Link negotiation system and method, and device
JP2012129651A (en) Communication device, communication system, control method, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15891646

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15891646

Country of ref document: EP

Kind code of ref document: A1