Abstract:
A self-adaptive communication method for an encryption dongle, comprising: an upper-layer software platform sets communication mode information of self, when connection of an encryption dongle to a host is detected, acquires communication mode information of the encryption dongle, determines whether or not the communication mode information of self matches the communication mode information of the encryption dongle, if yes, then communicates with the encryption dongle via an interrupt transmit pipeline, and if not, then transmits a communication instruction to the encryption dongle via a control transmit pipeline; the encryption dongle sets a communication mode identifier on the basis of the communication mode information of the upper-layer software platform in the communication instruction, and, the encryption dongle resets and resets communication mode information of self on the basis of the communication mode identifier. As such, when connection of the encryption dongle to the host is re-detected, the upper-layer software platform re-acquires the communication mode information of the encryption dongle, determines that the communication mode information is a match, and then communicates via the interrupt transmission pipeline, thus solving the technical problem that an existing encryption dongle can only support one communication mode of the host, and implementing self-adaptive communication for the encryption dongle.

Description:
FIELD OF THE INVENTION 
       [0001]    The present invention relates to a self-adaptive method for communication of dongle which belongs to the field of information security. 
       PRIOR ART 
       [0002]    With the development of the information security, a dongle is applied in the information security more frequently. The dongle is an encryption device which links to a Universal Serial Bus (USB) interface, and the dongle integrates software with hardware. Generally speaking, the dongle provides non-volatile memory space for a host to read and write, the host can communicate with the dongle via an upper software flat to read and write in the dongle. At the moment, the transmission channels for communicating between the dongle and the host mainly include an interrupt-transmission-channel and a control-transmission-channel. When connecting to the host, the dongle can communicate with the host via a control-transmission-channel, for example, the dongle performs enumeration and configuration between the host and itself via the control-transmission-channel. However, the dongle cannot communicate with the host via the interrupt-transmission-channel to realize reading and writing by the host in the dongle unless the dongle works with the upper software flat installed in the host, furthermore, only if a communication mode needed by the host matches a communication mode supported by the dongle, the host can communicate with the dongle normally via the upper software flat. In prior art, because types of main board vary from each other, the communication mode needed by the host includes a communication of 64 bytes and a communication mode of 32 bytes, etc; at the moment, the dongle can only support one type of communication mode during communication, that means, if the dongle supports the communication mode of 64 bytes, it can only communicate with the host, of which the communication mode is 64 bytes. 
       SUMMARY OF THE INVENTION 
       [0003]    The object of the present invention is to provide a self-adaptive method communication of a dongle, which applies in a system which includes a dongle and a host, in which, an upper software flat is installed in the host, by the method, the problem that the dongle can only effectively communicate with a host of one communication mode is solved. 
         [0004]    Thus, according to one aspect of the present invention, there is provided a self-adaptive method for communication of a dongle, wherein 
         [0005]    the upper software flat executes the following steps: 
         [0006]    Step s1, setting, by the upper software flat, information of a communication mode of the upper software flat according to a type of a main board of the host; 
         [0007]    Step s2, obtaining, by the upper software flat, information of the a communication mode of the dongle according to enumeration information returned from the dongle to the host, when any connection between the dongle and the host is detected; 
         [0008]    Step s3, determining, by the upper software flat, whether the information of the communication mode of itself matches the information of the communication mode of the dongle, if yes, executing Step s5; otherwise, executing Step s4; 
         [0009]    Step s4, sending, by the upper software flat, a communication instruction which includes the information of the communication mode of the upper software flat to the dongle via a control-transmission-channel, returning to Step s2; and 
         [0010]    Step s5, communicating, by the upper software flat, with the dongle effectively via the interrupt-transmission-channel according to the information of the communication mode of the upper software flat; and 
         [0011]    the dongle executes the following steps: 
         [0012]    Step r1, setting, by the dongle, information of a communication mode of the dongle according to a communication mode identification of the dongle, performing an enumeration, returning enumeration information to the host after the enumeration is finished, and waiting for communicating with the upper software flat; 
         [0013]    Step r2, executing Step r5 in the case that the dongle receives information sent from the upper software flat via the interrupt-transmission-channel; executing Step r3 in the case that the dongle receives information sent from the upper software flat via the control-transmission-channel; 
         [0014]    Step r3, setting, by the dongle, the communication mode identification of the dongle according to the information of the communication mode of the upper software flat in the communication instruction sent from the upper software flat; 
         [0015]    Step r4, resetting the dongle, then returning to Step r1; and Step r5, communicating, by the dongle, with the upper software flat effectively via the interrupt-transmission-channel according to the information of the communication mode of the dongle. 
         [0016]    According to another aspect of the present invention, there is provided a self-adaptive method for communication of a dongle, in which 
         [0017]    the upper software flat executes the following steps: 
         [0018]    Step s1, setting, by the upper software flat, the information of the communication mode of the upper software flat according to the type of the main board of the host; 
         [0019]    Step s2, obtaining, by the upper software flat, the information of the communication mode of the dongle according to the enumeration information returned from the dongle to the host, when a connection between the dongle and the host is detected by the upper software flat; 
         [0020]    Step s3, determining, by the upper software flat, whether the information of the communication mode of the upper software flat matches the information of the communication mode of the dongle, if yes, executing Step s5; otherwise, executing Step s4; 
         [0021]    Step s4, sending, by the upper software flat, the communication instruction which includes the information of the communication mode of the upper software flat to the dongle via the control-transmission-channel, waiting for receiving set-state information returned from the dongle, outputting prompt information to pull out or insert the dongle again when the set-state information returned from the dongle is received, returning to Step s2; and 
         [0022]    Step s5, communicating, by the upper software flat, with the dongle effectively via the interrupt-transmission-channel according to the information of the communication mode of the upper software flat; and 
         [0023]    the dongle executes the following steps: 
         [0024]    Step r1, setting, by the dongle, the information of the communication mode of the dongle according to the communication mode identification, performing the enumeration, returning the enumeration information to the host after the enumeration is finished, and waiting for communicating with the upper software flat; 
         [0025]    Step r2, executing Step r5 in the case that the dongle receives the information sent from the upper software flat via the interrupt-transmission-channel; executing Step r3 in the case that the dongle receives the communication instruction sent from the upper software flat via the control-transmission-channel; 
         [0026]    Step r3, setting, by the dongle, the communication mode identification of the dongle according to the information of the communication mode of the upper software flat in the communication instruction sent from the upper software flat; 
         [0027]    Step r4, returning, by the dongle, the set-state information to the upper software flat, executing Step r5; and 
         [0028]    Step r5, communicating, by the dongle, with the upper software flat. 
         [0029]    According to the third aspect of the present invention, there is provided a self-adaptive method for communication of a dongle, in which 
         [0030]    the upper software flat executes the following steps: 
         [0031]    Step s1, setting, by the upper software flat, information of a communication mode of the upper software flat according to a type of a main board of the host; 
         [0032]    Step s2, sending, by the upper software, a communication instruction which includes the information of the communication mode of the upper software flat to the dongle via a control-transmission-channel when the connection between the upper software flat and the dongle is detected by the upper software flat; 
         [0033]    Step s3, waiting, by the upper software flat, for receiving response information returned from the dongle; 
         [0034]    Step s4, determining, by the upper software flat, whether the received response information returned from the dongle is a first response information, if yes, executing Step s5; otherwise, returning to Step s2; and 
         [0035]    Step s5, communicating, by the upper software, with the dongle effectively via an interrupt-transmission-channel according to the information of the communication mode of the upper software flat; and 
         [0036]    the dongle executes the following steps: 
         [0037]    Step r1, setting, by the dongle, information of a communication mode of itself according to a communication mode identification of the dongle, performing an enumeration, returning enumeration information to the host after the enumeration is finished, and waiting for communicating with the upper software flat; 
         [0038]    Step r2, receiving, by the dongle, the communication instruction sent from the upper software flat via the control-transmission-channel; 
         [0039]    Step r3, determining, by the dongle, whether the information of communication mode of the dongle matches the information of the communication mode of the upper software flat in the communication instruction sent from the upper software flat, if yes, executing Step r6; otherwise, executing Step r4; 
         [0040]    Step r4, setting, by the dongle, the communication mode identification of itself according to the information of the communication mode of the upper software flat; 
         [0041]    Step r5, resetting the dongle, then returning to Step r1; and 
         [0042]    Step r6, returning, by the dongle, the first response information to the upper software flat, waiting for communicating effectively with the upper software flat via the interrupt-transmission-channel according to the information of the communication mode of the dongle. 
         [0043]    According to the fourth aspect of the present invention, there is provided a self-adaptive method for communication of a dongle, in which 
         [0044]    the upper software flat executes the following steps: 
         [0045]    Step s1, setting, by the upper software flat, information of a communication mode of the upper software flat according to a type of a main board of the host; 
         [0046]    Step s2, sending, by the upper software flat, a communication instruction which includes the information of the communication mode of the upper software flat to the dongle via a control-transmission-channel when the connection between the upper software flat and the dongle is detected; 
         [0047]    Step s3, waiting, by the upper software flat, for receiving response information returned from the dongle; 
         [0048]    Step s4, determining, by the upper software flat, a type of the received response information returned from the dongle, executing Step s5 in the case that the received response information is a first response information; outputting prompt information to pull out or insert the dongle again in the case that the received response information is a second response information, and returning to Step s2; and 
         [0049]    Step s5, communicating, by the upper software flat, with the dongle effectively via an interrupt-transmission-channel according to the information of the communication mode of the upper software flat; and 
         [0050]    the dongle executes the following steps: 
         [0051]    Step r1, setting, by the dongle, information of a communication mode of the dongle according to a communication mode identification of the dongle, performing an enumeration, returning the enumeration information to the host after the enumeration is finished, and waiting for communicating with the upper software flat; 
         [0052]    Step r2, receiving, by the dongle, the communication instruction sent from the upper software flat via the control-transmission-channel; 
         [0053]    Step r3, determining, by the dongle, whether the information of the communication mode of the dongle matches the information of the communication mode of the upper software flat in the communication instruction sent from the upper software flat, if yes, the dongle returning the first response information to the upper software flat, and executing Step r6; otherwise, executing Step r4; 
         [0054]    Step r4, setting, by the dongle, the communication mode identification of itself according to the information of the communication mode of the upper software flat; 
         [0055]    Step r5, returning, by the dongle, the second response information to the upper software flat, executing Step r6; and 
         [0056]    Step r6, waiting, by the dongle, for communicating with the upper software flat. 
         [0057]    According to the present invention, a dongle in the self-adaptive method for communication of a dongle can effectively communicate with a host needing every communication modes by interacting with the upper software flat to set the communication mode identification of the dongle. In this way, the method solves the problem that the dongle can only effectively communicate with the host of one communication mode. 
     
    
     
       BRIEF DESCRIPTION OF THE ACCOMPANYING DRAWINGS 
         [0058]      FIG. 1  shows a flow chart of specific operations of an upper software flat in a self-adaptive method for communication of a dongle according to Embodiment 1 of the present invention; 
           [0059]      FIG. 2  shows a flow chart of specific operations of a dongle in the method for self-adaption communication of a dongle according to Embodiment 1 of the present invention; 
           [0060]      FIG. 3  shows a flow chart of specific operations of an upper software flat in a method for self-adaption communication of a dongle according to Embodiment 2 of the present invention; 
           [0061]      FIG. 4  shows a flow chart of specific operations of a dongle in the method for self-adaption communication of a dongle according to Embodiment 2 of the present invention; 
           [0062]      FIG. 5  shows a flow chart of specific operations of an upper software flat in a method for self-adaption communication of a dongle according to Embodiment 3 of the present invention; 
           [0063]      FIG. 6  shows a flow chart of specific operations of a dongle in the method for self-adaption communication of a dongle according to Embodiment 3 of the present invention; 
           [0064]      FIG. 7  shows a flow chart of specific operations of an upper software flat in a method for self-adaption communication of a dongle according to Embodiment 4 of the present invention; and 
           [0065]      FIG. 8  shows a flow chart of specific operations of a dongle in the method for self-adaption communication of a dongle according to Embodiment 4 of the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0066]    The technical solutions in the Embodiments of the present invention are further described more clearly and completely with the drawings in the Embodiments of the present invention. Apparently, Embodiments described herein are just a few Embodiments of the present invention. On the basis of Embodiments of the invention, all other related Embodiments made by those skilled in the art without any inventive work belong to the scope of the invention. 
       Embodiment 1 
       [0067]    Embodiment 1 of the present invention provides a self-adaptive method for communication of a dongle, which applies in a system including a dongle and a host which installs an upper software flat. 
         [0068]    As shown in  FIG. 1 , in said method, the upper software flat executes following steps: 
         [0069]    Step  101 , the upper software flat is started; 
         [0070]    Specifically, the upper software flat, which is installed in the host, is configured to interact with the dongle to set up an effective communication between the host and the dongle. The effective communication between the host and the dongle in the invention includes operations of reading from and writing into, by the host, the dongle, the operations is done via an interrupt-transmission-channel. The host and the dongle cannot communicate effectively unless a communication mode of the host matches a communication mode of the dongle because the characteristics of the interrupt-transmission-channel. 
         [0071]    The host in the present invention includes: a personal computer, a personal digital assistant and a mobile computer, etc. 
         [0072]    Step  102 , information of a communication mode of the upper software flat is set by the upper software flat according to a type of a main board of the host; 
         [0073]    in the present Embodiment 1, Step  102  specifically includes: 
         [0074]    Step a1, the type of the main board of the host is obtained by the upper software flat via operating system tools of the host; 
         [0075]    in which, the operating system of the host may be Windows operating system, Linux operating system, etc; the types of the main board of the host include: GIGABYTE, ASUS, MSI, COLORFUL, ONDA, and BIOSTAR, etc. 
         [0076]    Specifically, the type of the main board of the host is obtained by the upper software flat via ManagementObjectSearcher class in an interface provided by a software development kit (SDK) which under the Windows operating system in the case that the operating system of the host is the Windows operating system. The type of the main board of the host is obtained by the upper software flat by invoking a dmidecode command provided by a Shell script under the Linux operating system in the case that the operating system of the host is the Linux operating system. 
         [0077]    Step a2, a communication mode needed by the host is obtained by the upper software flat according to the type of the main board; 
         [0078]    Specifically, in the present Embodiment 1, the upper software flat obtains the communication mode needed by the host by searching from a preset list, in which, the preset list can only include the type of the main board of the host by which the communication mode needed is the communication mode of 32 bytes; or the preset list could only include the type of the main board of the host, by which, the communication mode needed is the communication mode of 64 bytes; the preset list can also include the type of the main board and the communication mode needed by the host which uses the type of the main board. 
         [0079]    Preferably, in the present Embodiment 1, the preset list just includes the type of the main board of the host, by which the communication mode needed is the communication mode of 32 bytes, such as GIGABYTE; the upper software flat searches for the obtained type of the main board from the preset list after the type of the main board of the host is obtained, the communication mode needed by the host which obtains the main board is the communication mode of 32 bytes in the case that the obtained type of the main board is found; the communication mode needed by the host which obtains the main board is the communication mode of 64 bytes in the case that the obtained type of the main board is not found. 
         [0080]    For example, the communication mode, needed by the host, which is obtained by the upper software flat by searching from the preset list is the communication mode of 32 bytes in the case that the type of the main board of the host obtained by the upper software flat is GIGABYTE. 
         [0081]    Step a3, the information of the communication mode of the upper software flat is set by the upper software flat according to the communication mode needed by the host; 
         [0082]    Specifically, the information of the communication mode of the upper software flat is set by the upper software flat as 32 in the case that the communication mode needed by the host is the communication mode of 32 bytes; the information of the communication mode of the upper software flat is set by the upper software flat as 64 in the case that the communication mode needed by the host is the communication mode of 64 bytes. 
         [0083]    Step  103 , the upper software flat obtains the information of the communication mode of the dongle according to enumeration information returned from the dongle to the host when the connection between the dongle and the host is detected by the upper software flat; 
         [0084]    The step specifically includes: the upper software flat checks whether any dongle connects the host, the upper software flat obtains the information of the communication mode of the dongle according to the enumeration information returned from the dongle to the host in the case that a dongle is detected to connect the host; the upper software flat outputs information that no dongle is detected in the case that no connection between the dongle and the host is detected. 
         [0085]    Specifically, after it is started, the upper software flat checks whether any dongle connects to the host, specifically checks whether any dongle-inserted information exists, if yes, the upper software flat obtains information, such as a vendor ID (VID), a product ID (PID), a transmission channel for communication and the number of communication bytes supported by the transmission channel, in the enumeration information returned from the dongle to the host, and compares the vendor ID and the product ID with a preset vendor ID and a preset product ID of the dongle respectively, in the case that the vendor ID and the product ID are the same as the preset vendor ID and the preset product ID of the dongle respectively, the number of communication bytes supported by the interrupt-transmission-channel is set by the upper software flat as the information of communication mode of the dongle, and Step  104  is executed; in the case that the vendor ID and the product ID are not same as the preset vendor ID and the preset product ID of the dongle respectively, the upper software flat outputs information that no dongle is detected; the upper software outputs the information that no dongle is detected in the case that no connection between the dongle and the host is detected, 
         [0086]    in which, the information that no dongle is detected, output by the upper software flat, can be displayed via an interface of the host. 
         [0087]    Step  104 , the upper software flat determines whether the information of the communication mode of itself matches the information of the communication mode of the dongle, if yes, Step  106  is executed; otherwise, Step  105  is executed; 
         [0088]    Specifically, the upper software flat determines whether the information of the communication mode of itself is the same as the obtained information of the communication mode of the dongle, if yes, the information of the communication mode of the upper software flat matches the information of the communication mode of the dongle; otherwise, the information of the communication mode of the upper software flat does not match the information of the communication mode of the dongle. 
         [0089]    For instance, the upper software flat determines that the information of the communication mode of itself matches the information of the communication mode of the dongle in the case that the communication mode information of the upper software flat is 64 and the obtained communication mode information of the dongle is 64; 
         [0090]    while the upper software flat determines that the communication mode information of itself does not match the communication mode information of the dongle in the case that the communication mode information of the upper software flat is 32 and the obtained communication mode information of the dongle is 64. 
         [0091]    Step  105 , the upper software flat sends a communication instruction which includes the information of the communication mode of the upper software flat to the dongle via a control-transmission-channel, and returns to Step  103 ; 
         [0092]    Specifically, the upper software flat sets the communication instruction according to the information of the communication mode of itself, and sends the communication instruction which includes the information of the communication mode of the upper software flat to the dongle via the control-transmission-channel, 
         [0093]    in which, the communication instruction is composed of a series of setup packages which include the information of the communication mode of the upper software flat. 
         [0094]    For instance, information in the setup packages specifically include: 0x 21 ff 20 00 00 00 00 00, 
         [0095]    in which, the third byte is the information of the communication mode, the third byte is set as 0x20 if the information of the communication mode of the upper software flat is 32; the third byte is set as 0x40 if the information of the communication mode of the upper software flat is 64. 
         [0096]    It needs to be noted that the control-transmission-channel is a channel, via which the host communicates with the dongle through an endpoint  0  of the dongle; because of the characteristics of the control-transmission-channel, the host can communicate effectively with the dongle via the control-transmission-channel to finish configuration between the host and the dongle before the host can communicate with the dongle via the interrupt-transmission-channel. 
         [0097]    Step  106 , the upper software flat communicates with the dongle effectively via the interrupt-transmission-channel according to the information of the communication mode of the upper software flat. 
         [0098]    As shown in  FIG. 2 , in the method, the dongle executes following steps: 
         [0099]    Step  201 , the dongle sets the information of the communication mode of the dongle according to a communication mode identification, performs an enumeration, returns enumeration information to the host after the enumeration is finished, waits for communicating with the upper software flat, Step  202  is executed in the case that the communication instruction sent from the upper software flat is received via the control-transmission-channel; Step  204  is executed in the case that the information sent from the upper software flat is received via the interrupt-transmission-channel; 
         [0100]    Specifically, the dongle setting the information of the communication mode of the dongle according to the communication mode identification includes: the number of the communication bytes, supported by the interrupt-transmission-channel, in an endpoint descriptor and a report descriptor of the dongle is set as same as the communication mode identification, and the number of the communication bytes supported by the interrupt-transmission-channel is made as the information of the communication mode of the dongle. In the present Embodiment 1, the communication mode identification of the dongle is stored in a flag flash. For instance, the number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle according to the communication mode identification as 64 in the case that the communication mode identification of the dongle is 64, thus, the information of the communication mode of the dongle is 64. 
         [0101]    The number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle according to the communication mode identification as 32 in the case that the communication mode identification of the dongle is 32, thus, the information of the communication mode of the dongle is 32. 
         [0102]    It needs to be noted that, when it connects the host, the dongle sets the information of the communication mode of the dongle according to the communication mode identification, performs the enumeration, the dongle returns the enumeration information to the host after the enumeration is finished, and waits for communicating with the upper software flat, in which, the enumeration information includes the information, such as the transmission channel for the communication of the dongle, the number of the communication bytes supported by each transmission channel, the vendor ID (VID) of the dongle, and the product ID (PID). 
         [0103]    Step  202 , the dongle sets the communication mode identification of itself according to the information of the communication mode of the upper software flat in the received instruction; 
         [0104]    Specifically, the dongle receives a series of setup packages sent from the upper software flat via the control-transmission-channel, the setup packages include the information of the communication mode of the upper software flat, the dongle sets the communication mode identification of itself as the same as the information of the communication mode of the upper software flat according to the information of the communication mode of the upper software flat. 
         [0105]    For instance, the dongle resets the communication mode identification stored in the flag flash of the dongle as 32 in the case that the information of the communication mode of the upper software flat received by the dongle via the control-transmission-channel is 32. 
         [0106]    Step  203 , the dongle is reset, and Step  201  is returned to; Specifically, the dongle lowers an electrical level of a chip-reset-pin after the communication mode identification stored in the flag flash is reset by the dongle, a hardware of the dongle is reset. 
         [0107]    Step  204 , the dongle communicates with the upper software flat effectively via the interrupt-transmission-channel according to the information of the communication mode of the dongle. 
         [0108]    In the present Embodiment 1, the upper software flat sets the information of the communication mode of the upper software flat according to the type of the main board of the host after the upper software flat is started, the upper software flat obtains the information of the communication mode of the dongle according to the enumeration information returned from the dongle to the host when the connection between the dongle and the host is detected by the upper software flat, the upper software flat determines whether the information of the communication mode of itself matches the obtained information of the communication mode of the dongle, if yes, the upper software flat communicates with the dongle effectively via the interrupt-transmission-channel according to the information of the communication mode of the upper software flat; otherwise, the upper software flat sends the communication instruction to the dongle via the control-transmission-channel, and then the dongle resets the communication mode identification of the dongle according to the information of the communication mode of the upper software flat in the instruction after the instruction is received by the dongle, the dongle is reset, and the dongle resets the information of the communication mode of the dongle according to the communication mode identification, and finishes the enumeration; the upper software flat will detect the connection between the dongle and the host again when the dongle is reset, and the upper software flat obtains the information of the communication mode of the dongle again, in this way, the upper software flat will determine that the information of the communication mode of itself is as same as the obtained information of the communication mode of the dongle, and the upper software flat communicates with the dongle effectively according to the information of the communication mode of the upper software flat. In this way, the present invention solves the problem in prior art that a dongle can only support one communication mode of the host, the dongle in the present invention can adapt for both of the communication modes, and can communicate with the host of both communication modes effectively. 
       Embodiment 2 
       [0109]    Embodiment 2 of the present invention provides a self-adaptive method for communication of a dongle, which applies in a system including a dongle and a host in which an upper software flat is installed. 
         [0110]    As shown in  FIG. 3 , in the method, the upper software flat executes the following steps: 
         [0111]    Step  301 , the upper software flat is started; 
         [0112]    Specifically, the upper software flat, installed in the host, is configured to interact with the dongle to set up effective communication between the host and the dongle. The effective communication between the host and the dongle in the present invention is done via an interrupt-transmission-channel, and the effective communication specifically includes operations, such as reading from and writing into the dongle, done by the host. The host and the dongle cannot communicate with each other effectively unless a communication mode of the host matches a communication mode of the dongle, because of the characteristics of the interrupt-transmission-channel. 
         [0113]    The host in the present invention may be a personal computer, a personal digit assistant or a mobile computer, etc. 
         [0114]    Step  302 , the upper software flat sets information of the communication mode of the upper software flat according to a type of a main board of the host; 
         [0115]    In the present Embodiment 2, Step  302  specifically includes: 
         [0116]    Step a1, the upper software obtains the type of the main board of the host by operating system tools of the host; 
         [0117]    in which, the operating systems of the host include Windows operating system, Linux operating system, etc; and the types of the main board of the host include: GIGABYTE, ASUS, MSI, COLORFUL, ONDA, BIOSTAR, etc. 
         [0118]    Specifically, the upper software flat obtains the type of the main board of the host via ManagementObjectSearcher class in an interface provided by a software development kit (SDK) which is under the Windows operating system in the case that the operating system of the host is the Windows operating system; the upper software flat obtains the type of the main board of the host by invoking a dmindecode command provided by a shell script under the Linux operating system in the case that the operating system of the host is the Linux operating system. 
         [0119]    Step a2, the upper software obtains a communication mode needed by the host according to the type of the main board; 
         [0120]    Specifically, in Embodiment 2, the upper software flat can obtain the communication mode needed by the host by searching from a preset list, in which, the preset list can only include the type of the main board of the host by which the communication mode needed the communication mode of 32 bytes, or only include the type of the main board of the host by which the communication mode needed is the communication mode of 64 bytes, the preset list can also include the type of the main board and the communication mode needed by the host which uses the type of the main board. 
         [0121]    Preferably, in the present Embodiment 2, the preset list only includes the type of the main board of the host by which the needed communication mode is the communication mode of 32 bytes, such as GIGABYTE; the upper software flat searches for the obtained type of the main board from the preset list after the type of the main board of the host is obtained, the communication mode needed by the host which obtains the main board is the communication mode of 32 bytes in the case that the obtained type of the main board is found; the communication mode needed by the host which obtains the main board is the communication mode of 64 bytes in the case that the obtained type of the main board is not found. 
         [0122]    For example, the communication mode, needed by the host, which is obtained by the upper software flat by searching from the preset list is the communication mode of 32 bytes in the case that the type of the main board of the host obtained by the upper software flat is GIGABYTE. 
         [0123]    Step a3, the upper software flat sets the information of the communication mode of the upper software flat according to the communication mode needed by the host; 
         [0124]    Specifically, the information of the communication mode of the upper software flat is set by the upper software flat as 32 in the case that the communication mode needed by the host is the communication mode of 32 bytes; the information of the communication mode of the upper software flat is set by the upper software flat as 64 in the case that the communication mode needed by the host is the communication mode of 64 bytes. 
         [0125]    Step  303 , the upper software flat obtains information of the communication mode of the dongle according to enumeration information returned from the dongle to the host when a connection between the host and the dongle is detected by the upper software flat; 
         [0126]    The step specifically includes: the upper software flat checks whether any dongle connects to the host, the upper software flat obtains the information of the communication mode of the dongle according to the enumeration information returned from the dongle to the host in the case that the connection between the dongle and the host is detected; the upper software flat outputs information that no dongle is detected in the case that no connection between the dongle and the host is detected. 
         [0127]    Specifically, the upper software flat checks whether any dongle connects to the host after the upper software flat is started, the upper software flat specifically checks whether any dongle-inserted information is detected, if yes, the upper software flat obtains a vendor ID, a product ID, a transmission channel for communication and the number of communication bytes supported by each transmission channel from the enumeration information returned from the dongle to the host, and compares the vendor ID and the product ID with a preset vendor ID and a preset product ID of dongle respectively, the upper software flat makes the number of the communication bytes, which is supported by the interrupt-transmission-channel, as the information of the communication mode of the dongle, and executes Step  304  in the case that the vendor ID is same as the preset vendor ID of the dongle and the product ID is same as the preset product ID of the dongle; otherwise, the upper software flat outputs the information that no dongle is detected; if no connection between the host and the dongle is detected, the upper software flat outputs the information that no dongle is detected, 
         [0128]    in which, the information that no dongle is detected output by the upper software flat can be prompted through the interface of the host that no information of dongle can be detected. 
         [0129]    Step  304 , the upper software flat determines whether the information of the communication mode of itself matches the information of the communication mode of the dongle, if yes, Step  308  is executed; otherwise Step  305  is executed; 
         [0130]    Specifically, the upper software flat determines whether the information of the communication mode of itself is as same as the obtained information of the communication mode of the dongle, if yes, the information of the communication mode of the upper software flat matches the information of the communication mode of the dongle; otherwise, the information of the communication mode of the upper software flat does not match the information of the communication mode of the dongle. 
         [0131]    For instance, the upper software flat determines that the information of the communication mode of the upper software flat matches the information of the communication mode of the dongle in the case that both of the information of the communication mode of the upper software flat and the obtained information of the communication mode of the dongle are 64; 
         [0132]    the upper software flat determines that the information of the communication mode of itself does not match the information of the communication mode of the dongle in the case that the information of the communication mode of the upper software flat is 32, while the information of the communication mode of the dongle is 64. 
         [0133]    Step  305 , the upper software flat sends a communication instruction including the information of the communication mode of the upper software flat to the dongle via a control-transmission-channel; 
         [0134]    Specifically, the upper software flat sets the communication instruction according to the information of the communication mode of itself, and sends the communication instruction including the information of the communication mode of itself to the dongle via the control-transmission-channel, 
         [0135]    in which, the communication instruction is composed of a series of setup packages which include the information of the communication mode of the upper software flat. 
         [0136]    For instance, information in the setup packages is: 0x 21 ff 20 00 00 00 00 00, 
         [0137]    in which, the third byte is the information of the communication mode, and the third byte is set as 0x20 in the case that the information of the communication mode of the upper software flat is 32; the third byte is set as 0x40 in the case that the information of the communication mode of the upper software flat is 64. 
         [0138]    It needs to be noted that the control-transmission-channel is a channel, via which the host communicates with the dongle through an endpoint  0  of the dongle; because of the characteristics of the control-transmission-channel, the host can communicate with the dongle via the control-transmission-channel to finish configuration between the host and the dongle before the host can communicate effectively with the dongle via the interrupt-transmission-channel. 
         [0139]    Step  306 , the upper software flat waits for receiving setting-state information returned from the dongle; 
         [0140]    Step  307 , the upper software flat outputs information that pull out and re-insert the dongle when the setting-state information returned from the dongle is received by the upper software flat, and Step  303  is executed; 
         [0141]    Specifically, the information that pull out and re-insert the dongle can be displayed via the interface of the host to prompt a user to pull out and re-insert the dongle. 
         [0142]    Step  308 , the upper software flat communicates with the dongle effectively via the interrupt-transmission-channel according to the information of the communication mode of the upper software flat. 
         [0143]    As shown in  FIG. 4 , in the method, the dongle executes the following steps: 
         [0144]    Step  401 , the dongle sets the information of the communication mode of the dongle according to a communication mode identification, performs an enumeration, returns enumeration information to the host after the enumeration is finished, waits for communicating with the upper software flat, Step  402  is executed in the case that the communication instruction sent from the upper software flat is received via the control-transmission-channel; Step  404  is executed in the case that the information sent from the upper software flat is received via the interrupt-transmission-channel; 
         [0145]    Specifically, the dongle setting the information of the communication mode according to the communication mode identification includes: the number of the communication bytes, supported by the interrupt-transmission-channel, in an endpoint descriptor and a report descriptor of the dongle, is set as same as the communication mode identification, and the number of the communication bytes supported by the interrupt-transmission-channel is made as the information of the communication mode of the dongle. In the present Embodiment 2, the communication mode identification of the dongle is stored in a flag flash. For instance, the number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle according to the communication mode identification as 64 in the case that the communication mode identification of the dongle is  64 , thus, the information of the communication mode of the dongle is 64. 
         [0146]    The number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle according to the communication mode identification as 32 in the case that the communication mode identification of the dongle is 32, thus, the information of the communication mode of the dongle is 32. 
         [0147]    It needs to be noted that, when it connects the host, the dongle sets the information of the communication mode of the dongle according to the communication mode identification, performs the enumeration, the dongle returns the enumeration information to the host after the enumeration is finished, and waits for communicating with the upper software flat, in which, the enumeration information includes the information, such as the transmission channel for the communication of the dongle, the number of the communication bytes supported by each transmission channel, the vendor ID of the dongle, and the product ID. 
         [0148]    Step  402 , the dongle sets the communication mode identification of itself according to the information of the communication mode of the upper software flat in the received instruction; 
         [0149]    Specifically, the dongle receives a series of setup packages sent from the upper software flat via the control-transmission-channel, the setup packages include the information of the communication mode of the upper software flat, the dongle resets the communication mode identification of itself as the same as the information of the communication mode of the upper software flat according to the information of the communication mode of the upper software flat. 
         [0150]    For instance, the dongle resets the communication mode identification stored in the flag flash of the dongle as 32 in the case that the information of the communication mode of the upper software flat received by the dongle via the control-transmission-channel is 32. 
         [0151]    Step  403 , the dongle returns the setting-state information to the upper software flat via the control-transmission-channel, and Step  404  is executed; 
         [0152]    Preferably, the setting-state information is 0x9000. 
         [0153]    Step  404 , the dongle communicates with the upper software flat. 
         [0154]    In the present Embodiment 2, the upper software flat sets the information of the communication mode of the upper software flat according to the type of the main board of the host after the upper software flat is started, the upper software flat obtains the information of the communication mode of the dongle according to the enumeration information returned from the dongle to the host when the connection between the dongle and the host is detected by the upper software flat, the upper software flat determines whether the information of the communication mode of itself matches the obtained information of the communication mode of the dongle, if yes, the upper software flat communicates with the dongle effectively via the interrupt-transmission-channel according to the information of the communication mode of the upper software flat; otherwise, the upper software flat sends the communication instruction to the dongle via the control-transmission-channel, and then the dongle resets the communication mode identification of the dongle according to the information of the communication mode of the upper software flat in the instruction after the instruction is received by the dongle, the dongle returns the setting-state information to the upper software flat; the upper software outputs the information that pull out and re-insert the dongle after the setting-state information is received by the upper software flat, in the case that the dongle is pulled out and re-inserted, the dongle is reset, and the information of the communication mode of the dongle is also reset by the dongle according to the communication mode identification, and the enumeration is finished; subsequently, the upper software flat obtains the information of the communication mode of the dongle again when the dongle is reset, then the upper software flat determines that the information of the communication mode of itself is the same as the information of the communication mode of the dongle, and communicates with the dongle effectively according to the information of the communication mode of the upper software flat. In this way, the present invention solves the problem in prior art that a dongle can only support one communication mode of the host, the dongle in the present invention can adapt for both communication modes, and can communicate with the host of both communication modes effectively. 
       Embodiment 3 
       [0155]    Embodiment 3 of the present invention provides a self-adaptive method for communication of a dongle, which applies in a system including a dongle and a host which installs an upper software flat. 
         [0156]    As shown in  FIG. 5 , in the method, the upper software flat executes the following steps: 
         [0157]    Step  501 , the upper software flat is started; 
         [0158]    Specifically, the upper software flat, which is installed in the host, is configured to interact with the dongle to setup an effective communication. In the present invention, the effective communication between the host and the dongle, which includes operation such as reading from the dongle and writing into the dongle by the host, is done via an interrupt-transmission-channel. Because of the characteristics of the interrupt-transmission-channel, the host cannot communicate with the dongle effectively unless a communication mode of the host matches a communication mode of the dongle. 
         [0159]    In the present invention, the host may be a personal computer, a personal digital assistant or a mobile computer, etc. 
         [0160]    Step  502 , the upper software flat sets information of the communication mode of the upper software flat according to a type of a main board of the host; 
         [0161]    In the present Embodiment 3, Step  502  specifically includes: 
         [0162]    Step a1, the upper software flat obtains the type of the main board of the host by operating system tools of the host; 
         [0163]    in which, the operating systems of the host include Windows operating system and Linux operating system, etc; and the types of the main board of the host include GIGABYTE, ASUS, MSI, COLORFUL, ONDA and BIOSTAR, etc. 
         [0164]    Specifically, the upper software flat obtains the type of the main board of the host via ManagementObjectSearcher class in an interface provided by a software development kit (SDK) which is under the Windows operating system in the case that the operating system of the host is the Windows operating system; the upper software flat obtains the type of the main board of the host by invoking a dmidecode command provided by a Shell script under the Linux operating system in the case that the operating system is the Linux operating system. 
         [0165]    Step a2, the upper software flat obtains the communication mode needed by the host according to the type of the main board; 
         [0166]    Specifically, in the present Embodiment 3, the upper software flat obtains the communication mode needed by the host by searching from a preset list, in which, the preset list can only include the type of the main board of the host by which, the communication mode needed is the communication mode of 32 bytes, or can only include the type of the main board of the host by which, the communication mode needed is the communication mode of 64 bytes, or may include the type of the main board and the communication mode needed by the host which uses the type of the main board. 
         [0167]    Preferably, in the present Embodiment 3, the preset list just includes the type of the main board of the host by which, the communication mode needed is the communication mode of 32 bytes, such as GIGABYTE; the upper software flat searches an obtained type of the main board from the preset list after the type of the main board of the host is obtained by the upper software flat, the communication mode needed by the host is the communication mode of 32 bytes in the case that the obtained type of the main board is found; otherwise, the communication mode needed by the host is the communication mode of 64 bytes. 
         [0168]    For instance, the communication mode needed by the host, which is obtained by the upper software flat by searching from the preset list, is the communication mode of 32 bytes in the case that the type of the main board of the host obtained by the upper software flat is GIGABYTE. 
         [0169]    Step a3, the upper software flat sets information of the communication mode of the upper software flat according to the communication mode needed by the host; 
         [0170]    Specifically, the information of the communication mode of the upper software flat is set by the upper software flat as 32 in the case that the communication mode needed by the host is the communication mode of 32 bytes; the information of the communication mode of the upper software flat is set by the upper software flat as 64 in the case that the communication mode needed by the host is the communication mode of 64 bytes. 
         [0171]    Step  503 , the upper software flat sends a communication instruction including the information of the communication mode of the upper software flat to the dongle via a control-transmission-channel when a connection between the dongle and the host is detected by the upper software flat; 
         [0172]    The present step specifically includes: the upper software flat checks whether any dongle connects to the host, the upper software flat sends the communication instruction including the information of the communication mode of the upper software flat to the dongle via the control-transmission-channel in the case that the connection between the dongle and the host is detected; the upper software flat outputs information that no dongle is detected in the case that no connection between the dongle and the host is detected. 
         [0173]    Specifically, the upper software flat checks whether any dongle connects to the host after the upper software flat is started, the upper software flat specifically checks whether any dongle-inserted information is detected, if yes, the upper software flat obtains a vendor ID and a product ID according to an enumeration information returned from the dongle to the host, and compares the vendor ID and the product ID with a preset vendor ID and a preset product ID of dongle respectively, the upper software flat sends the communication instruction including the information of the communication mode of the upper software flat to dongle via the control-transmission-channel in the case that the vendor ID is same as the preset vendor ID of the dongle and the product ID is same as the preset product ID of the dongle; otherwise, the upper software flat outputs the information that no dongle is detected; if no connection between the host and the dongle is detected, the upper software flat outputs the information that no dongle is detected, 
         [0174]    in which, the information that no dongle is detected output by the upper software flat can be prompted through the interface of the host that no information of dongle can be detected. 
         [0175]    Specifically, the upper software flat sets the communication instruction according to the information of the communication mode of the upper software flat, and sends the communication instruction to the dongle via the control-transmission-channel, 
         [0176]    in which, the communication instruction is composed of a series of setup packages which include the information of the communication mode of the upper software flat. 
         [0177]    For instance, the specific information in the setup packages is: 0x 25 ff 20 00 00 00 00 00, 
         [0178]    in which, the third byte is the information of the communication mode, the third byte is set as 0x20 in the case that the information of the communication mode of the upper software flat is 32; the third byte is set as 0x40 in the case that the information of the communication mode of the upper software flat is 64. 
         [0179]    It needs to be noted that the control-transmission-channel is a channel for communication between the host and the dongle via an endpoint  0  of the dongle, because of characteristics of the control-transmission-channel, the host can communicate with the dongle via the control-transmission-channel to finish the configuration between the host and the dongle before the host can communicate effectively with the dongle via an interrupt-transmission-channel. 
         [0180]    Step  504 , the upper software flat waits for receiving response information returned from the dongle; 
         [0181]    Step  505 , the upper software flat determines whether a first response information returned from the dongle is received, if yes, Step  506  is executed; otherwise, Step  503  is returned to; 
         [0182]    Step  506 , the upper software communicates with the dongle effectively via an interrupt-transmission-channel according to the information of the communication mode of the upper software flat. 
         [0183]    As shown in  FIG. 6 , in the method, the dongle executes following steps: 
         [0184]    Step  601 , the dongle sets the information of the communication mode of the dongle according to a communication mode identification, performs an enumeration, returns enumeration information to the host after the enumeration is finished, waits for communicating with the upper software flat; 
         [0185]    Specifically, the dongle setting the information of the communication mode according to the communication mode identification includes: the number of communication bytes, supported by the interrupt-transmission-channel, in an endpoint descriptor and a report descriptor of the dongle, is set as same as the communication mode identification, and the number of the communication bytes supported by the interrupt-transmission-channel is made as the information of the communication mode of the dongle. In the present Embodiment 3, the communication mode identification of the dongle is stored in a flag flash. For instance, the number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle according to the communication mode identification as 64 in the case that the communication mode identification of the dongle is 64, thus, the information of the communication mode of the dongle is 64. 
         [0186]    The number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle according to the communication mode identification as 32 in the case that the communication mode identification of the dongle is 32, thus, the information of the communication mode of the dongle is 32. 
         [0187]    It needs to be noted that, when it connects the host, the dongle sets the information of the communication mode of the dongle according to the communication mode identification, performs the enumeration, the dongle returns the enumeration information to the host after the enumeration is finished, and waits for communicating with the upper software flat, in which, the enumeration information includes the information, such as the transmission channel for the communication of the dongle, the number of the communication bytes supported by each transmission channel, the vendor ID of the dongle, and the product ID. 
         [0188]    Step  602 , the dongle receives the communication instruction sent from the upper software flat via the control-transmission-channel; 
         [0189]    Specifically, the dongle receives a series of setup packages sent from the upper software flat via the control-transmission-channel, the setup packages include the information of the communication mode of the upper software flat. 
         [0190]    Step  603 , the dongle determines whether the information of the communication mode of the dongle matches the information of the communication mode of the upper software flat in the received instruction, if yes, Step  606  is executed; otherwise, Step  604  is executed; 
         [0191]    Specifically, the dongle determines whether the information of the communication mode of the dongle is the same as the information of the communication mode of the upper software flat in the received instruction, if yes, the information of the communication mode of the dongle matches the information of the communication mode of the upper software flat; otherwise, the information of the communication mode of the dongle does not match the information of the communication mode of the upper software flat. 
         [0192]    For instance, the information of the communication mode of the dongle does not match the information of the communication mode of the upper software flat in the case that the information of the communication mode of the dongle is 64, and the information of the communication mode of the upper software flat is 32. 
         [0193]    Step  604 , the dongle sets the communication mode identification of the dongle according to the information of the communication mode of the upper software flat; 
         [0194]    Specifically, the dongle sets the communication mode identification stored in the flag flash according to the information of the communication mode of the upper software flat in the instruction. 
         [0195]    For instance, the communication mode identification stored in the flag flash is set as 32 by the dongle in the case that the information of the communication mode of the upper software flat in the instruction is 32. 
         [0196]    Step  605 , the dongle is reset, and Step  601  is returned to; 
         [0197]    Specifically, the dongle lowers an electrical level of a chip-reset-pin after the communication mode identification stored in the flag flash is set by the dongle, and hardware of the dongle is reset. 
         [0198]    Step  606 , the dongle returns the first response information to the upper software flat via the control-transmission-channel, and waits for communicating with the upper software flat effectively according to the information of the communication mode of the dongle; 
         [0199]    Preferably, the first response information is 0x9001. 
         [0200]    In the present Embodiment 3, the upper software flat sets the communication mode information of the upper software flat according to the type of the main board of the host after the upper software flat is started, the upper software flat sends the communication instruction including the communication mode information of the upper software flat to the dongle via the control-transmission-channel when the connection between the dongle and the host is detected by the upper software flat; the dongle determines whether the communication mode of the dongle is as same as the communication mode of the upper software flat according to the communication mode information of the upper software flat in the instruction when the communication instruction is received by the dongle via the control-transmission-channel, if yes, the dongle returns a corresponding response information to the upper software flat, the upper software flat communicates with the dongle effectively via the interrupt-transmission-channel according to the communication mode information of the upper software flat after the response information is received by the upper software flat; otherwise, the dongle changes the communication mode of the dong according to the communication mode of the upper software flat, and then the dongle is reset, and reset the communication mode information of the dongle according to the communication mode identification, finishes the enumeration; the upper software flat detects again that the dongle connects to the host when the dongle is reset, and the upper software flat sends the communication instruction to the dongle again, in this way, the dongle determines that the communication mode of itself is same as the communication mode of the upper software after the instruction information is received, thus, the dongle returns the corresponding response information to the upper software flat, the upper software flat communicates with the dongle effectively via the interrupt-transmission-channel according to the communication mode information of the upper software flat after the response information is received by the upper software flat. By the present invention, it solves the problem in prior art that a dongle can only support one communication mode of the host, the dongle in the present invention can adapt for both communication modes, and can communicate with the host of both communication modes effectively. 
       Embodiment 4 
       [0201]    Embodiment 4 of the present invention provides a self-adaptive method for communication of a dongle, which applies in a system including a dongle and a host, in which an upper software flat is installed in. 
         [0202]    As shown in  FIG. 7 , in said method, the upper software flat executes following steps: 
         [0203]    Step  701 , the upper software flat is started; 
         [0204]    Specifically, the upper software flat, which is installed in the host, is configured to interact with the dongle to set up an effective communication between the host and the dongle. In the present invention, the effective communication between the dongle and the host, which includes operation such as reading from and writing into the dongle, is done via an interrupt-transmission-channel. Because of the characteristics of the interrupt-transmission-channel, the host cannot communicate with the dongle effectively unless a communication mode of the host matches a communication mode of the dongle. 
         [0205]    In the present invention, the host may by a personal computer, a personal digital assistant or a mobile computer. 
         [0206]    Step  702 , the upper software flat sets information of the communication mode of the upper software flat according to a type of a main board of the host; 
         [0207]    In the present Embodiment 4, Step  702  specifically includes: 
         [0208]    Step a1, the upper software flat obtains the type of the main board of the host by operating system tools of the host; in which, the operating systems of the host include Windows operating system and Linux operating system, etc; the types of the main board of the host include GIGABYTE, ASUS, MSI, COLORFUL, ONDA and BIOSTAR, etc. 
         [0209]    Specifically, the upper software flat obtains the type of the main board of the host via ManagementObjectSearcher class in an interface provided by a software development kit (SDK) which is under the Windows operating system in the case that the operating system of the host is the Windows operating system; the upper software flat obtains the type of the main board of the host by invoking a dmidecode command provided by a Shell script under the Linux operating system in the case that the operating system of the host is the Linux operating system. 
         [0210]    Step a2, the upper software flat obtains a communication mode needed by the host according to the type of the main board; 
         [0211]    Specifically, in the present Embodiment 4, the upper software flat obtains the communication mode needed by the host by searching from a preset list, in which, the preset list may only include the type of the main board of the host, by which, the communication mode needed is the communication mode of 32 bytes, or only include the type of the main board of the host, by which, the communication mode needed is the communication mode of 64 bytes; the preset list may include a type of a main board and the communication mode needed by the host which applies the type of the main board. 
         [0212]    Preferably, in the present Embodiment 4, the preset list only includes the type of the main board of the host, by which, the communication mode needed is the communication mode of 32 byte, such as GIGABYTE; the upper software flat searches an obtained type of the main board from the preset list after the type of the main board of the host is obtained by the upper software flat, the communication mode needed by the host is the communication mode of 32 bytes if the obtained type of the main board is found; the communication mode needed by the host is the communication mode of 64 bytes if the obtained type of the main board is not found. 
         [0213]    For instance, the communication mode needed by the host, which is obtained by the upper software flat by searching from the preset list, is the communication mode of 32 bytes in the case that the type of the main board of the host, obtained by the upper software flat, is GIGABYTE. 
         [0214]    Step a3, the upper software flat sets the information of the communication mode of the upper software flat according to the communication mode needed by the host; 
         [0215]    Specifically, the information of the communication mode of the upper software flat is set by the upper software flat as 32 in the case that the communication mode needed by the host is the communication mode of 32 bytes; the communication mode of the upper software flat set by the upper software flat as 64 in the case that the communication mode needed by the host is the communication mode of 64 bytes. 
         [0216]    Step  703 , the upper software flat sends a communication instruction including the information of the communication mode of the upper software flat to the dongle via an interrupt-transmission-channel when a connection between the host and the dongle is detected by the upper software flat; 
         [0217]    The present step specifically includes: the upper software flat checks whether any dongle connects to the host, the upper software flat sends the communication instruction including the information of the communication mode of the upper software flat to the dongle via the interrupt-transmission-channel if a dongle is detected to connect to the host; the upper software flat outputs information that no dongle is detected if no dongle is detected to connect to the host. 
         [0218]    Specifically, the upper software flat checks whether any dongle connects to the host when the upper software flat is started, that means the upper software flat specifically checks whether any dongle-inserted information is detected, the upper software flat obtains a vendor ID (VID) and a product ID (PID) according to enumeration information returned from the dongle to the host when a dongle-inserted information is detected, and the VID and the PID is compared with a preset VID of the dongle and a preset PID of the dongle respectively, the upper software flat sends the communication instruction including the information of the communication mode of the upper software flat to the dongle via the interrupt-transmission-channel in the case that the obtained VID is as same as the preset VID of the dongle and the obtained PID is as same as the preset PID of the dongle; otherwise, the upper software flat outputs the information that no dongle is detected; the upper software flat outputs information that no dongle is detected in the case that no dongle is detected to connect to the host, 
         [0219]    in which, the information that no dongle is detected output by the upper software flat can be displayed on an interface of the host that no dongle is detected. 
         [0220]    Specifically, the upper software flat sets the communication instruction according to the information of the communication mode of the upper software flat, and sends the communication instruction including the information of the communication mode of the upper software flat to the dongle via a control-transmission-channel, 
         [0221]    in which, the communication instruction is composed of a series of setup packages which includes the information of the communication mode of the upper software flat. 
         [0222]    For instance, the specific information in the setup packages includes 0x 27 ff 20 00 00 00 00 00, 
         [0223]    in which, the third byte is the information of the communication mode, the third bytes is set as 0x20 in the case that the information of the communication mode of the upper software flat is 32; the third byte is set as 0x40 in the case that the information of the communication mode of the upper software flat is 64. 
         [0224]    It needs to be noted that the control-transmission-channel is a channel for communication between the host and the dongle via an endpoint  0  of the dongle; because of the characteristics of the control-transmission-channel, the host can communicate with the dongle via the control-transmission-channel before the host can communicate with the dongle effectively via the interrupt-transmission-channel to finish a configuration between the host and the dongle. 
         [0225]    Step  704 , the upper software flat waits for receiving response information returned from the dongle; 
         [0226]    Step  705 , the upper software flat determines a type of the received response information returned from the dongle, Step  707  is executed in the case that the response information is a first response information; Step  706  is executed in the case that the response information is a second response information; 
         [0227]    Step  706 , the upper software flat outputs information that pull out and re-insert the dongle, Step  703  is returned to; 
         [0228]    Specifically, the upper software flat prompts that pull out and re-insert the dongle again by displaying information that pull out and re-insert the dongle again on the interface of the host. 
         [0229]    Step  707 , the upper software flat communicates with the dongle via the interrupt-transmission-channel effectively according to the information of the communication mode of the upper software flat. 
         [0230]    As shown in  FIG. 8 , in the method, the dongle executes the following steps: 
         [0231]    Step  801 , the dongle sets information of the communication mode of the dongle according to a communication mode identification, performs an enumeration, returns enumeration information to the host after the enumeration is finished, and waits for communicating with the upper software flat; 
         [0232]    Specifically, the dongle setting the information of the communication mode of the dongle according to the communication mode identification includes: the number of communication bytes, supported by the interrupt-transmission-channel, in an endpoint descriptor and a report descriptor of the dongle is set as the same as the communication mode identification, and the number of the communication bytes supported by the interrupt-transmission-channel is made as the information of the communication mode of the dongle. In the present Embodiment 4, the communication mode identification of the dongle is stored in flat flash. For instance, the number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle as 64 according to the communication mode identification in the case that the communication mode identification of the dongle is  64 , thus, the information of the communication mode of the dongle is 64; 
         [0233]    The number of the communication bytes, supported by the interrupt-transmission-channel, in the endpoint descriptor and the report descriptor of the dongle is set by the dongle as 32 according to the communication mode identification in the case that the communication mode identification of the dongle is  32 , thus, the information of the communication mode of the dongle is 32. 
         [0234]    It needs to be noted that the dongle sets the information the communication mode of the dongle according to the communication mode identification when the dongle connects to the host, performs the enumeration, returns the enumeration information to the host after the enumeration is finished; in which, the enumeration information includes a transmission channel for communication of the dongle, the number of communication bytes supported by each transmission channel, a vendor ID (VID) of the dongle and a product ID (PID), the dongle waits for communicating with the upper software flat. 
         [0235]    Step  802 , the dongle receives the communication instruction sent from the upper software flat via the control-transmission-channel; 
         [0236]    Specifically, the dongle receives a series of setup packages sent from the upper software flat via the control-transmission-channel, and the setup packages include the information of the communication mode of the upper software flat. 
         [0237]    Step  803 , the dongle determines whether the information of the communication mode of itself matches the information of the communication mode of the upper software flat in the received instruction, if yes, Step  806  is executed; otherwise, Step  804  is executed; 
         [0238]    Specifically, the dongle determines whether the information of the communication mode of itself is the same as the information of the communication mode of the upper software in the received instruction, if yes, the information of the communication mode of the dongle matches the information of the communication mode of the upper software flat; otherwise, the information of the communication mode of the dongle does not match the information of the communication mode of the upper software flat. 
         [0239]    For example, the information of the communication mode of the dongle does not match the information of the communication mode of the upper software flat in the case that the information of the communication mode of the dongle is 64 while the information of the communication mode of the upper software flat received by the dongle is 32. 
         [0240]    Step  804 , the dongle sets the communication mode identification of the dongle according to the information of the communication mode of the upper software flat; 
         [0241]    Specifically, the dongle sets the communication mode identification stored in the flag flash according to the information of the communication mode of the upper software flat. 
         [0242]    For example, the dongle sets the communication mode identification stored in the flag flash as 32 in the case that the information of the communication mode of the upper software flat is 32. 
         [0243]    Step  805 , the dongle returns the second response information to the upper software flat via the control-transmission-channel, Step  807  is executed; 
         [0244]    Preferably, the second response information is 0x9002. 
         [0245]    Step  806 , the dongle returns the first response information to the upper software flat via the control-transmission-channel, and Step  807  is executed; 
         [0246]    Preferably, the first response information is 0x9001. 
         [0247]    Step  807 , the dongle waits for communicating with the upper software flat. 
         [0248]    In the present Embodiment 4, the upper software flat sets the communication mode information of the upper software flat according to the type of the main board of the host after the upper software flat is started, the upper software flat sends the communication instruction including the communication mode information of the upper software flat to the dongle via the control-transmission-channel when a connection between the host and the dongle is detected by the upper software flat; the dongle determines whether the communication mode of the dongle is as same as the communication mode of the upper software flat according to the communication mode information of the upper software flat in the instruction when the dongle receives the communication instruction via the control-transmission-channel, if yes, the dongle returns the first response information to the upper software flat, and the upper software flat communicates effectively with dongle via the interrupt-transmission-channel according to the communication mode information of the upper software flat after the first response information is received; otherwise, the dongle changes the communication mode of the dongle according to the communication mode of the upper software flat, and then returns the second response information to the upper software flat; the upper software flat outputs the information that pull out and re-insert the dongle, and the dongle reset the communication mode information of the dongle according to the communication mode identification in the case that the dongle is reset, and the dongle performs the enumeration; when the dongle is reset, the upper software will detect connection between the dongle and the host again, and sends the communication instruction to the dongle again, in this way, the dongle determines that the communication mode of itself is just the same as the communication mode of the upper software flat after the instruction information is received by the dongle, thus, the dongle will return the first response information to the upper software flat, and the upper software flat communicates effectively with the dongle via the interrupt-transmission-channel according to the communication mode information of the upper software flat after the first response information is received by the upper software flat. By the present invention, it solves the problem in prior art that a dongle can only support one communication mode of the host, the dongle in the present invention can adapt for both communication modes, and can communicate with the host of both communication modes effectively.