Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more flydigi compatibility #51

Open
wants to merge 2 commits into
base: stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions sdb/linux/0300B40411241101.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name = "Flydigi Apex 2 (Wireless)"
type = "gamepad"

[remap]
# Sticks
JoyZ = "CamX"
CamZ = "CamY"

# Wheel
Brake = "ActionWheelX"
Gas = "ActionWheelY"

# Dpad
PovUp = "Up"
PovDown = "Down"
PovLeft = "Left"
PovRight = "Right"

# Face buttons flipped in function
ActionV = "ActionH"
ActionH = "ActionV"
PinkyRight = "ActionC"
11 = "ActionD"

# Rear buttons
15 = "ActionL" # Left Nub, diagonally between and bumpers
14 = "ActionR" # Right Nub

# Underside
13 = "PinkyLeft" # Left Grip
12 = "PinkyRight" # Right Grip
ActionD = "PaddleLeft" # Left Under
ActionC = "PaddleRight" # Right Under
6 changes: 6 additions & 0 deletions sdb/linux/0300B40412241101.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ CamZ = "CamY"
Brake = "ActionWheelX"
Gas = "ActionWheelY"

# Dpad
PovUp = "Up"
PovDown = "Down"
PovLeft = "Left"
PovRight = "Right"

# Face buttons flipped in function
ActionV = "ActionH"
ActionH = "ActionV"
Expand Down
38 changes: 38 additions & 0 deletions sdb/linux/0500151940000100.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name = "Flydigi Apex 2 (Bluetooth)"
type = "gamepad"

[remap]
# Sticks
JoyZ = "CamX"
CamZ = "CamY"

# Wheel
Brake = "ActionWheelX"
Gas = "ActionWheelY"

# Dpad
PovUp = "Up"
PovDown = "Down"
PovLeft = "Left"
PovRight = "Right"

# Face buttons flipped in function
ActionV = "ActionH"
ActionH = "ActionV"
MicPush = "ActionC"
Enter = "ActionD"

# Rear buttons
Sleep = "ActionL" # Left Nub, diagonally between and bumpers
Lang2 = "ActionR" # Right Nub

# Meta buttons
# Mode is already Mode
# Home is already Home
ThrottleButton = "Exit"

# Underside
ChinaForward = "PinkyLeft" # Left Grip
Eject = "PinkyRight" # Right Grip
LandingGearSilence = "PaddleLeft" # Left Under
ChinaBackward = "PaddleRight" # Right Under
18 changes: 10 additions & 8 deletions stick/remap_linux.sdb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
03005E048E021001X360 Controller x8108;8209;8301;840A;850B;0203;0302;0506;320C;3303;3406;0605;3105;2323s0.992;2424s0.992;250F;2020s0.992;2121s0.992;220E;350D;1D11;1E12;1F13;1C10;3002
03006F0E01050001PDP Wired Xbox 360 Gamepad x0506;0605;2323d0.075;2424d0.075;250F;2020d0.075;2121d0.075;220E;1D11;1E12;1F13;1C10;0E00;0F00
03005E04D1020101Microsoft Xbox One Controller x8108;840A;850B;250F;220E;0801;1D11;1E12;1F13;1C10
03006D0416C21101Logitech Dual Action PlayStation Gamepad p800E;810F;8208;8309;840A;850B;0205;0302;320C;3302;3406;3103;2324;2523s0.67;2223;080A;090B;350D;1D11;1E12;1F13;1C10;3005
0300B50716031001Thrustmaster Flightstick f2020d0.125;2121d0.125;2227a127i-128
05005E04E0020309Microsoft Xbox Wireless Controller x0405;070D;050C;0C08;0D09;250F;5501;220E;0E0A;0F0B
0300B40411241101Flydigi Apex 2 (Wireless) g8B07;8C54;8D53;8E34;8F32;0452;0751;0506;0605;2E5E;2524;2D5F;2223;5404;1D11;1E12;1F13;1C10
03004C0568021081Shanwan PlayStation3 Gamepad p0203;0302;250F;220E;0E00;0F00
0300790044181001GameCube Controller - Mayflash Adapter n810D;8A12;8309;8710;8813;8911;3200;3302;3406;3103;230Ed0.125;240Fd0.125;2523s0.67;2020s0.67;2121s0.67;2224s0.67;3500;1D11;1E12;1F13;1C10;3005
03004F0404041101Thrustmaster Warthog Throttle f8145;8A40;8B41;8C3E;8D3F;8E48;8F4A;9038;9139;924B;9349;8244;944C;953C;963D;9942;9A43;833A;843B;8547;8646;8736;8837;894D;3219;332F;341A;3118;2528a16339;204Ea1024;214Fa1024;2229a16339;351B;2726;3050
03006F0E01050001PDP Wired Xbox 360 Gamepad x0506;0605;2323d0.075;2424d0.075;250F;2020d0.075;2121d0.075;220E;1D11;1E12;1F13;1C10;0E00;0F00
0300B50716031001Thrustmaster Flightstick f2020d0.125;2121d0.125;2227a127i-128
03002509E8030101Wii Remote - Mayflash Adapter n800C;810D;8208;8309;8401;3302;3405;3106;2324;240E;250F;2223;1D11;1E12;1F13;1C10;3003
0300B40412241101Flydigi Apex 2 (Wired) g8B53;8C52;8D51;8E34;8F32;0506;0605;2E5E;2524;2D5F;2223
03004F0404041101Thrustmaster Warthog Throttle f8145;8A40;8B41;8C3E;8D3F;8E48;8F4A;9038;9139;924B;9349;8244;944C;953C;963D;9942;9A43;833A;843B;8547;8646;8736;8837;894D;3219;332F;341A;3118;2528a16339;204Ea1024;214Fa1024;2229a16339;351B;2726;3050
03006D0416C21101Logitech Dual Action PlayStation Gamepad p800E;810F;8208;8309;840A;850B;0205;0302;320C;3302;3406;3103;2324;2523s0.67;2223;080A;090B;350D;1D11;1E12;1F13;1C10;3005
0300B40412241101Flydigi Apex 2 (Wired) g8B53;8C52;8D51;8E34;8F32;0506;0605;2E5E;2524;2D5F;2223;1D11;1E12;1F13;1C10
0300790044181001GameCube Controller - Mayflash Adapter n810D;8A12;8309;8710;8813;8911;3200;3302;3406;3103;230Ed0.125;240Fd0.125;2523s0.67;2020s0.67;2121s0.67;2224s0.67;3500;1D11;1E12;1F13;1C10;3005
0500151940000100Flydigi Apex 2 (Bluetooth) g0506;0605;2E5E;2524;4652;4753;6254;6007;2D5F;2223;4A51;6534;2F04;1D11;1E12;1F13;1C10;6132;4D01
03005E048E021001X360 Controller x8108;8209;8301;840A;850B;0203;0302;0506;320C;3303;3406;0605;3105;2323s0.992;2424s0.992;250F;2020s0.992;2121s0.992;220E;350D;1D11;1E12;1F13;1C10;3002
03005E04D1020101Microsoft Xbox One Controller x8108;840A;850B;250F;220E;0801;1D11;1E12;1F13;1C10
14 changes: 14 additions & 0 deletions stick/src/ctlr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ enum Btn {
TrimDown = 69,
TrimRight = 70,
TrimLeft = 71,
Enter = 72,
Sleep = 73,
Eject = 74,
Mode = 75,
Lang1 = 76,
Lang2 = 77,
Home = 78,
}

#[repr(i8)]
Expand Down Expand Up @@ -437,7 +444,10 @@ impl Controller {
use Event::*;
match event {
Disconnect => Poll::Ready(Disconnect),
Enter(p) => self.button(Btn::Enter, Enter, p),
Exit(p) => self.button(Btn::Exit, Exit, p),
Sleep(p) => self.button(Btn::Sleep, Sleep, p),
Eject(p) => self.button(Btn::Eject, Eject, p),
MenuL(p) => self.button(Btn::MenuL, MenuL, p),
MenuR(p) => self.button(Btn::MenuR, MenuR, p),
ActionA(p) => self.button(Btn::ActionA, ActionA, p),
Expand Down Expand Up @@ -559,6 +569,10 @@ impl Controller {
TrimRight(p) => self.button(Btn::TrimRight, TrimRight, p),
ActionWheelX(v) => self.axis(ev, Axs::ActionWheelX, ActionWheelX, v),
ActionWheelY(v) => self.axis(ev, Axs::ActionWheelY, ActionWheelY, v),
Mode(p) => self.button(Btn::Mode, Mode, p),
Lang1(p) => self.button(Btn::Lang1, Lang1, p),
Lang2(p) => self.button(Btn::Lang2, Lang2, p),
Home(p) => self.button(Btn::Home, Home, p),
}
}
}
Expand Down
37 changes: 36 additions & 1 deletion stick/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,22 @@
pub enum Event {
/// Controller unplugged.
Disconnect,
/// Exit / Main / Home / Mode
/// Enter / Carriage Return
Enter(bool),
/// Home Menu (if seperate exit button exists)
Home(bool),
/// Exit / Main / Home / Mode / Back (If seperate button from home)
Exit(bool),
/// Sleep
Sleep(bool),
/// Language 1
Lang1(bool),
/// Language 2
Lang2(bool),
/// Mode
Mode(bool),
/// Eject
Eject(bool),
/// A / 1 / 4 / Circle. Action A (Primary action).
ActionA(bool),
/// B / 2 / 3 / Cross. Action B (Secondary action).
Expand Down Expand Up @@ -341,6 +355,13 @@ impl Event {
0x5D => Event::TrimRight(value != 0.0),
0x5E => Event::ActionWheelX(value),
0x5F => Event::ActionWheelY(value),
0x60 => Event::Enter(value != 0.0),
0x61 => Event::Sleep(value != 0.0),
0x62 => Event::Eject(value != 0.0),
0x63 => Event::Mode(value != 0.0),
0x64 => Event::Lang1(value != 0.0),
0x65 => Event::Lang2(value != 0.0),
0x66 => Event::Home(value != 0.0),
n => Event::Number((n & !0x80) as i8, value != 0.0),
}
}
Expand Down Expand Up @@ -446,6 +467,13 @@ impl Event {
TrimRight(p) => (0x5D, f64::from(u8::from(p))),
ActionWheelX(v) => (0x5E, v),
ActionWheelY(v) => (0x5F, v),
Enter(p) => (0x60, f64::from(u8::from(p))),
Sleep(p) => (0x61, f64::from(u8::from(p))),
Eject(p) => (0x62, f64::from(u8::from(p))),
Mode(p) => (0x63, f64::from(u8::from(p))),
Lang1(p) => (0x64, f64::from(u8::from(p))),
Lang2(p) => (0x65, f64::from(u8::from(p))),
Home(p) => (0x66, f64::from(u8::from(p))),
}
}
}
Expand Down Expand Up @@ -564,6 +592,13 @@ impl std::fmt::Display for Event {
Pinky(p) => write!(f, "Pinky {}", pushed(p)),
ActionWheelX(v) => write!(f, "ActionWheelX {}", v),
ActionWheelY(v) => write!(f, "ActionWheelY {}", v),
Enter(p) => write!(f, "Enter {}", pushed(p)),
Sleep(p) => write!(f, "Sleep {}", pushed(p)),
Eject(p) => write!(f, "Eject {}", pushed(p)),
Mode(p) => write!(f, "Mode {}", pushed(p)),
Lang1(p) => write!(f, "Lang1 {}", pushed(p)),
Lang2(p) => write!(f, "Lang2 {}", pushed(p)),
Home(p) => write!(f, "Home {}", pushed(p)),
}
}
}
22 changes: 22 additions & 0 deletions stick/src/raw/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,24 @@ fn linux_btn_to_stick_event(
pushed: bool,
) {
pending.push(match btn {
0x01C /* KEY_ENTER */ => Event::Enter(pushed),

0x08B /* KEY_MENU */ => Event::Context(pushed),

0x096 /* KEY_SLEEP */ => Event::Sleep(pushed),

0x09E /* KEY_BACK */ => Event::PaddleLeft(pushed),
0x09F /* KEY_FORWARD */ => Event::PaddleRight(pushed),

0x0A1 /* KEY_EJECT */ => Event::Eject(pushed),

0x0D4 /* KEY_MODE */ => Event::Mode(pushed),

0x0F1 /* KEY_LANG2 */ => Event::Lang2(pushed),
0x0F2 /* KEY_LANG1 */ => Event::Lang1(pushed),

0x100 /* BTN_MIC_PUSH */ => Event::MicPush(pushed),

0x120 /* BTN_TRIGGER */ => Event::Trigger(pushed),
0x121 /* BTN_THUMB */ => Event::ActionM(pushed),
0x122 /* BTN_THUMB2 */ => Event::Bumper(pushed),
Expand Down Expand Up @@ -69,6 +82,15 @@ fn linux_btn_to_stick_event(
0x13F /* BTN_PINKYR */ => Event::PinkyRight(pushed),
0x140 /* BTN_PINKYL */ => Event::PinkyLeft(pushed),

0x16A /* BTN_THROTTLE */ => Event::ThrottleButton(pushed),

0x16E /* BTN_HOME */ => Event::Home(pushed),

0x179 /* BTN_LANDING_GEAR_SILENCE */ => Event::LandingGearSilence(pushed),

0x192 /* BTN_CHINA_FORWARD */ => Event::ChinaForward(pushed),
0x193 /* BTN_CHINA_BACKWARD */ => Event::ChinaBackward(pushed),

0x220 /* BTN_DPAD_UP */ => Event::Up(pushed),
0x221 /* BTN_DPAD_DOWN */ => Event::Down(pushed),
0x222 /* BTN_DPAD_LEFT */ => Event::Left(pushed),
Expand Down
7 changes: 7 additions & 0 deletions xtask/src/sdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ fn name_to_hex(name: &str) -> &str {
"TrimRight" => "5D",
"ActionWheelX" => "5E",
"ActionWheelY" => "5F",
"Enter" => "60",
"Sleep" => "61",
"Eject" => "62",
"Mode" => "63",
"Lang1" => "64",
"Lang2" => "65",
"Home" => "66",
_unknown => panic!("Unknown: {}", _unknown),
}
}
Expand Down