An explanation of usage in USB hid: it cannot be simply understood as usage ID.

Source: Internet
Author: User

Recently I am reading the spec of USB hid:


As you can see, when item isLocalWhen btag = 0000 correspondsUsage.

The meaning of this usage was not understood at first. I thought it was wrong. It should be written as a usage ID, and someone on the Internet also said that this usage is actually a usage ID.

After some research, I finally understood that the above understanding is wrong. This usage cannot be simply understood as the usage ID.

The specific meaning of this usage is explained in spec " local items:

Translated into Chinese:

The meaning of usage is determined by bsize. Different bsize values have different meanings.

Bsize = 3The corresponding data is 4 bytes.Usage = high 16 bits + low 16 bits = usage page + usage IDIn this case, the extended usage (Extended usage) is used when usage = usage page + usage ID is used)

Bsize = 1 or 2The corresponding data is 1 or 2 bytes, and the usage is unsigned,Usage = usage IDThe meaning of this usage ID is determined by the current usage page. That is, the definition of the corresponding usage page is now available. Here, usage = usage ID forms the usage page + usage ID together and determines the final purpose.


In the above cases, bsize = 1 or 2 is the most common case, while bsize = 3 is rare.

That is,

Generally, bsize = 1 or 2, usage = usage ID, and the previously defined usage page are added to form the usage page + usage ID, which determines the usage of the device (usage );

Rare: bsize = 3, usage = usage page + usage ID, overwrite the previous usage page, and reset the usage page and usage ID here, determines the usage of the device ).


Therefore, the above bsize = 3, usage = usage page + usage ID is called the extended usage. It is estimated that this usage = usage ID (bsize = 1 or 2 ), therefore, when usage = usage page + usage ID, it is called an extended usage.



The spec of USB hid seems to be a little too simple and obscure... Yes!

A lot of content, must have a certain understanding of the basis, it is easy to understand its meaning...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.