search
HomeDatabaseMysql TutorialUSB1.1协议学习经验之2

USB1.1协议学习经验之2

Jun 07, 2016 pm 03:43 PM
usbone timelearnprotocolequipmentconnect

先了解一下USB设备的连接过程: 当 USB 设备接上或从 USB 设备移开的时候,主机启动一个被称作总线标识 (bus enumeration) 的进程,来标识并管理设备状态的改变,当 USB 设备接上一个加电端口时,系统当采取以下操作: 1.USB 设备所连的集线器通过其通向主机

 

先了解一下USB设备的连接过程:

USB设备接上或从USB设备移开的时候,主机启动一个被称作总线标识(bus enumeration)的进程,来标识并管理设备状态的改变,当USB设备接上一个加电端口时,系统当采取以下操作:

    1.USB设备所连的集线器通过其通向主机的状态改变通道向主机,汇报本USB设备已连接上。此时,USB设备处于加电状态,它所连接的端口是无效的。

    2.主机通过寻问集线器决定此次状态改变的确切含义。

    3.主机一旦得知新设备已连上以后,它至少等待100ms以使得插入操作的完成以及设备电源稳定工作。然后主机发出端口使能及复位命令给那个端口。

    4.集线器将发向端口的复位信号持续10ms。当复位信号撤消后,端口已经有效了。这时USB设备处于缺省状态,并且可从VBUS汲取小于100mA的电能,所有设备寄存器及状态已经被复位,设备可对缺省地址产生响应。

    5.主机给设备分配一个唯一的地址,设备转向编址状态。(Address state)

    6.USB设备接受设备地址之前,它的缺省控制通道(Default Control Pipe)在缺省地址处自然是可寻址的,主机通过读取设备描述表,判决设备缺省通道的实际净数据负载。

    7.主机从设备读取配置信息要从配置0读到配置n-1,其中n为配置个数,此操作须花费几个毫秒。

    8.基于从设备取来的配置信息及设备如何被使用的信息,主机给设备一个配置值,此刻,设备就处于配置状态(Configured state)并此配置有关的所有端节点,都按照配置各就各位,USB设备现在可以从VBUS得到描述中所要求的电量了。从设备的角度来讲,它已经准备就绪了。

    UBS设备被取走时,集线器同样会通知主机,断开一个设备连接会使得设备所连接的端口无效,一收到断开通知后,主机就会更新的拓扑信息。

 

地址分配

    USB设备连接以后,由主机负责给此设备分配一个唯一的地址,这个操作是在设备复位及端口使能操作以后。

配置

    USB设备在正常被使用以前,必须被配置,由主机负责配置设备。主机一般会从USB设备获取配置信息后再准定此设备有哪些功能。

    作为配置操作的一部分,主机会设置设备的配置值,并且,如果必要的话会选择合适的接口的备选设置。

    只须一个简单配置,一个设备可能支持多重接口。一个接口是一组端结点集合,它们代表了设备向主机提供的单一的功能或特性,用来与这组相关端结点通信的协议以及接口内各端结点的目的可以作为一个设备类的一部分或者由厂商制定具体定义。

    另外,一个配置中的结口可能有备选设置。这些备选设置会重定义相关端结点的数目或特性。如果是这样的话,设备必须支持GetInterface(接口请求)Set Interface(接口设置)请求,来汇报及选择指定的接口的设备选设置。

    在每个设备配置下,每个接口描述表可能包括用来标识接口的及备选设置的域,接口被从0N-1编号。n为配置所支持的能同时使用的接口数目,类似的设置的编号也从0开始。当设备初始化配置后,缺省设置是备选设置0

    为了支持通用的设备驱动程序管理一组相关的BUS设备,设备与接口描述表中包含了类(Class),子类(Sub class),及协议(Protocol)域。这些域用来标识一个设备的功能及用于通信的协议。

    一个类值被分配给一组按照特性划分成USB类说明一部分的设备。一个类的设备可进一步划分成子类,并且在一个类或子类中,一个协议代值可定义主机软件是怎样与设备通信的。

数据传送

    数据可能以四种方式(控制,批量,中断,同步)在USB设备端结点与主机之间传送。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to Grant Permissions to New MySQL UsersHow to Grant Permissions to New MySQL UsersMay 09, 2025 am 12:16 AM

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

How to Add Users in MySQL: A Step-by-Step GuideHow to Add Users in MySQL: A Step-by-Step GuideMay 09, 2025 am 12:14 AM

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

MySQL: Adding a new user with complex permissionsMySQL: Adding a new user with complex permissionsMay 09, 2025 am 12:09 AM

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

MySQL: String Data Types and CollationsMySQL: String Data Types and CollationsMay 09, 2025 am 12:08 AM

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

MySQL: What length should I use for VARCHARs?MySQL: What length should I use for VARCHARs?May 09, 2025 am 12:06 AM

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.

MySQL BLOB : are there any limits?MySQL BLOB : are there any limits?May 08, 2025 am 12:22 AM

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

MySQL : What are the best tools to automate users creation?MySQL : What are the best tools to automate users creation?May 08, 2025 am 12:22 AM

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

MySQL: Can I search inside a blob?MySQL: Can I search inside a blob?May 08, 2025 am 12:20 AM

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.