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

By receiving and parsing sharing requests and using preset mapping relationships to determine the USB device status, stable sharing of polymorphic USB devices is achieved, solving the continuity problem caused by changes in USB device status.

WO2026129701A1PCT designated stage Publication Date: 2026-06-25ROLLING WIRELESS SARL +1

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
ROLLING WIRELESS SARL
Filing Date
2025-08-20
Publication Date
2026-06-25

AI Technical Summary

Technical Problem

In existing technologies, the operating system cannot recognize changes in the state of a USB device, which leads to a lack of continuity in the use of USB devices and poor stability in the sharing of polymorphic USB devices.

Method used

By receiving the client's sharing request, parsing the target USB device's identification information and the user's sharing intent, using a preset mapping relationship to determine whether the USB device's current state matches the user's intent, and sharing the port with the client when it does, stable sharing of polymorphic USB devices is achieved.

Benefits of technology

It effectively solves the stability problem when sharing multi-state USB devices, ensuring the continuity and reliability of USB devices in different states.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025115840_25062026_PF_FP_ABST
    Figure CN2025115840_25062026_PF_FP_ABST
Patent Text Reader

Abstract

A USB device sharing method, apparatus and system, and a storage medium. The method comprises: receiving a sharing request sent by a client; in response to the sharing request, parsing from the sharing request identification information of a target USB device and a sharing intention of a user, and on the basis of the identification information of the target USB device and a preset mapping relationship, determining whether the current state of the target USB device conforms to the sharing intention of the user; and when it is determined that the current state of the target USB device conforms to the sharing intention of the user, sharing a port of the target USB device to the client, such that the client interacts with the target USB device on the basis of the port of the target USB device. In this way, the sharing of a polymorphic target USB device can be realized, thereby effectively solving the problem in the relevant art of the stability being low when a polymorphic USB device is shared.
Need to check novelty before this filing date? Find Prior Art

Description

USB device sharing methods, devices, systems, and storage media

[0001] This application claims priority to Chinese Patent Application No. 202411884024.8, filed on December 19, 2024, entitled "USB Device Sharing Method, Apparatus, System and Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of computer technology, and in particular to a USB device sharing method, apparatus, system and storage medium. Background Technology

[0003] Sharing multiple Universal Serial Bus (USB) devices can improve their utilization and flexibility, making them more convenient to use. As a result, USB device sharing is used in many scenarios.

[0004] In related technologies, during USB device sharing, if the state of a USB device changes, the operating system cannot recognize it as the same USB device, thus compromising the continuity of USB device usage. For example, when a user needs to upgrade a USB device, the USB device switches from normal mode to upgrade mode. At this time, the operating system cannot recognize which USB device it originally was, and therefore the user cannot continue to monitor its upgrade status. Therefore, related technologies suffer from poor stability when sharing USB devices with multiple states (hereinafter referred to as polymorphic USB devices). Summary of the Invention

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

[0006] In a first aspect, embodiments of this application provide a USB device sharing method applied to a server, the method comprising:

[0007] The server receives a sharing request sent by a client, wherein the sharing request carries the 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. The target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices include multiple online states.

[0008] In response to the sharing request, the identification information of the target USB device and the user's sharing intent are parsed from the sharing request. 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 conforms to the user's sharing intent. The preset mapping relationship is used to characterize the mapping relationship between the identification information of the plurality of USB devices and the multiple port information corresponding to each USB device in multiple states. The multiple states of the target USB device correspond one-to-one with the multiple port information.

[0009] If the current state of the target USB device is determined to be consistent with the user's sharing intention, the port of the target USB device is shared with the client, so that the client can interact with the target USB device based on the port of the target USB device.

[0010] Optionally, determining whether the current state of the target USB device matches the user's sharing intent based on the identification information of the target USB device and a preset mapping relationship includes:

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

[0012] The identification information and current port information of the target USB device are matched with the information in the preset mapping relationship to determine the current state of the target USB device.

[0013] If the current state of the target USB device matches the device state in the user's sharing intent, it is determined that the current state of the target USB device conforms to the user's sharing intent.

[0014] If the current state of the target USB device is inconsistent with the device state in the user's sharing intent, it is determined that the current state of the target USB device does not conform to the user's sharing intent.

[0015] Optionally, before determining whether the current state of the target USB device matches the user's sharing intention based on the identification information and preset mapping relationship of the target USB device, the method further includes:

[0016] Send a control command to the hub, wherein the control command is used to control the plurality of USB devices to power on sequentially;

[0017] Generate identification information for each USB device that is powered on, and obtain the port information of the USB device in various states for each powered-on state;

[0018] Based on the identification information of each USB device among the multiple USB devices and the port information of each USB device in various states, the preset mapping relationship is established.

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

[0020] If a replaced USB device exists among the plurality of USB devices, the port information of the replaced USB device in the preset mapping relationship is updated, wherein the identification information of the replaced USB device remains unchanged; and,

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

[0022] Optionally, the sharing request includes at least one of a normal mount request, a reset reconnection request, and a state transition reconnection request.

[0023] Secondly, embodiments of this application also provide a USB device sharing method, applied to a client, the method comprising:

[0024] Send a sharing request to the server, wherein the sharing request carries the 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, wherein the target USB device is any one of a plurality of USB devices connected to the server;

[0025] The server receives 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 determines 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 from the sharing request;

[0026] Interact with the target USB device based on the port of the target USB device.

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

[0028] Send a query command to the service management platform, wherein the query command carries query parameters, and the query parameters include at least one of the following: the device type of the device to be shared and the server information to which the device to be shared belongs;

[0029] Receive the target USB device returned by the service management platform, wherein the target USB device is the USB device among the plurality of USB devices that satisfies the query parameters;

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

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

[0032] Receive user operation instructions, wherein the operation instructions include reset instructions, state switching instructions, and AT information transmission instructions;

[0033] The operation command is sent to the target USB device through the port of the target USB device, so that the target USB device executes the operation corresponding to the operation command.

[0034] Thirdly, embodiments of this application also provide a USB device sharing device applied to a server, the device comprising:

[0035] The first receiving module is used to receive a sharing request sent by the client. The sharing request carries the identification information of the target USB device. The sharing request is used to request the server to share the port of the target USB device. The target USB device is any one of a plurality of USB devices connected to the server. The plurality of USB devices include multiple online states.

[0036] The parsing and judgment module is used to respond to the sharing request, parse the identification information of the target USB device and the user's sharing intent from the sharing request, and determine whether the current state of the target USB device conforms to the user's sharing intent based on the identification information of the target USB device and a preset mapping relationship. The preset mapping relationship is used to characterize the mapping relationship between the identification information of the plurality of USB devices and the multiple port information corresponding to each USB device in multiple states. The multiple states of the target USB device correspond one-to-one with the multiple port information.

[0037] 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.

[0038] Fourthly, embodiments of this application also provide a USB device sharing device for use on a client, the device comprising:

[0039] The second sending module is used to send a sharing request to the server, wherein the sharing request carries the 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, wherein the target USB device is any one of a plurality of USB devices connected to the server;

[0040] The 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 obtained by the server from the sharing request;

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

[0042] Fifthly, embodiments of this application also provide a USB device sharing system, the system including at least one server and at least one client, each of the at least one server and each of the at least one client being communicatively connected, and each of the at least one server being physically connected to multiple USB devices;

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

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

[0045] In a sixth aspect, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the USB device sharing method described in the first aspect, or implements the USB device sharing method described in the second aspect.

[0046] Compared with the prior art, the technical solution provided in this application has the following advantages: The method provided in this application receives a sharing request sent by a client, wherein the sharing request carries the identification information of a target USB device, and the sharing request is used to request the server to share the port of the target USB device. The target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices include multiple online states. In response to the sharing request, the identification information of the target USB device and the user's sharing intent are parsed from 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 conforms to the user's sharing intent. The preset mapping relationship is used to characterize the mapping relationship between the identification information of the plurality of USB devices and the multiple port information corresponding to each of the plurality of USB devices in multiple states, and the multiple states of the target USB device correspond one-to-one with the multiple port information. If it is determined that the current state of the target USB device conforms to the user's sharing intent, the port of the target USB device is shared with the client, so that the client can interact with the target USB device based on the port of the target USB device. In this way, the server can determine the port information of the target USB device in various states based on the identification information of the target USB device and the preset mapping relationship. Then, when receiving a sharing request sent by the client, it can determine whether the current state of the target USB device matches 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. This enables the sharing of multi-state target USB devices, thereby effectively solving the problem of poor stability in the sharing of multi-state USB devices in related technologies. Attached Figure Description

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

[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0049] Figure 1 is a flowchart illustrating a USB device sharing method provided in an embodiment of this application;

[0050] Figure 2 is a flowchart illustrating another USB device sharing method provided in an embodiment of this application;

[0051] Figure 3 is a schematic diagram of a USB device sharing device provided in an embodiment of this application;

[0052] Figure 4 is a structural schematic diagram of another USB device sharing device provided in an embodiment of this application;

[0053] Figure 5 is a schematic diagram of the structure of a USB device sharing system provided in an embodiment of this application. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0055] Referring to Figure 1, Figure 1 is a flowchart illustrating a USB device sharing method provided in an embodiment of this application. As shown in Figure 1, this USB device sharing method is applied to a server and may include the following steps:

[0056] Step S102: Receive a sharing request sent by the client. The sharing request carries the identification information of the target USB device. The sharing request is used to request the server to share the port of the target USB device. The target USB device is any one of multiple USB devices connected to the server. The multiple USB devices include various online states.

[0057] It should be noted that the USB device sharing method provided in this application embodiment can be applied to a server. This server can communicate with one or more clients and can also physically connect to multiple USB devices via a hub. During the server initialization phase, the server can use the hub to sequentially power on each USB device connected to it, assign a unique identifier to each powered-on USB device, and control each powered-on USB device to switch to different states to obtain port information for each powered-on USB device under different states. In this way, the server possesses the ability to identify multi-state USB devices. The multiple USB devices connected to the server can be storage disks, network cards, modems, electronic devices, communication modules, etc., connected via USB ports. Furthermore, the multiple USB devices connected to the server can include various online states, such as normal mode, fastboot mode, and emergency download mode (EDL mode).

[0058] The aforementioned sharing requests can be understood as a collective term for all requests sent by the client to share a USB device. These can include, but are not limited to, regular mount requests, reset / reconnect requests, and state-switching reconnect requests. A regular mount request is initiated by the client when it needs to mount a specific USB device. After successful mounting, the client can access, view, and edit files and data on the USB device, and also use the device, such as printing or playing music. A reset / reconnect request is initiated by the client when it needs to reconnect after resetting a specific USB device. For example, when a user needs to update the configuration of a specific USB device, the user needs to reset the USB device and reconnect after a successful reset. A state-switching reconnect request is initiated by the client when it needs to reconnect after a state switch of a specific USB device or a state switch caused by the USB device itself. For example, when a user needs to upgrade a specific USB device, it can send a state-switching reconnect request to the server after a successful upgrade to reconnect to the USB device.

[0059] The aforementioned sharing request carries the identification information of the target USB device. This target USB device can be any one of multiple USB devices connected to the server. Specifically, the target USB device can be selected by the user based on their needs, or it can be obtained from the service management platform; this embodiment does not impose specific limitations.

[0060] When a user needs to share a target USB device, they can trigger a sharing request on the client based on the identification information of the target USB device and send the sharing request to the server, so that the server can receive the sharing request.

[0061] Step S104: In response to the sharing request, the identification information of the target USB device and the user's sharing intent are parsed from the sharing request. Based on the identification information of the target USB device and the preset mapping relationship, it is determined whether the current state of the target USB device matches the user's sharing intent. The preset mapping relationship is used to represent the mapping relationship between the identification information of multiple USB devices and the multiple port information corresponding to each USB device in multiple states. The multiple states of the target USB device correspond one-to-one with the multiple port information.

[0062] Specifically, the aforementioned 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 port information corresponding to each USB device in multiple states. This 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; this application does not impose any specific limitations. The aforementioned user sharing intent refers to the user's actual intent in initiating the sharing request, such as the user's intent to perform normal mounting, reset and reconnection, or reconnection after a state switch on the target USB device.

[0063] After receiving a sharing request, the server can parse the request to obtain the target USB device's identification information and the user's sharing intent. Then, based on the target USB device's identification information and a preset mapping relationship, it determines the target USB device's port information in different states and, based on the target USB device's current port information, determines the target USB device's current state. Next, the server can determine whether the target USB device's current state matches the user's sharing intent. If the target USB device's current state matches the user's sharing intent, it means that the target USB device's current state can meet the user's actual sharing needs, and step S106 can be executed. If the target USB device's current state does not match the user's sharing intent, it means that the target USB device's current state does not meet the user's actual sharing needs, and a response message is returned to inform the client.

[0064] Step S106: If it is determined that the current state of the target USB device matches the user's sharing intention, the port of the target USB device is shared with the client so that the client can interact with the target USB device based on the port of the target USB device.

[0065] If the server determines that the current state of the target USB device matches the user's sharing intention, it can share the port of the target USB device with the client. In this way, the client can interact with the target USB device based on the port of the target USB device, thereby realizing the sharing of the target USB device.

[0066] In this way, the server can determine the port information of the target USB device in various states based on the identification information of the target USB device and the preset mapping relationship. Then, when receiving a sharing request sent by the client, it can determine whether the current state of the target USB device matches 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. This enables the sharing of multi-state target USB devices, thereby effectively solving the problem of poor stability in the sharing of multi-state USB devices in related technologies.

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

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

[0069] The current state of the target USB device is determined by matching the identification information and current port information of the target USB device with the information in the preset mapping relationship.

[0070] If the current state of the target USB device matches the device state in the user's sharing intent, then the current state of the target USB device is determined to match the user's sharing intent.

[0071] If the current state of the target USB device is inconsistent with the device state in the user's sharing intent, it is determined that the current state of the target USB device does not conform to the user's sharing intent.

[0072] Specifically, when determining whether the current state of the target USB device matches the user's sharing intent, the server can obtain the current port information of the target USB device based on its identification information. Then, it matches the target USB device's identification information and current port information with information in a preset mapping relationship to determine the current state of the target USB device. Next, the server can determine whether the current state of the target USB device matches the user's sharing intent. If the current state of the target USB device matches the device state in the user's sharing intent, then the current state of the target USB device matches the user's sharing intent; if the current state of the target USB device does not match the device state in the user's sharing intent, then the current state of the target USB device does not match the user's sharing intent.

[0073] Using the above method, based on the identification information and preset mapping relationship of the target USB device, it is possible to accurately determine whether the current state of the target USB device matches the user's sharing intention, thereby facilitating subsequent determination of whether to share the target USB device's port with the client.

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

[0075] Send control commands to the hub, wherein the control commands are used to control multiple USB devices to power on sequentially;

[0076] Generate identification information for each USB device that is powered on, and obtain the port information of the USB device in various states for each powered-on state;

[0077] A preset mapping relationship is established based on the identification information of each USB device among multiple USB devices and the port information of each USB device in various states.

[0078] Specifically, before determining whether the current state of the target USB device matches the user's sharing intention based on the target USB device's identification information and a preset mapping relationship, the server needs to pre-establish this preset mapping relationship. During the establishment of this preset mapping relationship, the server can send control commands to the hub to sequentially power on multiple USB devices under the hub. Then, it generates identification information for each powered-on USB device and obtains the port information corresponding to each powered-on USB device in various states. Next, based on the identification information of each USB device and the port information corresponding to each USB device in various states, the server establishes the preset mapping relationship. In this way, the server can realize the state recognition function of multi-state USB devices based on this preset mapping relationship.

[0079] In an optional embodiment, after establishing a preset mapping relationship based on the above steps, the identification information corresponding to each USB device among multiple USB devices, and the port information corresponding to each USB device in various states, the method further includes:

[0080] When a replaced USB device exists among multiple USB devices, the port information of the replaced USB device in the preset mapping relationship is updated, wherein the identification information of the replaced USB device remains unchanged; and,

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

[0082] Specifically, after establishing a preset mapping relationship, the server can 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 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.

[0083] At the same time, the server can back up the preset mapping relationship to the service management platform. In this way, 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 backed up from the service management platform in a timely manner due to device failure or accidental deletion, the data can be backed up in a timely manner.

[0084] In one alternative embodiment, the aforementioned sharing request includes at least one of a normal mount request, a reset reconnection request, and a state transition reconnection request.

[0085] Specifically, the aforementioned sharing requests include one or more of the following: normal mount requests, reset reconnection requests, and state transition reconnection requests.

[0086] 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 target USB device is currently online. If the target USB device is currently online, the server shares the port of the target USB device with the client, and the client mounts the target USB device to its local machine based on the port of the target USB device.

[0087] 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 recovered from the offline state to the online state, and whether the online state has changed before and after the reset. If the current state of the target USB device has recovered from the offline state to the online state, and the online state has not changed before and after the reset, the server shares the port of the target USB device with the client. The client then remounts the target USB device to its local machine based on the port of the target USB device.

[0088] 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 status of the target USB device has been switched. If the online status of the target USB device has been switched, the server shares the port of the target USB device with the client. The client then remounts the target USB device to its local machine based on the port of the target USB device.

[0089] The above methods can be used to share USB devices in various scenarios.

[0090] Referring to Figure 2, which is a flowchart illustrating another USB device sharing method provided in an embodiment of this application, the USB device sharing method is applied to a client and may include the following steps:

[0091] Step S202: Send a sharing request to the server. The sharing request carries the identification information of the target USB device. The sharing request is used to request the server to share the port of the target USB device. The target USB device is any one of the multiple USB devices connected to the server.

[0092] It should be noted that the USB device sharing method provided in this application embodiment can be applied to a client. This client can communicate with one or more servers, and each server can be physically connected to multiple USB devices via a hub. During the server initialization phase, the server can use the hub to sequentially power on each USB device connected to it, assign a unique identifier to each powered-on USB device, and control each powered-on USB device to switch to different states to obtain port information for each powered-on USB device in different states. In this way, the server possesses the ability to identify multi-state USB devices. The client supports multiple operating systems, such as Windows and Linux.

[0093] The aforementioned sharing requests can be understood as a collective term for all requests sent by the client to share a USB device. These can include, but are not limited to, regular mount requests, reset / reconnect requests, and state-switching reconnect requests. A regular mount request is initiated by the client when it needs to mount a specific USB device. After successful mounting, the client can access, view, and edit files and data on the USB device, and also use the device, such as printing or playing music. A reset / reconnect request is initiated by the client when it needs to reconnect after resetting a specific USB device. For example, when a user needs to update the configuration of a specific USB device, the user needs to reset the USB device and reconnect after a successful reset. A state-switching reconnect request is initiated by the client when it needs to reconnect after a state switch of a specific USB device or a state switch caused by the USB device itself. For example, when a user needs to upgrade a specific USB device, it can send a state-switching reconnect request to the server after a successful upgrade to reconnect to the USB device.

[0094] The aforementioned sharing request carries the identification information of the target USB device. This target USB device can be any one of multiple USB devices connected to the server. Specifically, the target USB device can be selected by the user based on their needs, or it can be obtained from the service management platform; this embodiment does not impose specific limitations.

[0095] When a user needs to share a target USB device, they can trigger a sharing request on the client based on the identification information of the target USB device and send the sharing request to the server, so that the server can receive the sharing request.

[0096] Step S204: Receive the port of the target USB device shared by the server. The port of the target USB device is shared by the server when it determines that the current state of the target USB device meets the user's sharing intention. The user's sharing intention is obtained by the server from the sharing request.

[0097] Specifically, the aforementioned 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 port information corresponding to each USB device in multiple states. This 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; this application does not impose any specific limitations. The aforementioned user sharing intent refers to the user's actual intent in initiating the sharing request, such as the user's intent to perform normal mounting, reset and reconnection, or reconnection after a state switch on the target USB device.

[0098] After receiving a sharing request, the server parses it to obtain the target USB device's identification information and the user's sharing intent. Then, based on the target USB device's identification information and a pre-defined mapping, it determines the target USB device's port information in different states and, based on the current port information, determines the target USB device's current state. Next, the server determines whether the target USB device's current state matches the user's sharing intent. If it does, the server can share the target USB device's port with the client.

[0099] Step S206: Interact with the target USB device based on the port of the target USB device.

[0100] In this way, the client can interact with the target USB device based on the target USB device's port, thereby enabling sharing of the target USB device.

[0101] In this way, the server can determine the port information of the target USB device in various states based on the identification information of the target USB device and the preset mapping relationship. Then, when receiving a sharing request sent by the client, it can determine whether the current state of the target USB device matches 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. This enables the sharing of multi-state target USB devices, thereby effectively solving the problem of poor stability in the sharing of multi-state USB devices in related technologies.

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

[0103] Send a query command to the service management platform. The query command carries query parameters, which include at least one of the following: the device type of the device to be shared and the server information to which the device to be shared belongs.

[0104] Receive the target USB device returned by the service management platform, where the target USB device is the USB device that meets the query parameters among multiple USB devices;

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

[0106] Specifically, before sending a sharing request to the server, the client needs to identify the target USB device. Therefore, when the user is unsure of the target USB device, they can send a query command to the service management platform. This query command carries query parameters, including at least one of the following: the device type of the device to be shared and the server information to which the device belongs. Upon receiving the query command, the service management platform can determine the target USB device from among the USB devices under multiple servers based on the query parameters, and then return the target USB device to the client. The client can then send a sharing request to the server connected to the target USB device.

[0107] For example, when a user needs to share a 5G-enabled USB device on server 1 and server 2, they can set the device type in the query parameters to 5G device type and the server information in the query parameters 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.

[0108] By using the above method, the query parameters carried in the query command can be set to flexibly determine the USB devices that the user actually needs to share from the service management platform.

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

[0110] Receive user operation commands, including reset commands, status switching commands, and AT information transmission commands;

[0111] The operation command is sent to the target USB device through the target USB device's port, so that the target USB device can execute the operation command corresponding to the operation command.

[0112] Specifically, when the client interacts with the target USB device via its port, it can mount the target USB device locally and receive various operation commands triggered by the user, such as reset commands, state switching commands, and AT message transmission commands. The client can then send these operation commands to the target USB device through its port, causing the target USB device to execute the corresponding operations, thereby achieving sharing of the target USB device.

[0113] Referring to Figure 3, Figure 3 is a structural schematic diagram of a USB device sharing device provided in an embodiment of this application. As shown in Figure 3, the USB device sharing device 300 is applied to a server, and the USB device sharing device 300 includes:

[0114] The first receiving module 302 is used to receive a sharing request sent by the client. The sharing request carries the identification information of the target USB device. The sharing request is used to request the server to share the port of the target USB device. The target USB device is any one of multiple USB devices connected to the server. The multiple USB devices include multiple online states.

[0115] The parsing and judgment module 304 is used to respond to the sharing request, parse the identification information of the target USB device and the user's sharing intent from the sharing request, and determine whether the current state of the target USB device conforms to the user's sharing intent based on the identification information of the target USB device and the preset mapping relationship. The preset mapping relationship is used to represent the mapping relationship between the identification information of multiple USB devices and the multiple port information corresponding to each USB device in multiple states. The multiple states of the target USB device correspond one-to-one with the multiple port information.

[0116] 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.

[0117] Furthermore, the parsing and judgment module 304 includes:

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

[0119] The first determining 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 to determine the current state of the target USB device.

[0120] The second determining submodule is used to determine that the current state of the target USB device conforms to the user's sharing intent when the current state of the target USB device is consistent with the device state in the user's sharing intent.

[0121] The third determination submodule is used to determine that the current state of the target USB device does not conform to 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.

[0122] Furthermore, the device 300 also includes:

[0123] The first transmitting module is used to send control commands to the hub, wherein the control commands are used to control multiple USB devices to power on sequentially;

[0124] The generation module is used to generate identification information for each USB device that is powered on, and to obtain the port information of the USB device in various states for each powered-on state.

[0125] The module is used to establish a preset mapping relationship based on the identification information of each USB device among multiple USB devices and the port information of each USB device in various states.

[0126] Furthermore, the device 300 also includes:

[0127] The update module is used to update the port information of the replaced USB device in a preset mapping relationship when a replaced USB device exists among multiple USB devices, wherein the identification information of the replaced USB device remains unchanged; and,

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

[0129] Furthermore, the sharing request includes at least one of the following: a normal mount request, a reset reconnect request, and a state transition reconnect request.

[0130] It should be noted that the USB device sharing device 300 can implement the steps of the USB device sharing method provided in the method embodiment shown in Figure 1 above, and can achieve the same technical effect, which will not be described in detail here.

[0131] Referring to Figure 4, which is a schematic diagram of another USB device sharing device provided in an embodiment of this application, the USB device sharing device 400 is applied to a client and includes:

[0132] The second sending module 402 is used to send a sharing request to the server. The sharing request carries the identification information of the target USB device. The sharing request is used to request the server to share the port of the target USB device. The target USB device is any one of the 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. 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. The user's sharing intention is obtained by the server from the sharing request.

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

[0135] Furthermore, the second transmitting module 402 includes:

[0136] The first sending submodule is used to send a query command to the service management platform. The query command carries query parameters, which include at least one of the following: the device type of the device to be shared and the server information to which the device to be shared belongs.

[0137] The first receiving submodule is used to receive the target USB device returned by the service management platform, wherein the target USB device is a USB device that meets 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 user operation commands, including reset commands, status switching commands, and AT information transmission commands.

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

[0142] It should be noted that the USB device sharing device 400 can implement the steps of the USB device sharing method provided in the method embodiment shown in Figure 2 above, and can achieve the same technical effect, which will not be described in detail here.

[0143] Referring to Figure 5, Figure 5 is a schematic diagram of the structure of a USB device sharing system provided in an embodiment of this application. As shown in Figure 5, 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 and each client in the at least one client 520 are communicatively connected, and each server in the at least one server 510 is physically connected to multiple USB devices 540.

[0144] In this embodiment, each server in at least one server 510 is used to execute the USB device sharing method provided in the method embodiment shown in FIG1 above;

[0145] Each client in at least one client 520 is used to execute the USB device sharing method provided in the aforementioned method embodiment shown in FIG2.

[0146] It should be noted that each client 520 can establish a communication connection with each server 510 directly via the Internet, or it can establish a communication connection through the network relay of the service management platform 530, depending on the actual network conditions of the client 520 and server 510. Each server 510 can be physically connected to multiple USB devices 540 through a hub 550. Specifically, the server 510 and the hub 550 can be connected via USB cables, and the hub 550 and the USB devices 540 can be connected via both USB cables and power cables. The hub 550 can provide power-on and power-off capabilities for the USB devices 540.

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

[0148] The first plugin, UPCSoE Server, can control the power-on and power-off of the hub and USB devices, and can also monitor the data of the shared USB devices by the second plugin, Virtual USB Server. At the same time, it will also upload the monitored data of the USB devices to the service management platform, USB Management Server.

[0149] A. Upon initial deployment, the first plugin, UPCSoE Server, iterates through all currently connected USB devices. During this iteration, only one USB device is powered on at a time. The UPCSoE Server generates a unique identifier for this USB device and iterates through all its states, such as normal mode, fastboot mode, and edl mode. It also iterates through all USB port-related information for each state, such as name, class, Product ID (PID), Vendor ID (VID), port number, location, and Serial Number (SN). Finally, the monitored data is uploaded to the USB Management Server service management platform.

[0150] B. When the first plug-in UPCSoE Server is working normally, it will automatically share the USB device after the USB device is detected to have been reset and restarted; it will also share the USB device when the state of the USB device is detected to have changed.

[0151] The second plugin, Virtual USB Server, enumerates all online USB devices on the server and shares them over the network. Virtual USB Server currently supports various sharing methods, such as USBIP, USB Over Network, USB redirector, and VirtualHere. It's important to note that Virtual USB Server is a third-party tool and is not subject to the restrictions of this proposal. Furthermore, Virtual USB Server and the fourth plugin, Virtual USB Client, must use the same sharing method.

[0152] The USB Management Server, a service management platform, stores data on USB devices uploaded by the first-level UPCSoE Server and provides this data for querying by the third-level UPCSoE Client. Through the USB Management Server, multiple first-level UPCSoE Servers and multiple third-level UPCSoE Clients can share a complete set of shared data for USB devices.

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

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

[0155] A. In a normal USB device mounting scenario, the third plugin UPCSoE Client will send a connection request message carrying the USB device identification information to the fourth plugin Virtual USB Client. After receiving the request, the fourth plugin Virtual USB Client will mount the remote USB to the local machine.

[0156] B. In scenarios involving USB device reset and reconnection, since the USB device's state has not changed,

[0157] The third plugin, UPCeoE Client, only requires initiating a connection and mounting directly using the USB device identification information.

[0158] C. In scenarios where a USB device has undergone a state transition and reconnection, since the USB port data under various states has been obtained and saved during initialization by the first plugin UPCSoE Server, the third plugin UPCSoE Client can obtain this data to identify which state the current device has switched to, and then connect and mount it using the corresponding USB device identification information.

[0159] D. For the power-on / off scenario of USB devices: The third plugin UPCSoE Client directly sends a power-on or power-off message to the first plugin UPCSoE Server. After receiving the message, the first plugin UPCSoE Server will power on or power off the USB device.

[0160] E. For cross-server connection and mounting scenarios: The third plugin 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's unique identifier. With the USB Server address and the USB device's identification information, a connection and mounting can be initiated.

[0161] F. For cross-platform scenarios: First, the chosen Virtual USB solution must support cross-platform compatibility (USB Redirector currently performs well in testing). After installing the corresponding fourth plugin, Virtual USB Client, run the corresponding platform's third plugin, UPCSoE Client. The usage is the same for Windows and Linux.

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

[0163] The client also includes a User Tool. Different USB devices have different drivers and corresponding tools, allowing users to install the appropriate drivers and tools based on the characteristics of their USB devices. For executing AT commands, the DeviceExpert tool can be used. This tool can easily enumerate the AT ports of the current USB device, open them, and send the corresponding AT command set.

[0164] Therefore, the USB device sharing method provided in this application has the following beneficial effects:

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

[0166] 2. Supports USB module reset and reconnection;

[0167] 3. Supports automatic reconnection during multi-state switching of the USB module;

[0168] 4. Supports cross-server connection and sharing of USB modules;

[0169] 5. The actual usage rate of USB modules has been greatly improved.

[0170] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the USB device sharing method provided in any of the foregoing method embodiments.

[0171] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0172] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily 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 invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for sharing USB devices, characterized in that, Applied to a server, the method includes: The server receives a sharing request sent by a client, wherein the sharing request carries the 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. The target USB device is any one of a plurality of USB devices connected to the server, and the plurality of USB devices include multiple online states. In response to the sharing request, the identification information of the target USB device and the user's sharing intent are parsed from the sharing request. 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 conforms to the user's sharing intent. The preset mapping relationship is used to characterize the mapping relationship between the identification information of the plurality of USB devices and the multiple port information corresponding to each USB device in multiple states. The multiple states of the target USB device correspond one-to-one with the multiple port information. If the current state of the target USB device is determined to be consistent with the user's sharing intention, the port of the target USB device is shared with the client, so that the client can interact 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 step of determining whether the current state of the target USB device matches the user's sharing intent based on the identification information of the target USB device and the preset mapping relationship includes: Based on the identification information of the target USB device, obtain the current port information of the target USB device; The identification information and current port information of the target USB device are matched with the information in the preset mapping relationship to determine the current state of the target USB device. If the current state of the target USB device matches the device state in the user's sharing intent, it is determined that the current state of the target USB device conforms to the user's sharing intent. If the current state of the target USB device is inconsistent with the device state in the user's sharing intent, it is determined that the current state of the target USB device does not conform to the user's sharing intent.

3. The method according to claim 2, characterized in that, Before determining whether the current state of the target USB device matches the user's sharing intent based on the identification information and preset mapping relationship of the target USB device, the method further includes: Send a control command to the hub, wherein the control command is used to control the plurality of USB devices to power on sequentially; Generate identification information for each USB device that is powered on, and obtain the port information of the USB device in various states for each powered-on state; Based on the identification information of each USB device among the multiple USB devices and the port information of each USB device in various states, the preset mapping relationship is established.

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 among the plurality of USB devices and the port information corresponding to each USB device in various states, the method further includes: If a replaced USB device exists among the plurality of USB devices, the port information of the replaced USB device in the preset mapping relationship is updated, wherein the identification information of the replaced USB device remains unchanged; and, Back up the preset mapping relationship to the service management platform.

5. The method according to claim 1, characterized in that, The sharing request includes at least one of the following: a normal mount request, a reset reconnection request, and a state transition reconnection request.

6. A method for sharing USB devices, characterized in that, Applied to a client, the method includes: Send a sharing request to the server, wherein the sharing request carries the 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, wherein the target USB device is any one of a plurality of USB devices connected to the server; The server receives 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 determines 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 from the sharing request; Interact with the target USB device based on the port of the target USB device.

7. The method according to claim 6, characterized in that, Sending a sharing request to the server includes: Send a query command to the service management platform, wherein the query command carries query parameters, and the query parameters include at least one of the following: the device type of the device to be shared and the server information to which the device to be shared belongs; Receive the target USB device returned by the service management platform, wherein the target USB device is the USB device among the plurality of USB devices that satisfies the query parameters; Send the sharing request to the server to which the target USB device is connected.

8. The method according to claim 6, characterized in that, The interaction with the target USB device based on the port of the target USB device includes: Receive user operation instructions, wherein the operation instructions include reset instructions, state switching instructions, and AT information transmission instructions; The operation command is sent to the target USB device through the port of the target USB device, so that the target USB device executes the operation corresponding to the operation command.

9. A USB device sharing device, characterized in that, Applied to a server, the device includes: The first receiving module is used to receive a sharing request sent by the client. The sharing request carries the identification information of the target USB device. The sharing request is used to request the server to share the port of the target USB device. The target USB device is any one of a plurality of USB devices connected to the server. The plurality of USB devices include multiple online states. The parsing and judgment module is used to respond to the sharing request, parse the identification information of the target USB device and the user's sharing intent from the sharing request, and determine whether the current state of the target USB device conforms to the user's sharing intent based on the identification information of the target USB device and a preset mapping relationship. The preset mapping relationship is used to characterize the mapping relationship between the identification information of the plurality of USB devices and the multiple port information corresponding to each USB device in multiple states. The multiple states of the target USB device correspond one-to-one with 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 includes: The second sending module is used to send a sharing request to the server, wherein the sharing request carries the 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, wherein the target USB device is any one of a plurality of USB devices connected to the server; The 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 obtained by the server from the sharing request; An interaction module is used to interact with the target USB device based on the port of the target USB device.

11. A USB device sharing system, characterized in that, The system includes at least one server and at least one client, wherein each server in the at least one server and each client in the at least one client are communicatively connected, and each server in the at least one server is physically connected to multiple USB devices; Each of the at least one server is used to execute the USB device sharing method as described in any one of claims 1-5; Each of the at least one client is used to perform 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, it implements the USB device sharing method of any one of claims 1-5, or the USB device sharing method of any one of claims 6-8.