USB equipment sharing method, device and system and storage medium

By analyzing and judging whether the current status of the USB device meets the user's sharing intention, and sharing the port when it meets the situation, the problem of poor sharing stability of polymorphic USB devices is solved, and stable sharing and efficient use of polymorphic USB devices are achieved.

CN119862144APending Publication Date: 2025-04-22ROLLING WIRELESS SARL
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411884024.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The prior art has poor stability when sharing polymorphic USB devices, which leads to the operating system not being able to recognize the state changes of the USB device, affecting the continuous use of the device.

Method used

By receiving the sharing request sent by the client, the identification information of the target USB device and the user's sharing intention are parsed, and the current status of the target USB device meets the user's sharing intention is determined based on the preset mapping relationship, and the port is shared with the client if it meets the situation.

Benefits of technology

It realizes stable sharing of polymorphic USB devices, ensuring that the client can correctly identify and interact with the status of USB devices, and improves the continuity and flexibility of USB devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862144A_ABST
    Figure CN119862144A_ABST
Patent Text Reader

Abstract

The invention relates to a USB equipment sharing method, device and system and a storage medium. The method comprises the following steps: receiving a sharing request sent by a client; in response to the sharing request, analyzing the sharing request to obtain identification information of the target USB equipment and a user sharing intention, and judging whether the current state of the target USB equipment accords with the user sharing intention or not based on the identification information of the target USB equipment and a preset mapping relationship; and under the condition that the current state of the target USB equipment accords with the sharing intention of the user, sharing the port of the target USB equipment to the client, so that the client interacts with the target USB equipment based on the port of the target USB equipment. Therefore, sharing of the polymorphic target USB equipment can be realized, and the problem of poor stability when the polymorphic USB equipment is shared in the prior art is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a USB device sharing method, device, system and storage medium. Background Art

[0002] Since sharing multiple Universal Serial Bus (USB) devices is beneficial to improving the utilization rate of USB devices and the flexibility and convenience of using USB devices, sharing USB devices is applied in many scenarios.

[0003] In the related art, during the USB device sharing process, once the state of the USB device changes, the operating system cannot recognize it as the same USB device, resulting in the inability to ensure the continuity of the USB device use. For example, when a user needs to upgrade a USB device, the USB device will switch from normal mode to upgrade mode. At this time, the operating system cannot recognize which USB device the USB device originally was, so the user cannot continue to monitor its upgrade status. Therefore, the related art has the problem of poor stability when sharing USB devices in multiple states (hereinafter referred to as polymorphic USB devices). Summary of the invention

[0004] The present application provides a USB device sharing method, apparatus, system and storage medium to solve the problem of poor stability in the related art when sharing polymorphic USB devices.

[0005] In a first aspect, an embodiment of the present application provides a USB device sharing method, which is applied to a server, and the method includes:

[0006] Receive a sharing request sent by a client, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, wherein the target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices each include a plurality of online states;

[0007] In response to the sharing request, the identification information of the target USB device and the user sharing intention are parsed from the sharing request, and based on the identification information of the target USB device and a preset mapping relationship, whether the current state of the target USB device meets the user sharing intention is determined, wherein the preset mapping relationship is used to represent the mapping relationship between the identification information of the multiple USB devices and the multiple port information corresponding to each USB device in the multiple USB devices in multiple states, and the multiple states of the target USB device correspond to the multiple port information one by one;

[0008] When it is determined that the current state of the target USB device meets the user's sharing intention, the port of the target USB device is shared with the client, so that the client interacts with the target USB device based on the port of the target USB device.

[0009] Optionally, judging whether the current state of the target USB device meets the user sharing intention based on the identification information of the target USB device and a preset mapping relationship includes:

[0010] Based on the identification information of the target USB device, obtaining the current port information of the target USB device;

[0011] Matching the identification information of the target USB device and the current port information of the target USB device with the information in the preset mapping relationship respectively, to determine the current state of the target USB device;

[0012] In a case where the current state of the target USB device is consistent with the device state in the user sharing intention, determining that the current state of the target USB device complies with the user sharing intention;

[0013] When the current state of the target USB device is inconsistent with the device state in the user sharing intention, it is determined that the current state of the target USB device does not comply with the user sharing intention.

[0014] Optionally, before judging whether the current state of the target USB device meets the user sharing intention based on the identification information of the target USB device and the preset mapping relationship, the method further includes:

[0015] Sending a control instruction to the hub, wherein the control instruction is used to control the multiple USB devices to power on in sequence;

[0016] Generate identification information for each USB device that is in a powered-on state, and obtain corresponding port information of each USB device that is in a powered-on state in multiple states;

[0017] The preset mapping relationship is established based on identification information corresponding to each USB device in the multiple USB devices and port information corresponding to each USB device in multiple states.

[0018] Optionally, after establishing the preset mapping relationship based on the identification information corresponding to each USB device in the multiple USB devices and the port information corresponding to each USB device in multiple states, the method further includes:

[0019] In the case that there is a replaced USB device among the multiple USB devices, updating the port information of the replaced USB device in the preset mapping relationship, wherein the identification information of the replaced USB device remains unchanged; and

[0020] The preset mapping relationship is backed up to the service management platform.

[0021] Optionally, the sharing request includes at least one of a common mount request, a reset reconnection request, and a state switching reconnection request.

[0022] In a second aspect, an embodiment of the present application further provides a USB device sharing method, which is applied to a client, and the method includes:

[0023] Sending a sharing request to a server, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, and the target USB device is any USB device among a plurality of USB devices connected to the server;

[0024] Receiving a port of the target USB device shared by the server, wherein the port of the target USB device is shared by the server when it is determined that a current state of the target USB device meets a user sharing intention, and the user sharing intention is obtained by parsing the server from the sharing request;

[0025] Interacting with the target USB device based on a port of the target USB device.

[0026] Optionally, sending a sharing request to a server includes:

[0027] Sending a query instruction to the service management platform, wherein the query instruction carries a query parameter, and the query parameter includes at least one of a device type of the device to be shared and information of a server to which the device to be shared belongs;

[0028] Receiving the target USB device returned by the service management platform, wherein the target USB device is a USB device that satisfies the query parameter among the multiple USB devices;

[0029] The sharing request is sent to a server to which the target USB device is connected.

[0030] Optionally, the interacting with the target USB device based on a port of the target USB device includes:

[0031] Receiving an operation instruction from a user, wherein the operation instruction includes a reset instruction, a state switching instruction, and an AT information sending instruction;

[0032] The operation instruction is sent to the target USB device through the port of the target USB device, so that the target USB device performs the operation corresponding to the operation instruction.

[0033] In a third aspect, an embodiment of the present application further provides a USB device sharing device, which is applied to a server, and the device includes:

[0034] A first receiving module is used to receive a sharing request sent by a client, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, and the target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices all include a plurality of online states;

[0035] a parsing and judging module, configured to, in response to the sharing request, parse the target USB device's identification information and the user's sharing intention from the sharing request, and judge whether the current state of the target USB device complies with the user's sharing intention based on the identification information of the target USB device and a preset mapping relationship, wherein the preset mapping relationship is used to represent a mapping relationship between the identification information of the multiple USB devices and the multiple port information corresponding to each of the multiple USB devices in the multiple USB devices in multiple states, and the multiple states of the target USB device correspond one-to-one to the multiple port information;

[0036] The sharing module is used to share the port of the target USB device with the client when it is determined that the current state of the target USB device meets the user's sharing intention, so that the client can interact with the target USB device based on the port of the target USB device.

[0037] In a fourth aspect, an embodiment of the present application further provides a USB device sharing device, which is applied to a client, and the device includes:

[0038] A second sending module is used to send a sharing request to the server, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, and the target USB device is any USB device among multiple USB devices connected to the server;

[0039] A second receiving module is used to receive the port of the target USB device shared by the server, wherein the port of the target USB device is shared by the server when it is determined that the current state of the target USB device meets the user's sharing intention, and the user's sharing intention is parsed by the server from the sharing request;

[0040] An interaction module is used to interact with the target USB device based on a port of the target USB device.

[0041] In a fifth aspect, an embodiment of the present application further provides a USB device sharing system, the system comprising at least one server and at least one client, each server in the at least one server is communicatively connected with each client in the at least one client, and each server in the at least one server is physically connected to a plurality of USB devices;

[0042] Wherein, each server in the at least one server is used to execute the USB device sharing method described in the first aspect;

[0043] Each client in the at least one client is used to execute the USB device sharing method described in the second aspect.

[0044] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the USB device sharing method described in the first aspect is implemented, or the USB device sharing method described in the second aspect is implemented.

[0045] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application receives a sharing request sent by a client, wherein the sharing request carries identification information of a target USB device, the sharing request is used to request the server to share a port of the target USB device, and the target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices all include a plurality of online states; in response to the sharing request, the identification information of the target USB device and the user's sharing intention are obtained by parsing the sharing request, and based on the identification information of the target USB device and a preset mapping relationship, it is determined whether the current state of the target USB device meets the user's sharing intention, wherein the preset mapping relationship is used to characterize the mapping relationship between the identification information of the plurality of USB devices and the plurality of port information corresponding to each USB device in the plurality of USB devices in a plurality of states, and the plurality of states of the target USB device correspond to the plurality of port information one-to-one; when it is determined that the current state of the target USB device meets the user's sharing intention, the port of the target USB device is shared with the client, so that the client interacts with the target USB device based on the port of the target USB device. Through the above method, the server can determine the port information corresponding to the target USB device in multiple states based on the identification information of the target USB device and the preset mapping relationship, and then when receiving the sharing request sent by the client, it can judge whether the current state of the target USB device meets the user's sharing intention based on the current port information of the target USB device and the identification information of the target USB device carried in the sharing request, thereby realizing the sharing of polymorphic target USB devices, thereby effectively solving the problem of poor stability in the related technology when sharing polymorphic USB devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

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

[0048] Figure 1 A flowchart of a USB device sharing method provided in an embodiment of the present application;

[0049] Figure 2A flowchart of another USB device sharing method provided in an embodiment of the present application;

[0050] Figure 3 A schematic diagram of the structure of a USB device sharing device provided in an embodiment of the present application;

[0051] Figure 4 A structural diagram of another USB device sharing device provided in an embodiment of the present application;

[0052] Figure 5 A schematic diagram of the structure of a USB device sharing system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0054] See also Figure 1 , Figure 1 A flowchart of a USB device sharing method provided in an embodiment of the present application is shown below. Figure 1 As shown, the USB device sharing method is applied to a server, and the USB device sharing method may include the following steps:

[0055] Step S102, receiving a sharing request sent by the client, wherein the sharing request carries identification information of the target USB device, and the sharing request is used to request the server to share a port of the target USB device. The target USB device is any USB device among multiple USB devices connected to the server, and the multiple USB devices all include multiple online states.

[0056] It should be noted that the USB device sharing method provided in the embodiment of the present application can be applied to a server, which can be connected to one or more clients in communication, and the server can be physically connected to multiple USB devices through a hub. In the server initialization stage, the server can use the hub to power on each USB device connected to it in turn, and assign a unique identification information to each powered-on USB device, and control each powered-on USB device to switch to a different state to obtain the port information of each powered-on USB device in different states, so that the server has the ability to identify polymorphic USB devices. The multiple USB devices connected to the server can be storage disks, network cards, modems, electronic devices, communication modules and other devices connected through USB ports, and the multiple USB devices connected to the server can include multiple online states, such as normal mode (i.e., normal mode), fast upgrade mode (i.e., fastboot mode) and emergency download mode (i.e., edl mode), etc.

[0057] The above-mentioned sharing request can be understood as a general term for all requests sent by the client in order to share the USB device, which may include but is not limited to ordinary mount requests, reset reconnection requests and state switching reconnection requests, etc., wherein the ordinary mount request refers to the request initiated by the client when a specific USB device needs to be mounted. After the USB device is successfully mounted, the client can access, view, and edit the files and data in the USB device, and can also use the USB device, such as printing materials, playing music, etc. The reset reconnection request refers to the request initiated by the client when a specific USB device needs to be reconnected after being reset. For example, when a user needs to update the configuration in a specific USB device, the user needs to reset the USB device and reconnect the USB device after the USB device is successfully reset. The state switching reconnection request refers to the request initiated by the client when a specific USB device is switched in state or the USB device itself switches in state and needs to be reconnected. For example, when a user needs to upgrade a specific USB device, a state switching reconnection request can be sent to the server to reconnect the USB device after the USB device is successfully upgraded.

[0058] The above-mentioned sharing request carries the identification information of the target USB device, where the target USB device can be any USB device among the multiple USB devices connected to the server. Specifically, the target USB device can be selected independently according to the user's needs, or can be obtained from the service management platform, which is not specifically limited in the embodiment of the present application.

[0059] When the user has a sharing demand for a target USB device, a sharing request can be triggered on the client based on the identification information of the target USB device, and the sharing request can be sent to the server, so that the server can receive the sharing request.

[0060] Step S104, in response to the sharing request, obtaining identification information of the target USB device and the user's sharing intention by parsing the sharing request, and judging whether the current state of the target USB device meets the user's sharing intention based on the identification information of the target USB device and a preset mapping relationship, wherein the preset mapping relationship is used to characterize a mapping relationship between identification information of multiple USB devices and multiple port information corresponding to each USB device in multiple states, and the multiple states of the target USB device correspond one-to-one to the multiple port information.

[0061] Specifically, the preset mapping relationship can be used to characterize the mapping relationship between the identification information of multiple USB devices connected to the server and the multiple port information corresponding to each USB device in the multiple USB devices in multiple states. The preset mapping relationship can be obtained by the server itself during the server initialization phase, or it can be manually obtained and set in advance, and the implementation of this application does not make specific limitations. The above-mentioned user sharing intention refers to the actual intention of the user to initiate the sharing request this time, such as the user's intention to mount the target USB device normally, reset and reconnect, or reconnect after state switching.

[0062] After receiving the sharing request, the server can parse the sharing request, parse the sharing request to obtain the identification information of the target USB device and the user's sharing intention, and then determine the port information of the target USB device in different states based on the identification information of the target USB device and the preset mapping relationship, and determine the current state of the target USB device based on the current port information of the target USB device. Then, the server can determine whether the current state of the target USB device meets the user's sharing intention. If the current state of the target USB device meets the user's sharing intention, it means that the current state of the target USB device can meet the user's actual sharing needs, and step S106 can be executed at this time; if the current state of the target USB device does not meet the user's sharing intention, it means that the current state of the target USB device does not meet the user's actual sharing needs, and a response message is returned to inform the client.

[0063] Step S106: when it is determined that the current state of the target USB device meets the user's sharing intention, the port of the target USB device is shared with the client, so that the client interacts with the target USB device based on the port of the target USB device.

[0064] When the server determines that the current state of the target USB device meets the user's sharing intention, the server can share the port of the target USB device with the client, so that the client can interact with the target USB device based on the port of the target USB device to achieve sharing of the target USB device.

[0065] Through the above method, the server can determine the port information corresponding to the target USB device in multiple states based on the identification information of the target USB device and the preset mapping relationship, and then when receiving the sharing request sent by the client, it can judge whether the current state of the target USB device meets the user's sharing intention based on the current port information of the target USB device and the identification information of the target USB device carried in the sharing request, thereby realizing the sharing of polymorphic target USB devices, thereby effectively solving the problem of poor stability in the related technology when sharing polymorphic USB devices.

[0066] In an optional embodiment, the above step S104, judging whether the current state of the target USB device meets the user's sharing intention based on the identification information of the target USB device and the preset mapping relationship, includes:

[0067] Based on the identification information of the target USB device, obtain the current port information of the target USB device;

[0068] Matching the identification information of the target USB device and the current port information of the target USB device with the information in the preset mapping relationship respectively to determine the current state of the target USB device;

[0069] When the current state of the target USB device is consistent with the device state in the user sharing intention, determining that the current state of the target USB device meets the user sharing intention;

[0070] When the current state of the target USB device is inconsistent with the device state in the user sharing intention, it is determined that the current state of the target USB device does not comply with the user sharing intention.

[0071] Specifically, when the server determines whether the current state of the target USB device meets the user's sharing intention, it can obtain the current port information of the target USB device based on the identification information of the target USB device, and then match the identification information of the target USB device and the current port information of the target USB device with the information in the preset mapping relationship respectively, so as to determine the current state of the target USB device. Then, the server can determine whether the current state of the target USB device meets the user's sharing intention. If the current state of the target USB device is consistent with the device state in the user's sharing intention, it can be determined that the current state of the target USB device meets the user's sharing intention; if the current state of the target USB device is inconsistent with the device state in the user's sharing intention, it can be determined that the current state of the target USB device does not meet the user's sharing intention.

[0072] In this way, based on the identification information of the target USB device and the preset mapping relationship, it is possible to accurately determine whether the current state of the target USB device meets the user's sharing intention, thereby facilitating subsequent determination of whether to share the port of the target USB device with the client.

[0073] In an optional embodiment, before the above step S104, based on the identification information of the target USB device and the preset mapping relationship, determining whether the current state of the target USB device meets the user's sharing intention, the method further includes:

[0074] Sending a control instruction to the hub, wherein the control instruction is used to control multiple USB devices to power on in sequence;

[0075] Generate identification information for each USB device that is in a powered-on state, and obtain corresponding port information of each USB device that is in a powered-on state in multiple states;

[0076] A preset mapping relationship is established based on identification information corresponding to each USB device in a plurality of USB devices and port information corresponding to each USB device in a plurality of states.

[0077] Specifically, before the server determines whether the current state of the target USB device meets the user's sharing intention based on the identification information of the target USB device and the preset mapping relationship, it is also necessary to pre-establish the preset mapping relationship. In the process of establishing the preset mapping relationship, the server can send a control instruction to the hub (i.e., Hub) to control the multiple USB devices under the hub to power on in sequence, and then generate identification information for each USB device in the power-on state, and obtain the corresponding port information of the USB device in the power-on state in multiple states, and then establish the preset mapping relationship based on the identification information corresponding to each USB device in the multiple USB devices and the corresponding port information of each USB device in multiple states. In this way, the server can realize the state recognition function of the polymorphic USB device based on the preset mapping relationship.

[0078] In an optional embodiment, after the above step, based on the identification information corresponding to each USB device in the plurality of USB devices and the port information corresponding to each USB device in a plurality of states, a preset mapping relationship is established, the method further comprises:

[0079] In the case that there is a replaced USB device among the multiple USB devices, updating the port information of the replaced USB device in the preset mapping relationship, wherein the identification information of the replaced USB device remains unchanged; and

[0080] Back up the preset mapping relationship to the service management platform.

[0081] Specifically, after establishing the preset mapping relationship, the server can also update the port information of the replaced USB device in the preset mapping relationship when there is a replaced USB device among multiple USB devices connected to it, while keeping the identification information of the replaced USB device unchanged. In this way, the information in the preset mapping relationship can be updated in real time when the USB device physically connected to the server is replaced, so as to ensure that the server can obtain the latest and most accurate preset mapping relationship.

[0082] At the same time, the server can back up the preset mapping relationship to the service management platform, so that the client can query the USB device information under each server based on the preset mapping relationship in the service management platform; moreover, when the preset mapping information on the server is deleted due to device failure or human error, data can be backed up from the service management platform in time.

[0083] In an optional embodiment, the sharing request includes at least one of a common mount request, a reset reconnection request and a state switching reconnection request.

[0084] Specifically, the above-mentioned sharing request includes one or a combination of multiple items of a common mount request, a reset reconnection request and a state switching reconnection request.

[0085] When the sharing request is a normal mount request, the client can send a normal mount request to the server. After receiving the normal mount request, the server determines whether the current state of the target USB device is online. If the current state of the target USB device is online, the port of the target USB device is shared with the client, and the client mounts the target USB device locally based on the port of the target USB device.

[0086] When the sharing request is a reset and reconnection request, the client can send a reset and reconnection request to the server. After receiving the reset and reconnection request, the server determines whether the current state of the target USB device has been restored from an offline state to an online state, and whether the online state has changed before and after the reset. If the current state of the target USB device has been restored from an offline state to an online state, and the online state has not changed before and after the reset, the port of the target USB device is shared with the client, and the client remounts the target USB device locally based on the port of the target USB device.

[0087] When the sharing request is a state switching reconnection request, the client can send a state switching reconnection request to the server. After receiving the state switching reconnection request, the server determines whether the online state of the target USB device is switched. If the online state of the target USB device is switched, the port of the target USB device is shared with the client, and the client remounts the target USB device locally based on the port of the target USB device.

[0088] Through the above method, USB device sharing in various scenarios can be achieved.

[0089] See also Figure 2 , Figure 2 A flowchart of another USB device sharing method provided in an embodiment of the present application is shown below. Figure 2 As shown, the USB device sharing method is applied to the client, and the USB device sharing method may include the following steps:

[0090] Step S202: Send a sharing request to the server, wherein the sharing request carries identification information of the target USB device, and the sharing request is used to request the server to share a port of the target USB device, and the target USB device is any USB device among multiple USB devices connected to the server.

[0091] It should be noted that the USB device sharing method provided in the embodiment of the present application can be applied to a client, and the client can be connected to one or more servers in communication, and each server can be physically connected to multiple USB devices through a hub. In the server initialization stage, the server can use the hub to power on each USB device connected to it in turn, and assign a unique identification information to each powered-on USB device, and control each powered-on USB device to switch to a different state to obtain the port information of each powered-on USB device in different states. In this way, the server has the ability to identify polymorphic USB devices. The client supports multiple operating systems, such as Windows, Linux, etc.

[0092] The above-mentioned sharing request can be understood as a general term for all requests sent by the client in order to share the USB device, which may include but is not limited to ordinary mount requests, reset reconnection requests and state switching reconnection requests, etc., wherein the ordinary mount request refers to the request initiated by the client when a specific USB device needs to be mounted. After the USB device is successfully mounted, the client can access, view, and edit the files and data in the USB device, and can also use the USB device, such as printing materials, playing music, etc. The reset reconnection request refers to the request initiated by the client when a specific USB device needs to be reconnected after being reset. For example, when a user needs to update the configuration in a specific USB device, the user needs to reset the USB device and reconnect the USB device after the USB device is successfully reset. The state switching reconnection request refers to the request initiated by the client when a specific USB device is switched in state or the USB device itself switches in state and needs to be reconnected. For example, when a user needs to upgrade a specific USB device, a state switching reconnection request can be sent to the server to reconnect the USB device after the USB device is successfully upgraded.

[0093] The above-mentioned sharing request carries the identification information of the target USB device, where the target USB device can be any USB device among the multiple USB devices connected to the server. Specifically, the target USB device can be selected independently according to the user's needs, or can be obtained from the service management platform, which is not specifically limited in the embodiment of the present application.

[0094] When the user has a sharing demand for a target USB device, a sharing request can be triggered on the client based on the identification information of the target USB device, and the sharing request can be sent to the server, so that the server can receive the sharing request.

[0095] Step S204, receiving the port of the target USB device shared by the server, wherein the port of the target USB device is shared by the server when it is determined that the current state of the target USB device meets the user's sharing intention, and the user's sharing intention is parsed by the server from the sharing request.

[0096] Specifically, the preset mapping relationship can be used to characterize the mapping relationship between the identification information of multiple USB devices connected to the server and the multiple port information corresponding to each USB device in the multiple USB devices in multiple states. The preset mapping relationship can be obtained by the server itself during the server initialization phase, or it can be manually obtained and set in advance, and the implementation of this application does not make specific limitations. The above-mentioned user sharing intention refers to the actual intention of the user to initiate the sharing request this time, such as the user's intention to mount the target USB device normally, reset and reconnect, or reconnect after state switching.

[0097] After receiving the sharing request, the server can parse the sharing request, parse the target USB device's identification information and the user's sharing intention from the sharing request, and then determine the target USB device's port information in different states based on the target USB device's identification information and the preset mapping relationship, and determine the target USB device's current state based on the target USB device's current port information. Then, the server can determine whether the target USB device's current state meets the user's sharing intention. If the target USB device's current state meets the user's sharing intention, it means that the target USB device's current state can meet the user's actual sharing needs, and the server can share the target USB device's port with the client.

[0098] Step S206: interact with the target USB device based on the port of the target USB device.

[0099] In this way, the client can interact with the target USB device based on the port of the target USB device to achieve sharing of the target USB device.

[0100] Through the above method, the server can determine the port information corresponding to the target USB device in multiple states based on the identification information of the target USB device and the preset mapping relationship, and then when receiving the sharing request sent by the client, it can judge whether the current state of the target USB device meets the user's sharing intention based on the current port information of the target USB device and the identification information of the target USB device carried in the sharing request, thereby realizing the sharing of polymorphic target USB devices, thereby effectively solving the problem of poor stability in the related technology when sharing polymorphic USB devices.

[0101] In an optional embodiment, the above step S202, sending a sharing request to the server, includes:

[0102] Sending a query instruction to the service management platform, wherein the query instruction carries a query parameter, and the query parameter includes at least one of a device type of the device to be shared and information of a server to which the device to be shared belongs;

[0103] Receiving a target USB device returned by the service management platform, wherein the target USB device is a USB device that satisfies the query parameters among the multiple USB devices;

[0104] Send a sharing request to the server to which the target USB device is connected.

[0105] Specifically, before the client sends a sharing request to the server, it needs to first determine the target USB device. Therefore, when the user is not sure about the target USB device, a query instruction can be sent to the service management platform, wherein the query instruction here carries a query parameter, and the query parameter includes at least one of the device type of the device to be shared and the server information to which the device to be shared belongs. After receiving the query instruction, the service management platform can determine the target USB device from the USB devices under multiple servers based on the query parameter, and then return the target USB device to the client, so that the client can send a sharing request to the server to which the target USB device is connected.

[0106] For example, when a user needs to share 5G-enabled USB devices on server 1 and server 2, the device type in the query parameter can be set to the 5G device type, and the server information in the query parameter can be set to server 1 and server 2. In this way, the client can query the 5G-enabled USB devices on server 1 and server 2 from the service management platform and use them as target USB devices.

[0107] In the above manner, the USB device that the user actually needs to share can be flexibly determined from the service management platform by setting the query parameters carried in the query instruction.

[0108] In an optional embodiment, the above step 206, interacting with the target USB device based on the port of the target USB device, includes:

[0109] Receiving operation instructions from a user, wherein the operation instructions include a reset instruction, a state switching instruction, and an AT information sending instruction;

[0110] The operation instruction is sent to the target USB device through the port of the target USB device, so that the target USB device performs the operation corresponding to the operation instruction.

[0111] Specifically, when the client interacts with the target USB device based on the port of the target USB device, the client can mount the target USB device locally and receive various operation instructions triggered by the user, such as reset instructions, state switching instructions, and AT information sending instructions, etc. Then the client can send the operation instruction to the target USB device through the port of the target USB device, so that the target USB device performs the operation corresponding to the operation instruction, thereby realizing the sharing of the target USB device.

[0112] See also Figure 3 , Figure 3 A schematic diagram of the structure of a USB device sharing device provided in an embodiment of the present application. Figure 3 As shown, the USB device sharing device 300 is applied to a server, and the USB device sharing device 300 includes:

[0113] A first receiving module 302 is used to receive a sharing request sent by a client, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to share a port of the target USB device, and the target USB device is any USB device among multiple USB devices connected to the server, and the multiple USB devices all include multiple online states;

[0114] The parsing and judging module 304 is used to respond to the sharing request, parse the target USB device identification information and the user sharing intention from the sharing request, and judge whether the current state of the target USB device meets the user sharing intention based on the identification information of the target USB device and a preset mapping relationship, wherein the preset mapping relationship is used to represent the mapping relationship between the identification information of the multiple USB devices and the multiple port information corresponding to each USB device in the multiple USB devices in multiple states, and the multiple states of the target USB device correspond to the multiple port information one by one;

[0115] The sharing module 306 is used to share the port of the target USB device with the client when it is determined that the current state of the target USB device meets the user's sharing intention, so that the client can interact with the target USB device based on the port of the target USB device.

[0116] Furthermore, the analysis and judgment module 304 includes:

[0117] The acquisition submodule is used to acquire the current port information of the target USB device based on the identification information of the target USB device;

[0118] A first determination submodule is used to match the identification information of the target USB device and the current port information of the target USB device with the information in the preset mapping relationship respectively, so as to determine the current state of the target USB device;

[0119] A second determination submodule is used to determine that the current state of the target USB device meets the user sharing intention when the current state of the target USB device is consistent with the device state in the user sharing intention;

[0120] The third determining submodule is used to determine that the current state of the target USB device does not meet the user's sharing intention when the current state of the target USB device is inconsistent with the device state in the user's sharing intention.

[0121] Furthermore, the device 300 also includes:

[0122] A first sending module is used to send a control instruction to the hub, wherein the control instruction is used to control multiple USB devices to power on in sequence;

[0123] A generating module, used to generate identification information for each USB device in a powered-on state, and obtain corresponding port information of each USB device in a powered-on state in multiple states;

[0124] The establishing module is used to establish a preset mapping relationship based on identification information corresponding to each USB device in a plurality of USB devices and port information corresponding to each USB device in a plurality of states.

[0125] Furthermore, the device 300 also includes:

[0126] an updating module, configured to update the port information of the replaced USB device in the preset mapping relationship when there is a replaced USB device among the multiple USB devices, wherein the identification information of the replaced USB device remains unchanged; and

[0127] The backup module is used to back up the preset mapping relationship to the service management platform.

[0128] Furthermore, the sharing request includes at least one of a common mount request, a reset reconnection request, and a state switching reconnection request.

[0129] It should be noted that the USB device sharing device 300 can implement the above Figure 1 The steps of the USB device sharing method provided by the method embodiment shown can achieve the same technical effect, and will not be repeated here one by one.

[0130] See also Figure 4 , Figure 4 A schematic diagram of the structure of another USB device sharing device provided in an embodiment of the present application.

[0131] like Figure 4 As shown, the USB device sharing device 400 is applied to the client, and the USB device sharing device 400 includes:

[0132] The second sending module 402 is used to send a sharing request to the server, wherein the sharing request carries identification information of the target USB device, and the sharing request is used to request the server to share the port of the target USB device, and the target USB device is any USB device among multiple USB devices connected to the server;

[0133] The second receiving module 404 is used to receive the port of the target USB device shared by the server, wherein the port of the target USB device is shared by the server when it is determined that the current state of the target USB device meets the user's sharing intention, and the user's sharing intention is obtained by the server parsing the sharing request;

[0134] The interaction module 406 is used to interact with the target USB device based on the port of the target USB device.

[0135] Further, the second sending module 402 includes:

[0136] A first sending submodule is used to send a query instruction to the service management platform, wherein the query instruction carries a query parameter, and the query parameter includes at least one of a device type of the device to be shared and server information to which the device to be shared belongs;

[0137] A first receiving submodule is used to receive a target USB device returned by the service management platform, wherein the target USB device is a USB device that satisfies the query parameters among multiple USB devices;

[0138] The second sending submodule is used to send a sharing request to the server to which the target USB device is connected.

[0139] Furthermore, the interaction module 406 includes:

[0140] The second receiving submodule is used to receive the user's operation instruction, wherein the operation instruction includes a reset instruction, a state switching instruction and an AT information sending instruction;

[0141] The third sending submodule is used to send the operation instruction to the target USB device through the port of the target USB device, so that the target USB device performs the operation corresponding to the operation instruction.

[0142] It should be noted that the USB device sharing device 400 can be implemented as described above. Figure 2 The steps of the USB device sharing method provided by the method embodiment shown can achieve the same technical effect, and will not be repeated here one by one.

[0143] See also Figure 5 , Figure 5A schematic diagram of the structure of a USB device sharing system provided in an embodiment of the present application. Figure 5 As shown, the USB device sharing system includes at least one server 510 and at least one client 520, each server in the at least one server 510 is communicatively connected with each client in the at least one client 520, and each server in the at least one server 510 is physically connected with a plurality of USB devices 540;

[0144] Each server in at least one server 510 is used to execute the aforementioned Figure 1 The USB device sharing method provided by the method embodiment shown;

[0145] Each of the at least one client 520 is used to execute the aforementioned Figure 2 The method embodiment shown provides a USB device sharing method.

[0146] It should be noted that each client 520 and each server 510 can establish a communication connection directly through the Internet, or through the network transfer of the service management platform 530, which can be determined according to the actual network conditions of the client 520 and the server 510. Each server 510 can be physically connected to multiple USB devices 540 through a hub 550, wherein the server 510 and the hub 550 can be connected through a USB cable, and the hub 550 and the USB device 540 can be connected through a USB cable and a power cable, and the hub 550 can provide the USB device 540 with power on and off capabilities.

[0147] like Figure 5 As shown, each server 510 may include a first plug-in UPCSoE Server and a second plug-in VirtualUSB Server. Each client 520 may include a third plug-in UPCSoE Client and a fourth plug-in Virtual USB Client.

[0148] The first plug-in UPCSoE Server can be responsible for controlling the power on and off of the hub and USB devices, and can also be responsible for monitoring the data of the shared USB devices of the second plug-in Virtual USB Server, and also upload the monitored USB device data to the service management platform USB Management Server.

[0149] A. When the first plug-in UPCSoE Server is deployed for the first time, it will traverse all currently connected USB devices. When the first plug-in UPCSoE Server traverses, only one USB device will be powered on at a time. The first plug-in UPCSoE Server will generate a unique identifier for the USB device and traverse all states of the USB device, such as normal mode, fast upgrade mode, fastboot mode, and emergency download mode, etc., as well as all USB port-related information in each state, such as name, type, product identification code (Product ID, referred to as PID), vendor identification code (Vendor ID, referred to as VID), port number, configuration item location, product serial number (Serial Number, referred to as SN), etc. Finally, the monitored data is uploaded to the service management platform USB Management Server.

[0150] B. When the first plug-in UPCSoE Server is working normally, when it is found that the USB device is reset and restarted, the first plug-in UPCSoE Server will automatically share the USB device; when it is found that the USB device has a state switch, the first plug-in UPCSoE Server will also share the USB device.

[0151] The second plug-in Virtual USB Server will enumerate all online USB devices in the current server and share the USB devices in the server through network sharing. The second plug-in Virtual USB Server currently has multiple sharing schemes, such as USBIP, USB Over Network, USB redirector, and VirtualHere. It should be noted that the second plug-in Virtual USB Server is a third-party tool and is not restricted by this proposal. At the same time, the second plug-in Virtual USB Server and the fourth plug-in Virtual USB Client must use the same sharing scheme.

[0152] The service management platform USB Management Server saves the USB device data uploaded by the first plug-in UPCSoE Server, and provides the data to the third plug-in UPCSoE Client for query. Through the service management platform USBManagement Server, multiple first plug-in UPCSoE Servers and multiple third plug-in UPCSoE Clients can share a complete set of shared data of USB devices.

[0153] The service management platform USB Management Server also provides a status display of the current USB device connection, such as client 2 connected to USB device 1 of server 1, client 1 connected to USB device 2 of server 2, etc. With the status information, administrators and users can easily understand the connection and usage of the current USB devices.

[0154] The third plug-in UPCSoE Client can obtain the device status and data of the USB of the current server by connecting to the first plug-in UPCSoE Server.

[0155] A. In a common USB device mounting scenario, the third plug-in UPCSoE Client sends a connection request message carrying USB device identification information to the fourth plug-in Virtual USB Client. After receiving the request, the fourth plug-in Virtual USB Client mounts the remote USB to the local device.

[0156] B. For the scenario where the USB device is reset and reconnected, since the USB device status has not changed, the third plug-in UPCEoE Client only needs to directly initiate connection and mount through the USB device identification information.

[0157] C. For the scenario where the USB device has switched states and reconnected, since the USB port data in various states has been obtained and saved in the first plug-in UPCSoE Server during initialization, the third plug-in UPCSoEClient can obtain this data to identify which state the current device has switched to, and use the corresponding USB device identification information to connect and mount.

[0158] D. For the power on and off scenarios of USB devices: the third plug-in UPCSoE Client directly sends a power on or power off message to the first plug-in UPCSoE Server. After receiving the message, the first plug-in UPCSoE Server will power on or power off the USB device.

[0159] E. For cross-server connection and mounting scenarios: The third plug-in UPCSoE Client needs to obtain the USB Server address corresponding to the USB device and the identification information of the USB device from the service management platform USB Management Server through the device unique identifier. With the USB Server address and the identification information of the USB device, the connection and mounting can be initiated.

[0160] F. For cross-platform scenarios: First, the Virtual USB solution must support cross-platform (USB Redirector has the best test results so far), install the corresponding fourth plug-in Virtual USB Client, and then run the third plug-in UPCSoE Client of the corresponding platform. The usage is the same for Windows and Linux.

[0161] The usage scheme of the fourth plug-in Virtual USB Client must be consistent with that of the second plug-in Virtual USB Server. After receiving the request from the third plug-in UPCSoE Client, the fourth plug-in Virtual USB Client will send a corresponding request to the fourth plug-in Virtual USB Client to mount or release the USB device.

[0162] The client also has a User Tool installed. Different USB devices have different drivers and corresponding tools. Users can install drivers and tools based on the characteristics of the USB device. If you need to execute AT commands, you can use the DeviceExpert tool, which can easily enumerate the AT ports of the current USB device, open and send the corresponding AT command set.

[0163] It can be seen that the USB device sharing method provided in the embodiment of the present application has the following beneficial effects:

[0164] 1. Cross-platform support for operating systems such as Windows and Linux;

[0165] 2. Support USB module reset and reconnection;

[0166] 3. Support USB module multi-state switching and automatic reconnection;

[0167] 4. Support cross-server connection and sharing of USB modules;

[0168] 5.The actual utilization rate of USB module is greatly improved.

[0169] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the USB device sharing method provided in any of the aforementioned method embodiments are implemented.

[0170] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0171] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A USB device sharing method, characterized in that: Applied to a server, the method comprises: Receive a sharing request sent by a client, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, wherein the target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices each include a plurality of online states; In response to the sharing request, the identification information of the target USB device and the user sharing intention are parsed from the sharing request, and based on the identification information of the target USB device and a preset mapping relationship, whether the current state of the target USB device meets the user sharing intention is determined, wherein the preset mapping relationship is used to represent the mapping relationship between the identification information of the multiple USB devices and the multiple port information corresponding to each USB device in the multiple USB devices in multiple states, and the multiple states of the target USB device correspond to the multiple port information one by one; When it is determined that the current state of the target USB device meets the user's sharing intention, the port of the target USB device is shared with the client, so that the client interacts with the target USB device based on the port of the target USB device.

2. The method according to claim 1, characterized in that The determining, based on the identification information of the target USB device and the preset mapping relationship, whether the current state of the target USB device meets the user sharing intention includes: Based on the identification information of the target USB device, obtaining the current port information of the target USB device; Matching the identification information of the target USB device and the current port information of the target USB device with the information in the preset mapping relationship respectively, to determine the current state of the target USB device; In a case where the current state of the target USB device is consistent with the device state in the user sharing intention, determining that the current state of the target USB device meets the user sharing intention; When the current state of the target USB device is inconsistent with the device state in the user sharing intention, it is determined that the current state of the target USB device does not conform to the user sharing intention.

3. The method according to claim 2, characterized in that Before judging whether the current state of the target USB device meets the user sharing intention based on the identification information of the target USB device and the preset mapping relationship, the method further includes: Sending a control instruction to the hub, wherein the control instruction is used to control the multiple USB devices to power on in sequence; Generate identification information for each USB device that is in a powered-on state, and obtain corresponding port information of each USB device that is in a powered-on state in multiple states; The preset mapping relationship is established based on identification information corresponding to each USB device in the multiple USB devices and port information corresponding to each USB device in multiple states.

4. The method according to claim 3, characterized in that After establishing the preset mapping relationship based on the identification information corresponding to each USB device in the multiple USB devices and the port information corresponding to each USB device in multiple states, the method further includes: In the case that there is a replaced USB device among the multiple USB devices, updating the port information of the replaced USB device in the preset mapping relationship, wherein the identification information of the replaced USB device remains unchanged; and The preset mapping relationship is backed up to the service management platform.

5. The method according to claim 1, characterized in that The sharing request includes at least one of a common mount request, a reset reconnection request, and a state switching reconnection request.

6. A USB device sharing method, characterized in that: Applied to a client, the method comprises: Sending a sharing request to a server, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, and the target USB device is any USB device among a plurality of USB devices connected to the server; Receiving a port of the target USB device shared by the server, wherein the port of the target USB device is shared by the server when it is determined that a current state of the target USB device meets a user sharing intention, and the user sharing intention is obtained by parsing the server from the sharing request; Interacting with the target USB device based on a port of the target USB device.

7. The method according to claim 6, characterized in that The sending of the sharing request to the server comprises: Sending a query instruction to the service management platform, wherein the query instruction carries a query parameter, and the query parameter includes at least one of a device type of the device to be shared and information of a server to which the device to be shared belongs; Receiving the target USB device returned by the service management platform, wherein the target USB device is a USB device that satisfies the query parameter among the multiple USB devices; The sharing request is sent to a server to which the target USB device is connected.

8. The method according to claim 6, characterized in that The interacting with the target USB device based on the port of the target USB device includes: Receiving an operation instruction from a user, wherein the operation instruction includes a reset instruction, a state switching instruction, and an AT information sending instruction; The operation instruction is sent to the target USB device through the port of the target USB device, so that the target USB device performs the operation corresponding to the operation instruction.

9. A USB device sharing device, characterized in that: Applied to a server, the device comprises: A first receiving module is used to receive a sharing request sent by a client, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, and the target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices all include a plurality of online states; a parsing and judging module, configured to, in response to the sharing request, parse the target USB device's identification information and the user's sharing intention from the sharing request, and judge whether the current state of the target USB device complies with the user's sharing intention based on the identification information of the target USB device and a preset mapping relationship, wherein the preset mapping relationship is used to represent a mapping relationship between the identification information of the multiple USB devices and the multiple port information corresponding to each of the multiple USB devices in the multiple USB devices in multiple states, and the multiple states of the target USB device correspond one-to-one to the multiple port information; The sharing module is used to share the port of the target USB device with the client when it is determined that the current state of the target USB device meets the user's sharing intention, so that the client can interact with the target USB device based on the port of the target USB device.

10. A USB device sharing device, characterized in that: Applied to a client, the device comprises: A second sending module is used to send a sharing request to the server, wherein the sharing request carries identification information of a target USB device, and the sharing request is used to request the server to perform port sharing on the target USB device, and the target USB device is any USB device among multiple USB devices connected to the server; A second receiving module is used to receive the port of the target USB device shared by the server, wherein the port of the target USB device is shared by the server when it is determined that the current state of the target USB device meets the user's sharing intention, and the user's sharing intention is parsed by the server from the sharing request; An interaction module is used to interact with the target USB device based on a port of the target USB device.

11. A USB device sharing system, characterized in that: The system comprises at least one server and at least one client, each server in the at least one server is communicatively connected with each client in the at least one client, and each server in the at least one server is physically connected with a plurality of USB devices; Wherein, each server in the at least one server is used to execute the USB device sharing method according to any one of claims 1 to 5; Each client in the at least one client is used to execute the USB device sharing method as described in any one of claims 6-8.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the USB device sharing method described in any one of claims 1 to 5 is implemented, or the USB device sharing method described in any one of claims 6 to 8 is implemented.

Citation Information

Cited By

  • USB device sharing method, apparatus and system, and storage medium

    WO2026129701A1