CN115269482A - Method and device for supporting connection of multiple USB devices - Google Patents

Method and device for supporting connection of multiple USB devices Download PDF

Info

Publication number
CN115269482A
CN115269482A CN202210909976.5A CN202210909976A CN115269482A CN 115269482 A CN115269482 A CN 115269482A CN 202210909976 A CN202210909976 A CN 202210909976A CN 115269482 A CN115269482 A CN 115269482A
Authority
CN
China
Prior art keywords
equipment
server
data
usb
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210909976.5A
Other languages
Chinese (zh)
Inventor
林乐新
张康
姜小康
周超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Shanhui Technology Co ltd
Original Assignee
Shenzhen Shanhui Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Shanhui Technology Co ltd filed Critical Shenzhen Shanhui Technology Co ltd
Priority to CN202210909976.5A priority Critical patent/CN115269482A/en
Publication of CN115269482A publication Critical patent/CN115269482A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus

Abstract

The invention discloses a method for supporting connection of a plurality of USB devices, which comprises the steps of recording USB device addresses and device attributes in a server side, identifying, enumerating and driving and carrying accessed USB devices through a USB system, recording the USB device addresses and the device attributes in the server side, identifying, enumerating and driving and carrying the accessed USB devices through the USB system, sending USB device detection instructions by a client side to enable the server side to send the instructions after receiving the instructions, sending the instructions to a daemon process by the server side, processing complete data through the subprocess of the daemon process and continuously executing a monitoring task by the daemon process, and realizing the network access function of the USB without changing internal hardware of the USB devices, so that the USB devices with old versions are recycled, bus transmission in the traditional sense of network transmission day and unreal is performed, and the stability of network communication and the accuracy of data transmission are improved.

Description

Method and device for supporting connection of multiple USB devices
Technical Field
The invention belongs to the technical field of computer communication, and particularly relates to a method and a device for supporting connection of a plurality of USB devices.
Background
Since the advent of the USB universal serial bus, USB has been rapidly developed, from the first USB1.0, USB1.1 standards to the market-approved USB2.0 standard, the fully popular USB3.0 standard, and from the first 1.5Mbps to 480Mbps and the latest 5Gbps standards. Because USB has the characteristics of plug and play, flexible interface, good compatibility, reliable transmission, low cost and the like, the USB quickly occupies the field of computer peripheral equipment interfaces. A wide variety of USB devices are also introduced in the market, a USB disk is a typical USB mobile storage device, and when the USB mobile storage device is used for data transmission, due to the limitation of its own hardware system design, there is a problem that one USB device can only communicate with one host. Under the current environment of market trend of sharing economy and sharing equipment, USB networking becomes an important task in the USB field, and the feasibility of USB networking mainly includes: the function of the host controller supporting USB communication can be completely realized by software, the data is transmitted in a clear text manner, and the transmission data on the bus can be forwarded through a network; the compatibility of the driver, one driver can be matched with various types of equipment, with the continuous deepening of the application of the internet of things and shared data services, the problem of sharing of the USB through networking is increasingly concerned by individuals and companies, and data transmission after the USB equipment is accessed to the network and shared becomes another big problem.
Disclosure of Invention
In view of this, the present invention provides a method and a system for supporting connection of multiple USB devices, which solves the timeliness of communication connection and stability of data transmission of multiple USB devices, and is implemented by specifically adopting the following technical solutions.
In a first aspect, the present invention provides a method for supporting multiple USB device connections, including the following steps:
the method comprises the steps of obtaining a USB device address and a device attribute recorded in a server, and identifying, enumerating and carrying a drive on an accessed USB device through a USB system, wherein the server comprises device identification, device binding and device data transmission, the device identification comprises a USB device processing mechanism, the device binding comprises unbinding and unbinding of a device drive and file writing of drive information, and the device data transmission comprises device data collection, packaging and data transmission;
establishing communication connection of mapping requirements of a server and a client, wherein the mapping requirements comprise detection of a client to a server address and reply of a server to USB equipment accessed in response, reply contents comprise an equipment number, a bus number and an equipment type, and a detection request is sent and responded to query the USB equipment in the server;
the client sends out a USB equipment detection instruction to enable the server to send the instruction to the server after receiving the instruction, the server receives the instruction and sends the instruction to the USBIPD daemon, the USBIPD daemon processes the complete data through a self subprocess and continues to execute a monitoring task, the subprocess enumerates USB equipment meeting the condition in the data, and the equipment meeting the detection condition returns equipment information to the client;
the client side filters the equipment information, the client side continuously sends an Attach mapping request to the server side, the server side receives the mapping equipment information required by the client side, the mapping equipment information is handed to a subprocess to be continuously processed and a network connection is established, the server side packages URB data packets transmitted by a local bus in an IP packet and transmits the URB data packets to the client side, a VHCI virtual bus controller in the client side analyzes the URB data packets to obtain complete URB packets, the VHCI transmits the analyzed URB packets to an upper layer according to the local bus transmission mode and submits the URB packets to an upper layer driver, and the upper layer driver completely feeds back data to a user according to the local transmission mode.
As a further improvement of the technical hair follicle, the execution process of accessing the equipment to the service end comprises the following steps:
the server is in a state of starting and accessing a network, and when the equipment is inserted, a kernel library function libudev of the USB system is called to enumerate the newly inserted equipment, bind a system drive and write the equipment attribute and the equipment address into a USB subsystem file;
after the device enumeration is completed, the device waits for USBIP to initiate a device detection request, the server is in a ready state, and when the USBIP detects the target device, the attribute value of the device is recorded, wherein the attribute value comprises a BUSID, a bus number, an address number or a HUB number;
after the USBIP obtains the BUSID, the local drive of the equipment is unbound and bound to the USBIP drive, the equipment address and the equipment attribute of the equipment on the local are clear, and the equipment address and the equipment attribute are recorded into a corresponding USBIP library file;
the USBIP analyzes and processes the data in the USB equipment, encapsulates the data into data packets with corresponding formats, and sends the data packets to the client through the data transmission module, if the server is not accessed to the network, the server enters an AP mode, and sends the data after the client is accessed to the AP.
As a further improvement of the above-mentioned technology, after the server completes all operations on the device, the execution process of the client includes:
the client is started, connected to the network and in a mapping ready state, and when the USB equipment on the server is detected, the client enters a mapping module to launch BUSID detection equipment to the server;
when the equipment on the server is detected, the server judges whether the BUSID of the USB equipment requested by the client is matched with the local equipment or not, if the BUSID is matched successfully, the server responds to the equipment attribute value responded by the client, and if the BUSID is not matched successfully, the server responds to error information;
the method comprises the steps that after a virtual host controller VHCI of a client acquires a device attribute value, the device attribute value is transmitted into a USB subsystem, the client enters a device enumeration process, a sharing drive is loaded after enumeration is successful, the client initiates IN transaction requests to a server for batch transmission, the server returns a device data file, and the client finishes mapping work.
As a further improvement of the above-mentioned technology, the method continues to send an Attach mapping request to the server, and the server receives mapping device information required by the client, and includes:
the frequency domain measurements are converted to time domain measurements using an inverse fourier transform, with frequency sampling points starting at a starting frequency and stepping in frequency intervals up to an ending frequency. By a step Δ f of frequency by one interval
Figure BDA0003773741090000031
The function samples the frequency response of the link,
Figure BDA0003773741090000032
the function scale factor is the frequency response of each corresponding point;
multiplying and sampling the frequency domain measurement result F (omega) and the frequency sampling function with the interval delta omega to obtain an expression of
Figure BDA0003773741090000041
The frequency domain performance of the two functions is equivalent to the convolution of time domain transformation, and if the time domain transformation result of F (omega) is F (t), the expression is expressed
Figure BDA0003773741090000042
Figure BDA0003773741090000043
Is equivalent to sampling of the frequency domain measurement data.
As a further improvement of the technology, the discrete frequency domain measurement data of the network analyzer is converted into a periodic appetite signal after time domain transformation, and the periodic expression of the signal is
Figure BDA0003773741090000044
Figure BDA0003773741090000045
The time domain transformation under the default condition in the USB vector network analyzer is limited to be expressed as
Figure BDA0003773741090000046
The analyzer converts discrete frequency domain frequency response into time domain response by utilizing inverse Fourier transform, the frequency combination of all measuring points is a pulse during measurement, the time domain response resolution is in inverse proportion to the frequency span, the wider the frequency span is, the narrower the time domain pulse signal is, the higher the resolution is; the narrower the frequency span, the wider the time domain pulse signal, and the lower the resolution.
As a further improvement of the technical hair follicle, a window function adopted by time domain transformation in a USB vector network analyzer is a Kaiser window, and expressions of time domain response resolution under each analog impulse are respectively as follows: low-pass step mode, the step signal rises from 10% to 90%,
Figure BDA0003773741090000047
Figure BDA0003773741090000048
the low-pass impulse mode is 50% of the pulse width,
Figure BDA0003773741090000049
Figure BDA00037737410900000410
the band-pass impulse mode, i.e., 50% of the pulse width,
Figure BDA00037737410900000411
Figure BDA00037737410900000412
as a further improvement of the above-mentioned technology, establishing a communication connection for mapping requirements between a server and a client includes:
the equipment end point correctly receives the data file, the equipment feeds back the data of the host to be normally sent, and if the cyclic redundancy check error is generated, no information is returned;
when the equipment is in a busy state, the equipment sends an invalid packet with a PID value of 1010B to the host, named as NAK and informs the host to send data again;
when the device is in the endpoint disabled state, the device sends an error packet with a PID value of 1110B, named STALL, to the host, the transaction ends and the bus resources are released.
As a further improvement of the technical capsule, the server encapsulates the URB data packet transmitted by the local bus in an IP packet and transmits the IP packet to the client, and the method comprises the following steps:
when the length of data sent at one time is greater than the maximum transmission length of the data, unpacking the data, namely dividing a complete data into a plurality of packets to be transmitted alternately;
if the first data packet is an even data packet, the second data packet is an odd data packet, and the even data packet and the odd data packet have the same data content and serve as a supplementary packet after the last data packet is lost.
As a further improvement of the technology, USB equipment data is taken out of a buffer area and then enters a data analysis process, and a basic data format of a data packet is analyzed after a message type is determined according to a preset protocol format;
after receiving the complete data packet, the analysis function firstly removes the start character SOF of the first bit of the data packet, takes out the complete data packet and the PID check bit, compares the check bit of the data, and if the formats are different, the data packet is wrong and the error is directly returned; if the formats are the same, the data is received correctly, and field classification operation is carried out.
In a second aspect, the present invention further provides an apparatus for supporting multiple USB device connections, including:
the data acquisition unit is used for acquiring the address and the equipment attribute of the USB equipment recorded in the server and identifying, enumerating and carrying the accessed USB equipment through a USB system, wherein the server comprises equipment identification, equipment binding and equipment data transmission, the equipment identification comprises a USB equipment processing mechanism, the equipment binding comprises unbinding and unbinding of equipment drive and file writing of drive information, and the equipment data transmission comprises equipment data collection, packaging and data transmission;
the communication connection unit is used for establishing communication connection of mapping requirements of the server and the client, wherein the mapping requirements comprise detection of the client to the address of the server and reply of the USB equipment accessed by the server, the reply content comprises an equipment number, a bus number and an equipment type, and the detection request is sent and responded to carry out query operation on the USB equipment in the server;
the system comprises a judging unit, a client side and a USBIPD daemon, wherein the judging unit is used for sending a USB equipment detection instruction by the client side so that the server side sends the instruction to the server side after receiving the instruction, the server side sends the instruction to the USBIPD daemon, the USBIPD daemon processes complete data through a self subprocess and continues to execute a monitoring task, the subprocess enumerates USB equipment meeting conditions in the data, and the equipment meeting the detection conditions returns equipment information to the client side;
the data transmission unit is used for screening the equipment information by the client, continuously sending an Attach mapping request to the server, receiving the mapping equipment information required by the client by the server, submitting the mapping equipment information to the subprocess for continuous processing and establishing network connection, packaging the URB data packet transmitted by the local bus in an IP packet by the server and transmitting the URB data packet to the client, analyzing by a VHCI virtual bus controller in the client to obtain a complete URB packet, transmitting the analyzed URB packet to an upper layer by the VHCI according to the local bus transmission mode and submitting the URB packet to an upper layer drive, and completely feeding back the data to the user by the upper layer drive according to the local transmission mode.
The invention provides a method and a device for supporting connection of a plurality of USB devices, which are characterized in that the addresses and the device attributes of the USB devices recorded in a server are obtained, the accessed USB devices are identified, enumerated and driven by a USB system, the addresses and the device attributes of the USB devices recorded in the server are obtained, the accessed USB devices are identified, enumerated and driven by the USB system, the client sends out a USB device detection instruction to enable the server to receive the instruction and then send the instruction to a BIPD daemon, the USBIPD daemon processes the complete data by a self sub-process and continues to execute a monitoring task, the sub-process enumerates the USB devices meeting the conditions in the data, the devices meeting the detection conditions return the device information to the client, the client screens the device information, continues to send Attach mapping requests to the server, the server receives the mapping device information required by the client, the mapping device information is sent to the sub-process and establishes network connection, the server encapsulates the URB data transmitted by a local bus in an IP packet, the client transmits the information to a VHCI controller to obtain the complete data, and feeds the URB packet back to a user driver layer according to a virtual transmission mode of a VHCI, and transmits the complete data to the upper layer. The USB network access function can be realized under the condition that the internal hardware of the USB equipment is not changed, so that the old version of the USB equipment is recycled, the USB network access mode is facilitated, and the stability of network communication and the accuracy of data transmission are improved by bus transmission in the network transmission natural and unreal traditional sense.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flow chart of a method of supporting multiple USB device connections according to the present invention;
FIG. 2 is a diagram illustrating an implementation of the present invention;
FIG. 3 is a diagram of a client implementation of the present invention;
FIG. 4 is a block diagram of a device supporting multiple USB device connections according to the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
It will be understood that when an element is referred to as being "secured to" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. In contrast, when an element is referred to as being "directly on" another element, there are no intervening elements present. The terms "vertical," "horizontal," "left," "right," and the like are used herein for purposes of illustration only.
In the present invention, unless otherwise explicitly stated or limited, the terms "mounted," "connected," "fixed," and the like are to be construed broadly, e.g., as being permanently connected, detachably connected, or integral; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
Referring to fig. 1, the present invention provides a method for supporting connection of multiple USB devices, comprising the following steps:
s11: the method comprises the steps of obtaining a USB device address and a device attribute recorded in a server, and identifying, enumerating and carrying accessed USB devices through a USB system, wherein the server comprises device identification, device binding and device data transmission, the device identification comprises a USB device processing mechanism, the device binding comprises unbinding, unbinding and drive information writing of a device drive, and the device data transmission comprises device data collection, packaging and data transmission;
s12: establishing communication connection of mapping requirements of a server and a client, wherein the mapping requirements comprise detection of a client to a server address and reply of a server to USB equipment accessed in response, reply contents comprise an equipment number, a bus number and an equipment type, and a detection request is sent and responded to query the USB equipment in the server;
s13: the client sends a USB equipment detection instruction to enable the server to receive the instruction and then send the instruction to the server, the server receives the instruction and sends the instruction to the USBIPD daemon process, the USBIPD daemon process processes the complete data through a self subprocess and continues to execute a monitoring task, the subprocess enumerates USB equipment meeting the conditions in the data, and the equipment meeting the detection conditions returns equipment information to the client;
s14: the client side screens the equipment information, an Attach mapping request is continuously sent to the server side, the server side receives the mapping equipment information required by the client side, the mapping equipment information is handed to a subprocess to be continuously processed and establish network connection, the server side packages URB data packets transmitted by a local bus in an IP packet and transmits the URB data packets to the client side, a VHCI virtual bus controller in the client side analyzes the URB data packets to obtain complete URB packets, the VHCI transmits the analyzed URB packets to an upper layer according to the transmission mode of the local bus and submits the URB packets to an upper layer drive, and the upper layer drive completely feeds back data to a user according to the local transmission mode.
In this embodiment, establishing a communication connection between a server and a client according to mapping requirements includes: the equipment end point correctly receives the data file, the equipment feeds back the data of the host to be normally sent, and if the cyclic redundancy check error is generated, no information is returned; when the equipment is in a busy state, the equipment sends an invalid packet with a PID value of 1010B to the host, named NAK and informs the host to send data again; when the device is in the endpoint disabled state, the device sends an error packet with a PID value of 1110B, named STALL, to the host, the transaction ends and the bus resources are released.
It should be noted that, the encapsulating, by the server, the URB packet transmitted by the local bus in an IP packet to be transmitted to the client includes: the data packets comprise odd data packets and even data packets, and when the length of data sent at one time is greater than the maximum transmission length of the data, unpacking operation is required, namely, a complete piece of data is divided into a plurality of packets to be transmitted alternately; if the first data packet is an even data packet, the second data packet is an odd data packet, and the even data packet and the odd data packet have the same data content and are used as a supplementary packet after the last data packet is lost.
It should be understood that stable data transmission is convenient for meeting user experience of real-time mapping, the requirement of high transmission rate is to avoid the problem of unsmooth blockage in the transmission process of a big data file, the requirement of plug-and-pull automatic mapping is that once a USB device is accessed to a server, a system automatically identifies the device and completes the automatic detection function of a client, and sharing conditions are possessed by all devices, namely, a printer, a mobile phone, a large-capacity storage device and the like can realize remote sharing through the system, so that the communication stability of the devices and the integrity of data transmission are improved.
Referring to fig. 2, the implementation process of the device accessing the server includes:
s22: the server is in a state of starting and accessing a network, when the equipment is inserted, a kernel library function libudev of the USB system is called to enumerate the newly inserted equipment, a system drive is bound, and the equipment attribute and the equipment address are written into a USB subsystem file;
s23: after the device enumeration is completed, the device waits for USBIP to initiate a device detection request, the server is in a ready state, and when the USBIP detects the target device, the attribute value of the device is recorded, wherein the attribute value comprises a BUSID, a bus number, an address number or a HUB number;
s24: after the USBIP obtains the BUSID, the local drive of the equipment is unbound and bound to the USBIP drive, the equipment address and the equipment attribute of the equipment on the local are clear, and the equipment address and the equipment attribute are recorded into a corresponding USBIP library file;
s25: the USBIP analyzes and processes the data in the USB equipment, encapsulates the data into data packets with corresponding formats, and sends the data packets to the client through the data transmission module, if the server is not accessed to the network, the server enters an AP mode, and sends the data after the client is accessed to the AP.
In this embodiment, the discrete frequency domain measurement data of the network analyzer is converted into a periodic appetite signal after time domain transformation, and the periodic expression of the signal is
Figure BDA0003773741090000101
The time domain transformation in the USB vector network analyzer is limited to be expressed as the default condition
Figure BDA0003773741090000102
The analyzer converts discrete frequency domain frequency response into time domain response by utilizing inverse Fourier transform, the frequency of all measuring points is combined into a pulse during measurement, the time domain response resolution is inversely proportional to the frequency span, the wider the frequency span is, the narrower the time domain pulse signal is, the higher the resolution is; the narrower the frequency span, the wider the time domain pulse signal, and the lower the resolution.
It should be noted that, the USB device data is taken out from the buffer and enters a data parsing process, and the basic data format of the data packet is parsed after the message type is determined according to the preset protocol format; after receiving the complete data packet, the analysis function firstly removes the start character SOF of the first bit of the data packet, takes out the complete data packet and the PID check bit, compares the check bit of the data, and if the formats are different, the data packet is wrong and the error is directly returned; if the formats are the same, the data is received correctly, and field classification operation is carried out.
Referring to fig. 3, after the server finishes all operations on the device, the execution process of the client includes:
s33: the client is started, is accessed to the network and is in a mapping ready state, and when the USB equipment on the server is detected, the client enters a mapping module to launch BUSID detection equipment to the server;
s34: when the equipment on the server is detected, the server judges whether the BUSID of the USB equipment requested by the client is matched with the equipment of the server, if the BUSID is successfully matched with the equipment, the server responds to the equipment attribute value responded by the client, and if the BUSID is not successfully matched with the equipment attribute value, the server responds to error information;
s35: the method comprises the steps that after a virtual host controller VHCI of a client acquires a device attribute value, the device attribute value is transmitted into a USB subsystem, the client enters a device enumeration process, a sharing drive is loaded after enumeration is successful, the client initiates IN transaction requests to a server for batch transmission, the server returns a device data file, and the client finishes mapping work.
In this embodiment, the step of continuously sending an Attach mapping request to the server, where the server receives mapping device information required by the client, includes: the frequency domain measurements are converted to time domain measurements using an inverse fourier transform, with frequency sampling points starting at a starting frequency and stepping in frequency intervals up to an ending frequency. By a step Δ f of frequency by one interval
Figure BDA0003773741090000111
The function samples the frequency response of the link,
Figure BDA0003773741090000112
the function scale factor is the frequency response of each corresponding point; multiplying and sampling the frequency domain measurement result F (omega) and the frequency sampling function with the interval of delta omega to obtain an expression of
Figure BDA0003773741090000113
Frequency domain of two functionsThe performance is equivalent to the convolution of time domain transformation, and if the time domain transformation result of F (omega) is F (t), the expression is
Figure BDA0003773741090000114
Is equivalent to sampling of the frequency domain measurement data.
It should be noted that, the window function adopted for time domain transformation in the USB vector network analyzer is a kaiser window, and the expressions of the time domain response resolution under each analog impulse are respectively: low-pass step mode, the step signal rises from 10% to 90%,
Figure BDA0003773741090000115
the low-pass impulse mode is 50% of the pulse width,
Figure BDA0003773741090000116
the band-pass impulse mode, i.e., 50% of the pulse width,
Figure BDA0003773741090000117
referring to fig. 4, the present invention also provides a device for supporting multiple USB device connections, including:
the data acquisition unit is used for acquiring the address and the equipment attribute of the USB equipment recorded in the server and identifying, enumerating and carrying the accessed USB equipment through a USB system, wherein the server comprises equipment identification, equipment binding and equipment data transmission, the equipment identification comprises a USB equipment processing mechanism, the equipment binding comprises unbinding and unbinding of equipment drive and file writing of drive information, and the equipment data transmission comprises equipment data collection, packaging and data transmission;
the communication connection unit is used for establishing communication connection of mapping requirements of the server and the client, wherein the mapping requirements comprise detection of the client to the address of the server and reply of the USB equipment accessed by the server, the reply content comprises an equipment number, a bus number and an equipment type, and the detection request is sent and responded to carry out query operation on the USB equipment in the server;
the system comprises a judging unit, a client side and a USBIPD daemon, wherein the judging unit is used for sending a USB equipment detection instruction by the client side so that the server side sends the instruction to the server side after receiving the instruction, the server side sends the instruction to the USBIPD daemon, the USBIPD daemon processes complete data through a self subprocess and continues to execute a monitoring task, the subprocess enumerates USB equipment meeting conditions in the data, and the equipment meeting the detection conditions returns equipment information to the client side;
the data transmission unit is used for screening the equipment information by the client, continuously sending an Attach mapping request to the server, receiving the mapping equipment information required by the client by the server, submitting the mapping equipment information to the subprocess for continuous processing and establishing network connection, packaging the URB data packet transmitted by the local bus in an IP packet by the server and transmitting the URB data packet to the client, analyzing by a VHCI virtual bus controller in the client to obtain a complete URB packet, transmitting the analyzed URB packet to an upper layer by the VHCI according to the local bus transmission mode and submitting the URB packet to an upper layer drive, and completely feeding back the data to the user by the upper layer drive according to the local transmission mode.
In this embodiment, the device requests in the system are all completed by the user, different USB devices have serial numbers, if different interfaces have different device BUSIDs, the BUSIDs on different servers are different, and the user can make the device request according to the serial numbers that the user needs to connect. The system has a great advantage in the aspect of autonomous selection of mapping, namely the system can expand a plurality of service terminals to provide an equipment sharing interface for a client, not only one service terminal can intelligently provide four interfaces for USB equipment needing sharing, and when the expansion number reaches a certain level, cluster operation of sharing the USB equipment can be realized. Although the automatic mapping mode lacks the full-automatic sharing characteristic of the automatic mapping mode, the automatic mapping mode has the characteristics of flexibility and the like. If a certain service end in the cluster has a functional fault, the service end can be directly taken out for maintenance, and when a user selects equipment to input an operation command, the state of the system can be determined according to relevant information such as an operation prompt, so that the system can be repaired and maintained conveniently.
It should be noted that the USB subsystem is used for functions of identification and device enumeration after the USB device is connected to the server, and collection and transmission of USB data. The data analysis and processing are mainly used for analyzing different types of transmission modes of the USB, and the data analysis and processing are mainly reflected in the specific data format difference of the URB packet due to the difference of the data formats used by different types, so that the data packets sent by different transmission types need to be analyzed independently. The data package is used for carrying out secondary packaging on the URB package uploaded by the data transmission layer, and the URB package is packaged into the IP package to form a PDU package which is then submitted to the data communication module. The network communication receives and sends the PDU packet under the condition of keeping network monitoring, and the communication mode is divided into an end-to-end communication mode, a wireless communication mode and a server trunking communication mode. The system main program comprises a server side main program and a client side main program, the server side main program and the client side main program are used for scheduling the functions in an application layer, and complete instruction cooperation between the server side and the client side ensures a complete work flow of sharing service of the USB equipment.
In all examples shown and described herein, any particular value should be construed as exemplary only and not as a limitation, and thus other examples of example embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above examples are merely illustrative of several embodiments of the present invention, and the description thereof is more specific and detailed, but not to be construed as limiting the scope of the invention. It should be noted that various changes and modifications can be made by those skilled in the art without departing from the spirit of the invention, and these changes and modifications are all within the scope of the invention.

Claims (10)

1. A method for supporting multiple USB device connections, comprising the steps of:
the method comprises the steps of obtaining a USB device address and a device attribute recorded in a server, and identifying, enumerating and carrying a drive on an accessed USB device through a USB system, wherein the server comprises device identification, device binding and device data transmission, the device identification comprises a USB device processing mechanism, the device binding comprises unbinding and unbinding of a device drive and file writing of drive information, and the device data transmission comprises device data collection, packaging and data transmission;
establishing communication connection of mapping requirements of a server and a client, wherein the mapping requirements comprise detection of the client to the address of the server and reply of USB equipment accessed by the server in response, the reply content comprises an equipment number, a bus number and an equipment type, and the detection request is sent and responded to carry out query operation on the USB equipment in the server;
the client sends a USB equipment detection instruction to enable the server to receive the instruction and then send the instruction to the server, the server receives the instruction and sends the instruction to the USBIPD daemon process, the USBIPD daemon process processes the complete data through a self subprocess and continues to execute a monitoring task, the subprocess enumerates USB equipment meeting the conditions in the data, and the equipment meeting the detection conditions returns equipment information to the client;
the client side filters the equipment information, the client side continuously sends an Attach mapping request to the server side, the server side receives the mapping equipment information required by the client side, the mapping equipment information is handed to a subprocess to be continuously processed and a network connection is established, the server side packages URB data packets transmitted by a local bus in an IP packet and transmits the URB data packets to the client side, a VHCI virtual bus controller in the client side analyzes the URB data packets to obtain complete URB packets, the VHCI transmits the analyzed URB packets to an upper layer according to the local bus transmission mode and submits the URB packets to an upper layer driver, and the upper layer driver completely feeds back data to a user according to the local transmission mode.
2. The method of claim 1, wherein the execution of the device access service includes:
the server is in a state of starting and accessing a network, when the equipment is inserted, a kernel library function libudev of the USB system is called to enumerate the newly inserted equipment, a system drive is bound, and the equipment attribute and the equipment address are written into a USB subsystem file;
after the device enumeration is completed, the device waits for USBIP to initiate a device detection request, the server is in a ready state, and when the USBIP detects the target device, the attribute value of the device is recorded, wherein the attribute value comprises a BUSID, a bus number, an address number or a HUB number;
after the USBIP obtains the BUSID, the local drive of the equipment is unbound and bound to the USBIP drive, the equipment address and the equipment attribute of the equipment on the local are clear, and the equipment address and the equipment attribute are recorded into a corresponding USBIP library file;
the USBIP analyzes and processes the data in the USB equipment, encapsulates the data into data packets with corresponding formats, and sends the data packets to the client through the data transmission module, if the server is not accessed to the network, the server enters an AP mode, and sends the data after the client is accessed to the AP.
3. The method for supporting connection of multiple USB devices according to claim 2, wherein after the server performs all operations on the devices, the client performs a process including:
the client is started, is accessed to the network and is in a mapping ready state, and when the USB equipment on the server is detected, the client enters a mapping module to launch BUSID detection equipment to the server;
when the equipment on the server is detected, the server judges whether the BUSID of the USB equipment requested by the client is matched with the equipment of the server, if the BUSID is successfully matched with the equipment, the server responds to the equipment attribute value responded by the client, and if the BUSID is not successfully matched with the equipment attribute value, the server responds to error information;
the method comprises the steps that after a virtual host controller VHCI of a client acquires a device attribute value, the device attribute value is transmitted into a USB subsystem, the client enters a device enumeration process, a sharing drive is loaded after enumeration is successful, the client initiates IN transaction requests to a server for batch transmission, the server returns a device data file, and the client finishes mapping work.
4. The method for supporting multiple USB device connections according to claim 1, wherein the step of continuing to send Attach mapping request to the server, and the server receiving mapping device information required by the client, comprises:
converting frequency domain measurements to time domain measurements using inverse fourier transformIf desired, the frequency sampling points begin at a starting frequency and step at intervals of frequency until an ending frequency. By a step Δ f of frequency
Figure FDA0003773741080000021
The function samples the frequency response of the contact,
Figure FDA0003773741080000022
the function scale factor is the frequency response of each corresponding point;
multiplying and sampling the frequency domain measurement result F (omega) and the frequency sampling function with the interval of delta omega to obtain an expression of
Figure FDA0003773741080000031
The frequency domain performance of the two functions is equivalent to the convolution of time domain transformation, if the time domain transformation result of F (omega) is F (t), the expression is
Figure FDA0003773741080000032
Figure FDA0003773741080000033
Is equivalent to sampling of the frequency domain measurement data.
5. The method of claim 4, further comprising:
the discrete frequency domain measurement data of the network analyzer is converted into periodic appetite signals after time domain transformation, and the periodic expression of the signals is
Figure FDA0003773741080000034
The time domain transformation under the default condition in the USB vector network analyzer is limited to be expressed as
Figure FDA0003773741080000035
The analyzer converts discrete frequency domain frequency response into time domain response by utilizing inverse Fourier transform, the frequency combination of all measuring points is a pulse during measurement, the time domain response resolution is in inverse proportion to the frequency span, the wider the frequency span is, the narrower the time domain pulse signal is, the higher the resolution is; the narrower the frequency span, the wider the time domain pulse signal, and the lower the resolution.
6. The method of claim 5, wherein the window function used for time domain transformation in the USB vector network analyzer is a kaiser window, and the expressions of time domain response resolution under each analog impulse are respectively: low-pass step mode, the step signal rises from 10% to 90%,
Figure FDA0003773741080000036
the low-pass impulse mode is 50% of the pulse width,
Figure FDA0003773741080000037
the band-pass impulse mode, i.e., 50% of the pulse width,
Figure FDA0003773741080000038
7. the method for supporting multiple USB device connections according to claim 1, wherein establishing the communication connection between the server and the client mapping requirement includes:
the equipment end point correctly receives the data file, the equipment feeds back the data of the host to be normally sent, and if the cyclic redundancy check error is generated, no information is returned;
when the equipment is in a busy state, the equipment sends an invalid packet with a PID value of 1010B to the host, named as NAK and informs the host to send data again;
when the device is in the endpoint disabled state, the device sends an error packet with a PID value of 1110B, named STALL, to the host, the transaction ends and the bus resources are released.
8. The method for supporting multiple USB device connections according to claim 1, wherein the server encapsulates the URB packet transmitted by the local bus in an IP packet and transmits the IP packet to the client, comprising:
when the length of data sent at one time is greater than the maximum transmission length of the data, unpacking the data, namely dividing a complete data into a plurality of packets to be transmitted alternately;
if the first data packet is an even data packet, the second data packet is an odd data packet, and the even data packet and the odd data packet have the same data content and serve as a supplementary packet after the last data packet is lost.
9. The method of supporting multiple USB device connections of claim 8, further comprising:
the USB equipment data is taken out from the buffer area and then enters a data analysis process, and the basic data format of the data packet is analyzed after the message type is determined according to the preset protocol format;
after receiving the complete data packet, the analysis function firstly removes the start character SOF of the first bit of the data packet, takes out the complete data packet and the PID check bit, compares the check bit of the data, and if the formats are different, the data packet is wrong and the error is directly returned; if the formats are the same, the data is received correctly, and field classification operation is carried out.
10. A multi-USB device connection supporting apparatus according to any one of claims 1 to 9, comprising:
the data acquisition unit is used for acquiring the address and the equipment attribute of the USB equipment recorded in the server and identifying, enumerating and carrying the accessed USB equipment through a USB system, wherein the server comprises equipment identification, equipment binding and equipment data transmission, the equipment identification comprises a USB equipment processing mechanism, the equipment binding comprises unbinding and unbinding of equipment drive and file writing of drive information, and the equipment data transmission comprises equipment data collection, packaging and data transmission;
the communication connection unit is used for establishing communication connection of mapping requirements of the server and the client, wherein the mapping requirements comprise detection of the client to the address of the server and reply of the USB equipment accessed by the server in response, reply contents comprise equipment numbers, bus numbers and equipment types, and the detection request is sent and responded to carry out query operation on the USB equipment in the server;
the system comprises a judging unit, a client side and a USBIPD daemon, wherein the judging unit is used for sending a USB equipment detection instruction by the client side so that the server side sends the instruction to the server side after receiving the instruction, the server side sends the instruction to the USBIPD daemon, the USBIPD daemon processes complete data through a self subprocess and continues to execute a monitoring task, the subprocess enumerates USB equipment meeting conditions in the data, and the equipment meeting the detection conditions returns equipment information to the client side;
the data transmission unit is used for screening the equipment information by the client, continuously sending an Attach mapping request to the server, receiving the mapping equipment information required by the client by the server, submitting the mapping equipment information to the subprocess for continuous processing and establishing network connection, packaging the URB data packet transmitted by the local bus in an IP packet by the server and transmitting the URB data packet to the client, analyzing by a VHCI virtual bus controller in the client to obtain a complete URB packet, transmitting the analyzed URB packet to an upper layer by the VHCI according to the local bus transmission mode and submitting the URB packet to an upper layer drive, and completely feeding back the data to the user by the upper layer drive according to the local transmission mode.
CN202210909976.5A 2022-07-29 2022-07-29 Method and device for supporting connection of multiple USB devices Pending CN115269482A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210909976.5A CN115269482A (en) 2022-07-29 2022-07-29 Method and device for supporting connection of multiple USB devices

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210909976.5A CN115269482A (en) 2022-07-29 2022-07-29 Method and device for supporting connection of multiple USB devices

Publications (1)

Publication Number Publication Date
CN115269482A true CN115269482A (en) 2022-11-01

Family

ID=83747829

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210909976.5A Pending CN115269482A (en) 2022-07-29 2022-07-29 Method and device for supporting connection of multiple USB devices

Country Status (1)

Country Link
CN (1) CN115269482A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117251328A (en) * 2023-11-17 2023-12-19 先进操作系统创新中心(天津)有限公司 USB peripheral remote adaptation method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117251328A (en) * 2023-11-17 2023-12-19 先进操作系统创新中心(天津)有限公司 USB peripheral remote adaptation method and system
CN117251328B (en) * 2023-11-17 2024-01-26 先进操作系统创新中心(天津)有限公司 USB peripheral remote adaptation method and system

Similar Documents

Publication Publication Date Title
US4768150A (en) Application program interface to networking functions
US6718412B2 (en) Apparatus and method for universal serial bus communications
US7836338B2 (en) Distributed transaction processing method, distributed transaction processing system, transaction management device, and computer product
US20020156952A1 (en) Communication control apparatus, communication system and communication control method
DE60309391T2 (en) Data transfer control system, program and data transfer control method
EP2090979A1 (en) Interface driver program for computer and recording medium therefor
CN115269482A (en) Method and device for supporting connection of multiple USB devices
CN115396527B (en) PCIE and SRIO protocol conversion system and method based on FPGA
US7051363B2 (en) System and method for interfacing to different implementations of the intelligent platform management interface
JP2007088775A (en) Radio communication system, device, and method
US5734918A (en) Computer system with an input/output processor which enables direct file transfers between a storage medium and a network
US7827194B2 (en) Access to shared disk device on storage area network
US6693905B1 (en) Data exchange unit
US10789005B2 (en) Server and associated computer program product using different tranmission speed for cold data tansmission
CN113518107A (en) File transmission method, computing device and computer storage medium
US6681284B1 (en) System and method for providing a serial bus interface using distributed driver execution
US10599588B1 (en) Interconnection of peripheral devices on different electronic devices
JP2003281072A (en) Method and device for controlling device
CN115150297B (en) Data filtering and content evaluating method and system based on mobile internet
CN111200594B (en) Method and device for receiving data, data receiving equipment and storage medium
CN114116559B (en) High-speed bus method suitable for PLC application
US20150180777A1 (en) Data processing apparatus and method
CN112039941B (en) Data transmission method, device and medium
JP3606145B2 (en) Data transfer control device and electronic device
WO2008063826A1 (en) Techniques to process received network protocol units

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination