Fix for flightgear enumeration issue

Signed-off-by: fly <merspieler@alwaysdata.net>
This commit is contained in:
fly 2024-12-02 13:06:57 +01:00
parent d89f5be067
commit 48c3cb4701
3 changed files with 7 additions and 12 deletions

View file

@ -4,11 +4,7 @@ usage = ['Generic Desktop', 'Joystick']
[[applicationCollection.inputReport]] [[applicationCollection.inputReport]]
[[applicationCollection.inputReport.variableItem]] [[applicationCollection.inputReport.variableItem]]
usageRange = ['Button', 'Button 1', 'Button 64'] usageRange = ['Button', 'Button 1', 'Button 128']
logicalValueRange = [0, 1]
[[applicationCollection.inputReport.variableItem]]
usageRange = ['Button', 'Button 1', 'Button 32']
logicalValueRange = [0, 1] logicalValueRange = [0, 1]
[[applicationCollection.outputReport]] [[applicationCollection.outputReport]]

View file

@ -22,16 +22,12 @@ pub const CUSTOM_DESCRIPTOR: &[u8] = &[
0x85, 0x01, // ReportId(1) 0x85, 0x01, // ReportId(1)
0x05, 0x09, // UsagePage(Button[0x0009]) 0x05, 0x09, // UsagePage(Button[0x0009])
0x19, 0x01, // UsageIdMin(Button 1[0x0001]) 0x19, 0x01, // UsageIdMin(Button 1[0x0001])
0x29, 0x40, // UsageIdMax(Button 64[0x0040]) 0x29, 0x80, // UsageIdMax(Button 128[0x0080])
0x15, 0x00, // LogicalMinimum(0) 0x15, 0x00, // LogicalMinimum(0)
0x25, 0x01, // LogicalMaximum(1) 0x25, 0x01, // LogicalMaximum(1)
0x95, 0x40, // ReportCount(64) 0x95, 0x80, // ReportCount(128)
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)
0x19, 0x01, // UsageIdMin(Button 1[0x0001])
0x29, 0x20, // UsageIdMax(Button 32[0x0020])
0x95, 0x20, // ReportCount(32)
0x81, 0x02, // Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
0x05, 0x0E, // UsagePage(Haptics[0x000E]) 0x05, 0x0E, // UsagePage(Haptics[0x000E])
0x09, 0x21, // UsageId(Manual Trigger[0x0021]) 0x09, 0x21, // UsageId(Manual Trigger[0x0021])
0x26, 0xFF, 0x00, // LogicalMaximum(255) 0x26, 0xFF, 0x00, // LogicalMaximum(255)
@ -42,7 +38,7 @@ 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 = "13")] // MUST be <= 64 else we get problem cause InBytes64 or OutBytes64 #[packed_struct(endian = "lsb", size_bytes = "17")] // MUST be <= 64 else we get problem cause InBytes64 or OutBytes64
pub struct CustomInputReport { pub struct CustomInputReport {
#[packed_field] #[packed_field]
pub report_id: u8, pub report_id: u8,
@ -50,6 +46,8 @@ pub struct CustomInputReport {
pub buttons1: u64, pub buttons1: u64,
#[packed_field] #[packed_field]
pub buttons2: u32, pub buttons2: u32,
#[packed_field]
pub dummy: u32,
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)]

View file

@ -235,6 +235,7 @@ fn main() -> ! {
report_id: 1, report_id: 1,
buttons1, buttons1,
buttons2, buttons2,
dummy: 0,
}; };
// Pull the next LSK column high for next time coming through in the main loop ~1ms // Pull the next LSK column high for next time coming through in the main loop ~1ms
if lsk_col_select <= 0 { if lsk_col_select <= 0 {