profile
viewpoint
ember arlynx emberian potsdam, ny https://lunar.town a rustacean! a resident of lunar.town
 not as much of a fan of github as i used to be, ngl...

brendanzab/gl-rs 642

An OpenGL function pointer loader for Rust

brendanzab/color-rs 43

A library that provides types and conversions for working with various color formats.

brendanzab/sax-rs 12

DEPRECATED - use https://github.com/netvl/rust-xml/ instead.

blas-lapack-rs/netlib-src 4

Source of BLAS and LAPACK via Netlib

emberian/alexandria 3

Central repository for the Alexandria project

emberian/blake2 3

Git "mirror" of the BLAKE2 code package from blake2.net

emberian/automatafl 1

An implementation of the Automatafl table-top game

PR merged emberian/evdev

Reviewers
Add FreeBSD tester to CI
+19 -0

3 comments

1 changed file

jeff-hiner

pr closed time in 8 days

push eventemberian/evdev

Jeff Hiner

commit sha d34a4d994415bcc5dcc2007fce4cdb6a30bc2491

Add FreeBSD tester to CI

view details

ember arlynx

commit sha 4c2b3196ab9ccf00400e19e698265412091c0a1e

Merge pull request #86 from emberian/freebsd_ci

view details

push time in 8 days

push eventemberian/pdo.sd4

ember arlynx

commit sha 94d791c11db9debaa7334e3443a52d7112c8cc80

Create README.md

view details

push time in 10 days

push eventemberian/esgea

ember arlynx

commit sha 335e5251cf22d10f48b618afda7ee51ab073640c

Create README.md

view details

push time in 19 days

create barnchemberian/esgea

branch : main

created branch time in 19 days

created repositoryemberian/esgea

created time in 19 days

create barnchemberian/absass

branch : master

created branch time in 19 days

created repositoryemberian/absass

created time in 19 days

push eventCOSI-Lab/book

ember arlynx

commit sha 36c09ba439cd19f374da39733dc9c6cc27a29313

document hbox existence

view details

push time in 19 days

push eventCOSI-Lab/book

ember arlynx

commit sha 727507df2915df2ccfc20fc4a4407a39e450aea1

hbox is 128.153.145.179

view details

push time in 19 days

PR merged emberian/evdev

Reviewers
Public interface and Typesytem refactor

I know this PR is kind of big and it breaks the whole public interface, but I think the changes are at least worth a discussion. Also I wanted to learn Rust.

My goal was to make the Interface more consistent and improve ergonomics.

Added

  • Create a ...Event struct for each EventType to hold the InputEvent
    • Guarantee that each ...Event struct can only hold a InputEvent of the corresponding EventType
  • Demonstrate what the FFEvent does in the force_feedback example.

Changed

  • Consistent naming and structure of all new-types for event-codes
    • Some of them where previously named ...Type now they are all named ...Code
    • Rename InputEventKind to EventSummary
    • Created missing EventSummary variants. I know some of them are kind of unused but it is less confusing if they are all there and look the same.
    • Each variant of the EventSummary enum now has the structure Variant(...Event, ...Type, value)
    • Renamed Key struct (the one with all the Key constants) to KeyCode to keep the naming consistent!
  • Rename InputEvent::kind to InputEvent::destructure this now returns a EventSummary
  • InputEvent::new no longer takes the EventType but u16 as first argument. If the EventType is known we can directly construct the correct variant.
  • Ensure the unsafe code still does what we expect.
  • Update the Examples.

Fixed

  • Update VirtualDevice::fetch_events to yield InputEvents instead of UInputEvents. That was a bug which was not accounted for be the type system. Yielding UInputEvents there will now panic.

I think except for the name changes and some structure changes in the InputEventKind enum all existing code should still work with only minor changes.


I would greatly appreciate any feedback as I just started learning Rust a week ago.

The changes are mainly based on my experience working with pyton-evdev on InputRemapper. I would like see these or similar changes merged, as I think it will help me working on a project similar to InputRemapper.

+709 -430

4 comments

17 changed files

jonasBoss

pr closed time in 20 days

push eventemberian/evdev

Jonas Bosse

commit sha 7e48ed6c5c3aafc5fa8665121daf93e41b13cec3

draft InputEvent enum

view details

Jonas Bosse

commit sha 65fa22623cc55c16d1fbd0342f6963bf9e8d10b1

more consistant naming for InputEventKind

view details

Jonas Bosse

commit sha dc7dc09eca938c512a3f5a5bb53590a7745eb367

finalized new typesystem. I Hope!

view details

Jonas Bosse

commit sha c223f32abe928b03342bd75cb49deee7db9f2380

fix uinput

view details

Jonas Bosse

commit sha 6e7daed5f271b3da06752f80050479414b977951

fix raw_stream

view details

Jonas Bosse

commit sha 4e8a90ee659763d363de09f0336189e9922b4fa3

fix sync_stream

view details

Jonas Bosse

commit sha 50ade9eef06450710b9397f9145b5fe2384439e4

fix typing bug in uinput

view details

Jonas Bosse

commit sha 2e87139ceba74e8e453348f67764b7229e409166

reexport event_variants

view details

Jonas Bosse

commit sha c1e5cde49aa58a9db8c9213fcf1e5214a30603f5

some FF related fixes

view details

Jonas Bosse

commit sha 597971d468ac1e8e6065abcef9fbdb65c97698c0

change InputEventKind to include the 'unwrapped' InputEvent

view details

Jonas Bosse

commit sha ea90e2cebde26a266a5e038b4bfcfcec30fe8e28

update virtual_ff example

view details

Jonas Bosse

commit sha d1a955ad7efcc4b1d95c4af3dc7feb88c0307ca4

serde and tokio 'fix'

view details

Jonas Bosse

commit sha a022e8d016cc589fcc57af471b27eb7b52585702

added convinience enum to match input event variants

view details

Jonas Bosse

commit sha 85488fd05c5098aed8ec9b5a3876eaf31c4368fb

use EvdevEvent trait when passing events into the lib

view details

Jonas Bosse

commit sha 03289dfd4298dbeb47d021b173860d829bdf9b94

update virtual_keyboard

view details

Jonas Bosse

commit sha cf5530c04b32c7f6b75a791bf31c25892c8d5758

update virtual_ff

view details

Jonas Bosse

commit sha eb84ea0e296f826d9c43a63ac028c7d08361bd48

update virtual_joystick

view details

Jonas Bosse

commit sha 446f2bb4294e687d4de41c76b4e43b80fc1920a7

update virtual_ff

view details

Jonas Bosse

commit sha 4c28f85720487acacf7dd2f37512f715e29b31e4

update force_feedback

view details

Jonas Bosse

commit sha 774a98623d671fbfbe85917159e6bb2afe4fb34c

update blink_keyboard_leds

view details

push time in 20 days

pull request commentemberian/evdev

Public interface and Typesytem refactor

this is looking awesome, thank you for your work here! let's get it merged and think about what we might want for a 1.0

jonasBoss

comment created time in 20 days

Pull request review commentemberian/evdev

Public interface and Typesytem refactor

 impl UinputAbsSetup { /// /// The meaning of the "code" and "value" fields will depend on the underlying type of event. #[derive(Copy, Clone)]-#[repr(transparent)]-pub struct InputEvent(input_event);--impl InputEvent {-    /// Returns the timestamp associated with the event.-    #[inline]-    pub fn timestamp(&self) -> SystemTime {-        timeval_to_systime(&self.0.time)-    }--    /// Returns the type of event this describes, e.g. Key, Switch, etc.-    #[inline]-    pub fn event_type(&self) -> EventType {-        EventType(self.0.type_)-    }+pub enum InputEvent {+    /// [`SynchronizationEvent`]+    Synchronization(SynchronizationEvent),+    /// [`KeyEvent`]+    Key(KeyEvent),+    /// [`RelativeAxisEvent`]+    RelativeAxis(RelativeAxisEvent),+    /// [`AbsoluteAxisEvent`]+    AbsoluteAxis(AbsoluteAxisEvent),+    /// [`MiscEvent`]+    Misc(MiscEvent),+    /// [`SwitchEvent`]+    Switch(SwitchEvent),+    /// [`LedEvent`]+    Led(LedEvent),+    /// [`SoundEvent`]+    Sound(SoundEvent),+    /// [`RepeatEvent`]+    Repeat(RepeatEvent),+    /// [`FFEvent`]+    ForceFeedback(FFEvent),+    /// [`PowerEvent`]+    Power(PowerEvent),+    /// [`FFStatusEvent`]+    ForceFeedbackStatus(FFStatusEvent),+    /// [`UInputEvent`]+    UInput(UInputEvent),+    /// [`OtherEvent`]+    Other(OtherEvent),+} -    /// Returns the raw "code" field directly from input_event.-    #[inline]-    pub fn code(&self) -> u16 {-        self.0.code-    }+macro_rules! call_at_each_variant {+    ($self:ident, $method:ident $(, $args:expr)*) => {+        match $self {+            InputEvent::Synchronization(ev) => ev.$method($($args),*),+            InputEvent::Key(ev) => ev.$method($($args),*),+            InputEvent::RelativeAxis(ev) => ev.$method($($args),*),+            InputEvent::AbsoluteAxis(ev) => ev.$method($($args),*),+            InputEvent::Misc(ev) => ev.$method($($args),*),+            InputEvent::Switch(ev) => ev.$method($($args),*),+            InputEvent::Led(ev) => ev.$method($($args),*),+            InputEvent::Sound(ev) => ev.$method($($args),*),+            InputEvent::Repeat(ev) => ev.$method($($args),*),+            InputEvent::ForceFeedback(ev) => ev.$method($($args),*),+            InputEvent::Power(ev) => ev.$method($($args),*),+            InputEvent::ForceFeedbackStatus(ev) => ev.$method($($args),*),+            InputEvent::UInput(ev) => ev.$method($($args),*),+            InputEvent::Other(ev) => ev.$method($($args),*),+        }+    };+} -    /// A convenience function to return `self.code()` wrapped in a certain newtype determined by-    /// the type of this event.+impl InputEvent {+    /// A convenience function to return the `self.code()` wrapped in a+    /// certain newtype corresponding to the `InputEvent` variant.     ///-    /// This is useful if you want to match events by specific key codes or axes. Note that this-    /// does not capture the event value, just the type and code.+    /// This is useful if you want to match events by specific key codes or axes.+    /// Note that this does not capture the event value, just the type and code.+    ///+    /// # Example+    /// ```+    /// use evdev::*;+    /// let event =  InputEvent::new(1, KeyType::KEY_A.0, 1);+    /// match event.kind() {+    ///     InputEventKind::Key(KeyType::KEY_A) =>+    ///         println!("Matched KeyEvent of type {:?}", KeyType::KEY_A),+    ///     _=> panic!(),+    /// }+    /// ```     #[inline]     pub fn kind(&self) -> InputEventKind {-        let code = self.code();-        match self.event_type() {-            EventType::SYNCHRONIZATION => InputEventKind::Synchronization(Synchronization(code)),-            EventType::KEY => InputEventKind::Key(Key::new(code)),-            EventType::RELATIVE => InputEventKind::RelAxis(RelativeAxisType(code)),-            EventType::ABSOLUTE => InputEventKind::AbsAxis(AbsoluteAxisType(code)),-            EventType::MISC => InputEventKind::Misc(MiscType(code)),-            EventType::SWITCH => InputEventKind::Switch(SwitchType(code)),-            EventType::LED => InputEventKind::Led(LedType(code)),-            EventType::SOUND => InputEventKind::Sound(SoundType(code)),-            EventType::FORCEFEEDBACK => InputEventKind::ForceFeedback(code),-            EventType::FORCEFEEDBACKSTATUS => InputEventKind::ForceFeedbackStatus(code),-            EventType::UINPUT => InputEventKind::UInput(code),-            _ => InputEventKind::Other,+        match self {+            InputEvent::Synchronization(ev) => InputEventKind::Synchronization(ev.kind()),+            InputEvent::Key(ev) => InputEventKind::Key(ev.kind()),+            InputEvent::RelativeAxis(ev) => InputEventKind::RelativeAxis(ev.kind()),+            InputEvent::AbsoluteAxis(ev) => InputEventKind::AbsoluteAxis(ev.kind()),+            InputEvent::Misc(ev) => InputEventKind::Misc(ev.kind()),+            InputEvent::Switch(ev) => InputEventKind::Switch(ev.kind()),+            InputEvent::Led(ev) => InputEventKind::Led(ev.kind()),+            InputEvent::Sound(ev) => InputEventKind::Sound(ev.kind()),+            InputEvent::Repeat(ev) => InputEventKind::Repeat(ev.kind()),+            InputEvent::ForceFeedback(ev) => InputEventKind::ForceFeedback(ev.kind()),+            InputEvent::Power(ev) => InputEventKind::Power(ev.kind()),+            InputEvent::ForceFeedbackStatus(ev) => InputEventKind::ForceFeedbackStatus(ev.kind()),+            InputEvent::UInput(ev) => InputEventKind::UInput(ev.kind()),+            InputEvent::Other(ev) => InputEventKind::Other(ev.kind()),         }     } -    /// Returns the raw "value" field directly from input_event.+    /// A convenience function to return the `InputEvent` its `kind()` and `value()` wrapped in a+    /// certain newtype corresponding to the `InputEvent` variant.     ///-    /// For keys and switches the values 0 and 1 map to pressed and not pressed respectively.-    /// For axes, the values depend on the hardware and driver implementation.+    /// # Example+    /// ```+    /// use evdev::*;+    /// let event =  InputEvent::new(1, KeyType::KEY_A.0, 1);+    /// match event.matcher() {+    ///     InputEventMatcher::Key(KeyEvent, KeyType::KEY_A, 1) => (),+    ///     _=> panic!(),+    /// }+    /// ```     #[inline]-    pub fn value(&self) -> i32 {-        self.0.value+    pub fn matcher(self) -> InputEventMatcher {

i'm generally happy to see things like that collapsed out if the API

jonasBoss

comment created time in 20 days

PullRequestReviewEvent

push eventCOSI-Lab/book

ember arlynx

commit sha aa03ff6498b1ae288ac2ec43e2005344fcbf40a6

add more HW to the equipment list! TODO: includes red links :(

view details

push time in a month

push eventCOSI-Lab/book

ember arlynx

commit sha ca7ad09c93dbfefb6c15d02feac28b4ac8397d49

note existence of imac courtesy of Dubrict Digital

view details

push time in a month

PullRequestReviewEvent

Pull request review commentaxodotdev/oranda

dev mode

 pub struct Serve { }  impl Serve {+    pub fn new(port: Option<u16>) -> Self {+        Serve {+            port: port.unwrap_or(7979),
            port: port.or_else(Dev::default().port)

if this works, this is still a little noisy to me compared to 7979 but might be nice? wdyt?

ashleygwilliams

comment created time in 2 months

Pull request review commentaxodotdev/oranda

dev mode

+use std::path::PathBuf;++use clap::Parser;++use crate::commands::{Build, Serve};+use oranda::errors::*;++#[derive(Debug, Parser)]+pub struct Dev {+    #[arg(long, default_value = "7979")]

nice

ashleygwilliams

comment created time in 2 months

PullRequestReviewEvent

pull request commentemberian/evdev

Add FreeBSD tester to CI

i think it'd be good, not sure i have much in the way of validation that the crate works on those platforms, but happy to merge this in

jeff-hiner

comment created time in 3 months

pull request commentemberian/evdev

tests: add integration test for virtualdevice

happy to take this into the tree in the meantime :)

waynr

comment created time in 3 months

push eventemberian/evdev

Wayne Warren

commit sha 75a671e0a626077efe695ec519f5cb72609e5cec

tests: add integration test for virtualdevice

view details

ember arlynx

commit sha b17e24781e2de943cd23d2576d376b13f4f8fe31

Merge branch 'master' into test-virtual-device-actually-emits

view details

ember arlynx

commit sha d79336fcb2a93494b9a2d5d952b490bb14f26e29

Merge pull request #63 from waynr/test-virtual-device-actually-emits

view details

push time in 3 months

PR merged emberian/evdev

tests: add integration test for virtualdevice

I noticed after switching to evdev from evdev_rs (mostly for the enumerate method) that the VirtualDevice my code was creating didn't seem to actually emit any input events. I think I've reproduced this in the test case I am including with this PR, but I know very little about Linux evdev or Rust.

I would definitely appreciate any pointers as to how I can get this test case passing. I don't necessarily expect y'all to merge this test but I would be happy to make any changes you require, like making it a unit test in one of the library modules,

Thanks in advance for any help you can provide!

+57 -1

0 comment

2 changed files

waynr

pr closed time in 3 months

push eventwaynr/evdev

Wayne Warren

commit sha 3a425349ec443fcbf144c8f4b0a4e7af6a47547f

RawDevice: introduce system_path() method

view details

Wayne Warren

commit sha e3e7d339bd4e490d459178d7ef237c6c0246505c

Device: introduce system_path() method

view details

Wayne Warren

commit sha 824302d0f65d4298ae3461d081238e96af4ed995

Revert "Device: introduce system_path() method" This reverts commit e3e7d339bd4e490d459178d7ef237c6c0246505c.

view details

Wayne Warren

commit sha 4d957a4dacabf78c3125f26b7de2413ff736b6e4

Revert "RawDevice: introduce system_path() method" This reverts commit 3a425349ec443fcbf144c8f4b0a4e7af6a47547f.

view details

Wayne Warren

commit sha 07095dbbbc32d9075506fb6fbe81e06217b0c069

enumerate should return a tuple, (PathBuf, Device)

view details

Wayne Warren

commit sha 773e8066c5ce1e7899e86da64e6dcdc81884fec2

examples: update _pick_device.rs example

view details

Noa

commit sha 93d8fb23e257a0be6e1c8bce0179123b922514bd

Merge pull request #62 from waynr/enable-showing-system-path enable getting system path for Device

view details

Noa

commit sha fd6c65154ba42988914988ca34ae6ce87254a04f

Implement FromIterator for AttributeSet

view details

Noa

commit sha 372d000c21b1ff7f47a16c10fb9859d04e885bcd

Release 0.11.5

view details

Matthew Broadway

commit sha 71a983bdb2a2a71042d0bc7d16f2bfba5fc13530

formatting and linting changes

view details

Matthew Broadway

commit sha 4e3e418d05ba4bf8b283ed95069d87dac073ff5e

small documentation improvements

view details

Matthew Broadway

commit sha 2597ec87e249a0a04c977ad2152227fbc9815714

removed empty module

view details

Matthew Broadway

commit sha db336f94977096475bc0f7ea1cd90795c34b9a86

added cargo fmt and clippy to CI

view details

Matthew Broadway

commit sha 1a661e6cbbb3a7f63abb272271158a603fda0bf1

updated dependencies and rust edition

view details

Matthew Broadway

commit sha 0a0e211e50f2dca3ab451b4b6bb1f512954b9b0e

upload docs for stable

view details

Matthew Broadway

commit sha 83dd20242d5398ecdbd7f6231059e0366fb8821f

added quotes around constant

view details

Matthew Broadway

commit sha b1b6b80c1609a0d5112a3aeac85ac622ea5dded7

added BSD to CI

view details

Matthew Broadway

commit sha 866216d00b7a3d96c125634a82d096157a5ff867

allow build failure on freebsd

view details

Matthew Broadway

commit sha 49473499e8974f0c17d2ae64d064bd0bb7c3b1b7

organised README and added more details to documentation

view details

Matthew Broadway

commit sha da9aad006195e8f6c2cf87866f8a0d2330ec28cf

cargo fmt

view details

push time in 3 months

PullRequestReviewEvent

pull request commentemberian/evdev

Add FreeBSD tester to CI

oo

jeff-hiner

comment created time in 3 months

more