Open HaoboGu opened 11 months ago
Looks like when I added the logical_min
field, logical_max
wasn't added.
b1a3a78a91f646b96078100be6297bf9c8a7a154 + 7dffba02672b4cac2cf15df880751e03d2ded85a
It will probably be something like this: https://github.com/haata/usbd-hid/tree/add_logical_maximum
This will require a test case, do you have an example that needs a logical_max
?
This will require a test case, do you have an example that needs a logical_max?
sorry, I do not have an example for this.
I currently set Logical Maximum field to 255 by default, it just works 😃
usbd-hid actually sets logical_maximum for you, so in your particular case it would be very helpful if you could share your hid descriptor.
@haata here is my hid descriptor:
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
0x09, 0x02, /* Usage (Mouse) */
0xA1, 0x01, /* Collection (Application) */
0x09, 0x01, /* Usage (Pointer) */
0xA1, 0x00, /* Collection (Physical) */
0x85, HID_REPORT_ID_MOUSE, /* Report ID (0x01) */
0x05, 0x09, /* Usage Page (Button) */
0x19, 0x01, /* Usage Minimum (0x01) (Button 1) */
0x29, 0x08, /* Usage Maximum (0x03) (Button 8) */
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0x01, /* Logical Maximum (1) */
0x95, 0x08, /* Report Count (8) */
0x75, 0x01, /* Report Size (1) */
0x81, 0x02, /* Input (Data,Var,Abs) */
I don't see your logical maximum 0xFF in that descriptor?
Are you trying to use Logical Minimum (0) -> Logical Maximum (255) for the X,Y,Wheel parameters? (instead of the default -127 to 128).
I don't see your logical maximum 0xFF in that descriptor?
The descriptor I gave is what's cannot be generated using gen_hid_descriptor
now.
I can provide an example of current behavior as well:
fn main() {
use usbd_hid::descriptor::generator_prelude::*;
#[gen_hid_descriptor(
(collection = APPLICATION, usage_page = 0xFF00, usage = 0x60) = {
(usage = 0x62, logical_min = 0x0) = {
#[item_settings data,variable,absolute] input_data=input;
};
}
)]
pub struct KeyboardReport {
pub input_data: [u8; 32],
}
println!("{:02X?}", KeyboardReport::desc());
}
The generated descriptor is:
[06, 00, FF, 09, 60, A1, 01, 09, 62, 15, 00, 26, FF, 00, 75, 08, 95, 20, 81, 02, C0]
15, 00, 26, FF, 00
part are the logical minimum and logical maximum
The implementation of the
gen_hid_descriptor
macro seems lacklogical_max
field, is that right? How can i do to addlogical_max
field?code here: https://github.com/twitchyliquid64/usbd-hid/blob/master/macros/src/spec.rs#L129