Equipment connection method and device, computer equipment and storage medium

By detecting and adjusting the interface mode when the device is connected, providing multiple connection modes, and exiting the file transfer mode when necessary to allow data changes, the problem of application and files being unavailable when the device is connected under traditional USB Mass Storage mode is solved, and data synchronization is achieved in a timely manner.

CN119903004APending Publication Date: 2025-04-29LABPANO TECHNOLOGY (CHANGZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411648640.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

When the device is connected, the traditional USB Mass Storage method causes the application and files accessing the device to be unavailable, and the data synchronization is not timely.

Method used

By detecting the connection between the terminal device and the target device, reading the interface status information, determining the interface mode, and displaying the matching device connection interface in the display interface of the target device, multiple connection modes are provided. Adjust the target device in response to the click operation, exit file transfer mode to allow data changes, and simulate plug-ins and unplugs the memory card after a preset time to ensure data updates.

Benefits of technology

It realizes the availability of applications and files when the device is connected, ensures timely data synchronization, and solves the problem of untimely data synchronization under traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119903004A_ABST
    Figure CN119903004A_ABST
Patent Text Reader

Abstract

The invention relates to an equipment connection method and device, computer equipment and a storage medium. The method comprises the following steps: reading state information of an interface connected with terminal equipment, and determining a mode of target equipment according to the state information of the interface; according to the mode of the target device, a device connection interface matched with the mode is displayed in the target device, and the device connection interface comprises a plurality of connection modes; in response to the detected click operation in the device connection interface, determining a connection mode indicated by the click operation in the device connection interface; in response to the condition that the connection mode is a file transmission mode and a change operation for data stored in the target equipment is detected, exiting the file transmission mode; and after a preset time, in response to the situation that the change operation for the data stored in the target equipment is not detected, performing analog plugging on a memory card of the target equipment, and then adjusting the target equipment based on the file transmission mode. By adopting the method, the data can be updated in time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a device connection method, apparatus, computer equipment, and storage medium. Background Art

[0002] With the development of mobile devices, different mobile devices need to exchange data through USB cables. In traditional technology, different mobile devices usually use UMS (USB Mass Storage) to exchange data.

[0003] However, this method has a problem in the process of processing. No matter which device is accessing the storage of the current device, it needs exclusive access, and the various applications and files in the currently accessed device will be unavailable. In addition, when the user needs to use the accessed device, the storage of the accessed device cannot update data because the various applications and files are unavailable, resulting in delayed data synchronization. Summary of the invention

[0004] Based on this, it is necessary to provide a device connection method, apparatus, computer equipment, and storage medium to address the above technical issues.

[0005] In a first aspect, the present disclosure provides a device connection method. The method comprises:

[0006] In response to detecting that a terminal device is connected to a target device, reading interface status information connected to the terminal device, and determining an interface mode connected to the terminal device according to the interface status information;

[0007] Determining a mode of the target device according to the interface mode;

[0008] According to the mode of the target device, displaying a device connection interface matching the mode in a display interface of the target device, wherein the device connection interface includes a plurality of connection modes;

[0009] In response to detecting a click operation in the device connection interface, determining a connection mode indicated by the click operation in the device connection interface, and adjusting the target device based on the indicated connection mode;

[0010] In response to the connection mode being a file transfer mode and detecting a modification operation on data stored in the target device, exiting the file transfer mode;

[0011] After a preset time, in response to not detecting a modification operation on the data stored in the target device, after simulating plugging and unplugging of a memory card of the target device, the target device is adjusted based on the file transfer mode.

[0012] In one embodiment, the interface status information includes: first status information, second status information, third status information, fourth status information, and fifth status information; the terminal device includes: a storage device, a mobile terminal, and a computer terminal; and determining the interface mode connected to the terminal device according to the interface status information includes:

[0013] In response to the interface status information being the first status information, determining that the target device is connected to a storage device;

[0014] In response to the interface status information being the second status information, determining that the target device is connected to the mobile terminal, and charging the mobile terminal;

[0015] In response to the received state information being the third state information, determining that the target device is connected to the mobile terminal, and the mobile terminal charges the target device;

[0016] In response to the receiving state information being the fourth state information, determining that the target device is connected to the computer terminal, and the connection interface is a Type-C interface;

[0017] In response to the receiving status information being the fifth status information, it is determined that the target device is connected to the computer terminal, and the connection interface is a Type-A interface.

[0018] In one embodiment, determining the mode of the target device according to the interface mode includes:

[0019] In response to determining that the target device is connected to a storage device, or that the target device is connected to a mobile terminal and is charging the mobile terminal, determining that the target device is in a main mode;

[0020] In response to the target device being connected to the computer terminal, or the target device being connected to the mobile terminal, and the mobile terminal charging the target device, it is determined that the target device is in slave mode.

[0021] In one embodiment, the device connection interface includes: a first device connection interface and a second device connection interface; the mode of the target device includes: a master mode and a slave mode; and displaying a device connection interface matching the mode in the display interface of the target device according to the mode of the target device includes:

[0022] In response to the mode of the target device being the main mode, displaying a first device connection interface matching the main mode in the display interface of the target device, wherein the first device connection interface includes a data reading menu, and the data reading menu is used to instruct the target device to read data in a storage device or a mobile terminal;

[0023] In response to the mode of the target device being a slave mode, a second device connection interface matching the slave mode is displayed in the display interface of the target device, wherein the second device connection interface includes a file transfer mode menu and a permission access mode menu; the file transfer mode menu is used to indicate that the target device is set to file transfer mode, and the permission access mode menu is used to indicate that the target device is set to MTP (Media Transfer Protoc01) mode.

[0024] In one embodiment, after simulating the plugging and unplugging of the memory card of the target device, adjusting the target device based on the file transfer mode includes:

[0025] Simulate unplugging a memory card of the target device, and simulate inserting the simulated unplugged memory card;

[0026] Check whether the memory card is in place after simulation insertion;

[0027] When it is detected that the memory card is in place after the simulated insertion, the mode of the target device is switched to a file transfer mode.

[0028] In one embodiment, the method further comprises:

[0029] In response to detecting that the terminal device is disconnected from the target device, exiting the connection mode;

[0030] In response to detecting that the disconnected terminal device re-establishes a connection with the target device after a preset time, determining the mode of the target device when the connection was disconnected, and restoring the mode of the target device when the connection was disconnected in the target device.

[0031] In a second aspect, the present disclosure further provides a device for connecting devices. The device comprises:

[0032] an interface mode determination module, configured to, in response to detecting that a terminal device is connected to a target device, read interface status information connected to the terminal device, and determine an interface mode connected to the terminal device according to the interface status information;

[0033] A device mode determination module, used to determine the mode of the target device according to the interface mode;

[0034] An interface display module, configured to display a device connection interface matching the mode in a display interface of the target device according to the mode of the target device, wherein the device connection interface includes a plurality of connection modes;

[0035] an operation adjustment module, configured to, in response to detecting a click operation on the device connection interface, determine a connection mode indicated by the click operation on the device connection interface, and adjust the target device based on the indicated connection mode;

[0036] The operation processing module is used to, in response to the connection mode being a file transfer mode and detecting a change operation on the data stored in the target device, exit the file transfer mode; after a preset time, in response to no change operation on the data stored in the target device being detected, simulate plugging and unplugging the memory card of the target device, and then adjust the target device based on the file transfer mode.

[0037] In a third aspect, the present disclosure further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in any of the above method embodiments are implemented.

[0038] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0039] In a fifth aspect, the present disclosure further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0040] In the above embodiments, when it is detected that the terminal device is connected to the target device, the target device can read the interface status information, and the interface mode connected to the terminal device can be determined according to the received status information. According to the interface mode, the connection status of the current target device can be accurately determined, thereby accurately determining the mode of the current target device. The modes of the target device are different, and the currently displayed device connection interface is also different. The device connection interface can provide multiple connection modes that match the mode of the target device. In response to detecting a click operation in the device connection interface, the target device is adjusted using the connection mode indicated by the click operation. When the connection mode is the file transfer mode, the target device cannot be operated at this time, and each application and file therein will be unavailable. Therefore, when a change operation for the data stored in the target device is detected, in order to ensure that the operation can be implemented, the file transfer mode can be exited to complete the change operation. After a preset time, in response to not detecting a change operation for the data stored in the target device, the memory card of the target device is simulated and plugged in and out, thereby ensuring timely update of the data, and the target device is adjusted again based on the file transfer mode, and the data in the target device is continuously processed to ensure that the data can be synchronized in time. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 A schematic diagram of an application environment of a device connection method in an embodiment;

[0043] Figure 2 A schematic diagram of a flow chart of a device connection method in an embodiment;

[0044] Figure 3 Schematic diagram of the process of step S202 in one embodiment;

[0045] Figure 4 Schematic diagram of the process of step S204 in one embodiment;

[0046] Figure 5 This is a schematic diagram of the process of step S206 in one embodiment;

[0047] Figure 6 Schematic diagram of the process of step S212 in one embodiment;

[0048] Figure 7A schematic diagram of a connection recovery process in one embodiment;

[0049] Figure 8 It is a schematic block diagram of the structure of a device connection device in one embodiment;

[0050] Fig. 9 Schematic diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.

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

[0053] In this article, the term "and / or" is only a description of the association relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the related objects before and after are in an "or" relationship.

[0054] The present disclosure provides a device connection method, which can be applied to Figure 1In the application environment shown. Among them, the target device 102 can be connected to the terminal device 104. In response to detecting that the terminal device 104 is connected to the target device 102, the target device 102 reads the interface status information connected to the terminal device 104. The target device 102 determines the interface mode connected to the terminal device 104 according to the interface status information. The target device 102 determines the mode of the target device according to the interface mode. According to the mode of the target device, the target device 102 displays a device connection interface matching the mode in the display interface of the target device according to the mode of the target device. The device connection interface includes multiple connection modes. In response to the target device 102 detecting a click operation in the device connection interface, the target device 102 determines the connection mode indicated by the click operation in the device connection interface. Adjust the target device 102 based on the indicated connection mode. In response to the target device 102 determining that the connection mode is a file transfer mode and detecting a change operation for data stored in the target device 102, the target device 102 exits the file transfer mode. After a preset time, in response to the target device 102 not detecting a change operation on the data stored in the target device 102, the target device 102 simulates plugging and unplugging the memory card, and then adjusts the target device 102 based on the file transfer mode. The target device 102 may be a smart phone, a tablet computer, a smart camera, etc. The terminal device 104 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc.

[0055] In one embodiment, Figure 2 As shown, a device connection method is provided, which is applied to Figure 1 Taking the target device 102 in the example as an example, the following steps are included:

[0056] S202, in response to detecting that a terminal device is connected to a target device, reading interface status information connected to the terminal device, and determining an interface mode connected to the terminal device according to the interface status information.

[0057] The interface status information may be the working status of the interface connected to the terminal device. The interface status information may be different when connected to different connection devices. The interface mode may be the connection status of the target device after the target device is currently connected.

[0058] Specifically, when the terminal device is connected to the target device, the target device can use a command line to read the interface status information connected to the terminal device. After reading the interface status information, the target device can determine the current connection status when connected to the terminal device according to the interface status information.

[0059] For example, if the target device and the terminal device are currently connected using a USB Type-C interface, you can use Linux commands to view the current mode setting of the USB Type-C interface. Read the system file to determine the interface status information about the working status of the USB Type-C interface.

[0060] S204: Determine the mode of the target device according to the interface mode.

[0061] The target device mode may include master mode and slave mode. A device in master mode usually plays a leading and controlling role in the communication or interaction process. It is responsible for initiating communication, setting communication rules and rhythm, and managing and coordinating the entire interaction process. Slave mode corresponds to master mode. A device in slave mode mainly responds to the instructions and requests of the master device and cooperates to complete communication or related tasks according to the rules set by the master device.

[0062] Specifically, the target device can be determined to be in master mode or slave mode according to different interface modes.

[0063] S206: According to the mode of the target device, display a device connection interface matching the mode in the display interface of the target device, wherein the device connection interface includes a plurality of connection modes.

[0064] Among them, the device connection interface can be the interface displayed by the target device after connecting to the terminal device. The connection mode can include: UFP mode, UMS mode, MTP mode, charging mode, etc. MTP (Media Transfer Protocol) is a protocol used to transfer media files and other data between mobile devices (such as mobile phones, tablets, etc.) and computers. The corresponding device that uses this protocol for connection can be called an MTP device. The connection mode usually matches the mode of the target device.

[0065] Specifically, according to different modes of the target device, a device connection interface matching the mode can be displayed in the target device. The device connection interface can include a variety of different connection modes. It should be noted that the device connection interface is different for different modes of the target device. However, there is at least one difference in the connection modes in different device connection interfaces. For example, the connection interface of device A contains a1 connection mode, b1 connection mode and c connection mode. The connection interface of device B can also contain a1 connection mode and b1 connection mode. In addition, the connection interface of device B can also have a b2 connection mode.

[0066] S208: In response to detecting a click operation in the device connection interface, determining a connection mode indicated by the click operation in the device connection interface, and adjusting the target device based on the indicated connection mode.

[0067] Specifically, a click operation can be triggered in the device connection interface by touching the screen of the target device. You can also click on a case in the target device to trigger a click operation in the device connection interface. In some embodiments of the present disclosure, there is no restriction on how the click operation is triggered. The target device can determine the connection mode clicked in the device connection interface based on the click operation. Adjust the current state of the target device based on the connection mode clicked. Generally, different click modes correspond to different states of the current target device. It should be noted that, according to the different connection conditions between the target device and the terminal device, those skilled in the art can flexibly select different connection modes to adapt to the current application scenario.

[0068] S210: In response to the connection mode being a file transfer mode and detecting a modification operation on data stored in the target device, exiting the file transfer mode.

[0069] Among them, the file transfer mode can be UMS mode in some embodiments of the present disclosure. UMS is the abbreviation of USB Mass Storage, and its Chinese name is USB large-capacity storage. It is a technical specification and protocol formulated based on the USB standard for regulating the USB device to work as a large-capacity storage device. When the target device is in UMS mode, the target device can be used as a large-capacity storage device for the mobile device to read the information therein.

[0070] Specifically, when the current connection mode of the target device is the file transfer mode, the target device can be used as a large-capacity storage device for the terminal device to read. When the user needs to use the target device, for example, to modify, delete or add data in the target device, the target device cannot be modified, deleted or added because it is in the UMS mode, and the target device needs to exit the file transfer mode.

[0071] S212: After a preset time, in response to not detecting a modification operation on the data stored in the target device, simulate plugging and unplugging a memory card of the target device, and then adjust the target device based on the file transfer mode.

[0072] Among them, simulated plugging and unplugging is an operation that simulates the actual physical insertion and unplugging actions and effects of the memory card through software or specific technical means.

[0073] Specifically, after exiting the file transfer mode, the user can modify the data in the target device. After a preset time has passed, if no modification is detected in the data stored in the target device, it can be determined that the current user data modification is complete. To ensure that the data in the target device is updated in a timely manner, the memory card of the target device can be simulated plugged in and out first, and then the target data can be adjusted again according to the file transfer mode. For example, the operation performed before exiting the file transfer mode can be continued.

[0074] In the above device connection method, when it is detected that the terminal device is connected to the target device, the target device can read the interface status information, and the interface mode connected to the terminal device can be determined according to the received status information. According to the interface mode, the connection status of the current target device can be accurately determined, thereby accurately determining the mode of the current target device. The modes of the target device are different, and the currently displayed device connection interface is also different. The device connection interface can provide multiple connection modes that match the mode of the target device. In response to detecting a click operation in the device connection interface, the target device is adjusted using the connection mode indicated by the click operation. When the connection mode is the file transfer mode, the target device cannot be operated at this time, and each application and file therein will be unavailable. Therefore, when a change operation for the data stored in the target device is detected, in order to ensure that the operation can be implemented, the file transfer mode can be exited to complete the change operation. After a preset time, in response to not detecting a change operation for the data stored in the target device, the memory card of the target device is simulated and plugged in and out, thereby ensuring timely update of the data, and the target device is adjusted again based on the file transfer mode, and the data in the target device is continuously processed to ensure that the data can be synchronized in time.

[0075] In one embodiment, Figure 3 As shown, the interface status information includes: first status information, second status information, third status information, fourth status information, and fifth status information; the terminal device includes: a storage device, a mobile terminal, and a computer terminal; and determining the interface mode connected to the terminal device according to the interface status information includes:

[0076] S302: In response to the interface status information being first status information, determine that the target device is connected to a storage device.

[0077] S304: In response to the interface status information being the second status information, determining that the target device is connected to the mobile terminal, and charging the mobile terminal.

[0078] S306: In response to the received state information being the third state information, determining that the target device is connected to the mobile terminal, and the mobile terminal charges the target device.

[0079] S308, in response to the receiving status information being the fourth status information, determining that the target device is connected to the computer terminal, and the connection interface is a Type-C interface.

[0080] S310, in response to the receiving status information being the fifth status information, determining that the target device is connected to the computer terminal, and the connection interface is a Type-A interface.

[0081] Specifically, after the terminal device and the target device are connected, the target device can determine the current interface mode through typec_mode.

[0082] For example, the target device can use the cat / sys / class / power_supply / usb / typec_mode command to view the current working mode of the interface and determine the interface mode. Different devices and usage scenarios have different corresponding typec_modes and different interface modes. Generally, when the target device is not connected to any device, the value of typec_mode can be Nothing attached using the above command. When the value of typec_mode is the first state information, the first state information can be Sink attached, and it can be determined that the target device is connected to a storage device, such as a USB flash drive or a mobile hard disk. When the value of typec_mode is the second state information, the second state information can be Powered cable w / sink, and it can be determined that the target device is connected to a mobile terminal (such as a mobile phone), and the target device can charge the mobile terminal. When the value of typec_mode is Source attached (medium current), the third state information can be Source attached (medium current), and it can also be determined that the target device is connected to a mobile terminal (such as a mobile phone), and the mobile terminal can charge the target device. When the value of typec_mode is Source attached(high current), the fourth state information can be Source attached(high current). At this time, it can be determined that the target device is connected to the computer terminal, and the connection interface uses a dual-head Type-C interface. When the value of typec_mode is Source attached(default current), it can also be determined that the target device is connected to the computer terminal, and the connection interface uses a Type-A interface. Depending on the interface mode, the subsequent processing process of the target device is also different. For example, when using a dual-head Type-C interface to transmit data, USB3.0 can be supported, faster data transmission speeds can be used, and data transmission time can be reduced.

[0083] In this embodiment, the current connection status of the target device can be accurately determined through different interface status information, so that the target device can be accurately adjusted according to the current connection status.

[0084] In one embodiment, Figure 4 As shown, determining the mode of the target device according to the interface mode includes:

[0085] S402: In response to determining that the target device is connected to a storage device, or that the target device is connected to a mobile terminal and is charging the mobile terminal, determining that the target device is in a master mode.

[0086] Specifically, when the target device is determined to be connected to the storage device, the target device can read the data in the storage device, and the target device can be in the master mode. In addition, when the target device is connected to the mobile terminal and charges the mobile terminal, the target device can also be in the master mode and can read the data in the mobile terminal.

[0087] When the target device is connected to the mobile terminal and can charge the mobile terminal, it means that the target device now acts as a power supplier. It has the ability to provide electrical energy and transmit electrical energy to the mobile terminal to meet its charging needs. Just like in a power supply system, the power plant is the source of electrical energy and transmits electricity to various electrical devices. Here, the target device is similar to the role of the power plant, in a position to control and provide electrical energy, so it is determined to be "master mode".

[0088] For example, in a common scenario where a charger is connected to a mobile phone for charging, the charger can be the target device. It obtains electrical energy from the mains and converts it into a form suitable for charging the mobile phone, and then transmits it to the mobile phone. The charger plays a leading role in this process and determines the supply of electrical energy, so it is the main mode.

[0089] In addition, in this connection situation, the target device not only provides power, but also often controls and manages the charging process. For example, it may adjust the charging current, voltage and other parameters according to the battery status of the mobile terminal to ensure safe and efficient charging. This further reflects the dominant position of the target device in the entire charging interaction process, just like a manager controlling the entire charging process, so it is identified as the "master mode".

[0090] S404: In response to the target device being connected to the computer terminal, or the target device being connected to the mobile terminal, and the mobile terminal charging the target device, determining that the target device is in slave mode.

[0091] Specifically, when the target device is connected to a computer terminal, the target device is usually set to slave mode, so that the computer terminal can control the data in the target device. In addition, when the target device is connected to a mobile terminal, and the mobile terminal charges the target device, the target device can be in slave mode.

[0092] When the mobile terminal charges the target device, the mobile terminal becomes the provider of power, and the target device becomes the receiver of power. In contrast to the master mode described above, the target device relies on the power provided by the mobile terminal to meet certain needs of its own (it may be to replenish its own battery power, power some of its internal components, etc.). It is like in an electricity usage scenario, a certain electrical device needs to obtain power from other power sources. Here, the target device is like the electrical device that needs power, and is in a subordinate position that depends on power supply, so it is determined to be "slave mode".

[0093] For example, some mobile phones now support the reverse charging function. When the mobile phone is connected to other devices that support reverse charging (such as headphones, smart watches, etc.) and reverse charging is turned on, the mobile phone is the mobile terminal that provides power, and the device being charged is the target device. At this time, the target device is in slave mode because it relies on the power provided by the mobile phone.

[0094] In this case, although the charging process may also be subject to some regulations and controls, the target device generally has relatively little say in starting and stopping charging and controlling charging parameters. It is usually the mobile terminal (power provider) that decides whether to start charging, how much current and voltage to charge, etc., and the target device is more likely to passively accept the charging arrangement. This also shows that the target device is in a subordinate position in the entire charging interaction process, so it is determined to be "slave mode".

[0095] In this embodiment, the mode of the target device can be flexibly adjusted according to the different connection conditions of the target device, so as to ensure that the target device is in the master mode or the slave mode during use, and when in the master mode, the connected device can be accurately controlled. When in the slave mode, it can be compatible with different mobile terminals.

[0096] In one embodiment, the device connection interface includes: a first device connection interface and a second device connection interface; the modes of the target device include: a master mode and a slave mode; Figure 5 As shown, displaying a device connection interface matching the mode in the display interface of the target device according to the mode of the target device includes:

[0097] S502, in response to the mode of the target device being the main mode, displaying a first device connection interface matching the main mode in the display interface of the target device, wherein the first device connection interface includes a data reading menu, and the data reading menu is used to instruct the target device to read data in a storage device or a mobile terminal.

[0098] Specifically, when the mode of the target device is the main mode, a specific interface, namely the first device connection interface, will be displayed on the display interface of the target device. This interface matches the main mode, and usually its layout, function presentation, etc. are designed according to the requirements and characteristics of the main mode. A data reading menu is included in this first device connection interface. The main function of this menu is to provide users with an instruction or operation method so that the target device can read data from other storage devices or mobile terminals. For example, relevant data information, such as documents, pictures, videos and other types of file data, can be read from storage devices such as USB flash drives and mobile hard drives, or mobile terminals such as mobile phones and tablets.

[0099] In some exemplary embodiments, it is assumed that the target device is a smart TV. During the startup or operation of the smart TV system, it will continuously detect the current mode according to the interface mode. So as to determine whether it is in the main mode. Once it is detected that it is in the main mode, the display interface of the smart TV will switch or load the matching first device connection interface. This interface may be implemented through a pre-designed layout file, which defines the position, size and style of each element. For example, a title bar may be displayed at the top of the interface, saying "Device Connection-Home Entertainment Main Mode", and different areas are divided below. There may be some icons or text buttons on one side of the interface to guide the user to perform different connection operations, which are all part of the overall layout of the first device connection interface. The data reading menu can be presented in the form of a drop-down list or a group of icon buttons on the interface. For example, there is an icon button of "Read Storage Device". After clicking it, the smart TV will scan nearby available storage devices, such as a USB flash drive connected through a USB interface. When a USB flash drive is detected to be inserted, the TV will automatically identify and try to read the file data in the USB flash drive, and then display a list of accessible files on the interface, and the user can further choose to view pictures, play videos, and other operations.

[0100] For reading data from a mobile terminal, there may be a "Connect to mobile terminal" button. After clicking it, the TV will prompt the user to perform corresponding operations on the mobile terminal, such as turning on the screen projection function or establishing a connection with the TV through a specific APP. After the connection is established, the TV can read the data content that is allowed to be shared in the specified folder or application on the mobile terminal, such as reading photos in the mobile phone album and displaying them on the TV screen.

[0101] S504, in response to the mode of the target device being a slave mode, a second device connection interface matching the slave mode is displayed in the display interface of the target device, the second device connection interface comprising a file transfer mode menu and a permission access mode menu; the file transfer mode menu is used to indicate that the target device is set to file transfer mode, and the permission access mode menu is used to indicate that the target device is set to MTP (Media Transfer Protocol) mode.

[0102] Specifically, when the operating mode of the target device is set to slave mode, the device will display a specific interface on its display interface according to this state, namely, the second device connection interface. This interface is specially designed and matched for the slave mode to meet the relevant operation requirements that the user may need to perform in this mode. The second device connection interface may include: the file transfer mode menu is used to provide a convenient operation instruction for the user, so that the user can set the target device to file transfer mode through the menu. In file transfer mode, the target device can perform file transfer operations with other devices (such as computers, mobile terminals, etc.), such as sending files in the target device to other devices. Permission access mode menu, which is used to indicate that the target device is set to MTP (Media Transfer Protocol) mode. MTP mode is a commonly used media transfer protocol mode. When the target device is set to this mode, other devices (usually computers, etc.) can access and operate media files (such as photos, music, videos, etc.) in the target device in accordance with the specifications of the MTP protocol, such as viewing, copying, deleting, etc., and it also involves certain permission management to ensure the security and reasonable use of data. It should be noted that when a large amount of data needs to be transferred, the file transfer mode can be used, and when a large amount of data does not need to be transferred, the MTP mode can be used.

[0103] In some exemplary embodiments, assuming that the target device is a smart phone, the operating system of the smart phone will continue to determine the mode it is currently in during startup or operation. Once it is detected that it is in slave mode, the display interface of the mobile phone will load a matching second device connection interface. This interface may be presented by a specific application or system component in the mobile phone operating system. For example, in the Android system, a built-in application similar to the "Device Connection Assistant" may be launched to display the interface.

[0104] The layout of the interface may have a title bar showing words such as "Slave Mode - Device Connection", and options such as the file transfer mode menu and the permission access mode menu will be clearly listed below. The file transfer mode menu may be presented in the form of an icon button with the text "File Transfer", and the permission access mode menu may be a button with "MTP Mode" or a button with a related icon.

[0105] In addition, it should be noted that in addition to the above-mentioned modes, there may also be other modes in the first device connection interface and the second device connection mentioned in the above embodiments.

[0106] In this embodiment, different device connection interfaces are displayed in the display interface of the target device according to different modes, and different functions can be provided for users to choose from. In addition, the connection modes existing in different device connection interfaces match the mode of the current target device, which can ensure the stable operation of the target device.

[0107] In one embodiment, Figure 6 As shown, after simulating the plugging and unplugging of the memory card of the target device, adjusting the target device based on the file transfer mode includes:

[0108] S602, simulate unplugging the memory card of the target device, and simulate inserting the simulated unplugged memory card.

[0109] Specifically, the removal and insertion of the memory card of the target device can be simulated at the software level. First, the operating system of the target device needs to be able to accurately identify the current status of the memory card, including whether it has been inserted and whether it is being used. This is usually achieved through low-level communication with the hardware and related drivers. For example, if the target device is an Android system, there will be a module in the Android system that is specifically responsible for managing storage devices. It will continuously monitor the connection status of the memory card slot (if it is a removable memory card) or the built-in memory card. The Android operating system will notify all applications and system services that are using memory card resources and ask them to suspend access to the memory card. For example, a gallery application that is reading photos from a memory card will receive a notification to temporarily stop the reading operation. At the system level, the mount status of the memory card is changed from "mounted" (indicating that it can be used normally) to "unmounted". This is similar to the situation where the device can no longer directly access the data in the memory card after physically unplugging the memory card. In the Android system, the properties of the mount point are changed through system calls to make it appear as unmounted. The operating system will first check the integrity of the memory card to ensure that the file system of the memory card is not damaged during the simulated removal and insertion process. Perform some basic verification operations on the memory card, such as checking whether the metadata of the file system is complete.

[0110] If the check passes, the system will reset the memory card's mount status from "unmounted" to "mounted". This allows the device to access the data in the memory card normally again. In the Android system, this is also achieved by operating the relevant file system mount point, and restoring the properties of the mount point through system calls so that it can be used normally.

[0111] In some exemplary embodiments, the following method may be used to simulate pulling out a memory card:

[0112] echo 0>

[0113] / sys / devices / platform / soc / 8804000.sdhci / mmc_host / mmc1 / clk_scaling / pulling_out,

[0114] echo is a commonly used command in Unix-like systems (such as Linux) to output the specified content to the standard output (by default) or redirect it to other places. Here, it redirects the number 0 to the specified file path

[0115] / sys / devices / platform / soc / 8804000.sdhci / mmc_host / mmc1 / clk_scaling / pulling_out.

[0116] This file path is usually a property setting file related to the storage control of the device, specifically, it is related to the clock scaling (clk_scaling) and analog pull-out (pulling_out) of the SD card (Secure Digital Card, a common storage card) or MMC (MultiMediaCard) device. By writing 0 to this file, it conveys some operation instructions about the storage device (corresponding to mmc1 here, usually indicating the first MMC or SD card device interface) to the system, such as simulating a certain state change of the device, simulating a way to start the operation of pulling out.

[0117] When successful, cat pulling_out: The card is not present.

[0118] Cat is also a common command in Unix-like systems, used to view the contents of a file and output it to standard output. Here we view the contents of the pulling_out file involved in the previous write operation.

[0119] The output result "The card is not present" indicates that after the previous echo command operation, based on the system's feedback on the contents of the file, the current system believes that the corresponding memory card (that is, the memory card associated with the mmc1 interface) is no longer in the device. That is, the operation of simulating the removal of the memory card seems to have been successfully completed at the system level, and the system detects that the memory card does not exist, just as if the memory card was really removed.

[0120] You can simulate inserting a memory card in the following ways:

[0121] echo 0>

[0122] / sys / devices / platform / soc / 8804000.sdhci / mmc_host / mmc1 / clk_scaling / rescan_disable

[0123] This command simulates a certain state change of the device and simulates a way to start related operations of inserting a memory card.

[0124] After success, cat pulling_out: The card is present.

[0125] The output result "The card is present." indicates that after the previous write operation to the "rescan_disable" file is executed, the system currently believes that the corresponding memory card (the memory card associated with the mmc1 interface) is present in the device, judging from the system's feedback on the contents of the "pulling_out" file. The current state detected by the system is still that the memory card exists and can be detected.

[0126] S604, detecting whether the simulated inserted memory card is in place.

[0127] Specifically, the file system mount point detection may be used to simulate whether the inserted memory card is in place, and the system log may be used to detect whether the inserted memory card is in place.

[0128] In some exemplary embodiments, the following command may be used to detect whether the simulated inserted memory card is in place:

[0129] cat / sys / devices / platform / soc / 8804000.sdhci / mmc_host / mmc1 / clk_scaling / pulling_out

[0130] cat: This is a commonly used command in Unix-like systems (such as Linux). Its full name is "concatenate". Its main function is to view the contents of a file and output it to the standard output (usually the terminal screen). In simple terms, it is used to display what is written in the specified file.

[0131] / sys / devices / platform / soc / 8804000.sdhci / mmc_host / mmc1 / clk_scaling / pulling_out: This is a file path that points to a specific file related to the hardware device in a Unix-like system. The specific explanation is as follows:

[0132] / sys: This is a virtual file system directory used to store information related to system devices in Linux systems (and some other Unix-like systems). The files here are not disk files in the traditional sense, but the device status, attributes and other information presented in the form of files after the kernel interacts with the hardware devices.

[0133] / devices / platform / soc / 8804000.sdhci: This part of the path further refines the location and type information of the device. " / devices" indicates information about various devices, "platform" usually involves the platform-related hardware of the system, "soc" generally refers to the system-on-chip (System on Chip), and "8804000.sdhci" is a specific identifier related to the SD card (Secure Digital Card) or MMC (Multi Media Card) controller, indicating that the device involved in this file is related to the hardware control of the SD card or MMC device.

[0134] / mmc_host / mmc1: "mmc_host" refers to the host controller-related part of the MMC device (including SD card, because SD card is developed based on MMC technology), and "mmc1" usually indicates the first MMC device interface (different interfaces may correspond to different device connection situations, and mmc1 here is one of the specific interface situations).

[0135] / clk_scaling / pulling_out: This is the part related to the clock scaling (clk_scaling) mechanism under the hardware control path related to the MMC device mentioned above. The "pulling_out" file may be used to record or control a certain state or operation related to the simulated unplugging (pulling_out) of the MMC device. For example, by writing a specific value to this file (such as the "echo0>..." operation mentioned earlier), the system may be triggered to simulate unplugging the memory card corresponding to the MMC device. Here, the "cat" command is used to view the content of this file in order to understand what the current system thinks of the device's status regarding the simulated unplugging, whether it has been simulated unplugged (it may display content similar to "The card is not present."), or it still believes that the device is in place (it may display content similar to "The card is present."), etc., so as to determine the current final state.

[0136] S606: When it is detected that the memory card is in place after the simulated insertion, the mode of the target device is switched to a file transfer mode.

[0137] Specifically, when it is detected that the memory card is in place, the mode of the target device can be switched back to the file transfer mode.

[0138] In this embodiment, the memory card is simulated for insertion and removal, and only when it is detected to be in place, the target device can be switched to the file transfer mode, thereby ensuring that the data is updated in a timely manner.

[0139] In one embodiment, Figure 7 As shown, the method also includes:

[0140] S702: In response to detecting that the connection between the terminal device and the target device is disconnected, exit the connection mode.

[0141] Specifically, when the target device detects that the connection with the terminal device is disconnected, the target device can record the current connection mode and then exit the current connection mode.

[0142] S704, in response to detecting that the disconnected terminal device re-establishes a connection with the target device after a preset time, determining the mode of the target device when the connection was disconnected, and restoring the mode of the target device when the connection was disconnected in the target device.

[0143] Specifically, after a preset period of time, when the target device detects that a connection has been reestablished with the disconnected terminal device, the target device can determine the mode of the target device when the connection was disconnected. When the connection is restored, the mode of the target device when the connection was disconnected can be restored, and the connected device can also continue the connection mode when the disconnection occurred.

[0144] In this embodiment, when re-establishing the connection with the disconnected terminal device, the mode of the target device when the connection was disconnected can be restored, thereby eliminating the need for the user to make repeated selections, which can improve efficiency.

[0145] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0146] Based on the same inventive concept, the embodiment of the present disclosure also provides a device connection device for implementing the device connection method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more device connection device embodiments provided below can refer to the limitations on the device connection method above, and will not be repeated here.

[0147] In one embodiment, Figure 8 As shown, a device connection apparatus 800 is provided, comprising: an interface mode determination module 802, a device mode determination module 804, an interface display module 806, an operation adjustment module 808 and an operation processing module 810, wherein:

[0148] The interface mode determination module 802 is used for, in response to detecting that the terminal device is connected to the target device, reading the interface status information connected to the terminal device, and determining the interface mode connected to the terminal device according to the interface status information;

[0149] A device mode determination module 804, configured to determine a mode of the target device according to the interface mode;

[0150] An interface display module 806 is used to display a device connection interface matching the mode in a display interface of the target device according to the mode of the target device, wherein the device connection interface includes multiple connection modes;

[0151] an operation adjustment module 808, configured to, in response to detecting a click operation on the device connection interface, determine a connection mode indicated by the click operation on the device connection interface, and adjust the target device based on the indicated connection mode;

[0152] The operation processing module 810 is used to, in response to the connection mode being a file transfer mode and detecting a change operation on the data stored in the target device, exit the file transfer mode; after a preset time, in response to not detecting a change operation on the data stored in the target device, simulate plugging and unplugging the memory card of the target device, and then adjust the target device based on the file transfer mode.

[0153] In one embodiment of the device, the interface status information includes: first status information, second status information, third status information, fourth status information, and fifth status information, and the terminal device includes: a storage device, a mobile terminal, and a computer terminal. The interface mode determination module 802 includes:

[0154] The first connection determination module is configured to determine, in response to the interface status information being the first status information, that the target device is connected to a storage device.

[0155] The second connection determination module is used to determine that the target device is connected to the mobile terminal in response to the interface status information being the second status information, and to charge the mobile terminal.

[0156] The third connection determination module is used to determine, in response to the receiving state information being the third state information, that the target device is connected to the mobile terminal, and the mobile terminal charges the target device.

[0157] The fourth connection determination module is used to determine, in response to the receiving state information being the fourth state information, that the target device is connected to the computer terminal, and the connection interface is a Type-C interface.

[0158] The fifth connection determination module is used to determine that the target device is connected to the computer terminal and the connection interface is a Type-A interface in response to the receiving status information being the fifth status information.

[0159] In one embodiment of the apparatus, the device mode determination module 804 includes:

[0160] The main mode determination module is used to determine that the target device is in the main mode in response to determining that the target device is connected to a storage device, or that the target device is connected to a mobile terminal and charges the mobile terminal.

[0161] The slave mode determination module is used to determine that the target device is in slave mode in response to the target device being connected to the computer terminal, or the target device being connected to the mobile terminal, and the mobile terminal charging the target device.

[0162] In one embodiment of the apparatus, the device connection interface includes: a first device connection interface and a second device connection interface; the modes of the target device include: a master mode and a slave mode; the interface display module 806 includes:

[0163] The first display module is used to display a first device connection interface matching the main mode in the display interface of the target device in response to the mode of the target device being the main mode, wherein the first device connection interface includes a data reading menu, and the data reading menu is used to instruct the target device to read data in a storage device or a mobile terminal.

[0164] A second display module is used to display a second device connection interface matching the slave mode in the display interface of the target device in response to the mode of the target device being a slave mode, wherein the second device connection interface includes a file transfer mode menu and a permission access mode menu; the file transfer mode menu is used to indicate that the target device is set to file transfer mode, and the permission access mode menu is used to indicate that the target device is set to MTP (Media Transfer Protocol) mode.

[0165] In one embodiment of the device, the operation processing module 810 is also used to simulate the removal of a memory card of the target device and simulate the insertion of the memory card after the simulated removal; detect whether the memory card after the simulated insertion is in place; and when it is detected that the memory card after the simulated insertion is in place, switch the mode of the target device to the file transfer mode.

[0166] In one embodiment of the device, the device further comprises:

[0167] A connection recovery module is used to exit the connection mode in response to detecting that the connection between the terminal device and the target device is disconnected; in response to detecting that the disconnected terminal device re-establishes a connection with the target device after a preset time, determine the mode of the target device when the connection is disconnected, and restore the mode of the target device when the connection is disconnected in the target device.

[0168] Each module in the above-mentioned device connection device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.

[0169] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a device connection method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0170] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0171] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0172] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0173] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0174] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present disclosure may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided by the present disclosure may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.

[0175] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0176] The above-described embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the attached claims.

Claims

1. A device connection method, characterized in that: The method comprises: In response to detecting that a terminal device is connected to a target device, reading interface status information connected to the terminal device, and determining an interface mode connected to the terminal device according to the interface status information; Determining a mode of the target device according to the interface mode; According to the mode of the target device, displaying a device connection interface matching the mode in a display interface of the target device, wherein the device connection interface includes a plurality of connection modes; In response to detecting a click operation in the device connection interface, determining a connection mode indicated by the click operation in the device connection interface, and adjusting the target device based on the indicated connection mode; In response to the connection mode being a file transfer mode and detecting a modification operation on data stored in the target device, exiting the file transfer mode; After a preset time, in response to not detecting a modification operation on the data stored in the target device, after simulating plugging and unplugging of a memory card of the target device, the target device is adjusted based on the file transfer mode.

2. The method according to claim 1, characterized in that The interface status information includes: first status information, second status information, third status information, fourth status information, and fifth status information; the terminal device includes: a storage device, a mobile terminal, and a computer terminal; and determining the interface mode connected to the terminal device according to the interface status information includes: In response to the interface status information being the first status information, determining that the target device is connected to a storage device; In response to the interface status information being the second status information, determining that the target device is connected to the mobile terminal, and charging the mobile terminal; In response to the received state information being the third state information, determining that the target device is connected to the mobile terminal, and the mobile terminal charges the target device; In response to the receiving state information being the fourth state information, determining that the target device is connected to the computer terminal, and the connection interface is a Type-C interface; In response to the receiving status information being the fifth status information, it is determined that the target device is connected to the computer terminal, and the connection interface is a Type-A interface.

3. The method according to claim 2, characterized in that Determining the mode of the target device according to the interface mode includes: In response to determining that the target device is connected to a storage device, or that the target device is connected to a mobile terminal and is charging the mobile terminal, determining that the target device is in a main mode; In response to the target device being connected to the computer terminal, or the target device being connected to the mobile terminal, and the mobile terminal charging the target device, it is determined that the target device is in slave mode.

4. The method according to any one of claims 1 to 3, characterized in that The device connection interface includes: a first device connection interface and a second device connection interface; the mode of the target device includes: a master mode and a slave mode; and according to the mode of the target device, displaying a device connection interface matching the mode in the display interface of the target device includes: In response to the mode of the target device being the main mode, displaying a first device connection interface matching the main mode in the display interface of the target device, wherein the first device connection interface includes a data reading menu, and the data reading menu is used to instruct the target device to read data in a storage device or a mobile terminal; In response to the mode of the target device being a slave mode, a second device connection interface matching the slave mode is displayed in the display interface of the target device, wherein the second device connection interface includes a file transfer mode menu and a permission access mode menu; the file transfer mode menu is used to indicate that the target device is set to file transfer mode, and the permission access mode menu is used to indicate that the target device is set to MTP (Media Transfer Protocol) mode.

5. The method according to claim 1, characterized in that: After simulating the insertion and removal of the memory card of the target device, adjusting the target device based on the file transfer mode includes: Simulate unplugging a memory card of the target device, and simulate inserting the simulated unplugged memory card; Check whether the memory card is in place after simulation insertion; When it is detected that the memory card is in place after the simulated insertion, the mode of the target device is switched to a file transfer mode.

6. The method according to claim 1, characterized in that The method further comprises: In response to detecting that the terminal device is disconnected from the target device, exiting the connection mode; In response to detecting that the disconnected terminal device re-establishes a connection with the target device after a preset time, determining the mode of the target device when the connection was disconnected, and restoring the mode of the target device when the connection was disconnected in the target device.

7. A device connection device, characterized in that: The device comprises: an interface mode determination module, configured to, in response to detecting that a terminal device is connected to a target device, read interface status information connected to the terminal device, and determine an interface mode connected to the terminal device according to the interface status information; A device mode determination module, used to determine the mode of the target device according to the interface mode; An interface display module, configured to display a device connection interface matching the mode in a display interface of the target device according to the mode of the target device, wherein the device connection interface includes a plurality of connection modes; an operation adjustment module, configured to, in response to detecting a click operation on the device connection interface, determine a connection mode indicated by the click operation on the device connection interface, and adjust the target device based on the indicated connection mode; The operation processing module is used to, in response to the connection mode being a file transfer mode and detecting a change operation on the data stored in the target device, exit the file transfer mode; after a preset time, in response to no change operation on the data stored in the target device being detected, simulate plugging and unplugging the memory card of the target device, and then adjust the target device based on the file transfer mode.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.