Control padding for byte-alignment
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- embedded-iot
Research direction
Start by locating the Waratah logic that lays out report fields and automatically inserts padding, then compare it with the keyboard and mouse descriptor examples in this issue. Determine how descriptor authors can request byte alignment or place padding before X and Y, and verify that the resulting report sizes and field offsets match those examples.
Written by the indexing model from the issue text.
Description
The sample for a keyboard (see below) uses 7 bits for each regular button. Thus the array items are not byte-aligned. While it is correct and compact, it's very cumbersome to use, e.g. when programming a MCU as a USB HID device. How can the report size be increased to 8 bits to make life easier?
Similarly for the below mouse descriptor. It's similar to the provided sample, however the buttons are moved to the front of the report. Waratah automatically adds 5 bits of padding, but it's added at the end. Thus, the mouse x and y movements are not byte aligned. How can the padding be moved before x and y?
Keyboard descriptor
[[applicationCollection]]
usage = ['Generic Desktop', 'Keyboard']
[[applicationCollection.inputReport]]
# Regular Buttons
[[applicationCollection.inputReport.arrayItem]]
usageRange = ['Keyboard/Keypad', 'ErrorRollOver', 'Keyboard Application']
count = 8
# Special buttons
[[applicationCollection.inputReport.variableItem]]
usageRange = ['Keyboard/Keypad', 'Keyboard LeftControl', 'Keyboard Right GUI']
logicalValueRange = [0, 1]
# LEDS
[[applicationCollection.outputReport]]
[[applicationCollection.outputReport.variableItem]]
usageRange = ['LED', 'Num Lock', 'Kana']
logicalValueRange = [0, 1]
Mouse descriptor
[[applicationCollection]]
usage = ['Generic Desktop', 'Mouse']
[[applicationCollection.inputReport]]
[[applicationCollection.inputReport.physicalCollection]]
usage = ['Generic Desktop', 'Pointer']
[[applicationCollection.inputReport.physicalCollection.variableItem]]
usageRange = ['Button', 'Button 1', 'Button 3']
logicalValueRange = [0, 1]
[[applicationCollection.inputReport.physicalCollection.variableItem]]
usage = ['Generic Desktop', 'X']
sizeInBits = 8
logicalValueRange = 'maxSignedSizeRange'
reportFlags = ['relative']
[[applicationCollection.inputReport.physicalCollection.variableItem]]
usage = ['Generic Desktop', 'Y']
sizeInBits = 8
logicalValueRange = 'maxSignedSizeRange'
reportFlags = ['relative']
- Dominant language
- C#
- Stars
- 291
- Forks
- 39
- Avg merge
- 1h 54m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/hidtools
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 1/5 Under an hour Newbie friendliness 48/100
All issues in microsoft/hidtools
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·