Data transmission method compatible with multiple systems, plug-in device, product and medium
By designing a multi-system-compatible data transmission method in infrared module plug-ins, and using dual-protocol drivers and interface endpoints to identify the operating system, the problem that plug-in devices can only adapt to a single system is solved, and data transmission compatibility and convenient use across systems are achieved.
Patent Information
- Application Number
- CN202510501477.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-01
AI Technical Summary
The existing infrared module plug-ins can only be adapted to mobile phones with a single operating system, resulting in users needing to replace plug-ins when changing different operating systems, increasing costs and reducing convenience of use.
A multi-system-compatible data transmission method is designed, and a dual-protocol driver is implemented through the control chip in the plug-in device, which can identify and adapt to Android and IOS systems, determine the target protocol using the receipt information of the session establishment request, and establish a data transmission path through the preset interface endpoint.
The compatibility of plug-in devices on mobile phones in different operating systems is achieved, ensuring that plug-in devices can be correctly identified and used, reducing costs and improving user experience.
Smart Images

Figure CN120407494A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of driving display, and in particular, to a data transmission method compatible with multiple systems, a plug-in device, a computer program product, and a computer-readable storage medium. Background Art
[0002] With the development of technology, various portable electronic devices, such as smart phones, have become indispensable tools in people's lives. At present, the photographing function of mobile phones is mainly visible light images. With the development of infrared imaging technology, as an important sensing technology, infrared image sensors have been widely used in the fields of security, detection, night vision, etc. Integrating infrared imaging technology into mobile phones to expand the functions of mobile phones has increased the demand for mobile phones to have infrared imaging capabilities.
[0003] It is also known that some infrared module plugins that can be connected to mobile phones have appeared on the market. As accessories of mobile phones, they are plugged into mobile phones to make them have infrared imaging capabilities. However, all known infrared module plugins can only be adapted to mobile phones with a single operating system, that is, they can only be used on Android mobile phones or only on IOS mobile phones. If users change mobile phones with different operating systems, they need to replace the plugins accordingly, resulting in inconvenience for users. For manufacturers of infrared module plugins, they also need to conduct targeted design and production for different operating systems, and the cost is also higher. Summary of the Invention
[0004] To solve the existing technical problems, the present application provides a data transmission method compatible with multiple systems, a plug-in device, a computer program product, and a computer-readable storage medium that can be compatible with different operating systems to achieve data transmission.
[0005] In a first aspect, an embodiment of the present application provides a data transmission method compatible with multiple systems, which is applied to a plug-in device and includes:
[0006] After being plugged into a host device through an interface and establishing a communication connection, a session establishment request for a specified operating system protocol setting is sent to the host device based on the communication connection;
[0007] According to whether receipt information of the host device based on the session establishment request is received, determine the target protocol supported by the host device;
[0008] Perform data transmission according to the target protocol.
[0009] In a second aspect, an embodiment of the present application provides a plug-in device, including:
[0010] A control chip, storing a computer program, and executing the computer program to implement the data transmission method compatible with multiple systems according to any embodiment of the present application;
[0011] An image capture module for capturing image data;
[0012] An interface, connected to the control chip, for plugging the plug-in device into the host device.
[0013] In a third aspect, an embodiment of the present application provides a computer program product, including a computer program, which when executed by a processor implements the multi-system compatible data transmission method described in any embodiment of the present application.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor, it implements the multi-system compatible data transmission method described in any embodiment of the present application.
[0015] In the multi-system compatible data transmission method provided in the above embodiments, after the plug-in device is plugged into the host device through the interface and a communication connection is established, a session establishment request is uniformly sent to the host device based on the communication connection. The operating system type of the current host device is identified according to whether the host device will send a receipt for the session establishment request, so as to determine the target protocol supported by the current host device, and data transmission is performed according to the corresponding target protocol. In this way, the plug-in device can be compatible with host devices of different operating system types, interact with the host device, ensure that the plug-in device can be correctly recognized and used by different operating systems of the host device, and achieve the purpose of data transmission compatible with different operating systems.
[0016] In the above embodiments, the plug-in device, the computer program product, and the computer-readable storage medium belong to the same concept as the corresponding embodiments of the multi-system compatible data transmission method, and thus have the same technical effects as the embodiments of the multi-system compatible data transmission method, which will not be elaborated here. Description of the Drawings
[0017] Figure 1 It is a schematic diagram of an optional application scenario for the multi-system compatible data transmission method.
[0018] Figure 2 It is a schematic diagram of the endpoint application planning of the interface in an embodiment.
[0019] Figure 3 For Figure 2 Another schematic diagram of the endpoint application planning of the interface shown.
[0020] Figure 4 It is a schematic diagram of the principle of the logical interface in an embodiment.
[0021] Figure 5It is a flowchart of a data transmission method compatible with multiple systems in an embodiment.
[0022] Figure 6 It is a flowchart of a data transmission method compatible with multiple systems in another embodiment.
[0023] Figure 7 It is a schematic diagram of a plug-in device in an embodiment. Specific implementation manners
[0024] The technical solution of the present invention will be further elaborated in detail below in conjunction with the accompanying drawings of the specification and specific embodiments.
[0025] In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the drawings. The described embodiments should not be regarded as limitations of the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application.
[0026] In the following description, the expression "some embodiments" is involved, which describes a subset of all possible embodiments. It should be noted that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0027] In the following description, the terms "first, second, third" involved are only used to distinguish similar objects, and do not represent a specific order for the objects. It can be understood that "first, second, third" can be interchanged with a specific order or sequence when allowed, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0028] The inventors of the present application have conducted the following research on the many limitations of the infrared module plug-in.
[0029] At present, the known infrared module plugins can only be adapted to devices of a single operating system. They can either only be used on Android devices or only on iOS devices. This is mainly due to the differences between the UVC protocol supported by Android devices and the MFI protocol supported by iOS devices. For iOS devices, in the iOS operating system, the driver of the plugin interface must strictly follow the development specifications of the iOS operating system and pass the security authentication mechanism in order to achieve data transmission with iOS devices. Based on this, in order for the plugin to be applicable to both Android devices and iOS devices, a set of general dual-protocol drivers is proposed. This dual-protocol driver is optimized for the operating systems of Android devices (hereinafter referred to as the Android system) and iOS devices (hereinafter referred to as the iOS system). After the plugin is plugged into the host device through the interface, it is initialized to establish a communication connection, and a session establishment request is uniformly sent to the host device. Whether a receipt from the host device can be received for the session establishment request is used to distinguish the type of the operating system of the current host device. In the Android system, the dual-protocol driver can interact well with the underlying hardware of the Android system. In the iOS system, it can achieve seamless connection with the iOS system through the security authentication mechanism, ensuring that the plugin device can be correctly recognized and used by different operating systems of the host device.
[0030] Among them, the session establishment request is an MFI authentication request set for the MFI protocol of the iOS system. An MFI chip is provided in the infrared module plugin, and the control chip obtains the specific data required for MFI authentication from the MFI chip to support the session establishment request uniformly sent by the infrared module plugin to the currently plugged-in host device to contain these characteristic data, so as to achieve seamless connection with the iOS system.
[0031] It should be noted that the design concept of the general dual-protocol driver applicable to Android devices and iOS devices by the inventor of this application is not limited to the infrared module plugin and can be applicable to any plugin device that is independent of the host device and is plugged into the host device through the interface to expand functions; the type of the host device can also be not limited to Android devices and iOS devices and can be applicable to devices of other operating system types that support different communication protocol transmissions, such as Windows devices. Among them, the interface refers to the standard specifications for connection and communication between different systems, modules, or components and can refer to various known standard interface types. After the plugin device is plugged into the host device, the dual-protocol driver is run to execute a data transmission method compatible with multiple systems to identify the type of the current host device and establish a path for data transmission corresponding to the target protocol supported by the host device, so as to perform data transmission with the host device according to the target protocol.
[0032] Please refer to Figure 1, which is an optional application scenario diagram of the multi-system compatible data transmission method provided by the embodiments of the present application. Herein, the plug-in device takes the infrared module plug-in 10 plugged into the host device 20 through the USB interface 13 as an example. The infrared module plug-in 10 includes a control chip 11, an infrared module 12 connected to the control chip 11, and a USB interface 13. The control chip 11 is loaded with a dual-protocol driver for executing the multi-system compatible data transmission method provided by the embodiments of the present application. A preset association relationship is established between the general input / output interface of the control chip 11 and the endpoints of the USB interface 13 to form a transmission path required for implementing data transmission through the communication protocols of the host device 20 supporting different operating systems. The general input / output interface of the control chip 11 can be formed into a logical interface for sending and receiving the instructions and data required for the communication protocols of the host device 20 of different types of operating systems to establish data transmission channels accordingly.
[0033] Please refer to Figure 2 and Figure 3 , taking the infrared module plug-in being compatible with the MFI protocol of IOS devices and the UVC protocol of Android devices as an example, the general input / output interface of the control chip 11 forms two logical interfaces, namely the first logical interface interface0 and the second logical interface interface1. The first logical interface interface0 is used for signal processing to meet the MFI authentication required by the IOS operating system, and the second logical interface interface1 is used for data transmission under the simulated serial communication protocol. Among them, the first logical interface interface0 corresponds to the transmission path association formed by two endpoints of the USB interface, and is used to support the sending of authentication requests during the MFI authentication process and the receipt of receipt information returned by the host device based on the authentication request. The second logical interface interface1 corresponds to the transmission path association formed by three endpoints of the USB interface, and is used to support the sending and receiving of instructions and data required for establishing a data transmission channel through the UVC protocol, and the sending and receiving of instructions and data required for establishing a data transmission channel through the MFI protocol.
[0034] Please refer to Figure 4, it is a chip architecture diagram for an infrared module plug-in to set specific data required for authentication according to a specified operating system protocol. The specified operating system protocol is specifically the MFI protocol of the IOS operating system. The infrared module plug-in includes a control chip 11 and an MFI chip 14. Three General Purpose InputOutput (GPIO) interfaces of the control chip 11 are connected to the MFI chip 14 to establish a serial data communication connection for analog I2C communication, so as to obtain specific data required when initiating a session establishment request for the IOS operating system settings from the MFI chip 14. In this way, the control chip 11 of the infrared module plug-in can be selected from various known models of chips, establish a data communication connection for analog I2C communication with the MFI chip 14 through three GPIO interfaces, and form a mapping between two logical interfaces (the first logical interface interface0 and the second logical interface interface1) through two GPIO interfaces, so that through the loading and operation of the general driver, the transmission paths required for data transmission corresponding to multiple system protocols can be established using the predefined logical interfaces.
[0035] Please refer to Figure 5 , it is a data transmission method compatible with multiple systems provided by an embodiment of this application, which can be applied to a plug-in device, such as Figure 1 the infrared module plug-in 10 shown, and this data transmission method compatible with multiple systems includes:
[0036] S103, after being plugged into the host device through the interface and establishing a communication connection, send a session establishment request for the specified operating system protocol setting to the host device based on the communication connection.
[0037] The interface generally refers to the standard specification for connection and communication between different systems, modules or components, and can refer to various known standard interface types. In an optional example, the plug-in device is plugged into the host device through a USB interface, and the interface correspondingly refers to the USB interface used in the plug-in device to connect to the host device. When the plug-in device is plugged into the host device, the plug-in device is powered on and automatically initialized to a known initial state to ensure that the plug-in device can start running from a determined initial state every time it is started. For example, when the plug-in device is plugged into the host device through the interface, the host device will detect the change in the electrical signal on the USB interface bus to detect the connection status of the plug-in device, and the host device will send a reset signal to the plug-in device so that the plug-in device can perform device initialization based on the reset signal, and the plug-in device is initialized to a preset known state for subsequent communication. The communication connection refers to the communication path established between the plug-in device and the host device to allow data transmission and information exchange between them.
[0038] A session establishment request refers to a request sent by a plug-in device to a host device to initiate a new session.
[0039] The specified operating system protocol refers to the communication protocol supported by the operating system of one of the host devices of different operating systems that the plug-in device is compatible with. After the plug-in device is plugged into the host device through the interface, it uniformly sends a session establishment request set for the specified operating system protocol to the currently plugged-in host device. At this time, the host device with a non-specified operating system does not need to process the session establishment request, while the host device with the specified operating system will perform device authentication based on this session establishment request to obtain authorization for data transmission with the host device, so that the interface can be compatible with multiple systems for data transmission.
[0040] S105. Determine the target protocol supported by the host device according to whether the receipt information based on the session establishment request is received from the host device.
[0041] After the host device receives the session establishment request sent by the plug-in device, if it can recognize the session establishment request, it sends a receipt information of session establishment confirmation to the plug-in device. Among them, the session establishment request is an effective connection and data exchange mechanism set for the host device of the specified operating system, that is, only the host device of the specified operating system can recognize the session establishment request and return the receipt information of session establishment confirmation. In this way, the plug-in device can distinguish whether the currently plugged-in host device is the host device of the specified operating system based on whether it can receive the receipt information of the session establishment request from the host device, and then can determine the target protocol for data transmission corresponding to the currently plugged-in host device.
[0042] S107. Perform data transmission according to the target protocol.
[0043] The plug-in device can recognize and distinguish the target protocol corresponding to the currently plugged-in host device, so as to perform data transmission based on the target protocol subsequently.
[0044] In the multi-system compatible data transmission method provided in the above embodiments, when the plug-in device is plugged into the host device through the interface and a communication connection is established, a session establishment request is uniformly sent to the host device based on the communication connection. The operating system type of the current host device is identified according to whether the host device will send a receipt for the session establishment request, so as to determine the target protocol supported by the current host device, and data transmission is performed according to the corresponding target protocol. In this way, the plug-in device can be compatible with host devices of different operating system types, interact with the host device, ensure that the plug-in device can be correctly recognized and used by different operating systems of the host device, and achieve the purpose of compatible data transmission with different operating systems.
[0045] In some embodiments, before sending a session establishment request for setting a specified operating system protocol to the host device in step S103, it includes:
[0046] Sending a device descriptor to the host device; wherein, the interface includes a plurality of preset configured endpoints, and the endpoints are configured to establish transmission paths required for data transmission respectively by multi-system protocols, and the device descriptor includes the transmission paths required for the plurality of endpoints of the interface to support data transmission respectively by multi-system protocols.
[0047] Step S107 includes:
[0048] Determining a corresponding transmission path for data transmission according to the target protocol, and performing data transmission through corresponding endpoints of the interface according to the corresponding transmission path.
[0049] An endpoint (Endpoint, ep) refers to a logical interface in the plug-in device for communicating with the host device, and is the source or destination of data transmission. The transmission path correspondingly refers to a logical channel in the host device for communicating with the endpoint. After the preset multiple endpoints are configured, corresponding transmission paths will be allocated respectively for the host device to perform data transmission with the endpoints. Endpoints usually include bidirectional control endpoints, unidirectional input endpoints, and output endpoints.
[0050] A descriptor refers to a data structure provided by the plug-in device, which usually contains basic information such as the device, interface, and endpoint.
[0051] The device descriptor includes the basic information of the plug-in device for the host device to obtain the device descriptor, understand the configuration supported by the plug-in device, and prepare the resources required to establish a transmission path for data transmission between the host device and the plug-in device. In this embodiment, the device descriptor includes the transmission paths required for the preset multiple endpoints of the interface to support data transmission respectively by the dual-system protocol. The plug-in device sends the device descriptor to the host device, and the host device prepares the resources required to establish a corresponding transmission path with the plug-in device according to the communication protocol supported for data transmission by itself, so as to support subsequent data transmission.
[0052] In the above embodiment, the plug-in device can send the device descriptor to the host device by using the default endpoint of the interface during the initialization process for the host device to understand the configuration supported by the plug-in device and prepare the resources required to establish a transmission path for data transmission between the host device and the plug-in device.
[0053] In some embodiments, the multi-system protocol is a dual-system protocol including the UVC protocol for the Android system and the MFI protocol for the IOS system. The session establishment request is an authentication request for establishing a connection set for the MFI protocol, and the method further includes:
[0054] If the receipt information of the host device based on the session establishment request is received, determine that the host device is an IOS device;
[0055] If the receipt information of the host device based on the session establishment request is not received, determine that the host device is an Android device.
[0056] In this embodiment, the plug-in device is designed to be compatible with both the Android system and the IOS system. After the plug-in device is plugged into the host device, regardless of whether the currently plugged host device is an IOS device or not, an authentication request for establishing a connection for the MFI protocol setting is uniformly sent to the host device. If the currently plugged host device is an IOS device, the plug-in device will receive the receipt information after authentication is passed, and thus obtain the authorization to perform data transmission with the currently plugged IOS device; otherwise, the plug-in device will regard the currently plugged host device as an Android device to perform subsequent data transmission.
[0057] In an optional example, the endpoints in the interface are configured to establish a dual-system protocol to respectively implement the transmission paths required for data transmission. Among them, the multiple endpoints supporting the dual-system protocol to respectively implement the transmission paths required for data transmission include: the first endpoint corresponding to the first transmission path for transmitting control instructions supporting the UVC protocol, the second endpoint supporting the data transmission of the UVC protocol and the MFI protocol, the third endpoint supporting the third transmission path for transmitting control instructions of the MFI protocol, the fourth endpoint supporting the fourth transmission path for receiving authentication information of the MFI protocol, and the fifth endpoint supporting the fifth transmission path for sending authentication requests of the MFI protocol.
[0058] In this example, the dual-system protocol refers to the UVC protocol of the Android system and the MFI protocol of the IOS system. The interface has 5 endpoints. Among them, the first endpoint ep0 is a two-way control endpoint that supports both input and output. After the plug-in device is plugged into the host device, it enumerates device information to the host device through the first endpoint ep0, such as sending the device descriptor to the host device, and supports the transmission of control instructions. The second endpoint ep1 corresponds to a relatively large data storage buffer reserved as the endpoint for subsequent data transmission. The third endpoint ep2 is the OUT endpoint for transmitting control instructions of the IOS system. The fourth endpoint ep4 is the OUT endpoint for MFI authentication of the IOS system. The fifth endpoint ep5 is the IN endpoint for MFI authentication. After the endpoints in the interface are configured, the first endpoint ep0 is assigned the corresponding first transmission path. During data transmission, the second endpoint ep1 is assigned the corresponding second transmission path, the third endpoint ep2 is assigned the corresponding third transmission path, the fourth endpoint ep4 is assigned the corresponding fourth transmission path, and the fifth endpoint ep5 is assigned the corresponding fifth transmission path.
[0059] In the above embodiments, through application planning for the preset 5 endpoints of the interface, multiple transmission paths supporting the UVC protocol for the Android system and the MFI protocol for the IOS system are formed through configuration. In this way, the configuration of the interface can be compatible with the data transmission of both the UVC protocol for the Android system and the MFI protocol for the IOS system.
[0060] In some embodiments, in step S103, the sending of a session establishment request for a specified operating system protocol setting to the host device based on the communication connection includes:
[0061] Sending an authentication request for the MFI protocol to the host device through the fifth transmission path corresponding to the fifth endpoint of the interface; wherein, after receiving the authentication request, the IOS device returns an authentication receipt message through the fourth transmission path corresponding to the fourth endpoint, and the Android device does not establish a data transmission path corresponding to the fifth endpoint and the fourth endpoint.
[0062] In this embodiment, still taking the example of a plug-in device designed to be compatible with both the Android system and the IOS system, for the configuration of the endpoints in the interface, a one-way input endpoint, that is, the fifth endpoint, and a one-way output endpoint, that is, the fourth endpoint, are used to complete the sending of the session establishment request and the receipt of the receipt message.
[0063] In some embodiments, the determining of the corresponding transmission path for data transmission according to the target protocol and the performing of data transmission through the corresponding endpoints of the interface according to the corresponding transmission path include:
[0064] If the target protocol is the MFI protocol, complete the MFI authentication of the IOS device through the corresponding transmission paths of the fourth and fifth endpoints of the interface;
[0065] After the MFI authentication is passed, receive the data transmission instruction issued by the IOS device through the corresponding transmission path of the third endpoint of the interface, and perform data transmission and instruction transmission during the data transmission to the IOS device through the corresponding transmission path of the second endpoint of the interface based on the data transmission instruction.
[0066] After the plug-in device is plugged into the host device through the interface, during the initialization process, it enumerates device information to the host device, so that the host device can understand the configurations supported by the plug-in device and prepare the resources required to establish a transmission path for data transmission between the host device and the plug-in device. After the plug-in device and the host device establish a communication connection, it sends a session establishment request to the host device through the transmission path corresponding to the specified endpoint. Different types of host devices return or do not return receipt information for the session establishment request. In an example where different types of host devices refer to Android devices running the Android system and iOS devices running the iOS system, the session establishment request refers to an MFI authentication request for establishing a connection with an iOS device according to the MIF protocol. For an iOS device, it returns an MFI authentication receipt information in response to the MFI authentication request of the plug-in device. In this way, the plug-in device can be adapted to be used with an iOS device, and through the security authentication mechanism of the iOS device, subsequent data transmission with the iOS device can be realized.
[0067] In the above embodiment, through the application planning of the preset 5 endpoints of the interface, and through endpoint configuration, the interface is formed into multiple transmission paths that support the MFI protocol of the iOS system. In this way, the plug-in device can be directly plugged into the iOS device for use, and the function of the plug-in device can be conveniently extended for the iOS device.
[0068] In some embodiments, determining the corresponding transmission path for data transmission according to the target protocol and performing data transmission through the corresponding endpoint of the interface according to the corresponding transmission path includes:
[0069] If the target protocol is the UVC protocol, receive the data transmission instruction sent by the host device through the corresponding transmission path of the first endpoint of the interface, and perform data transmission to the Android device through the corresponding transmission path of the second endpoint of the interface based on the data transmission instruction, and realize the instruction transmission of the Android device during the data transmission process based on the corresponding transmission path of the first endpoint.
[0070] After the plug-in device is plugged into the host device through the interface, during the initialization process, it enumerates device information to the host device, so that the host device can understand the configurations supported by the plug-in device and prepare the resources required to establish a transmission path for data transmission between the host device and the plug-in device. After the plug-in device and the host device establish a communication connection, it sends a session establishment request to the host device through the transmission path corresponding to the specified endpoint. Different types of host devices return or do not return receipt information for the session establishment request.
[0071] In an example where different types of host devices refer to Android devices running the Android system and iOS devices running the iOS system, the session establishment request is to send an MFI authentication request to the host device. For Android devices, the session establishment request will be directly discarded. Thus, for the plug-in device, it cannot receive the receipt information returned by the host device. At this time, it can be confirmed that the type of the currently plugged-in host device is an Android device. Since through the aforementioned step of enumerating device information, the Android device can identify the relevant information of the plug-in device in the step of enumerating device information and implement data transmission through the pre-determined transmission path allocated by the endpoint. In this way, the plug-in device can also be adapted to be used with Android devices.
[0072] In the above embodiment, through the application planning of the preset 5 endpoints of the interface, and through endpoint configuration, multiple transmission paths that support the UVC protocol of the Android system are formed for the interface. Thus, the plug-in device can be directly plugged into the Android device for use, and the function of the plug-in device can be conveniently extended for the Android device.
[0073] In some embodiments, the interface is a USB interface, and the sending of the device descriptor to the host device includes:
[0074] Through USB enumeration, send the device descriptor to the host device, and receive the resource configuration information returned by the host device after allocating transmission resources based on USB enumeration. Establish a corresponding transmission path with the currently plugged-in host device according to the resource configuration information.
[0075] Taking the interface specifically referring to a USB interface as an example, the plug-in device refers to a plug-in device using a USB interface. When the plug-in device is plugged into the host device, the USB host controller of the host device will detect the change in the connection state of the plug-in device and initiate the USB Enumeration process. Through USB enumeration, the initialization process of the host device for identifying and configuring the plug-in device is realized.
[0076] In an optional example, USB enumeration includes the host device sending a command to obtain a device descriptor to the plug-in device, requesting the plug-in device to provide it with a device descriptor, which usually can include device type (such as mouse, keyboard, storage device, etc.), manufacturer information, product information, communication capabilities of the device (supported USB version, maximum transfer speed), etc. The host device will select a corresponding appropriate configuration according to the information in the device descriptor. The configuration defines the resource allocation required for the plug-in device to execute data transmission in the working mode, so as to determine how to communicate with the plug-in device, and send a Set Configuration instruction to the plug-in device. The Set Configuration instruction carries the resource configuration information after the host device allocates resources for the corresponding data transmission. The plug-in device initializes its internal hardware resources and functional modules according to the Set Configuration instruction. During the USB enumeration process, the host device will obtain the planning information of the interfaces and endpoints of the plug-in device by sending commands to obtain interface descriptors and endpoint descriptors, and the host device will allocate transmission resources for the plug-in device according to the planning information of the interfaces and endpoints of the plug-in device, and establish a transmission path accordingly.
[0077] In the above embodiment, for the plug-in device with a USB interface type, by configuring the descriptors enumerated in the USB enumeration process, the USB enumeration enables the plug-in device to establish a transmission path required for data transmission with different types of host devices, achieving the purpose of being compatible with different types of host devices for data transmission.
[0078] In some embodiments, the endpoints of the interface are configured to form two logical interfaces corresponding to two general-purpose input / output ports of the control chip, and the logical interfaces are the iap2 interface and the data interface respectively;
[0079] The device descriptor includes the association description of the iap2 interface and its corresponding two endpoints, and the description of the endpoints corresponding to the transmission paths for implementing control instructions and data of the data interface.
[0080] Among them, the descriptors enumerated in the USB enumeration process include interface descriptors and endpoint descriptors. In this embodiment, the interface descriptor includes two logical interfaces, one iap2 (IOS Accessory Protocol 2) interface for MFI authentication of accessories for IOS devices, and one data interface for transmitting data and instructions. Taking the plug-in device as an infrared module plug-in for expanding the infrared image function of the host device as an example, transmitting data mainly refers to transmitting image data, and the data interface is the VIDEO interface. In the field of infrared images, infrared image transmission can adopt the information line mechanism to transmit each frame of image data in the form of information lines, and an indefinite number of information lines can also be added after each frame of image data to transmit information.
[0081] For IOS devices, an EAP (External Accessory Protocol) connection is established in the Identification stage of the MFI authentication process. After this stage is completed, the IOS device can send instructions to the infrared module plug-in through the endpoint ep2 corresponding to the transmission path that supports the transmission of MFI protocol control instructions, and receive data from the infrared module plug-in through the endpoint ep1 corresponding to the transmission path that executes the information line mechanism and transmit it to the IOS device. The endpoint ep1 corresponding to the transmission path of the information line mechanism is used as the transmission endpoint for image data and cannot be used as the IN endpoint of the instruction interface. Considering the endpoint characteristics and the requirements of IOS devices for accessories, the information line is used as the return value for instruction transmission, thus ensuring the integrity of the image data stream and also fulfilling the control requirements for the IOS device to send instructions to the plug-in end. For Android devices, data from the infrared module plug-in is received through the endpoint ep1 corresponding to the transmission path that executes the information line mechanism and transmitted to the Android device. The control endpoint ep0 corresponding to the transmission of control instructions that support the UVC protocol can be used for the control requirements of the Android device to send instructions to the plug-in end during the transmission of image data based on the information line mechanism.
[0082] Among them, the descriptors for setting the iap2 interface include the IAD descriptor, the Interface descriptor, and the descriptors for two endpoints (ep4, ep5) corresponding to executing the MFI authentication request. Compared with the standard UVC protocol, the dual-protocol driver for the data transmission method compatible with multiple systems provided in this embodiment of the application uses the general-purpose input / output ports of the control chip of the plug-in device to simulate the logic interface interface0, adds a logic interface interface0 corresponding to the iap2 interface for executing the MFI authentication, changes the parameter bFunctionClass in the IAD descriptor of the iap2 interface from 0x0e (representing the video interface class) to 0xff (representing the vendor-defined class), changes bFunctionSubClass from 0x03 to 0xf0 (indicating the MFI accessory) specified in the MFI protocol, modifies the corresponding interface descriptor, and configures the endpoint (ep) descriptor in BULK mode. The VIDEO interface includes two alternate (altsetting) interfaces. In this way, compared with the parameter configuration of the UVC protocol, only the parameter value indicating the video interface class in the interface descriptor needs to be modified to the parameter value of the MFI Accessory (MFI accessory) class specified in the MFI protocol, and the endpoint (ep) is determined as the BULK transfer endpoint. Thus, the dual-protocol driver configures through the application planning of the endpoints of the interface and combines the transmission method of the image data based on the information line mechanism, so as to achieve the purpose of being common to Android devices and IOS devices, and make the infrared module plug-in compatible with Android devices and IOS devices for use.
[0083] In order to have a more overall understanding of the data transmission method compatible with multiple systems provided in this embodiment of the application, please refer to Figure 6 , taking the plug-in device as an infrared module plug-in connected to the host device through a USB interface as an example, and the host device refers to an Android device and an IOS device, the data transmission method compatible with multiple systems will be exemplified and described. The method includes:
[0084] S11. The infrared module plug-in is powered on and reset, and the infrared core is started.
[0085] The infrared module plug-in is connected to the host device (host side) through the USB interface. The host side detects the level change of the USB interface, thereby detecting the connection state of the infrared module plug-in. The infrared module plug-in receives the reset signal and starts.
[0086] S12. USB initialization.
[0087] The USB interface is initialized to initialize the infrared module plug-in to a preset known state.
[0088] S13. USB enumeration.
[0089] The infrared module plug-in sends descriptors to the host through the USB enumeration process, sending the descriptor information of the device, interface, and endpoints to the host, so that the corresponding host can prepare the resources required for subsequent data transmission based on the descriptors, establish the transmission path for data transmission, and enable the infrared module plug-in to be correctly recognized and used by the host system.
[0090] In the embodiments of the present application, the dual-protocol driver that executes the data transmission method compatible with multiple systems mainly configures the application plan of the endpoints of the interface, combines the image data with the transmission method based on the information line mechanism, and sends the application plan of the endpoints to the host through USB enumeration to achieve the purpose of being universal for Android devices and IOS devices, so that the infrared module plug-in can be used compatibly with Android devices and IOS devices.
[0091] S14, Send an iap2 authentication request to the host.
[0092] S15, Determine whether a receipt from the host is received. If so, execute S161; if not, execute S171.
[0093] S161, Execute the iap2 authentication process of the MFI protocol.
[0094] S162, If the authentication is passed, the ISO device side issues a drawing instruction through the preset endpoint ep2.
[0095] S171, The Android device side issues a drawing instruction through the preset endpoint ep0.
[0096] S18, According to the received drawing instruction, the infrared core sends image data to the host through the preset endpoint ep1.
[0097] Among them, during the process of image data transmission, the IOS device side can send / receive instructions through endpoints ep2 and ep1, and the Android device side can send / receive instructions through ep0.
[0098] S19, Receive the stop drawing instruction and end the image data transmission.
[0099] The stop drawing instruction can be obtained based on the instruction received from the host or by detecting that the preset stop drawing condition is met. For example, reaching the preset image data transmission time, the power of the plug-in side, etc.
[0100] In the above embodiments, the design of the dual-system driver for implementing the data transmission method compatible with multiple systems can achieve cross-system compatibility, support the plug-in expansion functions of different operating systems of Android devices and IOS devices. It can be understood that this dual-system driver can be widely applied to various mobile phone plug-ins, and is not just a variant of the UVC protocol for Android devices. Various mobile phone plug-ins connected through the USB interface can draw on it. For different host terminals, the chips thereof can be applicable to the number of endpoints required for the application planning of the endpoints of the USB interface in the dual-system driver. For example, the plug-in device in the embodiment of the present application also supports compatible use with Windows devices. In this way, by adopting a general interface and an optimized dual-system driver, the plug-in can be stably connected to the host terminals of the two systems and achieve efficient data transmission, breaking the limitation that the existing plug-ins can only be adapted to a single operating system, providing a more convenient user experience for users and reducing the usage cost.
[0101] Please refer to Figure 7 , on the other hand, the present application further provides a plug-in device, including a control chip 11, an image capture module 121 and an interface 131. The image capture module 121 is used to collect image data. The interface 131 is connected to the control chip 11 and is used to plug the plug-in device into the host device. The control chip 11 stores a computer program, and executes the computer program to implement the data transmission method compatible with multiple systems described in any embodiment of the present application, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0102] Taking the MFI protocol compatible with IOS devices and the UVC protocol compatible with Android devices of the plug-in device as an example, the plug-in device further includes an MFI chip, and the MFI chip is connected to the control chip 11. The control chip 11 executes a dual-protocol driver, and the process of the data transmission method for realizing compatibility with multiple systems includes: after the plug-in device is plugged into the host device, the device information is enumerated through the interface for the host device to understand the configurations supported by the plug-in device, and to prepare the resources required to establish a transmission path for data transmission between the plug-in device and the host device, and a setting configuration instruction is returned for the plug-in device to establish a communication connection with the host device according to the setting configuration instruction. After the plug-in device and the host device establish a communication connection, the control chip 11 obtains the specific data required when initiating an MFI authentication request for the MFI protocol setting of the IOS operating system from the MFI chip, sends a session establishment request including these specific data to the currently plugged-in host device, and determines whether the currently plugged-in host device is an IOS device or an Android device by whether the receipt information returned by the currently plugged-in host device for the session establishment request is obtained. The plug-in device transmits the image data and sends and receives instructions during the image data transmission according to the transmission path of the data transmission established according to the communication protocol supported by the corresponding host device type based on the type of the currently plugged-in host device.
[0103] Optionally, the interface 131 is a USB interface, and the image capture module 121 is an infrared image capture module. The plug-in device can be plugged into host devices of different operating system types through the USB interface, and transmit the image data to the host device according to the target protocol supported by the host devices of different operating system types.
[0104] On the other hand, an embodiment of the present application further provides a computer program product, including a computer program, which when executed by a processor, realizes the data transmission method for compatible multi-systems described in any embodiment of the present application, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0105] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it realizes each process of the data transmission method embodiment for compatible multi-systems described in any of the above embodiments, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here. Among them, the computer-readable storage medium is, for example, a read-only memory (Read-Only Memory, abbreviated as ROM), a random access memory (Random Access Memory, abbreviated as RAM), a magnetic disk or an optical disc, etc.
[0106] It should be noted that in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including that element.
[0107] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0108] The above are only the specific embodiments of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A data transmission method compatible with multiple systems, applied to a plug-in device, characterized in that, Including: After being plugged into and establishing a communication connection with a host device through an interface, sending a session establishment request for a specified operating system protocol setting to the host device based on the communication connection; Determining a target protocol supported by the host device according to whether receipt information of the host device based on the session establishment request is received; Performing data transmission according to the target protocol accordingly.
2. The data transmission method compatible with multiple systems according to claim 1, characterized in that Before sending the session establishment request for a specified operating system protocol setting to the host device based on the communication connection, including: Sending a device descriptor to the host device; wherein the interface includes a plurality of preset configured endpoints, the endpoints are configured to establish transmission paths required for data transmission respectively by multiple system protocols, and the device descriptor includes information on the transmission paths required for data transmission respectively by multiple system protocols supported by the plurality of endpoints of the interface; The performing data transmission according to the target protocol accordingly includes: Determining a corresponding transmission path for data transmission according to the target protocol, and performing data transmission through a corresponding endpoint of the interface according to the corresponding transmission path.
3. The data transmission method compatible with multiple systems according to claim 2, wherein The multiple system protocols are a dual-system protocol including a UVC protocol for the Android system and an MFI protocol for the IOS system; The session establishment request is an authentication request for establishing a connection set for the MFI protocol, and the method further includes: If receipt information of the host device based on the session establishment request is received, determining that the host device is an IOS device; If receipt information of the host device based on the session establishment request is not received, determining that the host device is an Android device.
4. The data transmission method compatible with multiple systems according to claim 3, characterized in that The transmission paths required for the plurality of endpoints to support data transmission respectively by the dual-system protocol include: a first transmission path corresponding to the first endpoint for controlling instruction transmission of the UVC protocol, a second transmission path for the second endpoint to support data transmission of the UVC protocol and the MFI protocol, a third transmission path for the third endpoint to support controlling instruction transmission of the MFI protocol, a fourth transmission path for the fourth endpoint to support receiving authentication information of the MFI protocol, and a fifth transmission path for the fifth endpoint to support sending an authentication request of the MFI protocol.
5. The data transmission method compatible with multiple systems according to claim 4, characterized in that, The sending the session establishment request for a specified operating system protocol setting to the host device based on the communication connection includes: Sending an authentication request of the MFI protocol to the host device through a fifth transmission path corresponding to the fifth endpoint of the interface; wherein after receiving the authentication request, the IOS device returns receipt information of the authentication through a fourth transmission path corresponding to the fourth endpoint, and the Android device does not establish a data transmission path corresponding to the fifth endpoint and the fourth endpoint.
6. The data transmission method compatible with multiple systems according to claim 4, characterized in that, The determining a corresponding transmission path for data transmission according to the target protocol, and performing data transmission through a corresponding endpoint of the interface according to the corresponding transmission path includes: If the target protocol is the MFI protocol, completing the MFI authentication of the IOS device through the corresponding transmission paths of the fourth endpoint and the fifth endpoint of the interface; After the MFI certification is passed, receive the data transmission instruction sent by the IOS device through the corresponding transmission path of the third endpoint of the interface, and perform data transmission and instruction transmission during the data transmission process to the IOS device through the corresponding transmission path of the second endpoint of the interface.
7. The data transmission method compatible with multiple systems according to claim 4, characterized in that Determining the corresponding transmission path for data transmission according to the target protocol, and performing data transmission through the corresponding endpoint of the interface according to the corresponding transmission path, includes: If the target protocol is the UVC protocol, receive the data transmission instruction sent by the Android device through the corresponding transmission path of the first endpoint of the interface, perform data transmission to the Android device through the corresponding transmission path of the second endpoint of the interface based on the data transmission instruction, and implement the instruction transmission of the Android device during the data transmission process based on the corresponding transmission path of the first endpoint.
8. The data transmission method compatible with multiple systems according to claim 2, characterized in that, The interface is a USB interface, and sending the device descriptor to the host device includes: Through USB enumeration, send the device descriptor to the host device, and receive the resource configuration information returned by the host device after allocating transmission resources based on USB enumeration. Establish a corresponding transmission path with the currently plugged-in host device according to the resource configuration information.
9. The data transmission method compatible with multiple systems according to claim 8, wherein The endpoints of the interface are configured to form two logical interfaces corresponding to two general-purpose input / output ports of the control chip, and the logical interfaces are the iap2 interface and the data interface respectively; The device descriptor includes the association description of the iap2 interface and its corresponding two endpoints, and the description of the endpoints corresponding to the transmission paths for implementing control instructions and data of the data interface.
10. A plug-in device, characterized in that, Includes: A control chip, storing a computer program, and executing the computer program to implement the multi-system compatible data transmission method according to any one of claims 1 to 9; An image capture module, used for capturing image data; An interface, connected to the control chip, used for plugging the plug-in device into the host device.
11. The plug-in device according to claim 10, characterized in that, The interface is a USB interface, and the image capture module is an infrared image capture module; The plug-in device can be plugged into host devices of different operating system types through the USB interface, and transmit the image data to the host device according to the target protocols supported by the host devices of different operating system types.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the multi-system compatible data transmission method according to any one of 1 to 9.
13. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, it implements the multi-system compatible data transmission method according to any one of 1 to 9.