Hardware equipment calling method and device

By dynamically creating virtual device drivers in the virtual bus driver between terminal devices, the problem of insufficient hardware device call compatibility and scalability in the prior art is solved, and flexible call and management of multiple USB hardware devices is realized.

CN119225820APending Publication Date: 2024-12-31HONOR DEVICE CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310782520.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-28
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The prior art has poor compatibility, expansion and flexibility in hardware device calls between terminal devices, and it is impossible to effectively call hardware devices other than cameras, such as microphones and speakers.

Method used

By installing a virtual bus driver in the first terminal device, obtaining its hardware device information after detecting the second terminal device, dynamically creates a virtual device driver, and realizing calls to multiple USB hardware devices, and deleting the virtual device driver when not needed to increase flexibility.

Benefits of technology

The compatibility and extensibility of the hardware device call method is improved, allowing the first terminal device to dynamically call a variety of USB hardware devices, and the support and management of hardware devices other than cameras is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225820A_ABST
    Figure CN119225820A_ABST
Patent Text Reader

Abstract

The invention provides a hardware equipment calling method and device. The compatibility, expansibility and flexibility of calling hardware equipment of second terminal equipment by first terminal equipment are improved. The method comprises the following steps: a first terminal device obtains hardware device information of a second terminal device, wherein the hardware device information comprises device identification information of the second terminal device, type identification information of at least one hardware device of the second terminal device and hardware device capability information of the at least one hardware device; creating a virtual device driver for each of the at least one hardware device through the virtual bus driver based on the hardware device information; when it is detected that a first application program calls a message request of a first hardware device in the at least one hardware device through the first virtual device driver, receiving a data stream from a second terminal device through the data channel, the first virtual device driver is created by the virtual bus driver based on the hardware device information of the first hardware device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a method and apparatus for calling a hardware device. Background Art

[0002] Currently, for terminal devices that support Internet services, such as mobile phones, tablets, laptops, etc., users can interconnect the first terminal device and the second terminal device through the Internet service, thereby using the hardware devices of the second terminal device, such as cameras, microphones, speakers, etc., through applications on the first terminal device.

[0003] For example, when the first terminal device is a laptop, the second terminal device is a mobile phone, the hardware device is a camera, and the application is a conference application, when a user uses a laptop for a video conference and needs to conduct an experimental demonstration, it is difficult to capture the complete experimental demonstration screen through the laptop's camera. The laptop can call the mobile phone's camera function to obtain the video data captured by the mobile phone's camera, thereby improving the effect of the video demonstration. Specifically, the laptop includes a developed virtual device driver, and the laptop uses the virtual device driver to call the mobile phone's camera to shoot and obtain the captured video data.

[0004] However, such hardware device calling method has poor compatibility, scalability and flexibility. Summary of the invention

[0005] The present application provides a hardware device calling method and apparatus, which can improve the compatibility, scalability and flexibility of a hardware device called by a first terminal device on a second terminal device.

[0006] In a first aspect, a hardware device calling method is provided, which is applied to a system including a first terminal device and a second terminal device, a user logs in to the same account on the first terminal device and the second terminal device, and the wireless fidelity WiFi switch and the Bluetooth switch of the first terminal device and the second terminal device are both in the on state, the method comprising: when the second terminal device is detected, the first terminal device obtains the hardware device information of the second terminal device, the hardware device information includes the device identification information of the second terminal device, the type identification information of at least one hardware device of the second terminal device, and the hardware device capability information of the at least one hardware device; based on the hardware device information, the first terminal device creates a virtual device driver for each hardware device in the at least one hardware device through a virtual bus driver, and the virtual bus driver is used to manage the virtual device driver; when it is detected that a first application calls a message request of a first hardware device in the at least one hardware device through the first virtual device driver, the first terminal device receives a data stream from the second terminal device through a data channel, and the first virtual device driver is created by the virtual bus driver based on the hardware device information of the first hardware device.

[0007] The hardware device calling method of the present application is that when the first terminal device detects the second terminal device, the first terminal device can obtain the hardware device information of the hardware device in the second terminal device; based on the hardware device information of each hardware device, the first terminal device can create a virtual device driver corresponding to each hardware device through a virtual bus driver; then, when the first terminal device needs to call the hardware device of the second terminal device, it can obtain the data stream from the second terminal device through the virtual device driver corresponding to the hardware device. It can be seen that the first terminal device can dynamically create virtual device drivers with different attributes based on the type and number of hardware devices of the second terminal device through the virtual bus driver. In this way, when the first terminal device calls hardware devices other than the camera in the second terminal device, there is no need to redevelop the virtual device drivers for hardware devices other than the camera, which improves the scalability of the hardware device calling method; and the virtual bus driver can create a virtual device driver corresponding to any USB hardware device, so that the first terminal device can call a variety of USB hardware devices, which improves the compatibility of the hardware device calling method; in addition, the first terminal device can create a corresponding number of virtual device drivers based on the number of hardware devices of the second terminal device, and when the first terminal device no longer needs to call the hardware device of the second terminal device, the first terminal device can also delete the virtual device driver through the virtual bus driver, and can also delete the virtual bus driver at the same time, which improves the flexibility of the hardware device calling method.

[0008] It should be understood that an account may refer to a personal registration account provided by different terminal device brands to ensure the device security of the user. After the first terminal device and the second terminal device log in to the same account, data sharing between the devices can be achieved. When the first terminal device and the second terminal device log in to the same account, and the WiFi switch and the Bluetooth switch of the first terminal device and the second terminal device are both turned on, the first terminal device can detect the second terminal device.

[0009] In certain implementations of the first aspect, the first terminal device includes an application layer and a kernel layer; the application layer includes the first application, a first device virtualization module and a first communication service manager, the first device virtualization module is used to control the creation and deletion of virtual device drivers and process requests from applications, and the first communication service manager is used to perform data transmission between devices; the kernel layer includes the virtual bus driver, the virtual device driver and a driver development framework.

[0010] It should be understood that the number of virtual device drivers may be 0 or more. When the number of virtual device drivers is more than one, the properties of any two virtual device drivers among the multiple virtual device drivers may be different.

[0011] In certain implementations of the first aspect, the first terminal device obtains hardware device information of the second terminal device, including: the first device virtualization module obtains the hardware device information; based on the hardware device information, the first terminal device creates a virtual device driver for each hardware device of the at least one hardware device through the virtual bus driver, including: the first device virtualization module creates a virtual device driver corresponding to the attributes indicated by the type identification information, device identification information and hardware device capability information of each hardware device through the virtual bus driver.

[0012] It should be understood that the first device virtualization module can be used to implement data transmission between the first terminal device and the second terminal device, and can control the virtual bus driver to create a virtual device driver. The first terminal device can obtain hardware device information from the second terminal device through the first virtualization module; and can control the virtual bus driver to create or delete a virtual device driver through the first virtualization module.

[0013] In certain implementations of the first aspect, the creation of a virtual device driver corresponding to the attributes indicated by the type identification information, device identification information, and hardware device capability information of each hardware device includes: the first device virtualization module converts the type identification information and device identification information of each hardware device into a hardware device type descriptor in a universal serial bus (USB) protocol, and converts the hardware device capability information of each hardware device into a hardware device configuration descriptor in the USB protocol; the first device virtualization module transmits the hardware device type descriptor and the hardware device configuration descriptor to the virtual bus driver; the virtual bus driver creates a virtual device driver corresponding to the hardware device type descriptor and the hardware device configuration descriptor.

[0014] It should be understood that each available hardware device in the second terminal device can be identified as a USB device by the first terminal device, and the first device virtualization module needs to create a corresponding virtual device driver for each hardware device in the second terminal device. The hardware device type descriptor can be understood as a device descriptor, and the hardware device configuration descriptor can be understood as a configuration descriptor. In addition to the hardware device type descriptor and the hardware device configuration descriptor, the first device virtualization module can also configure other types of descriptors for each hardware device, such as string descriptors, etc. The virtual bus driver can create a virtual device driver corresponding to the descriptor of each hardware device.

[0015] In certain implementations of the first aspect, the second terminal device includes a second communication service manager, and the first communication service manager and the second communication service manager are used to implement data transmission between the first terminal device and the second terminal device; the first device virtualization module obtains the hardware device information, including: the first device virtualization module establishes a control channel; the first communication service manager sends a first request to the second communication service manager through the control channel, and the first request is used to request the hardware device information; the first communication service manager receives the hardware device information from the second communication service manager; the first communication service manager transmits the hardware device information to the first device virtualization module.

[0016] It should be understood that the second terminal device may be a terminal device such as a mobile phone or a tablet computer. The second terminal device may be installed with an Android system, and the software structure of the second terminal device may include an application layer and an application framework layer. The application framework layer of the second terminal device may include a second communication service manager. The control channel may be a data transmission channel for transmitting a control request.

[0017] In certain implementations of the first aspect, after the first communication service manager transmits the hardware device information to the first device virtualization module, the method further includes: the first device virtualization module deleting the control channel.

[0018] It should be understood that when a control request needs to be transmitted between the first terminal device and the second terminal device, the first device virtualization module can create a control channel, for example, the first terminal device needs to obtain the hardware device information of the second terminal device through the device virtualization module; when the first terminal device does not need to send a control request to the second terminal device, the first device virtualization module can delete the control channel, for example, after the first terminal device has created a virtual device driver corresponding to each hardware device in the second terminal device, the first device virtualization module can determine that the first terminal device no longer needs to send a control request to the second terminal device within a certain period of time, and can delete the control channel.

[0019] In certain implementations of the first aspect, the first device virtualization module establishes a control channel, including: when the hardware device information cannot be read from the cloud server, the first device virtualization module establishes the control channel.

[0020] It should be understood that, when the hardware device information of the second terminal device is stored in the cloud server, the first terminal device can directly obtain the hardware device information from the cloud server; when the cloud server does not store the hardware device information of the second terminal device, the first terminal device needs to obtain the hardware device information from the second terminal device. At this time, the first terminal device requires the second terminal device to send a control request for requesting the hardware device information. Therefore, the first device virtualization module establishes a control channel.

[0021] In certain implementations of the first aspect, the method also includes: when a change is detected in the cache message queue corresponding to the first virtual device driver, the first device virtualization module reads a second request from the cache message queue, and the second request is used to request to obtain the data stream; the first terminal device receives the data stream from the second terminal device through a data channel, including: the first device virtualization module sends the data stream to the virtual bus driver based on the second request; the virtual bus driver matches and encapsulates the data stream and the second request in the cache message queue to obtain an encapsulated data packet, and feeds the encapsulated data packet back to the first application.

[0022] It should be understood that the first device virtualization module can monitor the cache message queue corresponding to each virtual device driver in real time. When there is a change in the cache message queue corresponding to the first virtual device driver, the first device virtualization module can read the request in the cache message queue corresponding to the first virtual device driver. The second request can be a data request for requesting the transmission of a data stream, such as the transmission of video data, audio data, etc. The cache message queue is a message queue for caching message requests related to the first virtual device driver. Therefore, when the virtual bus driver receives the data stream from the first device virtualization module, it needs to match the second request corresponding to the data stream from the cache message queue and encapsulate the second request and the data stream.

[0023] In certain implementations of the first aspect, the method also includes: when it is detected that the second terminal device is offline, the first terminal device deletes the virtual device driver corresponding to the at least one hardware device through the virtual bus driver, and the second terminal device being offline indicates that the WiFi switch and / or Bluetooth switch of at least one device of the first terminal device and the second terminal device is in an off state, or, the first terminal device and the second terminal device are not logged in to the same account.

[0024] It should be understood that when the second terminal device goes offline, the first terminal device will no longer be able to detect the second terminal device. Therefore, the first terminal device can no longer call the hardware device of the second terminal device, and the first terminal device can delete the virtual device driver corresponding to at least one hardware device through the virtual bus driver.

[0025] In certain implementations of the first aspect, the first terminal device deletes the virtual device driver corresponding to the at least one hardware device through the virtual bus driver, including: the first communication service manager detects that the second terminal device is offline, and notifies the first device virtualization module to delete the virtual device driver corresponding to the at least one hardware device; the first device virtualization module passes the deletion message of the virtual device driver corresponding to the at least one hardware device to the virtual bus driver; and the virtual bus driver deletes the virtual device driver corresponding to the at least one hardware device based on the deletion message.

[0026] It should be understood that the first terminal device and the second terminal device are interconnected through the first communication service manager and the second communication service manager. In the case where the first communication service manager cannot connect to the second communication service manager, the first communication service manager can determine that the second terminal device is offline. In the case where the second terminal device is offline, the first communication service manager sends a message to the first device virtualization module to instruct the deletion of the virtual device driver corresponding to at least one hardware device; the first device virtualization module controls the virtual bus driver to delete the virtual device driver corresponding to at least one hardware device based on the message.

[0027] In certain implementations of the first aspect, the first terminal device obtains hardware device information of the second terminal device, including: obtaining the hardware device information when a first switch button in a setting interface of the first terminal device and a second switch button in a setting interface of the second terminal device are in an on state, the first switch button is used for a user to select to turn on or off a function of calling a hardware device, and the second switch button is used for a user to select to turn on or off a function of calling a hardware device.

[0028] It should be understood that the setting interface can be a system setting interface of the terminal device, or a setting interface of an application of the terminal device. When both the first switch button and the second switch button are in the on state, the first terminal device can call the hardware device of the second terminal device.

[0029] In certain implementations of the first aspect, the method further includes: when the first switch button and / or the second switch button is switched from an on state to an off state, the first terminal device deletes the virtual device driver corresponding to the at least one hardware device through the virtual bus driver.

[0030] It should be understood that when the first switch button and / or the second switch button is switched from the on state to the off state, the first terminal device will no longer be able to continue to call the hardware device of the second terminal device. Therefore, the first terminal device can delete the virtual device driver corresponding to at least one hardware device through the virtual bus driver.

[0031] In certain implementations of the first aspect, the method further includes: the first terminal device displays a setting interface, the setting interface includes the first switch button; based on the user's selection operation of the first switch button, the first switch button is adjusted to an on state or an off state.

[0032] It should be understood that the selection operation may be a click operation, a slide operation, etc., and the user's selection operation can switch the state of the first switch button.

[0033] In some implementations of the first aspect, the first terminal device includes a second application; and the first terminal device installs a virtual bus driver, comprising: the first terminal device installs the virtual bus driver through the second application.

[0034] It should be understood that the second application can call the installation script and installation package of the virtual bus driver to install the virtual bus driver. For example, the second application can be PC Manager.

[0035] In certain implementations of the first aspect, before the first terminal device obtains the hardware device information of the second terminal device, the method also includes: the first terminal device detects whether a calling condition of the hardware device is met, and the calling condition includes at least one of the following: the device type of the second terminal device is a preset type; the first terminal device supports the ability to call the hardware device; or, the function of the first terminal device calling the hardware device is in an turned-on state; obtaining the hardware device information of the second terminal device includes: obtaining the hardware device information when the calling condition is met.

[0036] It should be understood that when the first terminal device discovers the second terminal device, the first terminal device can obtain the device type of the second terminal device. The preset types may include mobile phones, tablet computers, and the like. The first terminal device can call the hardware device of the second terminal device of the preset type. The first terminal device supports the ability to call the hardware device, which can be understood as the first terminal device installing a virtual bus driver. The function of the first terminal device calling the hardware device is in the turned-on state, which can be understood as the first switch button is in the turned-on state.

[0037] In certain implementations of the first aspect, the first terminal device obtains the hardware device information of the second terminal device, including: the first terminal device reads the hardware device information from a cloud server.

[0038] It should be understood that when the cloud server stores the hardware device information of the second terminal device, the first terminal device can directly obtain the hardware device information from the cloud server, which can improve the efficiency of the first terminal device in obtaining the hardware device information of the second terminal device.

[0039] In some implementations of the first aspect, the at least one hardware device includes a camera and / or a microphone.

[0040] In a second aspect, the present application provides a hardware device calling device, including a processor, the processor is coupled to a memory, and can be used to execute instructions in the memory to implement the method in any possible implementation of the first aspect. Optionally, the device also includes a memory. Optionally, the device also includes a communication interface, and the processor is coupled to the communication interface.

[0041] In one implementation, the apparatus is a first terminal device. When the apparatus is a first terminal device, the communication interface may be a transceiver, or an input / output interface.

[0042] In another implementation, the device is a chip configured in a terminal device. When the device is a chip configured in a terminal device, the communication interface may be an input / output interface.

[0043] In a third aspect, a processor is provided, comprising: an input circuit, an output circuit, and a processing circuit. The processing circuit is used to receive a signal through the input circuit and transmit a signal through the output circuit, so that the processor executes the method in any possible implementation of the first aspect.

[0044] In the specific implementation process, the processor can be a chip, the input circuit can be an input pin, the output circuit can be an output pin, and the processing circuit can be a transistor, a gate circuit, a trigger, and various logic circuits. The input signal received by the input circuit can be, for example, but not limited to, received and input by a receiver, and the signal output by the output circuit can be, for example, but not limited to, output to a transmitter and transmitted by the transmitter, and the input circuit and the output circuit can be the same circuit, which is used as an input circuit and an output circuit at different times. The embodiments of the present application do not limit the specific implementation methods of the processor and various circuits.

[0045] In a fourth aspect, a processing device is provided, comprising a processor and a memory. The processor is used to read instructions stored in the memory, and can receive signals through a receiver and transmit signals through a transmitter to execute the method in any possible implementation of the first aspect.

[0046] Optionally, the number of the processors is one or more, and the number of the memories is one or more.

[0047] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.

[0048] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated with the processor on the same chip or can be set on different chips respectively. This application does not limit the type of memory and the setting method of the memory and the processor.

[0049] It should be understood that the relevant data interaction process, such as sending indication information, can be a process of outputting indication information from a processor, and receiving capability information can be a process of receiving input capability information from a processor. Specifically, the processed output data can be output to a transmitter, and the input data received by the processor can come from a receiver. Among them, the transmitter and the receiver can be collectively referred to as a transceiver.

[0050] The processing device in the fourth aspect mentioned above can be a chip. The processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor, which is implemented by reading the software code stored in the memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.

[0051] In a fifth aspect, a computer program product is provided, comprising: a computer program (also referred to as code, or instruction), which, when executed, enables a computer to execute a method in any possible implementation of the first aspect.

[0052] In a sixth aspect, a computer-readable storage medium is provided, which stores a computer program (also referred to as code, or instructions) which, when executed on a computer, enables the computer to execute a method in any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0054] Figure 2 A schematic diagram of an application scenario provided in an embodiment of the present application;

[0055] Figure 3 A software structure block diagram of a Windows system of a terminal device according to an embodiment of the present application;

[0056] Figure 4 A flowchart of a hardware device calling method provided in an embodiment of the present application;

[0057] Figure 5 A schematic diagram of a process for a first application program to obtain data stream or hardware device information provided by an embodiment of the present application;

[0058] Figure 6 A flowchart of another hardware device calling method provided in an embodiment of the present application;

[0059] Figure 7A flowchart of another hardware device calling method provided in an embodiment of the present application;

[0060] Figure 8 A schematic diagram of an interface of a notebook computer display device manager provided in an embodiment of the present application;

[0061] Fig. 9 A schematic diagram of an interface of a laptop computer displaying a second interface provided by an embodiment of the present application;

[0062] Fig.10 A schematic diagram of another interface of a notebook computer display device manager provided in an embodiment of the present application;

[0063] Fig.11 A schematic diagram of another interface of a laptop computer displaying a virtual device provided in an embodiment of the present application;

[0064] Fig.12 A schematic block diagram of a hardware device calling apparatus provided in an embodiment of the present application. DETAILED DESCRIPTION

[0065] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0066] In the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially identical functions and effects. For example, the first value and the second value are only used to distinguish between different values, and do not limit their order. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0067] It should be noted that in the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplarily" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.

[0068] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.

[0069] In order to better understand the terminal device in the embodiment of the present application, Figure 1 The hardware structure of the terminal device in the embodiment of the present application is described in detail.

[0070] Figure 1 This is a schematic diagram of the structure of the terminal device 100 provided in the embodiment of the present application. Figure 1 As shown, the terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0071] It is understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0072] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0073] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0074] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0075] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0076] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the terminal device 100.

[0077] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0078] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0079] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0080] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the terminal device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the terminal device 100.

[0081] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0082] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the terminal device 100, and can also be used to transmit data between the terminal device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other terminal devices, such as AR devices, etc.

[0083] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0084] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the terminal device 100. While the charging management module 140 is charging the battery 142, it may also power the terminal device through the power management module 141.

[0085] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0086] The wireless communication function of the terminal device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0087] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0088] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0089] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0090] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the terminal device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0091] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0092] The terminal device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0093] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0094] The terminal device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0095] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0096] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0097] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the terminal device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0098] Video codecs are used to compress or decompress digital videos. The terminal device 100 may support one or more video codecs. Thus, the terminal device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0099] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the terminal device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0100] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0101] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the terminal device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the terminal device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0102] The terminal device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0103] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0104] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The terminal device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0105] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the terminal device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the ear.

[0106] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The terminal device 100 can be provided with at least one microphone 170C. In other embodiments, the terminal device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the terminal device 100 can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, realization of directional recording function, etc.

[0107] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130, or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0108] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The terminal device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the terminal device 100 detects the touch operation intensity according to the pressure sensor 180A. The terminal device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0109] The gyroscope sensor 180B can be used to determine the motion posture of the terminal device 100. In some embodiments, the angular velocity of the terminal device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the terminal device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the terminal device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.

[0110] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0111] The magnetic sensor 180D includes a Hall sensor. The terminal device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the terminal device 100 is a flip phone, the terminal device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover automatic unlocking and other features are set.

[0112] The acceleration sensor 180E can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes). When the terminal device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the terminal device and applied to applications such as horizontal and vertical screen switching and pedometers.

[0113] The distance sensor 180F is used to measure the distance. The terminal device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the terminal device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0114] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The terminal device 100 emits infrared light outward through the light emitting diode. The terminal device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 100. When insufficient reflected light is detected, the terminal device 100 can determine that there is no object near the terminal device 100. The terminal device 100 can use the proximity light sensor 180G to detect that the user holds the terminal device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode, and pocket mode automatically unlocks and locks the screen.

[0115] The ambient light sensor 180L is used to sense the ambient light brightness. The terminal device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the terminal device 100 is in a pocket to prevent accidental touch.

[0116] The fingerprint sensor 180H is used to collect fingerprints. The terminal device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0117] The temperature sensor 180J is used to detect temperature. In some embodiments, the terminal device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the terminal device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the terminal device 100 heats the battery 142 to avoid abnormal shutdown of the terminal device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the terminal device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

[0118] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the terminal device 100, which is different from the position of the display screen 194.

[0119] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.

[0120] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The terminal device 100 may receive key input and generate key signal input related to user settings and function control of the terminal device 100.

[0121] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0122] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.

[0123] The SIM card interface 195 is used to connect the SIM card. The SIM card can be connected to and separated from the terminal device 100 by inserting the SIM card interface 195 or pulling it out from the SIM card interface 195. The terminal device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The terminal device 100 interacts with the network through the SIM card to realize functions such as calls and data communications. In some embodiments, the terminal device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the terminal device 100 and cannot be separated from the terminal device 100. The software system of the terminal device 100 can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the terminal device 100.

[0124] Currently, for terminal devices that support Internet services, such as mobile phones, tablets, laptops, etc., users can interconnect the first terminal device and the second terminal device through the Internet service, thereby using the hardware devices of the second terminal device, such as cameras, microphones, speakers, etc., through applications on the first terminal device.

[0125] Combine the following Figure 2 , taking the first terminal device as a laptop, the second terminal device as a mobile phone, and the hardware device as a camera as an example, the application scenario of the embodiment of the present application is described in detail.

[0126] Figure 2 Schematic diagram of an application scenario 200 provided in an embodiment of the present application. Figure 2 As shown, when a user conducts a video conference through a video conference application on a laptop 201, if it is necessary to shoot experimental equipment, the user can interconnect the laptop 201 and the mobile phone 202 so that the laptop 201 and the mobile phone 202 can transmit data. In this way, the laptop 201 can call the camera of the mobile phone 202, and the video data stream of the experimental equipment shot by the camera of the mobile phone 202 can be transmitted to the laptop 201, so as to show the experimental equipment to other people participating in the video conference.

[0127] Specifically, the first terminal device calling the hardware device of the second terminal device can currently be achieved through the following process: the application in the first terminal device can send a request to the virtual camera driver preset in the first terminal device, and the request is used to call the camera in the second terminal device; the first terminal device then obtains the video data captured by the camera of the second terminal device based on the request.

[0128] However, the virtual camera driver in the first terminal device is preset, so the amount of camera data that the first terminal device can recognize is fixed. When the number of cameras included in the second terminal device is greater than the number of virtual camera drivers, the first terminal device cannot fully recognize all the cameras of the second terminal device; through the virtual camera driver, the first terminal device cannot call hardware devices other than the camera in the second terminal device, such as microphones, speakers, etc.; in addition, when the first terminal device does not need to call the camera of the second terminal device, the virtual camera driver will not be deleted. It can be seen that the compatibility, scalability and flexibility of such a hardware device calling method are poor.

[0129] In order to solve the above technical problems, the present application provides a hardware device calling method, which is applied to a system including a first terminal device and a second terminal device, in which a user logs in to the same account on the first terminal device and the second terminal device, and the wireless fidelity WiFi switch and the Bluetooth switch of the first terminal device and the second terminal device are both in the on state. A virtual bus driver is installed in the first terminal device, and when the first terminal device detects the second terminal device, the first terminal device can obtain the hardware device information of the hardware device in the second terminal device; based on the hardware device information of each hardware device, the first terminal device can create a virtual device driver corresponding to each hardware device through the virtual bus driver; then, when the first terminal device needs to call the hardware device of the second terminal device, it can obtain the data stream from the second terminal device through the virtual device driver corresponding to the hardware device. It can be seen that the first terminal device can dynamically create a virtual device driver based on the type and number of the hardware devices of the second terminal device through the virtual bus driver. When the first terminal device calls the hardware devices other than the camera in the second terminal device, there is no need to redevelop the virtual device drivers for the hardware devices other than the camera, which improves the scalability of the hardware device calling method; and the virtual bus driver can create a virtual device driver corresponding to any USB hardware device, so that the first terminal device can call a variety of USB hardware devices, which improves the compatibility of the hardware device calling method; in addition, when the first terminal device no longer needs to call the hardware device of the second terminal device, the first terminal device can delete the virtual device driver based on the virtual bus driver, and can also delete the virtual bus driver at the same time, which improves the flexibility of the hardware device calling method.

[0130] Combine the following Figure 3 , the software structure applicable to the hardware device calling method of the embodiment of the present application is described in detail.

[0131] For example, the terminal device 100 is a personal computer (PC). Figure 3 This is a software structure block diagram of the Windows system of the terminal device 100 according to an embodiment of the present application.

[0132] like Figure 3 As shown in FIG. 1 , the layered architecture of the Windows system divides the software into several layers, each of which has a clear role and division of labor. The layers communicate with each other through software interfaces. For example, the application layer and the system layer can interact through the application programming interface (API), and the system layer and the kernel layer can interact through the standard I / O interface. In some embodiments, the Windows system is divided into three layers, namely, the application layer, the system layer, and the kernel layer from top to bottom. The specific functional modules included in each layer are explained below.

[0133] 1. Application layer

[0134] The application layer may include a series of applications, such as music, PC manager, Bluetooth, WLAN, games, videos, third-party applications, cameras, software development kits (SDKs), communication service managers, device virtualization modules, device managers, etc. For example, in the embodiment of the present application, in the application layer, the application can access the device virtualization SDK and call the device virtualization module of the system layer through the device virtualization SDK.

[0135] The PC manager may include installation packages for multiple applications, and users may install multiple applications for the terminal device 100 through the PC manager; it is also used to implement system optimization, smart audio-visual, smart interconnection between devices, multi-screen collaboration, and hotspot sharing. The PC manager may also have other names, which are not specifically limited in this application.

[0136] Optionally, the PC manager includes a communication service manager and a device virtualization module, and the PC manager implements services such as smart interconnection through the communication service manager.

[0137] The above-mentioned third-party applications may include social applications and office applications.

[0138] The communication service manager can realize data transmission across devices. For example, in the embodiment of the present application, the communication service manager can realize security authentication and account authentication of devices with the same account, self-discovery and self-organizing network of devices, data transmission between devices, and access to communication services.

[0139] The communication service manager may also be called a smart interconnection module, magiclink, etc. This application does not make any specific limitations on this.

[0140] The device virtualization module is used to manage the life cycle of the virtual device driver, control the creation and deletion of the virtual device driver (also known as the insertion and removal of the virtual device driver) through the virtual bus driver, and is also used to process the request sent by the application to the virtual device driver and feed back the processing result to the application. The device virtualization module can interact with other applications through the device virtualization SDK of the application layer.

[0141] The device virtualization module can also be called a hardware service cross-device sharing module, a distributed mobile sensing development platform (DMSDP), a hardware virtualization module, etc., and this application does not make specific restrictions on this. Correspondingly, the device virtualization SDK can also be called a hardware service cross-device sharing SDK, a DMSDPSDK, a hardware virtualization SDK, etc., and this application embodiment does not make any restrictions on this.

[0142] Device Manager is used to view and change device properties, change device drivers, configure device settings, and uninstall devices.

[0143] 2. System layer

[0144] The system layer may include the Windows multimedia framework, etc., which may provide corresponding services for the execution of user application processes.

[0145] The Windows Multimedia Framework includes a variety of Windows functional functions that can be called by applications for developing applications. The Windows Multimedia Framework is also used to connect the application layer and the kernel layer to achieve interaction between the application layer and the kernel layer. Exemplarily, the request sent by the application to the kernel layer can be first transmitted to the Windows Multimedia Framework through the Windows Application Framework (framwork, FWK) API, and then transmitted to the kernel layer through the standard I / O interaction interface.

[0146] 3. Kernel layer

[0147] The kernel layer is the layer between hardware and software. The kernel layer is used to drive the hardware to make it work. The kernel layer may include virtual bus drivers, virtual device drivers, Windows Driver Foundation (WDF) modules, operating system (OS) kernels, etc.

[0148] The virtual device driver can be recognized by the terminal device as a universal serial bus (USB) device and used by the terminal device. For example, a virtual camera device, a virtual microphone (mic) device. If the terminal device 100 recognizes an available USB device (also called a hardware device), the terminal device 100 can create a corresponding virtual device driver for each USB device, and the number of virtual device drivers included in the kernel layer of the terminal device 100 can be multiple; if the terminal device 100 does not recognize an available USB device, the number of virtual device drivers included in the kernel layer of the terminal device 100 is 0. In the case where the terminal device 100 creates at least one virtual device driver, the at least one virtual device driver can be displayed in the device manager of the terminal device 100.

[0149] The virtual bus driver is used to create or delete virtual device drivers, that is, it is responsible for managing the insertion, removal and communication processes of virtual device drivers.

[0150] Optionally, PC Manager can call the installation script and installation package of the virtual bus driver to install the virtual bus driver.

[0151] The virtual bus driver may also be referred to as a virtual bus controller, a virtual driver bus, etc., and this application does not make any specific limitation on this.

[0152] The OS kernel is used to convert requests from the application layer into data processing instructions and send them to the virtual device driver through the driver development framework.

[0153] The driver development framework is used to implement sending data processing instructions from the OS kernel to the virtual device driver.

[0154] Combine the following Figures 4 to 11 The hardware device calling method of the present application is described in detail. The embodiment shown in the present application shows the hardware device calling method provided by the present application from the perspective of device interaction. The specific form and quantity of each device shown therein are only examples and should not constitute any limitation on the implementation of the method provided by the present application. Below, taking the first terminal device and the second terminal device as the execution subject as an example, the hardware device calling method of the embodiment of the present application is described in detail.

[0155] It should be understood that the terminal device can be the terminal device itself, or it can be a chip, chip system or processor that supports the terminal device to implement a hardware device calling method, or it can be a logic module or software that can implement all or part of the terminal device functions. This application does not make specific limitations on this.

[0156] Figure 4 A flowchart of a hardware device calling method 400 provided in an embodiment of the present application. The method 400 is applied to a system including a first terminal device and a second terminal device. A user logs into the same account on the first terminal device and the second terminal device, and the wireless fidelity (WiFi) switch and the Bluetooth switch of the first terminal device and the second terminal device are both turned on. The hardware structure of the first terminal device can be as follows: Figure 1 As shown, the software structure can be as follows Figure 3 shown.

[0157] It should be understood that an account may refer to a personal registration account provided by different terminal device brands to ensure the device security of the user. After the first terminal device and the second terminal device log in to the same account, data sharing between the devices can be achieved. When the first terminal device and the second terminal device log in to the same account, and the WiFi switch and the Bluetooth switch of the first terminal device and the second terminal device are both turned on, the first terminal device can detect the second terminal device.

[0158] The method 400 comprises the following steps:

[0159] S401. When a second terminal device is detected, obtain hardware device information of the second terminal device, where the hardware device information includes device identification information of the second terminal device, type identification information of at least one hardware device of the second terminal device, and hardware device capability information of at least one hardware device.

[0160] Optionally, before S401, the first terminal device may install a virtual bus driver, where the virtual bus driver is used to manage virtual device drivers.

[0161] Specifically, the first terminal device may send a request for requesting the hardware device information of the second terminal device to the second terminal device; and the second terminal device may send the hardware device information of the second terminal device to the first terminal device based on the request.

[0162] The device identification information may be any information used to indicate the second terminal device, such as the device type, device model, or device ID. Exemplarily, the device identification information is the device model, such as H 90, which is used to indicate that the second terminal device is a mobile phone, and the mobile phone model is H 90; the device identification information may also be the device name of the second terminal device set by the user, such as Zhang San's mobile phone. The type identification information is used to indicate the type of at least one hardware device included in the second terminal device. The hardware device may refer to devices such as a camera, a microphone, and a speaker. Different type identification information may correspond to different hardware devices respectively. For example, the type identification information includes 0 and 1, where 0 may indicate the camera of the second terminal device, and 1 may indicate the microphone of the second terminal device. Different type identification information may correspond to different hardware devices of the same type of hardware device respectively. For example, the type identification information includes A and B, where A may indicate the front camera of the second terminal device, and B may indicate the rear camera of the second terminal device. The hardware device capability information may include at least one information used to indicate the performance of the hardware device. For example, if the hardware device is a camera, the hardware device capability information of the camera may include information such as the resolution, magnification, or frame rate supported by the camera.

[0163] S402: Based on the hardware device information, create a virtual device driver for each hardware device in the at least one hardware device through a virtual bus driver, where the virtual bus driver is used to manage the virtual device drivers.

[0164] It should be understood that the first terminal device can determine the number, type and hardware device capabilities of the hardware devices included in the second terminal device based on the hardware device information, so that the first terminal device can create a corresponding virtual device driver for each hardware device based on the hardware device information of each hardware device in the at least one hardware device. Each hardware device in the second terminal device corresponds to a virtual device driver.

[0165] S403. When it is detected that the first application program calls a message request of a first hardware device in at least one hardware device through a first virtual device driver, the first terminal device receives a data stream from the second terminal device through a data channel, and the first virtual device driver is created by a virtual bus driver based on the hardware device information of the first hardware device.

[0166] It should be understood that the first application can be a third-party application or a system application. The first hardware device can be any hardware device in the second terminal device that can be used by the first terminal device, for example, it can be the front camera of the second terminal device. The hardware device information of the first hardware device includes the device identification information of the second terminal device, the type identification information of the first hardware device, and the hardware device capability information of the first hardware device. Based on the hardware device information of the first hardware device, the first terminal device can create a first virtual device driver with the same properties as the first hardware device through a virtual bus driver. The data channel can be understood as a channel that can be used to implement the transmission of data streams between the first terminal device and the second terminal device. For example, a peer-to-peer (P2P) connection is established between the first terminal device and the second terminal device, and the data channel can be a P2P connection.

[0167] In a possible implementation, before S403, method 400 further includes: the first terminal device creates a data channel, wherein creating a data channel can be understood as establishing a P2P connection.

[0168] The hardware device calling method of the present application is that when the first terminal device detects the second terminal device, the first terminal device can obtain the hardware device information of the hardware device in the second terminal device; based on the hardware device information of each hardware device, the first terminal device can create a virtual device driver corresponding to each hardware device through a virtual bus driver; then, when the first terminal device needs to call the hardware device of the second terminal device, it can obtain the data stream from the second terminal device through the virtual device driver corresponding to the hardware device. It can be seen that the first terminal device can dynamically create virtual device drivers with different attributes based on the type and number of hardware devices of the second terminal device through the virtual bus driver. In this way, when the first terminal device calls hardware devices other than the camera in the second terminal device, there is no need to redevelop the virtual device drivers for hardware devices other than the camera, which improves the scalability of the hardware device calling method; and the virtual bus driver can create a virtual device driver corresponding to any USB hardware device, so that the first terminal device can call a variety of USB hardware devices, which improves the compatibility of the hardware device calling method; in addition, the first terminal device can create a corresponding number of virtual device drivers based on the number of hardware devices of the second terminal device, and when the first terminal device no longer needs to call the hardware device of the second terminal device, the first terminal device can also delete the virtual device driver through the virtual bus driver, and can also delete the virtual bus driver at the same time, which improves the flexibility of the hardware device calling method.

[0169] As an optional embodiment, the first terminal device includes an application layer and a kernel layer; the application layer includes a first application, a first device virtualization module and a first communication service manager, the first device virtualization module is used to control the creation and deletion of virtual device drivers and process requests from applications, and the first communication service manager is used to perform data transmission between devices; the kernel layer includes a virtual bus driver, a virtual device driver and a driver development framework.

[0170] It should be understood that the software structure of the first terminal device can be found in Figure 3 The first application may be a third-party application or a system application at the application layer. The first device virtualization module may refer to Figure 3 The device virtualization module in the first communication service manager may refer to Figure 3 The number of virtual device drivers may be 0 or more. When the number of virtual device drivers is more than one, the properties of any two virtual device drivers among the more than one virtual device drivers may be different.

[0171] In a possible implementation, the first terminal device creates a data channel, including: a first device virtualization module creates the data channel.

[0172] As an optional embodiment, S401 can be specifically implemented in the following manner: the first device virtualization module obtains hardware device information; S402 can be specifically implemented in the following manner: the first device virtualization module creates a virtual device driver corresponding to the attributes indicated by the type identification information, device identification information and hardware device capability information of each hardware device through a virtual bus driver.

[0173] It should be understood that the first device virtualization module can be used to implement data transmission between the first terminal device and the second terminal device, and can control the virtual bus driver to create a virtual device driver. The first terminal device can obtain hardware device information from the second terminal device through the first virtualization module; and can control the virtual bus driver to create or delete a virtual device driver through the first virtualization module.

[0174] In one possible implementation, a virtual device driver corresponding to the attributes indicated by the type identification information, device identification information, and hardware device capability information of each hardware device is created, including: a first device virtualization module converts the type identification information and device identification information of each hardware device into a hardware device type descriptor in a universal serial bus (USB) protocol, and converts the hardware device capability information of each hardware device into a hardware device configuration descriptor in the USB protocol; the first device virtualization module transmits the hardware device type descriptor and the hardware device configuration descriptor to a virtual bus driver; and the virtual bus driver creates a virtual device driver corresponding to the hardware device type descriptor and the hardware device configuration descriptor.

[0175] It should be understood that each available hardware device in the second terminal device can be identified as a USB device by the first terminal device, and the first device virtualization module needs to create a corresponding virtual device driver for each hardware device in the second terminal device. The hardware device type descriptor can be understood as a device descriptor, and the hardware device configuration descriptor can be understood as a configuration descriptor. In addition to the hardware device type descriptor and the hardware device configuration descriptor, the first device virtualization module can also configure other types of descriptors for each hardware device, such as string descriptors, etc. The virtual bus driver can create a virtual device driver corresponding to the descriptor of each hardware device.

[0176] It should be understood that the hardware device type descriptor may include information other than the descriptors corresponding to the type identification information and the device identification information; the hardware device configuration descriptor may include information other than the descriptors corresponding to the hardware device capability information, and this application does not make specific limitations on this.

[0177] In a possible implementation, the second terminal device includes a second communication service manager, and the first communication service manager and the second communication service manager are used to implement data transmission between the first terminal device and the second terminal device; the first device virtualization module obtains hardware device information, including: the first device virtualization module establishes a control channel; the first communication service manager sends a first request to the second communication service manager through the control channel, and the first request is used to request hardware device information; the first communication service manager receives the hardware device information from the second communication service manager; the first communication service manager transmits the hardware device information to the first device virtualization module.

[0178] It should be understood that the second terminal device may be a terminal device such as a mobile phone or a tablet computer. The second terminal device may be installed with an Android system, and the software structure of the second terminal device may include an application layer and an application framework layer. The application framework layer of the second terminal device may include a second communication service manager. The control channel may be a data transmission channel for transmitting a control request.

[0179] In a possible implementation, the control channel is created by establishing a P2P connection or a Bluetooth connection between the first terminal device and the second terminal device.

[0180] In a possible implementation, the control channel is preferentially created by establishing a P2P connection between the first terminal device and the second terminal device. When a P2P connection cannot be established between the first terminal device and the second terminal device, the control channel is created by establishing a Bluetooth connection between the first terminal device and the second terminal device.

[0181] In a possible implementation, after the first communication service manager transmits the hardware device information to the first device virtualization module, the method 400 further includes: the first device virtualization module deleting the control channel.

[0182] It should be understood that when a control request needs to be transmitted between the first terminal device and the second terminal device, the first device virtualization module can create a control channel, for example, the first terminal device needs to obtain the hardware device information of the second terminal device through the device virtualization module; when the first terminal device does not need to send a control request to the second terminal device, the first device virtualization module can delete the control channel, for example, after the first terminal device has created a virtual device driver corresponding to each hardware device in the second terminal device, the first device virtualization module can determine that the first terminal device no longer needs to send a control request to the second terminal device within a certain period of time, and can delete the control channel.

[0183] In a possible implementation, after the virtual device driver is created, the first device virtualization module waits for a preset period of time before deleting the control channel.

[0184] It should be understood that the control channel is deleted with a delay. Deleting the control channel can also be understood as destroying the control channel.

[0185] In a possible implementation, the first device virtualization module establishes the control channel, including: when the hardware device information cannot be read from the cloud server, the first device virtualization module establishes the control channel.

[0186] It should be understood that, when the hardware device information of the second terminal device is stored in the cloud server, the first terminal device can directly obtain the hardware device information from the cloud server; when the cloud server does not store the hardware device information of the second terminal device, the first terminal device needs to obtain the hardware device information from the second terminal device. At this time, the first terminal device requires the second terminal device to send a control request for requesting the hardware device information. Therefore, the first device virtualization module establishes a control channel.

[0187] As an optional embodiment, S401 is specifically implemented in the following manner: reading hardware device information from a cloud server.

[0188] It should be understood that when the cloud server stores the hardware device information of the second terminal device, the first terminal device can directly obtain the hardware device information from the cloud server, which can improve the efficiency of the first terminal device in obtaining the hardware device information of the second terminal device.

[0189] In a possible implementation, when a terminal device obtains hardware device information from a second terminal device, the second terminal device transmits the hardware device information to a cloud server.

[0190] It should be understood that the terminal device may be the first terminal device or other terminal devices. In the case where a terminal device obtains hardware device information from a second terminal device at a historical moment, the second terminal device may determine that a terminal device needs to obtain the hardware device information, and therefore, the second terminal device may upload the hardware device information to the cloud server.

[0191] As an optional embodiment, method 400 also includes: when a change is detected in the cache message queue corresponding to the first virtual device driver, the first device virtualization module reads a second request from the cache message queue, and the second request is used to request to obtain a data stream; the first terminal device receives the data stream from the second terminal device through a data channel, including: the first device virtualization module sends the data stream to the virtual bus driver based on the second request; the virtual bus driver matches and encapsulates the data stream and the second request in the cache message queue to obtain an encapsulated data packet, and feeds the encapsulated data packet back to the first application.

[0192] It should be understood that the first device virtualization module can monitor the cache message queue corresponding to each virtual device driver in real time. When there is a change in the cache message queue corresponding to the first virtual device driver, the first device virtualization module can read the request in the cache message queue corresponding to the first virtual device driver. The second request can be a data request for requesting the transmission of a data stream, such as the transmission of video data, audio data, etc. The cache message queue is a message queue for caching message requests related to the first virtual device driver. The cache message queue may include multiple requests. Therefore, when the virtual bus driver receives the data stream from the first device virtualization module, it needs to match the second request corresponding to the data stream from the cache message queue and encapsulate the second request and the data stream.

[0193] In a possible implementation, when the first application sends a control request, the kernel layer of the first terminal device creates a control endpoint, which can cache a control message queue, and the control message queue can include multiple control requests; when the first application sends a data request, the kernel layer of the first terminal device creates a data endpoint, which can cache a data message queue, and the data message queue can include multiple control requests. The control endpoint can cache received control requests in the cache message queue, and the data endpoint can cache received data requests in the cache message queue.

[0194] Figure 5 A schematic diagram of the process of obtaining data stream or hardware device information by a first application program provided in an embodiment of the present application. Figure 5 As shown. When the driver development framework detects a control request from the first application, the driver development framework creates a control endpoint; when the driver development framework detects a data request from the first application, the driver development framework creates a data endpoint. The control endpoint includes a control message queue; the data endpoint includes a data message queue. When the request sent by the first application is a control request, such as a first request, when the driver development framework detects a change in the control message queue, the first request is cached in the cache message queue through the virtual bus driver; when the request sent by the first application is a data request, such as a second request, when the driver development framework detects a change in the data message queue, the second request is cached in the cache message queue through the virtual bus driver. When the first device virtualization module detects a change in the cache message queue, it reads the request in the cache message queue, such as the first request and the second request mentioned above. The first device virtualization module processes the read request and sends a request reply to the virtual bus driver. When the request read by the first device virtualization module is the first request, the request reply can be the hardware device information of the second terminal device; when the request read by the first device virtualization module is the second request, the request reply can be a data stream. The virtual bus driver matches and encapsulates the request reply with the request in the cache message queue to obtain an encapsulated data packet, for example, matching and encapsulating the hardware device information with the first request, and matching and encapsulating the data stream with the second request. Then the virtual bus driver replies to the request of the first application, that is, feeding back the encapsulated data packet to the first application.

[0195] As an optional embodiment, method 400 also includes: when it is detected that the second terminal device is offline, the first terminal device deletes the virtual device driver corresponding to at least one hardware device through the virtual bus driver. The second terminal device being offline indicates that the WiFi switch and / or Bluetooth switch of at least one device of the first terminal device and the second terminal device is in the off state, or the first terminal device and the second terminal device are not logged in to the same account.

[0196] It should be understood that when the second terminal device goes offline, the first terminal device will no longer be able to detect the second terminal device. Therefore, the first terminal device can no longer call the hardware device of the second terminal device, and the first terminal device can delete the virtual device driver corresponding to at least one hardware device through the virtual bus driver. The WiFi switch and / or Bluetooth switch of at least one of the first terminal device and the second terminal device being in an off state can refer to the WiFi switch and / or Bluetooth switch of at least one of the first terminal device and the second terminal device being switched from an on state to an off state; the first terminal device and the second terminal device not logging in to the same account can be understood as the account logged in by the first terminal device and / or the second terminal device being offline.

[0197] In a possible real-time method, the first terminal device deletes the virtual device driver corresponding to at least one hardware device through a virtual bus driver, including: the first communication service manager detects that the second terminal device is offline, and notifies the first device virtualization module to delete the virtual device driver corresponding to the at least one hardware device; the first device virtualization module passes the deletion message of the virtual device driver corresponding to the at least one hardware device to the virtual bus driver; the virtual bus driver deletes the virtual device driver corresponding to the at least one hardware device based on the deletion message.

[0198] It should be understood that the first terminal device and the second terminal device are interconnected through the first communication service manager and the second communication service manager. In the case where the first communication service manager cannot connect to the second communication service manager, the first communication service manager can determine that the second terminal device is offline. In the case where the second terminal device is offline, the first communication service manager sends a message to the first device virtualization module to instruct the deletion of the virtual device driver corresponding to at least one hardware device; the first device virtualization module controls the virtual bus driver to delete the virtual device driver corresponding to at least one hardware device based on the message.

[0199] In a possible implementation, the virtual bus driver deletes the virtual device driver corresponding to at least one hardware device based on the deletion message, including: the virtual bus driver deletes the descriptor corresponding to at least one hardware device based on the deletion message, the descriptor including the hardware device type descriptor and the hardware device configuration descriptor.

[0200] As an optional embodiment, S401 can be specifically implemented in the following manner: when the first switch button in the first terminal device setting interface and the second switch button in the second terminal device setting interface are in the on state, the hardware device information is obtained, the first switch button is used for the user to choose to turn on or off the function of calling the hardware device, and the second switch button is used for the user to choose to turn on or off the function of calling the hardware device.

[0201] It should be understood that the setting interface can be a system setting interface of the terminal device, or a setting interface of an application of the terminal device. When both the first switch button and the second switch button are in the on state, the first terminal device can call the hardware device of the second terminal device.

[0202] As an optional embodiment, method 400 further includes: when the first switch button and / or the second switch button is switched from an on state to an off state, the first terminal device deletes a virtual device driver corresponding to at least one hardware device through a virtual bus driver.

[0203] It should be understood that when the first switch button and / or the second switch button is switched from the on state to the off state, the first terminal device will no longer be able to continue to call the hardware device of the second terminal device. Therefore, the first terminal device can delete the virtual device driver corresponding to at least one hardware device through the virtual bus driver.

[0204] As an optional embodiment, method 400 also includes: the first terminal device displays a setting interface, the setting interface includes a first switch button; based on the user's selection operation on the first switch button, the first switch button is adjusted to an on state or an off state.

[0205] It should be understood that the selection operation may be a click operation, a slide operation, etc., and the user's selection operation can switch the state of the first switch button.

[0206] As an optional embodiment, the first terminal device includes a second application program; and the first terminal device installs a virtual bus driver, comprising: the first terminal device installs the virtual bus driver through the second application program.

[0207] It should be understood that the second application can call the installation script and installation package of the virtual bus driver to install the virtual bus driver. For example, the second application can be Figure 3 PC Manager as shown in .

[0208] In a possible implementation, when the second application is installed on the first terminal device, the second application calls an installation script and an installation package of the virtual bus driver to install the virtual bus driver.

[0209] In a possible implementation, the user installs the virtual bus driver through an installation package of the virtual bus driver.

[0210] As an optional embodiment, before S401, method 400 also includes: the first terminal device detects whether the calling condition of the hardware device is met, the calling condition includes at least one of the following: the device type of the second terminal device is a preset type; the first terminal device supports the ability to call the hardware device; or, the function of the first terminal device to call the hardware device is in the turned-on state; obtaining the hardware device information of the second terminal device, including: obtaining the hardware device information when the calling condition is met.

[0211] It should be understood that when the first terminal device discovers the second terminal device, the first terminal device can obtain the device type of the second terminal device. The preset types may include mobile phones, tablet computers, and the like. The first terminal device can call the hardware device of the second terminal device of the preset type. The first terminal device supports the ability to call the hardware device, which can be understood as the first terminal device installing a virtual bus driver. The function of the first terminal device calling the hardware device is in the turned-on state, which can be understood as the first switch button is in the turned-on state.

[0212] As an optional embodiment, the at least one hardware device includes a camera and / or a microphone.

[0213] Figure 6 FIG. 6 is a flow chart of a hardware device calling method 600 provided in an embodiment of the present application. Figure 6 As shown, method 600 is applied to a system including a first terminal device and a second terminal device, a user logs in to the same account on the first terminal device and the second terminal device, and the WiFi switch and the Bluetooth switch of the first terminal device and the second terminal device are both in the on state.

[0214] The hardware structure of the first terminal device can be as follows Figure 1 As shown, the software structure can be as follows Figure 3 The hardware structure of the second terminal device can be as follows. Figure 1 As shown, the software structure of the second terminal device includes a second communication service manager and a second device virtualization module. The second device virtualization module is used to interact with the camera API of the first terminal device, and can turn on or off the camera of the first terminal device, obtain video data captured by the camera, and process the video data, such as encoding and decoding images; it is also used for the management of control channels and data channels, and the data channel is used to transmit data streams; it is used to interact with the application of the second terminal device to trigger the pause, reply and close of the virtual camera.

[0215] The method 600 comprises the following steps:

[0216] S601. Use PC Manager to install the virtual bus driver.

[0217] S602: The first device virtualization module obtains hardware device information of the second terminal device from the second device virtualization module.

[0218] Specifically, the second device virtualization module sends the hardware device information to the second communication service manager; the second communication service manager sends the hardware device information to the first communication service manager; the first communication service manager sends the hardware device information to the first device virtualization module.

[0219] S603: The first device virtualization module notifies the virtual bus driver to insert the virtual device. It can be understood that the first device virtualization module writes the descriptor corresponding to the hardware device into the virtual bus driver.

[0220] S604: The virtual bus driver creates a virtual device driver for each hardware device in the second terminal device.

[0221] S605: The first device virtualization module reads the message in the cache message queue corresponding to the virtual device driver through the virtual bus driver.

[0222] S606: The first device virtualization module writes data to the virtual bus driver.

[0223] It should be understood that data can be understood as hardware device information.

[0224] S607: When the second terminal device is offline or the first terminal device no longer needs to call the hardware device of the second terminal device, the first device virtualization module notifies the virtual bus driver to unplug the virtual device. It can be understood that the first device virtualization module sends a deletion message to the virtual bus driver.

[0225] S608: The virtual bus driver deletes the virtual device driver.

[0226] S609. Uninstall the virtual bus driver through PC Manager.

[0227] It should be understood that, if the user needs to delete the virtual bus driver, the virtual bus driver can be deleted through PC Manager.

[0228] It should be understood that the specific implementation of S601 to S609 is similar to the steps in method 400, and can be found above, and will not be repeated here.

[0229] Combine the following Figure 7 , taking the hardware device as a camera as an example, the hardware device calling method is explained in detail.

[0230] Figure 7 A flowchart of a hardware device calling method 700 provided in an embodiment of the present application. Figure 7As shown, method 700 is applied to a system including a first terminal device and a second terminal device, a user logs in to the same account on the first terminal device and the second terminal device, and the WiFi switch and the Bluetooth switch of the first terminal device and the second terminal device are both in the on state.

[0231] The hardware structure of the first terminal device can be as follows Figure 1 As shown, the software structure can be as follows Figure 3 The virtual bus driver in the first terminal device can be installed through PC Manager. After the virtual bus driver is installed by PC Manager, the virtual bus driver can be displayed in the device manager of the first terminal device. Figure 8 As shown, the first terminal device is a notebook computer, and the system devices of the device manager in the notebook computer include a virtual bus driver.

[0232] The hardware structure of the second terminal device can be as follows Figure 1 As shown, the software structure of the second terminal device includes a second communication service manager and a second device virtualization module. The second device virtualization module is used to interact with the camera API of the first terminal device, and can turn on or off the camera of the first terminal device, obtain video data captured by the camera, and process the video data, such as encoding and decoding images; it is also used for the management of control channels and data channels, and the data channel is used to transmit data streams; it is used to interact with the application of the second terminal device to trigger the pause, reply and close of the virtual camera.

[0233] The method 700 comprises the following steps:

[0234] S701: The second communication service manager sends a first message to the first communication service manager, where the first message is used to notify the first communication service manager that a second terminal device is online. Correspondingly, the first communication service manager receives the first message from the second communication service manager.

[0235] Optionally, when the second terminal device is close to the first terminal device so that the distance between the second terminal device and the first terminal device is less than a preset distance, the second communication service manager sends a first message to the first communication service manager.

[0236] S702: The first communication service manager discovers an online device based on the first message. The online device may be understood as a second terminal device.

[0237] S703: The first communication service manager sends a second message to the application, where the second message is used to notify the application that the second terminal device is online. Correspondingly, the application receives the second message from the first communication service manager.

[0238] It should be understood that the second message may include information such as the device type and device model of the second terminal device. Figure 3 PC Manager in .

[0239] S704: PC Manager discovers an online device based on the second message.

[0240] Optionally, PC Manager can discover online devices based on Smart Connect. When PC Manager can discover the second terminal device based on Smart Connect, the first terminal device displays a second interface, which includes the device type and device model of the second terminal device. For example, the first terminal device is a laptop, the device model of the second terminal device is H90, and the device type is a mobile phone. The second interface can be as follows: Fig. 9 shown.

[0241] S705: PC Manager detects whether the calling conditions of the hardware device are met.

[0242] It should be understood that the PC manager can detect whether the first terminal device and / or the second terminal device meet the calling conditions of the hardware device. For example, the PC manager detects whether the device type of the first terminal device is a preset type; detects whether the first terminal device and / or the second terminal device supports the capability of a virtual camera; detects whether the first switch button and the second switch button are in an on state, etc.

[0243] When the first terminal device and the second terminal device meet the calling condition of the hardware device, S706 is executed.

[0244] S706: PC Manager starts the first device virtualization module.

[0245] S707: The PC manager performs a registration callback on the first device virtualization module.

[0246] S708: The PC manager notifies the first device virtualization module to enable the camera.

[0247] S709. The first device virtualization module obtains hardware device information from the cloud server.

[0248] S710: The first device virtualization module pulls up the second device virtualization module and creates a control channel.

[0249] Optionally, when the hardware device information is not stored in the cloud server, the first device virtualization module sends a first request to the second device virtualization module through the control channel; the second device virtualization module sends the hardware device information to the first communication service manager through the second communication service manager based on the first request; the first communication service manager sends the hardware device information to the first device virtualization module.

[0250] S711. The first device virtualization module instructs the virtual bus driver to create a virtual device driver based on the hardware device information.

[0251] S712. Create a virtual device driver based on the virtual bus driver.

[0252] Optionally, after the virtual bus driver creates the virtual device driver, the virtual device driver may be displayed in the device manager of the first terminal device. Exemplarily, the available hardware devices of the second terminal device include a front camera and a rear camera, and the device model of the second terminal device is H90. Fig.10 As shown, after the virtual bus driver creates a virtual device driver corresponding to the front camera and a virtual device driver corresponding to the rear camera, the device manager of the first terminal device displays virtual devices corresponding to the two virtual device drivers: H90 rear camera 1001 and H90 front camera 1002.

[0253] S713: The first device virtualization module reads a third message from the virtual bus driver, where the third message is used to notify the first device virtualization module that the creation of the virtual device driver is complete.

[0254] S714. The first device virtualization module sends a fourth message to the PC manager, where the fourth message is used to notify the PC manager that the creation of the virtual device driver is complete.

[0255] It should be understood that after the virtual device driver is created, the virtual device corresponding to the virtual device driver can be displayed in the first application. Fig.11 As shown, the first application is a conference application, the hardware device of the second terminal device includes a front camera and a rear camera, the device model of the second terminal device is H90, and after the virtual bus driver creates a virtual device driver corresponding to the front camera and a virtual device driver corresponding to the rear camera, the camera selection interface of the first application includes virtual devices corresponding to the two virtual device drivers: H90 rear camera 1101 and H90 front camera 1102.

[0256] Optionally, the third-party application of the first terminal device sends the second request to the cache message queue corresponding to the virtual device driver through the Windows multimedia framework and the driver development framework in sequence. After the first device virtualization module detects that the cache message queue corresponding to the virtual device driver has changed, it reads the second request; based on the second request, the first device virtualization module obtains the data stream from the second device virtualization module through the first communication service manager and the second communication service manager in sequence; the first device virtualization module sends the data stream to the virtual bus driver, and the virtual bus driver matches and encapsulates the data stream and the second request, and feeds back the encapsulated data packet to the third-party application. Exemplarily, the third-party application can be a conference application; the virtual device driver can be the driver corresponding to the front camera of the second terminal device and the driver corresponding to the rear camera of the second terminal device. When the third-party application calls the front camera, it sends the second request to the cache message queue of the driver corresponding to the front camera; then the first device virtualization module transmits the video data stream obtained by the front camera to the third-party application.

[0257] Optionally, after reading the second request, the first device virtualization module can determine that the third-party application needs to call the first hardware device of the second terminal device; send an instruction to open the first hardware device to the second device virtualization module through the first communication service manager and the second communication service manager in sequence; the second device virtualization module obtains the data stream obtained by the operation of the first hardware device based on the instruction, and sends the data stream obtained by the operation of the first hardware device to the first device virtualization module through the second communication service manager and the first communication service manager in sequence; the first device virtualization module sends the data stream obtained by the operation of the first hardware device to the virtual bus driver, the virtual bus driver matches and encapsulates the data stream obtained by the operation of the first hardware device and the second request, and feeds back the encapsulated data packet to the third-party application.

[0258] S715. The first device virtualization module deletes the control channel.

[0259] It should be understood that after the second device virtualization module detects that all control channels are deleted, unbinding is triggered, that is, control requests are no longer transmitted. After the second device virtualization module detects that all services are unbound, deregistration is triggered. All service unbinding can be understood as the first terminal device no longer continuing to call the hardware device of the second terminal device.

[0260] It should be understood that the present application does not limit the order of S715 and the process of the third-party application acquiring the data stream, and S715 can be executed before, after or during the process of the third-party application acquiring the data stream.

[0261] S716: After the second communication service manager detects that the second terminal device is away from the first terminal device, determine that the second terminal device is offline.

[0262] It should be understood that the second terminal device being far away from the first terminal device can be understood as the distance between the second terminal device and the first terminal device is too far, so that the second terminal device and the first terminal device are not in the same local area network, or the Bluetooth connection between the first terminal device and the second terminal device is disconnected.

[0263] S717: The first communication service manager sends a fifth message to the application, where the fifth message is used to notify the application that the second terminal device is offline. Correspondingly, the application receives the fifth message from the first communication service manager.

[0264] S718: The application program notifies the first device virtualization module to disable the camera.

[0265] S719: The first device virtualization module sends a deletion message to the virtual bus driver, where the deletion message is used to instruct the virtual bus driver to delete the virtual device driver. Correspondingly, the virtual bus driver receives the deletion message from the first device virtualization module.

[0266] S720. The virtual bus driver deletes the virtual device driver.

[0267] It should be understood that the specific implementation of S701 to S720 is similar to the steps in method 400, and can be found above, and will not be repeated here.

[0268] It should be understood that the order of execution of the above methods does not necessarily mean the order in which they are executed. The order in which the methods are executed should be determined by their functions and internal logic.

[0269] Combination of the above Figures 2 to 11 , describes in detail the hardware device calling method of the embodiment of the present application, and the following is combined with Fig.12 , describes in detail the hardware device calling device of the embodiment of the present application.

[0270] Fig.12 A schematic block diagram of a hardware device calling device 1200 provided in an embodiment of the present application. The device 1200 includes a processor 1201, a transceiver 1202, and a memory 1203. The processor 1201, the transceiver 1202, and the memory 1203 communicate with each other through an internal connection path, the memory 1203 is used to store instructions, and the processor 1201 is used to execute the instructions stored in the memory 1203 to control the transceiver 1202 to send signals and / or receive signals.

[0271] It should be understood that the device 1200 can be specifically the first terminal device in the above embodiment, and can be used to execute the various steps and / or processes corresponding to the first terminal device in the above method embodiment. Optionally, the memory 1203 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A part of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type. The processor 1201 may be used to execute instructions stored in the memory, and when the processor 1201 executes the instructions stored in the memory, the processor 1201 is used to execute the various steps and / or processes of the above method embodiment. The transceiver 1202 may include a transmitter and a receiver, the transmitter may be used to implement the various steps and / or processes corresponding to the above transceiver for performing the sending action, and the receiver may be used to implement the various steps and / or processes corresponding to the above transceiver for performing the receiving action.

[0272] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0273] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor executes the instructions in the memory, and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.

[0274] The present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to implement the method shown in the above method embodiment.

[0275] The present application also provides a computer program product, which includes a computer program (also referred to as code or instruction). When the computer program runs on a computer, the computer can execute the method shown in the above method embodiment.

[0276] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0277] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0278] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

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

[0280] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0281] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0282] The above is only a specific implementation of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the embodiments of the present application, which should be included in the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application should be based on the protection scope of the claims.

Claims

1. A method for calling a hardware device, characterized in that: Applied to a system including a first terminal device and a second terminal device, a user logs in to the same account on the first terminal device and the second terminal device, and both the wireless fidelity WiFi switch and the Bluetooth switch of the first terminal device and the second terminal device are turned on, the method comprising: When the second terminal device is detected, the first terminal device acquires hardware device information of the second terminal device, where the hardware device information includes device identification information of the second terminal device, type identification information of at least one hardware device of the second terminal device, and hardware device capability information of the at least one hardware device; Based on the hardware device information, the first terminal device creates a virtual device driver for each hardware device in the at least one hardware device through a virtual bus driver, wherein the virtual bus driver is used to manage the virtual device driver; When it is detected that the first application calls a message request of the first hardware device among the at least one hardware device through the first virtual device driver, the first terminal device receives the data stream from the second terminal device through the data channel, and the first virtual device driver is created by the virtual bus driver based on the hardware device information of the first hardware device.

2. The method according to claim 1, characterized in that The first terminal device comprises an application layer and a kernel layer; The application layer includes the first application, a first device virtualization module and a first communication service manager, the first device virtualization module is used to control the creation and deletion of virtual device drivers and process requests from the application, and the first communication service manager is used to perform data transmission between devices; The kernel layer includes the virtual bus driver, the virtual device driver and the driver development framework.

3. The method according to claim 2, characterized in that The first terminal device acquires the hardware device information of the second terminal device, including: The first device virtualization module obtains the hardware device information; The first terminal device creates a virtual device driver for each hardware device in the at least one hardware device through the virtual bus driver based on the hardware device information, including: The first device virtualization module creates a virtual device driver corresponding to the type identification information, the device identification information, and the attributes indicated by the hardware device capability information of each hardware device through the virtual bus driver.

4. The method according to claim 3, characterized in that The creating of a virtual device driver corresponding to the type identification information, the device identification information, and the attributes indicated by the hardware device capability information of each hardware device includes: The first device virtualization module converts the type identification information and the device identification information of each hardware device into a hardware device type descriptor in a universal serial bus (USB) protocol, and converts the hardware device capability information of each hardware device into a hardware device configuration descriptor in the USB protocol; The first device virtualization module transmits the hardware device type descriptor and the hardware device configuration descriptor to the virtual bus driver; The virtual bus driver creates a virtual device driver corresponding to the hardware device type descriptor and the hardware device configuration descriptor.

5. The method according to claim 3 or 4, characterized in that: The second terminal device comprises a second communication service manager, and the first communication service manager and the second communication service manager are used to implement data transmission between the first terminal device and the second terminal device; The first device virtualization module obtains the hardware device information, including: The first device virtualization module establishes a control channel; The first communication service manager sends a first request to the second communication service manager through the control channel, where the first request is used to request the hardware device information; The first communication service manager receives the hardware device information from the second communication service manager; The first communication service manager transmits the hardware device information to the first device virtualization module.

6. The method according to claim 5, characterized in that After the first communication service manager transmits the hardware device information to the first device virtualization module, the method further includes: The first device virtualization module deletes the control channel.

7. The method according to claim 5 or 6, characterized in that: The first device virtualization module establishes a control channel, including: In the case where the hardware device information cannot be read from the cloud server, the first device virtualization module establishes the control channel.

8. The method according to any one of claims 2 to 7, characterized in that The method further comprises: When a change is detected in the cache message queue corresponding to the first virtual device driver, the first device virtualization module reads a second request from the cache message queue, where the second request is used to request to obtain the data stream; The first terminal device receives the data stream from the second terminal device through the data channel, including: The first device virtualization module sends the data stream to the virtual bus driver based on the second request; The virtual bus driver matches and encapsulates the data stream and the second request in the cache message queue to obtain an encapsulated data packet, and feeds the encapsulated data packet back to the first application.

9. The method according to any one of claims 2 to 8, characterized in that The method further comprises: When it is detected that the second terminal device is offline, the first terminal device deletes the virtual device driver corresponding to the at least one hardware device through the virtual bus driver. The second terminal device being offline indicates that the WiFi switch and / or Bluetooth switch of at least one device among the first terminal device and the second terminal device is in the off state, or the first terminal device and the second terminal device are not logged in to the same account.

10. The method according to claim 9, characterized in that The first terminal device deletes the virtual device driver corresponding to the at least one hardware device through the virtual bus driver, including: The first communication service manager detects that the second terminal device is offline, and notifies the first device virtualization module to delete the virtual device driver corresponding to the at least one hardware device; The first device virtualization module transmits a deletion message of the virtual device driver corresponding to the at least one hardware device to the virtual bus driver; The virtual bus driver deletes the virtual device driver corresponding to the at least one hardware device based on the deletion message.

11. The method according to any one of claims 1 to 10, characterized in that The first terminal device acquires the hardware device information of the second terminal device, including: When a first switch button in the first terminal device setting interface and a second switch button in the second terminal device setting interface are in the on state, the hardware device information is obtained, the first switch button is used by the user to select whether to turn on or off the function of calling the hardware device, and the second switch button is used by the user to select whether to turn on or off the function of calling the hardware device.

12. The method according to claim 11, characterized in that The method further comprises: When the first switch button and / or the second switch button is switched from an on state to an off state, the first terminal device deletes the virtual device driver corresponding to the at least one hardware device through the virtual bus driver.

13. The method according to claim 12, characterized in that The method further comprises: The first terminal device displays a setting interface, wherein the setting interface includes the first switch button; Based on a user's selection operation on the first switch button, the first switch button is adjusted to an on state or an off state.

14. The method according to any one of claims 1 to 13, characterized in that The first terminal device includes a second application; The first terminal device installs a virtual bus driver, including: The first terminal device installs the virtual bus driver through the second application.

15. The method according to any one of claims 1 to 14, characterized in that Before the first terminal device obtains the hardware device information of the second terminal device, the method further includes: The first terminal device detects whether a calling condition of the hardware device is met, and the calling condition includes at least one of the following: The device type of the second terminal device is a preset type; The first terminal device supports the ability to call a hardware device; or, The function of the first terminal device calling the hardware device is in an enabled state; The obtaining of the hardware device information of the second terminal device includes: When the calling condition is met, the hardware device information is obtained.

16. The method according to any one of claims 1 to 15, characterized in that The first terminal device acquires the hardware device information of the second terminal device, including: The first terminal device reads the hardware device information from the cloud server.

17. The method according to any one of claims 1 to 16, characterized in that The at least one hardware device includes a camera and / or a microphone.

18. A hardware device calling device, characterized in that: include: A processor, wherein the processor is coupled to a memory, wherein the memory is used to store a computer program, and when the processor calls the computer program, the device is caused to execute the method according to any one of claims 1 to 17.

19. A computer-readable storage medium, characterized in that: Used to store a computer program, the computer program comprising instructions for implementing the method according to any one of claims 1 to 17.

20. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is executed on a computer, the computer is enabled to implement the method according to any one of claims 1 to 17.

Citation Information

Cited By

  • Hardware device calling method and apparatus

    EP4589426A1

  • Hardware device calling method and apparatus

    WO2025002367A1