Works from flightgear, hidviz is broken
Signed-off-by: fly <merspieler@alwaysdata.com>
This commit is contained in:
parent
04d8e5812e
commit
af34339c44
2 changed files with 10 additions and 7 deletions
|
@ -19,7 +19,7 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
|
||||||
0x05, 0x01, // UsagePage(Generic Desktop[0x0001])
|
0x05, 0x01, // UsagePage(Generic Desktop[0x0001])
|
||||||
0x09, 0x04, // UsageId(Joystick[0x0004])
|
0x09, 0x04, // UsageId(Joystick[0x0004])
|
||||||
0xA1, 0x01, // Collection(Application)
|
0xA1, 0x01, // Collection(Application)
|
||||||
// 0x85, 0x01, // ReportId(1)
|
0x85, 0x01, // ReportId(1)
|
||||||
0x09, 0x01, // UsageId(Pointer[0x0001])
|
0x09, 0x01, // UsageId(Pointer[0x0001])
|
||||||
0xA1, 0x00, // Collection(Physical)
|
0xA1, 0x00, // Collection(Physical)
|
||||||
0x09, 0x30, // UsageId(X[0x0030])
|
0x09, 0x30, // UsageId(X[0x0030])
|
||||||
|
@ -37,6 +37,7 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
|
||||||
0x95, 0x10, // ReportCount(16)
|
0x95, 0x10, // ReportCount(16)
|
||||||
0x75, 0x01, // ReportSize(1)
|
0x75, 0x01, // ReportSize(1)
|
||||||
0x81, 0x02, // Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
|
0x81, 0x02, // Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
|
||||||
|
0x85, 0x02, // ReportId(2)
|
||||||
0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
|
0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
|
||||||
0x09, 0x01, // Usage (0x01)
|
0x09, 0x01, // Usage (0x01)
|
||||||
0x27, 0x80, 0xBB, 0x00, 0x00, // LogicalMaximum(48,000)
|
0x27, 0x80, 0xBB, 0x00, 0x00, // LogicalMaximum(48,000)
|
||||||
|
@ -50,10 +51,10 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
|
||||||
];
|
];
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)]
|
||||||
#[packed_struct(endian = "lsb", size_bytes = "6")]
|
#[packed_struct(endian = "lsb", size_bytes = "7")]
|
||||||
pub struct CustomInputReport {
|
pub struct CustomInputReport {
|
||||||
// #[packed_field]
|
#[packed_field]
|
||||||
// pub report_id: u8,
|
pub report_id: u8,
|
||||||
#[packed_field]
|
#[packed_field]
|
||||||
pub axis: [u16; 2],
|
pub axis: [u16; 2],
|
||||||
#[packed_field]
|
#[packed_field]
|
||||||
|
@ -61,8 +62,10 @@ pub struct CustomInputReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)]
|
||||||
#[packed_struct(endian = "lsb", size_bytes = "4")]
|
#[packed_struct(endian = "lsb", size_bytes = "5")]
|
||||||
pub struct CustomOutputReport {
|
pub struct CustomOutputReport {
|
||||||
|
#[packed_field]
|
||||||
|
pub report_id: u8,
|
||||||
#[packed_field]
|
#[packed_field]
|
||||||
pub integ_lt: u16,
|
pub integ_lt: u16,
|
||||||
pub generic: u16,
|
pub generic: u16,
|
||||||
|
@ -82,7 +85,7 @@ impl<'a, B: UsbBus> CustomDevice<'a, B> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_report(&mut self) -> Result<CustomOutputReport, UsbHidError> {
|
pub fn read_report(&mut self) -> Result<CustomOutputReport, UsbHidError> {
|
||||||
let mut data = [0, 0, 0, 0];
|
let mut data = [0; 5];
|
||||||
self.interface
|
self.interface
|
||||||
.read_report(&mut data[..])
|
.read_report(&mut data[..])
|
||||||
.map(|_| CustomOutputReport::unpack(&data).unwrap())
|
.map(|_| CustomOutputReport::unpack(&data).unwrap())
|
||||||
|
|
|
@ -282,7 +282,7 @@ fn get_report(pins: &mut MyPins, adc1: &mut adc::Adc<pac::ADC1>, cal: &Calibrati
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomInputReport {
|
CustomInputReport {
|
||||||
// report_id: 1,
|
report_id: 1,
|
||||||
axis: values_norm,
|
axis: values_norm,
|
||||||
buttons,
|
buttons,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue