Device hot plug method and terminal device

By establishing a mapping relationship between virtual devices and real devices in the Windows system, the problem of information updates when devices change in the Android emulator is solved, enabling hot-swapping of devices and normal use of applications, thus improving the user experience.

CN115878191BActive Publication Date: 2025-11-04HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110901795.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-06
Publication Date
2025-11-04
Estimated Expiration
2041-08-06

AI Technical Summary

Technical Problem

Existing Android emulators cannot update device information in a timely manner when external devices connected to a personal computer change, causing applications to malfunction and resulting in a poor user experience.

Method used

By establishing a mapping relationship between virtual devices and real devices in the Windows system of the terminal device, the hot-swappable function of the device is realized, enabling the Windows system to dynamically update device information and send data from the real device to the application.

Benefits of technology

Ensure that applications can call real devices normally in the emulator, improve user experience, and support hot-swapping of multiple devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115878191B_ABST
    Figure CN115878191B_ABST
Patent Text Reader

Abstract

A device hot plug method and a terminal device, the method comprises the following steps: a real device is connected to the terminal device through a wireless connection or a wired connection, the Windows system of the terminal device can receive virtual device information sent by an application, then corresponding real device information is found based on a mapping relationship between the real device information and the virtual device information, so as to call the real device and establish a communication connection. Moreover, when the real device connected by the terminal device is hot plugged, the mapping relationship can be updated in real time, the normal calling of the real device side is ensured, and the user experience can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of terminal, in particular to a device hot plug method and a terminal device. BACKGROUND

[0002] There are various brands of simulators on the market, such as Thunder, Night God, and Mumu simulator, which are all Android simulators. An Android simulator is a simulator that can enable a user to run and simulate an Android operating system on a personal computer in addition to the original computer system, and can install, use, and uninstall Android applications. For example, a camera application, a music application, etc. can be installed on an Android simulator, but if a camera, a microphone, a speaker, etc. are needed to be used on the simulator, a camera, a microphone, a speaker, etc. pre-configured on the personal computer or externally connected by the user are needed.

[0003] Currently, when an Android simulator is started, the simulator can obtain the information of the externally connected device on the personal computer in the initial state, but if an externally connected device is added or removed from the personal computer during the use of the simulator, the simulator cannot update the information of the externally connected device obtained in the initial state. That is, if an externally connected device is added or removed from the personal computer, the application on the simulator can not be normally used. For example, a camera device is externally connected to the personal computer in the initial state, and the user removes the externally connected camera device during the use of the simulator, which will cause the camera application in the simulator to be unable to be normally used, such as the user opening the camera application, failing to collect images, or failing to switch the front and rear cameras, etc., resulting in poor user experience. SUMMARY

[0004] The present application provides a device hot plug method and a terminal device to realize the hot plug of multiple devices and improve user experience.

[0005] In a first aspect, the present application provides a device hot plug method, which can be applied to a terminal device carrying a Windows system, and the terminal device is externally connected to a first real device. The method comprises: the Windows system of the terminal device receiving a first virtual device identifier sent by a first application, then determining a first real device identifier corresponding to the first virtual device identifier based on the first virtual device identifier, and finally the Windows system of the terminal device can obtain data collected by the first real device corresponding to the first real device identifier, and send the data collected by the first real device to the first application.

[0006] By the technical solution, the Windows system of the terminal device can determine the real device identifier corresponding to the virtual device identifier based on the virtual device identifier, so that when the external device changes, the Windows system can update the information of the external device, so that when the application in the simulator is used, the real device can be normally called, the normal use of the application is ensured, and the user experience can be improved. Moreover, hot plugging of multiple devices can be implemented.

[0007] In a possible design, the Windows system of the terminal device determines the first real device identifier corresponding to the first virtual device identifier, including: the Windows system of the terminal device determines the first real device identifier corresponding to the first virtual device identifier according to a first mapping relationship, and the first mapping relationship includes a corresponding relationship between the identifier of the first real device connected by the terminal device and the identifier of the configured virtual device.

[0008] By the technical solution, the Windows system of the terminal device can determine the real device identifier corresponding to the virtual device identifier based on the mapping relationship between the virtual device and the real device, so as to call the real device corresponding to the real device identifier and establish a communication connection.

[0009] In a possible design, the device connected by the terminal device further includes a second real device, and the first real device and the second real device are devices of the same type.

[0010] When the first real device is unplugged, the method further includes: the Windows system of the terminal device determines a second real device identifier corresponding to the first virtual device identifier according to a second mapping relationship, the second mapping relationship includes a corresponding relationship between the identifier of the second real device connected by the terminal device and the identifier of the configured virtual device; the Windows system of the terminal device acquires data collected by the second real device corresponding to the second real device identifier, and sends the data collected by the second real device to the first application.

[0011] By the technical solution, the mapping relationship between the virtual device and the real device can be updated as the external device changes. For example, when the devices connected by the terminal device include external devices of the same type, such as the first real device and the second real device, if the first real device is unplugged, the mapping relationship can be updated, that is, the mapping relationship between the first real device and the corresponding virtual device is deleted. Or when the first real device is unplugged and a same-type external device, such as the second real device, is newly plugged in, the mapping relationship can also be updated, so that the corresponding real device can be found according to the updated mapping relationship, and the real device can be normally called.

[0012] In a possible design, the method further includes: the Windows system of the terminal device receiving a second virtual device identifier sent by the first application; the Windows system of the terminal device determining a first real device identifier corresponding to the second virtual device identifier; and the Windows system of the terminal device obtaining data collected by a first real device corresponding to the first real device identifier, and sending the data collected by the first real device to the first application.

[0013] Through the technical solution, when there is only one external real device of the same type, one real device can correspond to multiple virtual devices, that is, the same real device identifier can be found through different virtual device identifiers. For example, when there is only one external real device, the virtual device identifiers of the front camera and the rear camera are different, but the external real camera can be called as the front camera or the rear camera.

[0014] In a possible design, the device connected to the terminal device further includes a second real device, and when the first real device and the second real device are devices of the same type, the method further includes: the Windows system of the terminal device receiving a second virtual device identifier sent by the first application; the Windows system of the terminal device determining a second real device identifier corresponding to the second virtual device identifier; and the Windows system of the terminal device obtaining data collected by a second real device corresponding to the second real device identifier, and sending the data collected by the second real device to the first application.

[0015] Through the technical solution, when there are at least two devices of the same type in the real devices connected to the terminal device, one real device can correspond to one virtual device. That is, the Windows system of the terminal device can find a first real device identifier according to a first virtual device identifier, and find a second real device identifier according to a second virtual device identifier. For example, when there are two external cameras, one camera can be called as the front camera and the other camera can be called as the rear camera. Of course, there can be a case that one real device corresponds to multiple virtual devices, which is not limited in the present application.

[0016] In a possible design, the first real device includes at least one of the following devices: a camera, a microphone, and a loudspeaker.

[0017] Through the technical solution, the camera, the microphone, and the loudspeaker can be connected to the terminal device, so as to ensure normal use of the application under the simulator of the terminal device.

[0018] In a possible design, the first real device is a device connected to the terminal device in a wired or wireless manner.

[0019] Through the technical solution, the external real device can establish a connection with the terminal device through wireless or wired manner, so that a communication connection is established between the real device and the terminal device.

[0020] In a possible design, the first real device is a device connected to a terminal device different from the terminal device through wired or wireless connection.

[0021] Through the technical solution, the external real device on the terminal device can be a device externally connected to another terminal device. That is, the external real device can be connected to at least one terminal device at the same time.

[0022] In a possible design, the wired connection includes a universal serial bus (USB) line, an adapter line, the wireless connection includes wireless fidelity (Wi-Fi), Bluetooth, ultra-wideband wireless communication (UWB), and near field communication (NFC).

[0023] In a possible design, the first application is any application under a system of an Android emulator.

[0024] In the embodiment, the emulator on the terminal device can be an Android emulator, and the first application can be an Android application under the Android emulator, such as a camera application, a video application, a music application, and the like.

[0025] In a possible design, the first virtual device identifier is pre-stored in the Android system.

[0026] Through the technical solution, the Windows system of the terminal device can obtain the real device identifier connected to the terminal device, then configure a virtual device identifier based on the real device identifier, and send the virtual device identifier to the Android system. After receiving the virtual device identifier, the Android system can save the virtual device identifier, so that when an application under the emulator calls an external device, the virtual device identifier can be found.

[0027] In a possible design, the method further includes: displaying the data collected by the first real device.

[0028] Through the technical solution, after the Windows system of the terminal device sends the data collected by the first real device to the first application, the data collected by the first real device can be displayed on an application interface of the first application. For example, when the real device is a camera, an image (or a picture) collected by the camera can be displayed on an application interface of the camera, so as to be viewed by a user.

[0029] In a second aspect, the present application provides a terminal device, comprising a display screen; one or more processors; one or more memories; one or more sensors; a plurality of applications; and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs comprise instructions which, when invoked to be executed by the one or more processors, cause the terminal device to perform the method of the first aspect and any possible design of the first aspect.

[0030] In a third aspect, the present application also provides a terminal device, which comprises modules / units for performing the method of the first aspect or any possible design of the first aspect; these modules / units can be implemented by hardware, or by hardware executing corresponding software.

[0031] In a fourth aspect, the present application also provides a computer-readable storage medium, which stores instructions, and when the instructions run on a terminal device, cause the terminal device to perform the method of the first aspect and any possible design of the first aspect.

[0032] In a fifth aspect, the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to perform the method of the first aspect and any possible design of the first aspect.

[0033] The technical effects of each of the second aspect to the fifth aspect and each possible design of the first aspect can be referred to the technical effect description of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 An application scenario provided by the embodiments of the present application;

[0035] Figure 2 A structural diagram of an electronic device provided by the embodiments of the present application;

[0036] Figure 3A A structural block diagram of a terminal device provided by the embodiments of the present application;

[0037] Figure 3B A flowchart of a device hot plug method provided by the embodiments of the present application;

[0038] Figure 4A A flowchart of a device hot plug provided by the embodiments of the present application;

[0039] Figure 4B A flowchart of a camera device hot plug provided by the embodiments of the present application;

[0040] Figure 5 A user interface schematic diagram provided for an embodiment of the present application;

[0041] Figure 6 A device hot plug method flow chart provided for an embodiment of the present application;

[0042] Figure 7 Another device hot plug method flow chart provided for an embodiment of the present application;

[0043] Figure 8 Another electronic device structure schematic diagram provided for an embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be described in detail below with reference to the accompanying drawings in the embodiments of the present application.

[0045] First, the concepts related to the embodiments of the present application are explained.

[0046] 1) Emulator: a software that can make users run and simulate other operating systems on personal computers except the original computer system, and can install, use and uninstall other operating system applications. For example, an Android emulator is a software that can make users run and simulate the Android operating system on personal computers except the original computer system, and can install, use and uninstall Android applications.

[0047] 2) Hot plug: refers to allowing users to insert, remove and replace devices connected to terminal devices through wired or wireless connection without shutting down the system and cutting off the power supply. For example, these devices can be cameras, microphones, speakers, etc. The wired connection method can be a universal serial bus (USB) line, an adapter, etc. The wireless connection method can be at least one of wireless fidelity (Wi-Fi), Bluetooth, ultra wide band (UWB) wireless communication, and near field communication (NFC).

[0048] 3) Application (APP): an application refers to a software program capable of realizing one or more specific functions. Generally, multiple applications can be installed in a terminal device. For example, a camera application, an SMS application, an email application, a video application, a music application, WeLink, and the like. The application mentioned below can be an application installed in a terminal device when the terminal device is shipped, or an application downloaded from a network or obtained from another terminal device by a user during use of the terminal device.

[0049] It should be noted that the device hot plug method provided by the embodiments of the present application can be applied to terminal devices with display screens, such as personal computers (PCs) (for example, tablet computers, notebook computers, ultra-mobile personal computers (UMPCs)), smart screens, and the like, and the embodiments of the present application are not limited thereto. In addition, exemplary embodiments of the terminal device include, but are not limited to, terminal devices carrying Harmony or other operating systems.

[0050] First, the application scenario of the embodiments of the present application is introduced. As shown in Figure 1 , it is a schematic diagram of an application scenario provided by the embodiments of the present application. Referring to Figure 1 , the application scenario can include a terminal device 10, externally connected real devices (which can also be referred to as external devices or real devices), such as a Bluetooth speaker 20, a camera 21, a camera 22, a microphone 23, and a loudspeaker 24. It should be understood that Figure 1 only five externally connected real devices are taken as examples in the present application, and there can be more or fewer external devices in the present application, which are not limited specifically.

[0051] Among them, the terminal device 10 and the external device can be connected through a USB interface, that is, a connection can be established through a USB line. Of course, the terminal device 10 can also establish a connection with the external device through other ways, such as establishing a connection through Bluetooth (BT) and the like, which are not limited.

[0052] The structure of the terminal device in the application scenario shown in Figure 1 will be introduced below.

[0053] As shown in Figure 2As shown, the terminal device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charge 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 loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 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 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric 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.

[0054] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors. The controller can be the nerve center and command center of the terminal device 100. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching instructions and executing instructions. A memory can also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can directly call from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.

[0055] The USB interface 130 is an interface complying with the USB standard specification, and 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 a peripheral device. The charging management module 140 is configured to receive charging input from the charger. The power management module 141 is configured to connect the battery 142 and the charging management module 140. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to supply power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160, etc. In some embodiments of the present application, the terminal device 100 can be connected to a real device in communication through the USB interface or Bluetooth.

[0056] The wireless communication function of the terminal device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc. The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0057] The mobile communication module 150 can provide a solution including 2G / 3G / 4G / 5G wireless communication applied to the terminal device 100. The mobile communication module 150 can 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 perform filtering, amplification, etc. on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert the signals into electromagnetic waves to be radiated through the antenna 1. In some embodiments, at least part of the function modules of the mobile communication module 150 can be arranged in the processor 110. In some embodiments, at least part of the function modules of the mobile communication module 150 and at least part of the modules of the processor 110 can be arranged in the same device.

[0058] The wireless communication module 160 can provide a solution for wireless communication including wireless local area networks (WLAN) (e.g., Wi-Fi network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared (IR) technology, etc. applied to the terminal device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 can also receive signals to be transmitted from the processor 110, frequency-modulate them, amplify them, and radiate them as electromagnetic waves via the antenna 2.

[0059] In some embodiments, the antenna 1 and the mobile communication module 150 of the terminal device 100 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the terminal device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies can 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), the fifth generation (5G) mobile communication system, future communication systems such as a 6th generation (6G) system, BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS can 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 systems (SBAS).

[0060] The display screen 194 is configured to display a display interface of an application, 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 (AMOLED), a flex light-emitting diode (FLED), a Miniled, a Micro Led, a Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the terminal device 100 can include one or N display screens 194, where N is a positive integer greater than 1. In the embodiments of the present application, the display screen 194 can be configured to display an application interface.

[0061] The camera 193 is configured to capture a still image or a video. The camera 193 can include a front camera and a rear camera.

[0062] The internal memory 121 can be configured to store computer executable program codes including instructions. The processor 110 executes various functional applications and data processing of the terminal device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system and software codes of at least one application program (e.g., an iQiyi application, a WeChat application, etc.). The data storage area can store data (e.g., images, videos, etc.) generated during use of the terminal device 100, etc. In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0063] The external memory interface 120 can be configured 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 realize a data storage function. For example, files such as pictures and videos are saved in the external memory card.

[0064] The terminal device 100 can realize an audio function through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, etc. For example, music playing, recording, etc.

[0065] The keys 190 include a power key, a volume key, and the like. The keys 190 can be mechanical keys. Alternatively, the keys 190 can be touch keys. The terminal device 100 can receive key input and generate key signal input related to user settings and function control of the terminal device 100. The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompt, and can also be used for touch vibration feedback. For example, touch operations for different applications (e.g., taking pictures, playing audio, and the like) can correspond to different vibration feedback effects. The indicator 192 can be an indicator light, which can be used to indicate a charging state, a power change, and can also be used to indicate a message, a missed call, a notification, and the like. The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or pulled out of the SIM card interface 195 to achieve contact and separation with the terminal device 100.

[0066] It can be understood that, Figure 2 It can be understood that, Figure 2 The terminal device 100 shown in the figure is taken as an example for introduction.

[0067] Figure 3A The terminal device 100 shown in the figure is taken as an example for introduction. Figure 3A As shown in the figure, the terminal device 100 can be an electronic device running a Windows system, and a plurality of application programs can be installed under the Windows system, such as an emulator application (emulator.exe). The emulator application can be an application running an Android system, and a plurality of Android applications can be included under the Android system, such as a camera application, a music application, a Huawei video application, and the like.

[0068] The terminal device is taken as a notebook computer as an example. In the embodiment of the present application, when a user externally connects a real device to the notebook computer, the same number of virtual devices can be generated on the Android emulator, and then a mapping relationship between the virtual devices and the externally connected device can be established. In this way, when a virtual device on the emulator is called, the externally connected real device can be called according to the mapping relationship, so as to establish communication with the real device, and realize the hot plug function of the emulator supporting the device. It should be understood that the real device can be the device as described above, which is connected to the terminal device in a wired or wireless manner, such as a camera, a microphone, a loudspeaker, and the like.

[0069] As shown in the figure, Figure 3BAs shown, assuming that the terminal device is externally connected with N (the N is a positive integer greater than or equal to 1) real devices, the Windows system can acquire the information of the externally connected real devices. When the simulator starts, the simulator can send an initialization request message to the Windows system, and after the Windows system receives the initialization request message, the Windows system can convert the information of the externally connected real devices into virtual device information, that is, build a mapping relationship between the real device information and the virtual device information, and send the virtual device information to the Android system. When the user uses the camera application, the camera needs to be called, at this time the camera application can acquire the virtual device information from the Android system and send the virtual device information to the Windows system, and then the Windows system finds the corresponding real device information according to the mapping relationship. Taking the camera device as an example, when the simulator starts, the simulator can send an initialization request message to the Windows system to initialize the Android camera. The initialization request message can include virtual camera information, such as the resolution of the virtual camera. For example, the initialization request message can include three resolutions supported by the camera, 1:1 (720*720), 4:3 (960*720), and 16:9 (1280*720) in the embodiment of the application. It should be understood that the above resolutions are only an example, and the externally connected real camera does not necessarily completely support the above three resolutions, and it is possible to support only one of the resolutions, which is not limited in the application.

[0070] Figure 4A Fig. 1 shows a schematic diagram of a device hot plug method provided by an embodiment of the application. Referring to Fig. 1, Figure 4A As shown, the terminal device 100 is an electronic device carrying a Windows system, and the simulator application can be installed under the Windows system, and the simulator is an application carrying an Android system. In addition, the terminal device 100 can be externally connected with at least one real device. For example, referring to Fig. 1(a), Figure 4A As shown in Fig. 1(a), when the simulator starts, the simulator can send an initialization request message to the Windows system, and after the Windows system receives the initialization request message, the Windows system can convert the information of the externally connected real devices into virtual device information, and build a mapping relationship between the real device information and the virtual device information, such as establishing a mapping relationship between the virtual device and the real device on the Windows side according to the name of the real device. Then, the Windows system can send the virtual device information to the Android system, and the Android system can save the virtual device information after receiving the virtual device information.

[0071] Referring to Fig. 1, Figure 4AAs shown in (b), a real device is connected to the Windows side, and the user can hot-plug the real device, such as adding or deleting it. For example, if a user connects a new external device to the Windows side (i.e., adds a real device), the Windows side can update the mapping relationship through hot-plugging. See also... Figure 4A As shown in (c), the Windows side executes corresponding operations by responding to user commands to operate the actual device. These operations can include connecting and disconnecting the device.

[0072] like Figure 4B As shown, taking a camera as an example, this diagram illustrates the interaction between the hot-plugging and unplugging methods of the device. (See attached image.) Figure 4B As shown in (a), when the emulator starts, it can send an initialization request message to the Windows system. Upon receiving this message, the Windows system can configure the virtual camera information (Virtual Camera Info) based on the external real camera information and establish a mapping between the virtual camera information and the real camera information. Then, the Windows system can send the virtual camera information to the Android system, such as the virtual camera's name, direction, frame rate, and ID. After receiving the virtual camera information, the Android system can save it.

[0073] See Figure 4B As shown in (b), when a user inserts or removes an external real camera device from the terminal device (i.e., hot-plugs or unplugs the camera device), the above mapping relationship can be updated accordingly to ensure that Android can map the virtual camera to the real camera when calling the virtual camera, thereby ensuring the normal use of the camera. See also Figure 4BAs shown in (c) in the figure, the Windows system can respond to the device operation instruction received by the external real camera device to perform corresponding operation. The device operation of the external real camera device can include: camera connection (Connect), image acquisition start (Start), camera resolution (Frame), image acquisition stop (Stop), camera disconnection (Disconnect) operation, etc. For example, when the user opens the camera application and needs to use the camera, the external real camera device can receive the camera connection (Connect) instruction, and then open the camera. When the user clicks the shooting button, the external real camera device can receive the image acquisition start (Start) instruction to start shooting or recording, etc.

[0074] It should be noted that the identifier of the virtual camera is used to identify whether the camera is a front camera or a rear camera. For example, when the identifier of the virtual camera is A, it can be considered that the virtual camera is a front camera; when the identifier of the virtual camera is B, it can be considered that the virtual camera is a rear camera. Alternatively, the identifier of the virtual camera can be used to identify whether the camera is a camera pre-installed on the terminal device at the factory or an external camera. For example, when the identifier of the virtual camera is A, it can be considered that the virtual camera is a camera pre-installed on the terminal device at the factory; when the identifier of the virtual camera is B, it can be considered that the virtual camera is an external camera.

[0075] The following embodiments are described by taking the Windows system as an example. Figure 2 The architecture of the terminal device 100 shown in the figure is taken as an example for description.

[0076] In addition, at least one of the following embodiments includes one or more; wherein the plurality refers to greater than or equal to two. In addition, it should be understood that in the description of the present application, the words "first", "second", etc. are only used for the purpose of distinguishing the description.

[0077] Taking a notebook computer as an example, the notebook computer can be a device equipped with a Windows system. The notebook computer equipped with the Windows system can install an emulator application (hereinafter referred to as an emulator). Assuming that the emulator is an Android emulator, an Android application can be installed in the Android emulator, such as a camera application, a music application, a Huawei video application, etc. For example, refer to Figure 5As shown, assuming the notebook computer displays an interface 500, which can include at least one application icon, such as an emulator application icon 501, a camera application icon 502, a music application icon 503, and a Huawei video application icon 504. Among them, the camera application, the music application, and the Huawei video application are Android applications installed in the Android emulator, that is, after the emulator installs the above applications, the application icons are placed on the desktop of Windows. Of course, the interface 500 can also include a taskbar 505 and the like, which is not limited in the present application. When the user clicks the emulator application icon 501 in the interface 500, the notebook computer can display an interface 510. Among them, the interface 510 can include a desktop window 511 of the Android system carried by the emulator, which can include application icons of Android applications, such as the camera application icon 502, the music application icon 503, and the Huawei video application icon 504.

[0078] In some embodiments, before the Android emulator starts, at least one device can be externally connected to the notebook computer, such as two camera devices or one camera device and one audio device. When the emulator starts, the emulator can send an initialization request message to the Windows system. After receiving the initialization request message, the Windows system can convert real device information (such as a real device list) into virtual device information (such as a virtual device list), and construct a mapping relationship between the virtual device information and the real device information. Then, the Windows system can send the virtual device information to the Android system, and the Android system can save the virtual device information, so that when the corresponding device is called, the corresponding virtual device can be found in the Android system, and then the corresponding real device can be found according to the mapping relationship, so that the real device can be successfully called and the application program on the emulator can be normally used. That is, in the embodiments of the present application, the mapping relationship is used to determine the real device information corresponding to the virtual device information according to the virtual device information by the Windows system.

[0079] The mapping relationship between the virtual device and the real device can be a one-to-one relationship. That is, each virtual device can correspond to one real device. Specifically, the virtual device can be mapped to the device identifier (display name) of the real device through the device identifier (display name). That is, the same device identifier (display name) can correspond to a virtual device identifier (fake name) and a real device identifier (real name). Taking a camera device as an example, the device identifier of the camera device can be camera(), the virtual camera device identifier can be fake camera(), and the real camera device identifier can be real camera(). For example, the display name is camera1, the virtual camera device identifier is fake camera1, and the real camera device identifier is real camera2. When fake camera1 is called, the corresponding display name, i.e., camera1, can be found according to fake camera1, and then the real camera identifier corresponding to camera1, i.e., real camera2, can be found in the real device identifier according to the display name, so as to call the real camera.

[0080] For example, the mapping relationship between the real device and the virtual device can refer to Table 1 shown below.

[0081] Table 1

[0082] External device Virtual device Camera 1 Virtual camera 1 Camera 2 Virtual camera 2 Audio device 1 Virtual audio device 1

[0083] It should be understood that Table 1 described above is only an illustrative description, and 1 and 2 can be understood as the identifier information of the device, that is, the mapping relationship between the real device and the virtual device can be established through the identifier information.

[0084] In some other embodiments, the mapping relationship described above can be updated in real time according to the insertion and removal of the external real device. For example, when the camera 1 in the external real device is removed from the notebook computer and a new camera 3 is inserted, the mapping relationship between the camera 1 and the virtual camera 1 can be deleted, and a new mapping relationship can be established, for example, the mapping relationship between the camera 3 and the virtual camera 1. Or when the camera 1 in the external real device described above is removed, and the external real device is left with only the camera 2 and the audio device 1, the camera 2 can be mapped to the virtual camera 1 and the virtual camera 2 at the same time. Or based on Table 1 described above, if a new camera 3 is inserted, a mapping relationship between the camera 3 and the virtual camera 3 can be added to the table.

[0085] The device hot-plugging method of this application embodiment is described below in conjunction with the above scenario.

[0086] like Figure 6 The diagram shown is a flowchart of a device hot-plugging method provided in an embodiment of this application. (See attached diagram.) Figure 6 As shown, the method may include the following steps:

[0087] S601: The first application within the emulator responds to the user's first operation and searches for information about the first virtual device.

[0088] For ease of description, the Android application within the emulator can be referred to as the "first application," such as a camera application. The first operation can be the operation of opening the first application, such as a user clicking the application icon or opening the application via voice triggering, etc. This application does not limit this. For example, the first operation can be a user... Figure 5 The first operation is a click on the camera application icon 502 on interface 500 or interface 510. Of course, the first operation can also be a click on a button on the application interface of the first application, such as a click on the button to switch between the front and rear cameras.

[0089] In some embodiments, when a user clicks the application icon of an Android application running on the emulator's Android system, such as the camera application icon, the emulator can send a notification message to the Android system to inform it which application is to be launched. Correspondingly, upon receiving the notification message, the Android system can launch the camera application and then send a feedback message to the emulator to inform it that the Android application has been opened.

[0090] Based on the above description of application scenarios, when an external device is connected to a Windows-based laptop, the Android system can store the corresponding virtual device information. This allows the system to locate the virtual device when needed. For example, when a user opens the camera app, they need to access the camera, and thus need to find the virtual camera information within the Android system.

[0091] In the embodiments of the present application, the first virtual device information can include information of at least one virtual device, that is, the first virtual device can include at least one. For example, when a notebook computer is externally connected with a camera, the front and rear cameras of the camera can be mapped through one camera. That is, one externally connected camera can be used as a front camera and a rear camera at the same time, and in this case, the first virtual device is one virtual device. For example, when a notebook computer is externally connected with two cameras, the front and rear cameras of the camera can be mapped through one camera, that is, one camera is used as a front camera and the other camera is used as a rear camera, and in this case, the first virtual device is two virtual devices.

[0092] Further, the first virtual device information can include attribute information of the virtual device, such as an identifier, a resolution, and the like.

[0093] S602: The first application in the simulator sends the first virtual device information to the Windows system.

[0094] In some embodiments, after the first application finds the first virtual device information from the Android system, the first application can send the first virtual device information to the Windows system, so that the Windows system can find the corresponding real device information according to the first virtual device information.

[0095] For example, the first application can send the attribute information of the first virtual device to the Windows system, so that the Windows system can find the corresponding real device information according to the attribute information of the first virtual device. For example, the first application can send the display name information of the first virtual device to the Windows system.

[0096] S603: The Windows system determines the corresponding first real device information according to the first virtual device information.

[0097] In the embodiments of the present application, the Windows system can match the first real device information corresponding to the first virtual device information according to the mapping relationship between the virtual device and the real device. For example, assuming that the first virtual device information is virtual camera 1 and virtual camera 2, according to the mapping relationship in Table 1, it can be obtained that the first real device information can be camera 1 and camera 2. It should be understood that the first virtual device and the first real device are the same type of device, and the number of the first virtual device and the first real device can be the same or different, which is not limited in the present application.

[0098] For example, assuming that the virtual device information found in S601 is: the identification information of the virtual camera device is fake camera1, and the corresponding device identification display name is camera1, then the virtual device information sent to the Windows system in S602 can be display name, and then the Windows system finds the real camera identification corresponding to camera1 in the real device identification according to the display name, such as real camera2.

[0099] Since the mapping relationship is updated as the device is inserted and pulled out, that is, the mapping relationship can be updated in real time by monitoring the insertion and pulling out of the external device in real time, so that normal communication can be realized when different external devices of the same type are switched, and multi-device hot plugging of the same type can be realized, which can improve the user experience.

[0100] S604: The Windows system obtains the data collected by the first real device.

[0101] After the Windows system determines the first real device information according to the mapping relationship, the Windows system can obtain the data collected by the first real device. For example, when the external real device is a camera, the Windows system can establish a connection with the real camera after determining the real camera corresponding to the virtual camera according to the mapping relationship, call the camera driver of the external real camera on the Windows side to take a photo, and then obtain the image collected by the real camera. When the external real device is a microphone / speaker, the Windows system can call the audio driver of the external real device to collect audio data, and then obtain the audio data collected by the real device.

[0102] S605: The Windows system sends the data collected by the first real device to the first application.

[0103] In some embodiments, the Windows system can call the real device to collect data, and then feed back the data collected by the real device to the first application, so that the first application can be normally used. For example, the Windows system can call the real camera to collect images, and then feed back the images collected by the real camera to the camera application, so that the user can see the images collected by the real camera in the interface of the camera application.

[0104] Optionally, after S605, the following steps can also be included:

[0105] S606: Display the data collected by the first real device.

[0106] For example, when the real device is a camera, the Windows system can call the real camera to capture an image, and then send the captured image to the camera application, so that the camera application can display the image captured by the real camera on its display interface. For example, if the real camera supports a resolution of 4:3 (960*720), the camera application can display an image with a resolution of 4:3 (960*720) on its display interface.

[0107] Of course, the data captured by the real device does not necessarily need to be displayed on the display interface of the application. For example, when the real device is a microphone, the data captured by the microphone is audio data, which can be played through a speaker and does not need to be displayed on the application interface.

[0108] Through the above technical solution, the device hot plug of the simulator can be realized, so that the user can normally use the camera, microphone, etc. on the simulator, and the user experience can be improved.

[0109] It should be noted that the above embodiments can be arbitrarily split and combined to form new embodiments, which are not limited by the present application. For example, in one possible embodiment, the real device connected to the terminal device carrying the Windows system can also be an external device connected to another device. For example, the terminal device carrying the Windows system is terminal device 1, and the real devices connected to the terminal device 1 include camera 1, camera 2, and speaker 1, wherein camera 1 can be a camera of a terminal device (e.g., terminal device 2) external to terminal device 1. That is, terminal device 1 and terminal device 2 can be distributed devices, and terminal device 1 can call the native devices (cameras, speakers, etc.) and external devices (cameras, speakers, etc.) of terminal device 2, wherein the optional calling mode is to virtualize the native devices and / or external devices of terminal device 2 as the native devices and / or external devices of terminal device 1. Terminal device 2 can be an Android system or a Windows system, or other systems, which are not limited by the present application.

[0110] The following will take the camera as an example to introduce the method shown in Figure 6 in detail. Referring to Figure 7 , which is another device hot plug method flowchart provided by the embodiment of the present application. Figure 7 The flowchart can include two parts, the left flowchart is the process of how to create a mapping relationship, and the right flowchart is how to update the mapping relationship when a device hot plug event occurs. First, introduce the process of creating a mapping relationship: the Windows system can first obtain the camera device information connected to the terminal device, and determine whether the number of connected camera devices is greater than or equal to two, which can include the following cases:

[0111] Case 1: If the number of connected camera devices is greater than or equal to two, the connected camera device information is saved.

[0112] Case 2: If the number of connected camera devices is less than two, for example, there is one connected camera device, a virtual camera device is created, and the created virtual camera device information and the connected camera device information are saved.

[0113] Case 3: If the number of connected camera devices is less than two, for example, there are zero connected camera devices, two virtual camera devices are created, and the created virtual camera device information is saved.

[0114] It should be noted that the above process is distinguished by whether the number of cameras is greater than or equal to two. In this application, the number of cameras can be different according to different application scenarios, for example, it can also be four, etc., which is not limited in this application. It should be understood that the virtual camera device created here is used for placeholder, that is, to ensure that the number of cameras is at least two. For the convenience of understanding, the connected camera device information and / or the created virtual camera device information for placeholder can be recorded as initial camera information. Then, the initial camera information (g cameraServiceDesc) can be saved in g cameraUpdateDesc, and the initial camera information is used as the basis for updating the real device.

[0115] After obtaining the initial camera information, the Windows system can create corresponding virtual camera information based on the initial camera information, and construct the mapping relationship between the initial camera (or real camera) and the virtual camera.

[0116] The following describes how to update the mapping relationship when a device hot plug event occurs. When the device hot plug event is triggered, that is, the real device externally connected to the terminal device is unplugged or a new device is plugged in, the Windows system can obtain the current connected camera device information, and then update the mapping relationship according to the number of currently connected camera devices. Specifically, the following cases can be divided:

[0117] Case 1: If the number of currently connected camera devices is equal to zero, no processing is performed.

[0118] Case 2: If the number of currently connected camera devices is one, the front and rear cameras use the same camera.

[0119] Case 3: If the number of currently connected camera devices is two, it is continued to judge whether there is a same device connected to the currently connected camera devices, and if there is a same device connected, another device other than the same device is updated. For example, assuming that two camera devices are connected to the terminal device, which are camera device 1 and camera device 2 respectively, if a user unplugs one camera device, such as camera device 1, from the terminal device, and inserts a new camera device (for example, camera device 3), at this time, camera device 2 is the same device, and camera device 3 is the different device, therefore, only the newly inserted camera device (i.e., camera device 3) needs to be established with the mapping relationship with the virtual camera device.

[0120] That is, with the update of the real camera device, the mapping relationship can be updated accordingly. In this way, the Windows system can find the real camera information corresponding to the virtual camera information according to the continuously updated mapping relationship. Specifically, the device identifier (display name) in the virtual device information can be mapped to the continuously updated real device information, and the same device identifier (display name) can correspond to a real device and a virtual device. Therefore, the Windows system can map the device identifier (display name) in the virtual device information to the real device with the same device identifier in the continuously updated real device information, so as to find the real device corresponding to the virtual device.

[0121] Through the method of the embodiment of the present application, real-time updating is achieved through detection of device hot plug, Android repeated initialization is avoided, and multi-device hot plug in similar products is achieved, and real-time switching of multiple devices can be achieved. For example, if a connected camera is unplugged and a new camera device is inserted, the camera can be opened to successfully call the newly inserted camera to collect pictures, ensure the normal use of the camera application, and improve the user experience.

[0122] It should be understood that the above embodiments are only described by taking the camera as an example, when multiple audio (microphone, speaker) devices are connected to the Windows side, a specified device can be selected as an input / output device on the Android side, and the present application does not limit this.

[0123] The method provided in the embodiments of the present application is introduced from the perspective of the electronic device as an execution subject. To implement the functions in the method provided in the embodiments of the present application, the electronic device can include a hardware structure and / or a software module, and implement the above functions in the form of hardware structure, software module, or hardware structure plus software module. Whether a certain function in the above functions is implemented in the form of hardware structure, software module, or hardware structure plus software module depends on the specific application and design constraints of the technical solution.

[0124] As shown in Figure 8 Some other embodiments of the present application disclose a terminal device, which can be an electronic device with a display screen. Referring to Figure 8 The terminal device 800 includes a display screen 801, one or more processors 802, one or more memories 803, one or more sensors 804 (not shown in the figure), a plurality of applications 805 (not shown in the figure), and one or more computer programs 806 (not shown in the figure), which can be connected through one or more communication buses 807.

[0125] The display screen 801 is configured to display the display interface of the application in the electronic device. The memory 803 stores one or more computer programs, and the one or more computer programs include instructions. The processor 802 invokes the instructions stored in the memory 803, so that the terminal device 800 can implement the device hot plug method in the above embodiments.

[0126] In the embodiments of the present application, the processor 802 can be a general processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array, or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as execution completed by a hardware processor, or executed by a combination of hardware and software modules in the processor. The software module can be located in the memory 803, and the processor 802 reads the program instructions in the memory 803 and combines the hardware to complete the steps of the above method.

[0127] In the embodiments of the present application, the memory 803 can be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), and can also be a volatile memory, such as a RAM. The memory can also be any other medium capable of carrying or storing desired program codes in the form of instructions or data structures and capable of being accessed by a computer, but is not limited to this. The memory in the embodiments of the present application can also be a circuit or any other device capable of realizing a storage function, used for storing instructions and / or data.

[0128] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein.

[0129] Based on the above embodiments, the present application further provides a computer storage medium, which stores a computer program. When the computer program is executed by a computer, the computer executes the method provided in the above embodiments.

[0130] The embodiments of the present application also provide a computer program product, which includes instructions that, when executed on a computer, cause the computer to execute the method provided in the above embodiments.

[0131] The embodiments of the present application are described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure One one flow or multiple flows and / or blocks Figure One an apparatus that performs the functions specified in one block or multiple blocks.

[0132] These computer program instructions can also be stored in a computer-readable memory capable of guiding a computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including instruction means, which implements the functions specified in the flowcharts and / or block diagrams. Figure One one flow or multiple flows and / or blocks Figure One an apparatus that performs the functions specified in one block or multiple blocks.

[0133] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operational steps are generated to realize the computer-implemented processes in the computer or other programmable devices, and the instructions executed in the computer or other programmable devices provide steps for implementing the functions specified in the flowchart Figure One or multiple flows and / or blocks Figure One or multiple blocks in the flowchart or multiple blocks in the flowchart.

Claims

1. A device hot plug method applied to a terminal device carrying a Windows system, wherein the device connected by the terminal device comprises a first real device and a second real device, and the method comprises the following steps: The method comprises the following steps: ​ The Windows system of the terminal device receives a first virtual device identifier sent by a first application, the first application is an application of an Android emulator, and the virtual device identifier is a device identifier of a virtual device corresponding to a real device; The Windows system of the terminal device determines a first real device identifier corresponding to the first virtual device identifier; The Windows system of the terminal device obtains data collected by a first real device corresponding to the first real device identifier, and sends the data collected by the first real device to the first application; When the first real device is unplugged, the Windows system of the terminal device updates a mapping relationship of the first virtual device identifier to a second real device identifier of a second real device, and sends data collected by the second real device to the first application.

2. The method of claim 1, wherein, The Windows system of the terminal device determines a first real device identifier corresponding to the first virtual device identifier, comprising: The Windows system of the terminal device determines a first real device identifier corresponding to the first virtual device identifier according to a first mapping relationship, and the first mapping relationship comprises a corresponding relationship between an identifier of a first real device connected to the terminal device and an identifier of a configured virtual device.

3. The method of claim 1 or 2, wherein, The first real device and the second real device are devices of the same type; when the first real device is unplugged, the mapping relationship of the first virtual device identifier is updated to the second real device identifier of the second real device, and data collected by the second real device is sent to the first application, comprising: The Windows system of the terminal device determines a second real device identifier corresponding to the first virtual device identifier according to a second mapping relationship, and the second mapping relationship comprises a corresponding relationship between an identifier of a second real device connected to the terminal device and an identifier of a configured virtual device; The Windows system of the terminal device obtains data collected by a second real device corresponding to the second real device identifier, and sends the data collected by the second real device to the first application.

4. The method of claim 1 or 2, wherein, The method further comprises: The Windows system of the terminal device receives a second virtual device identifier sent by the first application; The Windows system of the terminal device determines a first real device identifier corresponding to the second virtual device identifier; The Windows system of the terminal device obtains data collected by a first real device corresponding to the first real device identifier, and sends the data collected by the first real device to the first application.

5. The method of claim 1 or 2, wherein, When the terminal device is connected to a second real device and the first real device and the second real device are devices of the same type, the method further comprises: The Windows system of the terminal device receives a second virtual device identifier sent by the first application; The Windows system of the terminal device determines a second real device identifier corresponding to the second virtual device identifier; The Windows system of the terminal device obtains data collected by a second real device corresponding to the second real device identifier, and sends the data collected by the second real device to the first application. The Windows system of the terminal device acquires data collected by the second real device corresponding to the second real device identifier, and sends the data collected by the second real device to the first application.

6. The method of claim 1, wherein, The first real device includes at least one of a camera, a microphone, and a speaker.

7. The method of claim 1, wherein, The first real device is a device connected to the terminal device through wired connection or wireless connection.

8. The method of claim 1, wherein, The first real device is a device connected to a terminal device different from the terminal device through wired connection or wireless connection.

9. The method of claim 7 or 8, wherein, The wired connection includes a universal serial bus (USB) cable and an adapter cable, and the wireless connection includes wireless fidelity (Wi-Fi), Bluetooth, ultra-wideband wireless communication (UWB), and near field communication (NFC).

10. The method of claim 1, wherein, The first virtual device identifier is pre-stored in an Android system.

11. The method of claim 1, wherein, The method further includes: displaying the data collected by the first real device.

12. A terminal device, comprising: The terminal device includes a display screen, one or more processors, one or more memories, one or more sensors, a plurality of applications, and one or more computer programs. The one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when executed by the one or more processors, cause the terminal device to perform the method of any one of claims 1 to 11.

13. A computer-readable storage medium having stored therein instructions, the computer-readable storage medium being characterized by, When the instructions are executed on the terminal device, the terminal device performs the method of any one of claims 1 to 11.

14. A computer program product comprising instructions, characterized in that, When the computer program product is executed on the terminal device, the terminal device performs the method of any one of claims 1 to 11.

Citation Information

Patent Citations

  • Vehicle-mounted camera calling method and device

    CN112363767A