Summary of the invention
In view of this, the invention provides a kind of for realizing the device of multi-user access USB device and a kind of for realizing the method for multi-user access USB device.
Provided by the invention a kind of for realizing the device of multi-user access USB device, described device has can be by IP network by remote access IP network interface and several USB physical interfaces that can connect USB device, and described device also comprises:
TCP driver module, for the tcp port that provides several to be used by described remote access;
USB driver module, for driving several USB physical interfaces;
Interface mappings module, sets up and safeguards the mapping relations between the tcp port number of tcp port and the USB port of USB physical interface number; Described remote access take the IP address of described device as object IP address, take arbitrary tcp port during as destination interface, this tcp port is mapped to corresponding USB physical interface according to described mapping relations, and realize this tcp port and change with the data protocol between corresponding USB physical interface.
In described interface mappings module, be further provided with the first corresponding relation between the USB port number of each USB physical interface and the silk-screen of this USB physical interface number;
Described interface mappings module further receives configuration information, includes the second corresponding relation between tcp port number and silk-screen number in described configuration information; According to described the first corresponding relation and described the second corresponding relation, set up described mapping relations.
Described device further has a configuration input port, and described interface mappings module receives described configuration information by described configuration input port; Or described interface mappings module further receives by TCP driver module the described configuration information that uses reserved tcp port to send.
Described interface mappings module further, after knowing that arbitrary USB physical interface has USB device to insert, checks whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, asked described TCP driver module to trigger the corresponding tcp port of this USB physical interface to enter listening state; After knowing that arbitrary USB physical interface has USB device to extract, check whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, asked described TCP driver module to trigger the corresponding tcp port of this USB physical interface to enter closed condition.
Described interface mappings module is further after setting up described mapping relations, and whether the USB port number corresponding USB physical interface in the described mapping relations that judgement has been set up has USB device to insert and ask described TCP driver module to trigger the corresponding tcp port of this USB physical interface when having USB device to insert enters listening state;
And, described interface mappings module is further informed in arbitrary USB physical interface to be had after USB device insertion, checks whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, asked described TCP driver module to trigger the corresponding tcp port of this USB physical interface to enter listening state; After knowing that arbitrary USB physical interface has USB device to extract, check whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, asked described TCP driver module to trigger the corresponding tcp port of this USB physical interface to enter closed condition.
Described interface mappings module is further being known the insertion event that records this USB physical interface while having USB physical interface to insert USB device, is being known the insertion event of deleting this USB physical interface having recorded while having USB physical interface to extract USB device; And described interface mappings module is further carried out described judgement according to the insertion event of record after setting up described mapping relations.
Provided by the invention a kind of for realizing the method for multi-user access USB device, the method be applied to have can be by IP network by remote access IP network interface and can connect in the device of several USB physical interfaces of USB device, and described method comprises:
Several tcp ports that can be used by described remote access are provided and drive several USB physical interfaces;
Set up and safeguard the mapping relations between the tcp port number of tcp port and the USB port of USB physical interface number;
Described remote access take the IP address of described device as object IP address, take arbitrary tcp port during as destination interface, this tcp port is mapped to corresponding USB physical interface according to described mapping relations, and realize this tcp port and change with the data protocol between corresponding USB physical interface.
Described method further comprises:
Set in advance the first corresponding relation between the USB port number of each USB physical interface and the silk-screen of this USB physical interface number;
Receive configuration information, in described configuration information, include the second corresponding relation between tcp port number and silk-screen number;
According to described the first corresponding relation and described the second corresponding relation, set up described mapping relations.
Described method further sets in advance configuration input port, and further utilizes described configuration input port to receive described configuration information; Or described method further sets in advance reserved tcp port, and further receive the described configuration information sending when PC uses reserved tcp port access.
Described method further comprises knowing after arbitrary USB physical interface has USB device to insert: check whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, triggered the corresponding tcp port of this USB physical interface to enter listening state;
Described method further comprises knowing after arbitrary USB physical interface has USB device to extract: check whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, triggered the corresponding tcp port of this USB physical interface to enter closed condition.
Described method further comprises after setting up described mapping relations: whether the USB port number corresponding USB physical interface in the described mapping relations that judgement has been set up has USB device to insert and trigger the corresponding tcp port of this USB physical interface when having USB device to insert enters listening state;
Described method further comprises knowing after arbitrary USB physical interface has USB device to insert: check whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, triggered the corresponding tcp port of this USB physical interface to enter listening state;
Described method further comprises knowing after arbitrary USB physical interface has USB device to extract: check whether to have set up the described mapping relations of this USB physical interface and when setting up described mapping relations, triggered the corresponding tcp port of this USB physical interface to enter closed condition.
Described method is knowing that arbitrary USB physical interface further comprises while having USB device to insert: the insertion event that records this USB physical interface;
Described method is knowing that arbitrary USB physical interface further comprises while having USB device to extract: the insertion event of deleting this USB physical interface having recorded; And described method is further carried out described judgement according to the insertion event of record after setting up described mapping relations.
As seen from the above technical solution, utilize the present invention, with using per family tcp port, realize the remote access across IP network, and the tcp port using during by remote access is mapped in corresponding USB physical interface, thereby can pass through shone upon USB physical interface, have access to the USB device that connects corresponding USB physical interface.Because same tcp port number is not limited to login, the user of same PC, use, thereby can avoid the single usb host restrict access to USB device, realize real multi-user access; And, by IP network, to the access of USB device, also make the distance between PC and USB device can arbitrary extension, avoided the locus limitation of USB device.
More preferably, the mapping relations of tcp port and USB physical interface, can be according to the corresponding relation between the silk-screen of user configured tcp port number and USB physical interface number and set up.User can observe the silk-screen number of institute's mint-mark on the USB physical interface that its USB device that need to access connects in advance, corresponding relation between the silk-screen of the USB physical interface of then inputting the tcp port number of its tcp port that need to use and observing number, thus the mapping relations that obtain between USB physical interface that its tcp port that need to use is connected with its USB device that need to access just can be set up.Thus, because user can be known the corresponding relation between tcp port number that it arranges voluntarily and silk-screen number, thereby also just can uniquely know the mapping relations of tcp port and USB physical interface by inference, thereby can distinguish the USB device that is inserted in corresponding USB physical interface according to different tcp ports, and then also facilitate the management to USB device.Even if the USB physical interface that USB device connects can change, corresponding relation between the silk-screen of the tcp port number that user still can use corresponding tcp port before this USB device and reconfigure this tcp port and new USB physical interface number, thereby the obscuring of can avoid that variation due to USB physical interface causes USB device is identified.
Embodiment
For making object of the present invention, technical scheme and advantage clearer, referring to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
The present embodiment has substituted USB system architecture simple in prior art with the system architecture of IP based network, and in the system architecture of IP based network, be provided with a kind of device that is integrated with IP network interface (for example 100,000,000 ether interfaces) and a plurality of USB physical interfaces, and utilize this device to realize the access of multi-user to any USB device.
Specifically, referring to Fig. 2, the present embodiment comprises for realizing the system of multi-user access USB device:
Be positioned at least one PC of IP network one side;
At least one the USB device (datacom device for example with USB device function) of the present embodiment that is arranged in described IP network opposite side for realizing the device of multi-user access USB device and can connecting the USB interface of this device.Owing to being connected to IP network for realizing the IP network interface that the device of multi-user access USB device has by it in the present embodiment, thereby this device has IP address; But described at least one USB device is only to connect not connect IP network for realizing the device of multi-user access USB device, thereby can not have IP address.
Wherein, in the present embodiment, for realizing the tcp port using when the device of multi-user access USB device can provide several to be accessed by described IP network by arbitrary PC and can be used as usb host, drive several USB physical interfaces that can insert USB device (the USB physical interface quantity having can arrange arbitrarily, thereby this device need to be integrated with concentrator function or built-in hub).
And, in the present embodiment, for realizing the device of multi-user access USB device, can also set up and safeguard the mapping relations between the tcp port number of at least one tcp port and the USB port of its arbitrary USB physical interface number (or being referred to as hub side slogan).These mapping relations can automatically be set up (these mapping relations are the mapping relations that device carries) after device initialization, also can in device use procedure, be configured voluntarily (these mapping relations are user-defined mapping relations and be not present in this device before being configured by user) by user.
Arbitrary the PC that user logins all can by IP network and use Telnet (for example Telnet agreement) realize in the present embodiment for realizing the remote access of the device of multi-user access USB device.Arbitrary PC when remote access, need to take the IP address of this device as object IP address, the arbitrary tcp port that this device provides of take is destination interface.
Although the object IP address of access is for realizing the IP address of the device of multi-user access USB device in the present embodiment, but, this device can be mapped in corresponding USB physical interface using the tcp port as destination interface according to above-mentioned mapping relations, thus make arbitrary PC to the access map of this device for invisible to PC to being inserted in access and the said apparatus of USB device of corresponding USB physical interface.
As above visible, because same tcp port number is not limited to login, the user of same PC, use, thereby can avoid the single usb host restrict access to USB device, realize real multi-user access; And, by IP network, to the access of USB device, also make the distance between PC and USB device can arbitrary extension, avoided the locus limitation of USB device.
In addition, as long as user can be known the mapping relations between the tcp port number of tcp port and the USB port of USB physical interface number, can distinguish the USB device that is inserted in corresponding USB physical interface according to tcp port, and then also just can be convenient to the management to USB device.
For this reason, in the present embodiment, preferably by user, configure voluntarily the mapping relations between the tcp port number of tcp port and the USB port of USB physical interface number.
Concrete configuration mode is: the silk-screen of institute's mint-mark number (" silk-screen number " as herein described refers to that mint-mark is at the visable indicia of USB physical interface) on the USB physical interface that its USB device that need to access of user's observable connects.Then, user inputs the tcp port number of its tcp port that need to use in the present embodiment for realizing the device of multi-user access USB device, with and the silk-screen observed number between corresponding relation, this device can be according to user configured above-mentioned corresponding relation, and the corresponding relation (this corresponding relation is the corresponding relation that device carries) between the USB port of the inner predefined same USB physical interface of this device number and silk-screen number, foundation obtains the mapping relations between the USB port number of the USB physical interface that USB device that the tcp port number of the tcp port that user need to use need to access with user is connected.
Like this, because user can be known the corresponding relation between tcp port number and silk-screen number, thereby also just can uniquely know the mapping relations of tcp port and USB physical interface by inference, thereby can distinguish the USB device that is inserted in corresponding USB physical interface according to tcp port, and then also facilitate the management to USB device.Even if the USB physical interface that USB device connects can change, corresponding relation between the silk-screen of the tcp port number that user still can use corresponding tcp port before this USB device and reconfigure this tcp port and new USB physical interface number, thereby the obscuring of can avoid that variation due to USB physical interface causes USB device is identified.
Referring to Fig. 3, in the present embodiment, for realizing the internal logic layer of the device of multi-user access USB device, comprise:
Tcp protocol stack, it uses while accessing by described IP network for arbitrary PC for the tcp port of predetermined quantity is provided;
USB device class drives, usb protocol stack drives and usb host controller drives, for example, for driving several USB physical interfaces (USB device and the transfer of data based on usb protocol that, drive some USB physical interface identification to insert);
Interface mappings function, mainly comprises the mapping relations of setting up and safeguarding between tcp port and USB physical interface; Arbitrary PC take the IP address of described device as object IP address, take arbitrary tcp port when destination interface is accessed, can utilize above-mentioned mapping relations that the tcp port as destination interface is mapped to corresponding USB physical interface, and realize the data protocol conversion between this tcp port and corresponding USB physical interface.
When needing user to configure above-mentioned mapping relations, interface mappings function can be by the tcp port number in the configuration information of user's input and silk-screen number binding, and according to the corresponding relation between the silk-screen of the same USB physical interface setting in advance number and USB port number, find the silk-screen number corresponding USB port number in configuration information, so can set up the tcp port number in configuration information and the USB port that finds number between mapping relations, be the mapping relations between tcp port and USB physical interface.
When driving, USB device class knows that arbitrary USB physical interface has after USB device insertion, can to interface mappings function, report insertion event by control channel C2, the corresponding tcp port that is identified corresponding tcp port and identify to tcp protocol stack registration by control channel C1 according to above-mentioned mapping relations by interface mappings function again, makes tcp protocol stack can trigger corresponding tcp port and enters monitoring (Listening) state.
In practical application, whether the driving of USB device class can detect immediately this USB physical interface after interface mappings function is set up mapping relations for arbitrary USB physical interface has USB device to insert; Interface mappings function also can drive to detect after arbitrary USB physical interface has USB device to insert to check immediately whether for this USB physical interface, set up and have mapping relations in USB device class.
When corresponding tcp port enters after listening state, use the access of this tcp port can be mapped in the corresponding USB physical interface of this tcp port, and transmit data between this tcp port and corresponding USB physical interface.Wherein, the data of transmitting can be presented as with being segmented data flow M2 between driving of data flow M1 between interface mappings function and tcp protocol stack, interface mappings function and USB device class and USB device class drive with the driving of usb protocol stack between data flow M3.Because interface mappings function can also realize the transparent transmission based on protocol conversion between data flow M1 and data flow M2, thereby, between data flow M1, data flow M2 and data flow M3, can be connected.
After the driving of USB device class knows that arbitrary USB physical interface has USB device to extract, can to interface mappings function, report the event of extracting by control channel C2, by interface mappings function, according to above-mentioned mapping relations, identify corresponding tcp port and by control channel C1, to tcp protocol stack, nullify the corresponding tcp port identifying again, make tcp protocol stack trigger corresponding tcp port and enter closed condition.
Internal logic layer based on as shown in Figure 3, in the present embodiment for realize the device of multi-user access USB device except have can be by IP network by remote access IP network interface and can connect several USB physical interfaces of USB device, referring to Fig. 4, this device also specifically comprises following internal logic structure:
TCP driver module, tcp protocol stack the tcp port for providing several to be used by remote access are at least provided for it;
USB driver module, it at least carries, and USB device class drives, usb protocol stack drives and usb host controller drives, and for driving several can insert the USB physical interface of USB device;
Interface mappings module, for set up and safeguard between the tcp port number of tcp port and USB physical interface USB port mapping relations; The remote access of carrying out at arbitrary PC take the IP address of the machine as object IP address, take arbitrary tcp port during as destination interface, tcp port as destination interface is mapped to corresponding USB physical interface according to above-mentioned mapping relations, and realize this tcp port and change with the data protocol between corresponding USB physical interface.
For the ease of user, can decide above-mentioned mapping relations in its sole discretion, in interface mappings module, be further provided with the corresponding relation between the USB port number of each USB physical interface and the silk-screen of this USB physical interface number, and can further receive the configuration information that user inputs, in this configuration information, include the corresponding relation between tcp port number and silk-screen number, thereby can make interface mappings module according to above-mentioned two corresponding relations, set up the mapping relations between the tcp port number of tcp port and the USB port of USB physical interface number.
The mode of user's input configuration information has two kinds:
Local configuration mode, user in the present embodiment for realize multi-user access USB device device place IP network a side, be that local side is directly to this device input configuration information, now, this device can further have one and be exclusively used in the configuration input port that receives configuration information, so that interface mappings module receives configuration information by configuration input port;
Remote configuration mode, user logins PC and accesses in the present embodiment for realizing the device of multi-user access USB device by IP network, in this PC access process at this moment, can send configuration information to this device, and the tcp port that the access now of this PC is used is to be exclusively used in the reserved tcp port that receives configuration information; Interface mappings module can will be used the access of reserved tcp port to be identified as configuration operation, and the information that the access of using reserved tcp port is sent is identified as configuration information.
In addition, whether interface mappings module can also have equipment to insert to safeguard the state of corresponding tcp port according to USB physical interface, specifically:
Interface mappings module after setting up above-mentioned mapping relations at every turn, the whether existing USB device of USB port number corresponding USB physical interface in the mapping relations that capital judgement has been set up is inserted, and when the existing USB device of this USB physical interface is inserted, asks TCP driver module to trigger the corresponding tcp port of this USB physical interface to enter listening state; Wherein, interface mappings module can be notified immediately USB driver module to carry out detection and carry out judgement according to testing result after setting up above-mentioned mapping relations; Or, the insertion event that interface mappings module also can record according to it at every turn when knowing the USB physical interface that has USB device insertion is carried out judgement, in this case, interface mappings module also need to known the insertion event of deleting this USB physical interface having recorded while having USB physical interface to extract USB device at every turn;
Interface mappings module detects USB physical interface at USB driver module and inserts after USB device (the USB device class of carrying in USB driver module drives the insertion event that reports), check the above-mentioned mapping relations whether set up this USB physical interface, and when this USB physical interface has been set up above-mentioned mapping relations, according to above-mentioned mapping relations request TCP driver module (tcp protocol stack carrying in TCP driver module), trigger the corresponding tcp port of this USB physical interface and enter listening state;
That is to say, as long as meeting to be inserted with USB device and to set up simultaneously, arbitrary USB physical interface has these two conditions of corresponding mapping relations, interface mappings module enters listening state with regard to asking TCP driver module to trigger corresponding tcp port, but the precedence relationship of two condition establishments does not affect corresponding tcp port, does not enter listening state;
The USB device that interface mappings module also detects USB physical interface at USB driver module is extracted after (the USB device class of carrying in USB driver module drives the event of extracting that reports), check the described mapping relations whether set up this USB physical interface, and when the built vertical mapping relations of this USB physical interface, according to described mapping relations request TCP driver module (tcp protocol stack carrying in TCP driver module), trigger the corresponding tcp port of this USB physical interface and enter closed condition.
Below, in conjunction with specific works flow process, the present embodiment is being further illustrated for realizing the device of multi-user access USB device.
Fig. 5 a is that the present embodiment is carried out the processing procedure schematic diagram of mapping configuration for realizing the device of multi-user access USB device.As shown in Figure 5 a, the processing procedure of this mapping configuration is mainly completed and is comprised by interface mappings module:
S11, interface mappings module receives the configuration information (local input or remote input) of user's input.
S12, interface mappings module judges whether the represented tcp port of the tcp port number in configuration information is used,, whether the represented tcp port of tcp port number there are the mapping relations with USB physical interface, if, thereby represent to be configured and can to cause corresponding tcp port to shine upon more than one USB physical interface appearance conflict simultaneously with this tcp port number, therefore jump to S17; Otherwise continue to carry out S13.
S13, interface mappings module, by the tcp port number in configuration information and silk-screen number binding, then continues to carry out S14.
S14, interface mappings module is according to the corresponding relation of the USB port that sets in advance number and silk-screen number, identify bound silk-screen number corresponding USB port number, and set up the tcp port number in configuration information and the USB port that identifies number between mapping relations, for tcp port and the mapping relations between USB physical interface, then the continuation execution S15 that represents that user will configure.
S15, whether the USB port number corresponding USB physical interface that the judgement of interface mappings module identifies now has USB device to insert, if there is USB device to insert and continue, carries out S16, otherwise process ends.
Judgment mode in this step can wait for that receiving USB device class drives the insertion event reporting for interface mappings module, or, also can inquire about the equipment insertion information of its record, all insertion events that this equipment insertion information recording has the driving of USB device class to report for interface mappings module.
S16, interface mappings module is registered the tcp port number in configuration information to TCP driver module immediately, with notice TCP driver module, trigger immediately corresponding tcp port and enter listening state, thereby allow the USB device of using USB physical interface corresponding to this tcp port number remote access now to insert, then process ends.
S17, the information of interface mappings module output tcp port conflict, then process ends.
So far, a configuration flow finishes.
Fig. 5 b is that the present embodiment is for realizing the processing procedure schematic diagram of the device executive's interface mapping of multi-user access USB device.As shown in Figure 5 b, the processing procedure of this interface mappings comprises:
S21, USB driver module detects the device type that equipment inserts arbitrary USB physical interface and obtains interventional instrument.
Processing procedure in this step specifically comprises: the HCD carrying in USB driver module can notify usb protocol stack to drive has equipment to insert USB physical interface, the usb protocol stack carrying in USB driver module again drives and utilizes general USB control command to obtain the type of interventional instrument, and then notifying the USB device class of carrying in USB driver module to drive has equipment to insert USB physical interface.
S22, whether the equipment that USB driver module inserts USB physical interface according to the device type judgement of obtaining is legal USB device, if it is carries out S23, otherwise indication equipment does not mate and process ends.
" legal " described in this step mainly refers to USB serial line interface, also allows by the USB device of user management.For example, for the present embodiment, with USB serial line interface, and to allow can be datacom device by " legal " USB device of user management, such as USB flash disk, USB mouse etc., do not need by the USB device for managing, not belong to " legal " USB device in the present embodiment.That is to say, " legal " can be understood as the USB device classification of predefined a kind of acquiescence, only belongs to USB device " legal " of this USB device classification.
Processing procedure in this step specifically comprises: the USB device class of carrying in USB driver module drives according to usb protocol stack and drives the device type of obtaining to carry out above-mentioned judgement, if, by S23 trigger interface mapping block, otherwise notice usb protocol stack driving arrangement does not mate and process ends.
S23, USB driver module reports insertion event to interface mappings module, with notification interface mapping block, has USB device to insert USB physical interface, then carries out S24.
S24, interface mappings module records equipment inserts information, then carries out S25.
The equipment recording in this step inserts information, can use for the S15 as shown in Fig. 5 a.Interface mappings module is being known the insertion event that also should delete this USB physical interface having recorded while having USB physical interface to extract USB device.
S25, the USB physical interface that whether the USB physical interface that interface mappings module is inserted with USB device according to the mapping relations judgement of having set up exist corresponding tcp port, insert USB device has been set up mapping relations, if, carry out S26, otherwise the USB device that represents to be inserted in this USB physical interface cannot be by remote access process ends.
S26, interface mappings module is registered corresponding tcp port number to TCP driver module, with notice TCP driver module, trigger immediately corresponding tcp port and enter listening state, thereby allow the USB device of using corresponding this USB physical interface of tcp port number remote access now to insert, then process ends.
So far, once shining upon flow process finishes.
Except as above, for realizing the system and device of multi-user access USB device, it is a kind of for realizing the method for multi-user access USB device that the present embodiment also provides.
The method be applied to have can be by IP network by remote access IP network interface and can connect in the device of several USB physical interfaces of USB device.
And the method can provide several tcp ports that can be used by the remote access of arbitrary PC and drive several USB physical interfaces that can insert USB device, meanwhile, the method can also comprise the steps:
Set up and safeguard the mapping relations between tcp port and USB physical interface, these mapping relations can be expressed as the mapping relations between the tcp port number of tcp port and the USB port of USB physical interface number;
And, arbitrary PC take the IP address of device of application the method as object IP address, take arbitrary tcp port when destination interface is accessed, this tcp port is mapped to corresponding USB physical interface according to above-mentioned mapping relations, and realize this tcp port and change with the data protocol between corresponding USB physical interface.
In addition, in order to make user, can know that mapping relations between tcp port and USB physical interface are so that the management to USB device, the method can support user to configure the corresponding relation between the silk-screen number of tcp port number and USB physical interface, and according to user configured above-mentioned corresponding relation, sets up the mapping relations of tcp port and USB physical interface.
Specifically, user can observe the silk-screen number of institute's mint-mark on the USB physical interface that its USB device that need to access connects in advance.Then, to the device of application the method input the tcp port number that need to use when it carries out remote access, with and the silk-screen observed number between corresponding relation, the method can be according to the corresponding relation between the USB port of user configured above-mentioned corresponding relation and predefined same USB physical interface number and silk-screen number, sets up the mapping relations between the USB port number that obtains the USB physical interface that USB device that the tcp port number of the tcp port that user need to use need to access with user is connected.
With described in device part above in like manner, the mode of user's input configuration information has two kinds:
For local configuration mode, the method can further have one and be exclusively used in the configuration input port that receives configuration information, and utilizes configuration input port to receive described configuration information.
For Remote configuration mode, the method can further set in advance reserved tcp port, and further receive the configuration information that the reserved tcp port of PC access sends, be that the method will be used the access of reserved tcp port to be identified as configuration operation, and the information that the access of using reserved tcp port is sent is identified as configuration information.
In addition, whether the method can also have equipment to insert to safeguard the state of corresponding tcp port according to USB physical interface, specifically:
After setting up above-mentioned mapping relations at every turn, the whether existing USB device of USB port number corresponding USB physical interface in the above-mentioned mapping relations that capital judgement has been set up is inserted, and when the existing USB device of this USB physical interface is inserted, triggers the corresponding tcp port of this USB physical interface and enter listening state; Wherein, can after setting up above-mentioned mapping relations, carry out immediately detection, also according to instant testing result, carry out judgement; Or, also can be according to knowing that the insertion event that further records this USB physical interface while having USB device to insert USB physical interface carries out judgement before this at every turn, and, knowing the insertion event that also should delete this USB physical interface having recorded while having USB physical interface to extract USB device at every turn;
Knowing have USB physical interface to insert after USB device at every turn, check the above-mentioned mapping relations whether set up this USB physical interface, and when this USB physical interface has been set up above-mentioned mapping relations, according to above-mentioned mapping relations, trigger the corresponding tcp port of this USB physical interface and enter listening state;
That is to say, as long as meeting to be inserted with USB device and to set up simultaneously, arbitrary USB physical interface has these two conditions of corresponding mapping relations, the method enters listening state with regard to triggering corresponding tcp port, but the precedence relationship of two condition establishments does not affect corresponding tcp port, does not enter listening state;
Also after knowing at every turn and having the USB device of USB physical interface to extract, check the above-mentioned mapping relations whether set up this USB physical interface, and when this USB physical interface has been set up above-mentioned mapping relations, according to above-mentioned mapping relations, trigger the corresponding tcp port of this USB physical interface and enter closed condition.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of doing, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.