CN106452838A - USB (Universal Serial Bus) equipment simulation device and method - Google Patents
USB (Universal Serial Bus) equipment simulation device and method Download PDFInfo
- Publication number
- CN106452838A CN106452838A CN201610798196.2A CN201610798196A CN106452838A CN 106452838 A CN106452838 A CN 106452838A CN 201610798196 A CN201610798196 A CN 201610798196A CN 106452838 A CN106452838 A CN 106452838A
- Authority
- CN
- China
- Prior art keywords
- usb device
- descriptor
- controlled end
- module
- control end
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/14—Network analysis or design
- H04L41/145—Network analysis or design involving simulating, designing, planning or modelling of a network
Abstract
The invention relates to a USB (Universal Serial Bus) equipment simulation device and method. The device comprises a communication module, a storage module and a processing module, wherein the communication module is connected with the storage module and the processing module, the storage module is connected with the processing module, the communication module is in communication connection with a control terminal, and the processing module is in interface connection with a controlled terminal; the communication module receives the equipment descriptor, which is sent from the control terminal, of USB equipment to be simulated, and outputs the equipment descriptor to the storage module to be pre-stored; the processing module receives an equipment descriptor request instruction sent from the controlled terminal; the equipment descriptor request instruction is responded, and the pre-stored equipment descriptor is obtained from the storage module and is sent to the controlled terminal; and a data request instruction sent from the controlled terminal according to the equipment descriptor is received, the data request instruction is forwarded to the control terminal through the communication module, and response data returned from the control terminal is received and sent to the controlled terminal. Therefore, the communication module, the storage module and the processing module are adopted to form the equipment simulation device of a hardware structure, and the equipment simulation device does not need to be driven by software and is high in reliability.
Description
Technical field
The present invention relates to hardware simulation technique field, more particularly to a kind of USB device analog and method.
Background technology
Software developer is being developed a software being communicated with certain hardware device or is needing soft to exploitation
When part is tested, need to use hardware device.When not having enough hardware devices, or the price of hardware device is very
When expensive, possibly cannot meet each developer has a hardware device, now, is typically with the side of equipment simulating
Formula solves the problems, such as hardware device for not enough.
Traditional USB device analog form is usually to adopt pure software simulated implementation, by the interface driving setting to connect.
When adopting connection computer in this way, the antivirus software that computer carries may intercept the driving of software simulation, leads to mould
Intend unsuccessful, reliability is low.
Content of the invention
Based on this it is necessary to be directed to the problems referred to above, provide a kind of high USB device analog of reliability and method.
A kind of USB device analog, including communication module, memory module and processing module, described communication module connects
Described memory module and described processing module, described memory module connects described processing module, and described communication module is additionally operable to lead to
Letter connects control end, and described processing module is additionally operable to interface and connects controlled end;
Described communication module receives the device descriptor of USB device to be simulated that described control end sends and exports to described
Memory module carries out pre-stored;
Described processing module receives the device descriptor request instruction that described controlled end sends;And in response to described equipment
Descriptor request instruction, the device descriptor taking pre-stored from described memory module sends to described controlled end;And receive institute
State the data requesting instructions that controlled end sends according to described device descriptor, by described communication module, described request of data is referred to
Order is forwarded to control end, receives the reply data of described control end return and sends to described controlled end.
Above-mentioned USB device analog, is communicated with control end by communication module, receives the equipment that control end sends
Descriptor sending is stored to memory module, thus being modeled as USB device corresponding with device descriptor;By processing mould
Block is connected with controlled end interface, device descriptor is sent to controlled end so that controlled end identifies, and receives the number of controlled end
According to request instruction, data requesting instructions are forwarded to by control end by communication module, receive the reply data of control end return simultaneously
Send to controlled end.So, by forming the USB device mould of hardware configuration using communication module, memory module and processing module
Intend device it is not necessary to software-driven, reliability is high.
A kind of USB device analogy method, comprises the steps:
Receive the device descriptor request instruction that controlled end sends;
In response to described device descriptor request instruction, the device descriptor of the USB device to be simulated of pre-stored is taken to send
To described controlled end;
Receive the data requesting instructions that described controlled end sends according to described device descriptor;
Described data requesting instructions are forwarded to control end, receive the reply data of described control end return and send to institute
State controlled end.
Above-mentioned USB device analogy method, receives the device descriptor request instruction that controlled end sends, in response to equipment description
Symbol request instruction, takes the device descriptor of the USB device to be simulated of pre-stored to send to controlled end;Receive controlled end according to equipment
The data requesting instructions that descriptor sends, data requesting instructions are forwarded to control end, receive the reply data that control end returns
And send to controlled end.So, by being modeled as USB device corresponding with device descriptor, and realize and controlled end and control
It is not necessary to software-driven, reliability is high for the analogue communication at end.
Brief description
Fig. 1 is the structured flowchart of USB device analog in an embodiment;
Fig. 2 is the operating diagram of USB device analog in an application examples;
Fig. 3 is the flow chart of USB device analogy method in an embodiment;
Fig. 4 is the flow chart of USB device analogy method in another embodiment.
Specific embodiment
With reference to Fig. 1, the USB device analog in an embodiment, including communication module 110, memory module 130 and process
Module 150, communication module 110 connects memory module 130 and processing module 150, and memory module 130 connects processing module 150, leads to
Letter module 110 is additionally operable to communicate to connect control end, and processing module 150 is additionally operable to interface and connects controlled end.
Communication module 110 receives the device descriptor of USB device to be simulated of control end transmission and exports to memory module
130 carry out pre-stored.Processing module 150 receives the device descriptor request instruction that controlled end sends;And retouch in response to equipment
State symbol request instruction, the device descriptor taking pre-stored from memory module 130 sends to controlled end;And receive controlled end according to
Data requesting instructions are forwarded to control end by communication module 110 by the data requesting instructions that device descriptor sends, and receive control
The reply data of end processed return simultaneously sends to controlled end.
Device descriptor is used for indicating the general information of USB device to be simulated, such as USB device, device descriptor
Including the information that USB device and all devices have been configured with whole effect, the device descriptor of USB device is in USB device quilt piece
During act, to the characteristic (input or output) of each end points of host report, including support on endpoint number, communication direction, end points 0
Maximum data packet length (is also referred to as Data payload), bandwidth requirement etc..
Control end is passed through to send device descriptor to communication module 110, indicates that USB device analog is modeled as and equipment
The corresponding equipment of descriptor, for example, need to use USB device A, then control end passes through communication module 110 by the equipment of USB device A
Descriptor sends and is stored to memory module 130, and instruction USB device analog is modeled as USB device A.Controlled end refers to
After USB device analog is modeled as the corresponding equipment of device descriptor, it is simulated, with USB device analog, end of communicating
End.Control end and controlled end can be the terminal units such as computer, and control end and controlled end can be different terminals, also may be used
To be using same terminal.
Above-mentioned USB device analog, is communicated with control end by communication module 110, receives what control end sent
Device descriptor sending is stored to memory module 130, thus being modeled as USB device corresponding with device descriptor;Logical
Cross processing module 150 to be connected with controlled end interface, device descriptor is sent to controlled end so that controlled end identifies, and receive
Data requesting instructions are forwarded to control end by communication module 110 by the data requesting instructions that controlled end sends, and receive control end
The reply data of return simultaneously sends to controlled end.So, by using communication module 110, memory module 130 and processing module
It is not necessary to software-driven, reliability is high for the USB device analog of 150 composition hardware configurations.
In one embodiment, device descriptor includes the general information of multiple USB devices to be simulated.So, when communication mould
Block 110 receives the device descriptor that control end sends and exports and carry out pre-stored to memory module 130, a now equipment description
Symbol can correspond to multiple USB devices to be simulated, and USB device analog is simulated multiple devices simultaneously and deposited it is not necessary to repeat reception
Storage device descriptor, improves simulation precision.
In one embodiment, communication module 110 is WiFi module.WiFi module can realize radio communication, convenient and swift.
It is appreciated that in other embodiments, communication module 110 can also adopt other types, such as bluetooth module.
In one embodiment, memory module 130 is buffer.Communication module 110 by the device descriptor of reception export to
Buffer carries out pre-stored, from buffer extraction device after the device descriptor request instruction of processing module 150 reception controlled end
Descriptor sends to controlled end.Buffer exchange velocity is fast, by using buffer depositor's device descriptor, can improve storage and
The efficiency extracted.
In one embodiment, processing module 150 is provided with USB interface, and processing module 150 connects controlled end by USB interface.
So, processing module 150 is connected with controlled end by way of USB interface connects, and plug is convenient.
In one embodiment, processing module 150 is MCU (Micro Control Unit micro-control unit).MCU function is strong
Greatly, by processing module 150 is used as using MCU, data-handling efficiency can be improved.
In one embodiment, processing module 150 can be referred to by the re-enumeration that communication module 110 receives control end transmission
Order, instructs transmission according to re-enumeration and enumerates signal to controlled end, so that controlled end is according to enumerating apparatus for transmitting signal descriptor
Request instruction is to processing module 150.
With reference to Fig. 2, it is the operating diagram of a concrete application example, communication module 110 should adopt WiFi module in use-case,
Memory module 130 adopts buffer, and processing module 150 adopts MCU, and overall work process is:
(1), communicated with USB device analog by software in control end, by setting of USB device to be simulated
The information such as standby descriptor are written in buffer by WiFi module.
(2), control end sends re-enumeration instruction by WiFi module to MCU, and MCU sends and enumerates signal to controlled end.
(3), controlled end sends device descriptor request instruction to MCU.
(4), MCU extraction device descriptor from buffer, device descriptor is returned to controlled end, thus completing equipment
Identification process, such as now USB device analog simulation for device A.
(5), controlled end sends the data requesting instructions specific to device A to MCU.
(6), data requesting instructions are sent to control end by WiFi module by MCU, and control end please according to different data
Instruction is asked to return corresponding reply data.
(7), reply data returns to controlled end by MCU.
For controlled end send have polytype data requesting instructions when, repeat step (5) arrive (7), thus complete right
The full simulation of device A.
With reference to Fig. 3, the USB device analogy method in an embodiment, can apply to above-mentioned USB device analog, should
Method comprises the steps.
S110:Receive the device descriptor request instruction that controlled end sends.
Controlled end refers to, after USB device analog is modeled as the corresponding equipment of device descriptor, simulate dress with USB device
Put the terminal being simulated communication, can be the terminal units such as computer.
S130:In response to device descriptor request instruction, the device descriptor of the USB device to be simulated of pre-stored is taken to send
To controlled end.
Device descriptor is used for indicating the general information of USB device to be simulated, such as USB device, device descriptor
Including the information that USB device and all devices have been configured with whole effect, the device descriptor of USB device is in USB device quilt piece
During act, to the characteristic (input or output) of each end points of host report, including support on endpoint number, communication direction, end points 0
Maximum data packet length (is also referred to as Data payload), bandwidth requirement etc..Device descriptor can be communications reception control end
It is stored in memory module after the device descriptor sending or be stored in after directly receiving the device descriptor that interface inputs
Memory module.
Device descriptor can include the general information of multiple USB devices to be simulated.So, a device descriptor is permissible
Corresponding multiple USB devices to be simulated, USB device analog simulates multiple devices it is not necessary to repeat to receive storage device simultaneously
Descriptor, improves simulation precision.
S150:Receive the data requesting instructions that controlled end sends according to device descriptor.
After controlled end receiving device descriptor, identify that the corresponding USB to be simulated of device descriptor sets according to device descriptor
Standby.If device descriptor corresponds to a USB device to be simulated, data requesting instructions are to should the request of device descriptor refer to
Order;If device descriptor corresponds to multiple USB devices to be simulated, data requesting instructions are that controlled end is waited to simulate from the multiple of identification
The corresponding request instruction of USB device to be simulated chosen in USB device.For example, the device descriptor of controlled end receiving terminal corresponds to
USB device A to be simulated and USB device B to be simulated, now, controlled end needs the data of USB device A to be simulated, then send and correspond to
The data requesting instructions of USB device A to be simulated.
S170:Data requesting instructions are forwarded to control end, receive the reply data that control end returns and send to controlled
End.
By data requesting instructions are forwarded to control end, returned corresponding according to different data requesting instructions by control end
Reply data, mitigate equipment simulating device burden, complete the corresponding data communication of data requesting instructions.
Above-mentioned USB device analogy method, receives the device descriptor request instruction that controlled end sends, in response to equipment description
Symbol request instruction, takes the device descriptor of the USB device to be simulated of pre-stored to send to controlled end;Receive controlled end according to equipment
The data requesting instructions that descriptor sends, data requesting instructions are forwarded to control end, receive the reply data that control end returns
And send to controlled end.So, by being modeled as USB device corresponding with device descriptor, and realize and controlled end and control
It is not necessary to software-driven, reliability is high for the analogue communication at end.
In one embodiment, refer to Fig. 4, before step S110, also include step S100.
S100:Set up the communication connection with control end, receive the device descriptor of control end transmission and store.
By communicating with control end, so that the device descriptor receiving control end transmission is stored.For example, an embodiment
In, especially by communication module communicate to connect control end, communication module receive control end send device descriptor, and export to
Memory module is stored.It is appreciated that in other embodiments, it would however also be possible to employ other modes complete the pre- of device descriptor
Storage.
In one embodiment, please continue to refer to Fig. 4, step S110 includes:Receive the re-enumeration instruction that control end sends,
Transmission is instructed according to re-enumeration and enumerates signal to controlled end, and receive controlled end according to the device descriptor enumerating signal transmission
Request instruction.
By receiving the re-enumeration instruction of control end and transmission is instructed according to re-enumeration enumerating signal to controlled end, such as
This is so that notice controlled end can be with re-enumeration.For example, in an embodiment, processing module receives the re-enumeration that control end sends
Instruction, and signal is enumerated to controlled end according to re-enumeration instruction transmission.It is appreciated that in other embodiments, can also be
Sent using other modes and enumerate signal to controlled end, for example, when need to notify controlled end can with re-enumeration when, to processing mould
Interface between block and controlled end carries out plug, reconnects controlled end, controlled end detection process mould after making processing module power-off
Reconnect after block power-off then it is assumed that processing module sends enumerates signal.
Each technical characteristic of embodiment described above can arbitrarily be combined, for making description succinct, not to above-mentioned reality
The all possible combination of each technical characteristic applied in example is all described, as long as however, the combination of these technical characteristics is not deposited
In contradiction, all it is considered to be the scope of this specification record.
Embodiment described above only have expressed the several embodiments of the present invention, and its description is more concrete and detailed, but simultaneously
Can not therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art
Say, without departing from the inventive concept of the premise, some deformation can also be made and improve, these broadly fall into the protection of the present invention
Scope.Therefore, the protection domain of patent of the present invention should be defined by claims.
Claims (10)
1. a kind of USB device analog is it is characterised in that include communication module, memory module and processing module, described communication
Module connects described memory module and described processing module, and described memory module connects described processing module, described communication module
It is additionally operable to communicate to connect control end, described processing module is additionally operable to interface and connects controlled end;
Described communication module receives the device descriptor of USB device to be simulated of described control end transmission and exports to described storage
Module carries out pre-stored;
Described processing module receives the device descriptor request instruction that described controlled end sends;And in response to the description of described equipment
Symbol request instruction, the device descriptor taking pre-stored from described memory module sends to described controlled end;And be subject to described in receiving
Described data requesting instructions are turned by the data requesting instructions that control end sends according to described device descriptor by described communication module
It is sent to control end, receive the reply data of described control end return and send to described controlled end.
2. USB device analog according to claim 1 is it is characterised in that described device descriptor includes multiple treating
The general information of simulation USB device.
3. USB device analog according to claim 1 is it is characterised in that described processing module is provided with USB interface,
Described processing module connects described controlled end by described USB interface.
4. USB device analog according to claim 1 is it is characterised in that described communication module is WiFi module.
5. USB device analog according to claim 1 is it is characterised in that described memory module is buffer.
6. USB device analog according to claim 1 is it is characterised in that described processing module is MCU.
7. a kind of USB device analogy method is it is characterised in that comprise the steps:
Receive the device descriptor request instruction that controlled end sends;
In response to described device descriptor request instruction, the device descriptor of the USB device to be simulated of pre-stored is taken to send to institute
State controlled end;
Receive the data requesting instructions that described controlled end sends according to described device descriptor;
Described data requesting instructions are forwarded to control end, receive the reply data that described control end returns sending and be subject to described
Control end.
8. USB device analogy method according to claim 7 is it is characterised in that described device descriptor includes multiple treating
The general information of simulation USB device.
9. USB device analogy method according to claim 7 it is characterised in that described reception controlled end send equipment
Before the step of descriptor request instruction, also include step:
Set up the communication connection with control end, receive the device descriptor of described control end transmission and store.
10. USB device analogy method according to claim 7 it is characterised in that described reception controlled end send equipment
The step of descriptor request instruction, including:
Receive the re-enumeration instruction that control end sends, signal is enumerated according to the instruction transmission of described re-enumeration extremely described controlled
End, and receive described controlled end according to the described described device descriptor request instruction enumerating signal transmission.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610798196.2A CN106452838A (en) | 2016-08-31 | 2016-08-31 | USB (Universal Serial Bus) equipment simulation device and method |
PCT/CN2016/113193 WO2018040429A1 (en) | 2016-08-31 | 2016-12-29 | Usb device simulation apparatus and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610798196.2A CN106452838A (en) | 2016-08-31 | 2016-08-31 | USB (Universal Serial Bus) equipment simulation device and method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106452838A true CN106452838A (en) | 2017-02-22 |
Family
ID=58164528
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610798196.2A Pending CN106452838A (en) | 2016-08-31 | 2016-08-31 | USB (Universal Serial Bus) equipment simulation device and method |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106452838A (en) |
WO (1) | WO2018040429A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108388372A (en) * | 2018-02-24 | 2018-08-10 | 广州视源电子科技股份有限公司 | A kind of method, apparatus, equipment and the storage medium of adaptive touch data |
CN110069288A (en) * | 2019-03-13 | 2019-07-30 | 北京淳中科技股份有限公司 | USB device sharing method, apparatus and system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101266590A (en) * | 2008-04-22 | 2008-09-17 | 北京飞天诚信科技有限公司 | Method and system for dynamically switching equipment arrangement |
CN102713843A (en) * | 2010-08-24 | 2012-10-03 | 联发科技股份有限公司 | Method of USB device enumeration including detecting operating system type of USB host |
CN102737003A (en) * | 2011-04-01 | 2012-10-17 | 中兴通讯股份有限公司 | Method and device for simulating USB (Universal Serial Bus) device |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080021693A1 (en) * | 2006-07-21 | 2008-01-24 | Microsoft Corporation | Storage Device Simulator |
US7881919B2 (en) * | 2007-04-03 | 2011-02-01 | Microsoft Corporation | USB device simulator |
CN103617068A (en) * | 2013-11-18 | 2014-03-05 | 四川长虹电器股份有限公司 | Method of simulating operations of USB device in Android simulator |
CN105488000B (en) * | 2015-12-23 | 2018-09-14 | 数安时代科技股份有限公司 | Realize the method and system that USB device quickly accesses |
-
2016
- 2016-08-31 CN CN201610798196.2A patent/CN106452838A/en active Pending
- 2016-12-29 WO PCT/CN2016/113193 patent/WO2018040429A1/en active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101266590A (en) * | 2008-04-22 | 2008-09-17 | 北京飞天诚信科技有限公司 | Method and system for dynamically switching equipment arrangement |
CN102713843A (en) * | 2010-08-24 | 2012-10-03 | 联发科技股份有限公司 | Method of USB device enumeration including detecting operating system type of USB host |
CN102737003A (en) * | 2011-04-01 | 2012-10-17 | 中兴通讯股份有限公司 | Method and device for simulating USB (Universal Serial Bus) device |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108388372A (en) * | 2018-02-24 | 2018-08-10 | 广州视源电子科技股份有限公司 | A kind of method, apparatus, equipment and the storage medium of adaptive touch data |
CN110069288A (en) * | 2019-03-13 | 2019-07-30 | 北京淳中科技股份有限公司 | USB device sharing method, apparatus and system |
CN110069288B (en) * | 2019-03-13 | 2022-03-04 | 北京淳中科技股份有限公司 | USB equipment sharing method, device and system |
Also Published As
Publication number | Publication date |
---|---|
WO2018040429A1 (en) | 2018-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10178206B2 (en) | Multi-protocol gateway for connecting sensor devices to cloud | |
US20100169523A1 (en) | Scalable method and apparatus to configure a link | |
CN101788972A (en) | System and method for transmitting data | |
CN104216840B (en) | The method and device that a kind of USB sets and operated to external equipment | |
JP5863199B2 (en) | Method and system for providing MDT measurement information to a base station in a wireless network environment | |
US8683085B1 (en) | USB interface configurable for host or device mode | |
CN104750588A (en) | Serial port communication based pressure testing method | |
CN103559156A (en) | Communication system between FPGA (field programmable gate array) and computer | |
US10162778B2 (en) | Universal serial bus emulation layer | |
CN108780430B (en) | Sending Universal Serial Bus (USB) data over an alternate mode connection | |
CN104836636B (en) | The method, apparatus and system communicated based on novel CAN frame | |
CN106452838A (en) | USB (Universal Serial Bus) equipment simulation device and method | |
CN106126465A (en) | A kind of data transmission method and device | |
WO2019200914A1 (en) | Terminal and screen projection system | |
CN109165185B (en) | PCIe signal conversion method and device based on FPGA | |
CN108920193A (en) | SDIO communication interface realization method and device between FPGA and CPU | |
CN104615558B (en) | A kind of data transferring method and electronic device | |
CN109120731B (en) | Universal communication method, system and device | |
CN107885674B (en) | Bluetooth device simulator, working method thereof and Bluetooth device operating system | |
CN109189705A (en) | A kind of usb expansion method, apparatus, equipment, storage medium and system | |
CN114218138A (en) | USB equipment simulation device and test system | |
US20110022765A1 (en) | System, method, and computer program product for maintaining a direct connection between an initiator and a drive | |
JP2012098885A (en) | Data transfer method | |
JP3940843B2 (en) | Serial communication system and local terminal for serial communication | |
CN114928377B (en) | Output transmission method, device and equipment for reducing transparent transmission bandwidth of USB data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170222 |