Add FF to InputEventKind

This commit is contained in:
hodasemi 2022-01-30 14:55:41 +01:00
parent 4d2edf8d16
commit a6452d1858

View file

@ -114,6 +114,9 @@ pub enum InputEventKind {
Switch(SwitchType), Switch(SwitchType),
Led(LedType), Led(LedType),
Sound(SoundType), Sound(SoundType),
ForceFeedback(FFEffect),
ForceFeedbackStatus(FFStatusDataIndex),
Repeat(RepeatType),
Other, Other,
} }
@ -166,6 +169,11 @@ impl InputEvent {
EventType::SWITCH => InputEventKind::Switch(SwitchType(code)), EventType::SWITCH => InputEventKind::Switch(SwitchType(code)),
EventType::LED => InputEventKind::Led(LedType(code)), EventType::LED => InputEventKind::Led(LedType(code)),
EventType::SOUND => InputEventKind::Sound(SoundType(code)), EventType::SOUND => InputEventKind::Sound(SoundType(code)),
EventType::FORCEFEEDBACK => InputEventKind::ForceFeedback(FFEffect(code)),
EventType::FORCEFEEDBACKSTATUS => {
InputEventKind::ForceFeedbackStatus(FFStatusDataIndex(code))
}
EventType::REPEAT => InputEventKind::Repeat(RepeatType(code)),
_ => InputEventKind::Other, _ => InputEventKind::Other,
} }
} }
@ -252,7 +260,9 @@ pub struct EnumerateDevices {
impl Iterator for EnumerateDevices { impl Iterator for EnumerateDevices {
type Item = (PathBuf, Device); type Item = (PathBuf, Device);
fn next(&mut self) -> Option<(PathBuf, Device)> { fn next(&mut self) -> Option<(PathBuf, Device)> {
self.inner.next().map(|(pb, dev)| (pb, Device::from_raw_device(dev))) self.inner
.next()
.map(|(pb, dev)| (pb, Device::from_raw_device(dev)))
} }
} }