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

Mouse detection bug #20

Open
skiv71 opened this issue Aug 14, 2023 · 11 comments
Open

Mouse detection bug #20

skiv71 opened this issue Aug 14, 2023 · 11 comments

Comments

@skiv71
Copy link

skiv71 commented Aug 14, 2023

Hi, great application!

I've noticed a bug when deploying this application in fydeos, but on reviewing the source, I see a possible bug in the -M choices 0,1,2.

I've not seen this issue on fedora, ubuntu etc and even brunch, but I think it must be down to the driver being used.

Basically, in 0 (default) the code was missing my: -

/dev/input/by-id/pci-0000:00:15.0-platform-i2c_designware.0-event-mouse -> ../event9

I think it relates to https://github.com/alexmohr/keyboard-backlight/blob/master/kbd_backlight.cpp#L473

I was able to workaround by specifying -m 1 (internal only), but really, option 0 should pick this up.

@alexmohr
Copy link
Owner

you can try the following patch

diff --git a/kbd_backlight.cpp b/kbd_backlight.cpp
index a964be4..602cf0c 100644
--- a/kbd_backlight.cpp
+++ b/kbd_backlight.cpp
@@ -476,7 +476,7 @@ int main(int argc, char **argv) {
 						  "/dev/input/",
 						  std::regex(".*mice.*"),
 						  inputDevices);
-	  break;
+	  [[fallthrough]];
 	case INTERNAL:
 	  get_devices_in_path(ignoredDevices,
 						  "/dev/input/by-path",

@skiv71
Copy link
Author

skiv71 commented Aug 14, 2023

Sorry, I'm not actually sure how to apply this. I added the fallthrough manually and compiled, but it did not work as hoped.

Did I miss something?

@alexmohr
Copy link
Owner

Did you also remove the break?

@skiv71
Copy link
Author

skiv71 commented Aug 14, 2023

Ah no, which looking at it now, is the same change I was gonna hack myself to fix it. Good ol' switch statements.

I'll try it soon, but I'm sure it'll work

@skiv71
Copy link
Author

skiv71 commented Aug 14, 2023

Yea, that works fine

@skiv71
Copy link
Author

skiv71 commented Oct 19, 2023

Hi Alex, wonder if you can please assist me again? I'm trying to get this working on chrome os flex... and I can for keyboard detection... but the OS doesn't implement the /dev/input/by-path directory.

I have found the event file (/dev/input/event5) and I've found the device in /sys/class/input/input6, but I'm not sure how to modify the search to get it to read the events?

I've tried /dev/input with regex .event5 but it doesn't work :(

@alexmohr
Copy link
Owner

in this line https://github.com/alexmohr/keyboard-backlight/blob/master/kbd_backlight.cpp#L477
replace std::regex(".*mice.*"), with std::regex("event5")
This should detect mouse events in /dev/input/event5
If you need more than 1 event file you can detect multiple files by adding multiple regex conditions
std::regex("event[5,10,1]") to detect events in event5, event10andevent1`
Mouse detection mode must be set to 'all'

@alexmohr
Copy link
Owner

alexmohr commented Oct 20, 2023

I'm not sure if this is what you've done already. If it is make sure event5 is actually the correct event file.
Do you get any errors?
If not please enable debug output by running cmake -DDEBUG_LEVEL=-g3 -DCMAKE_BUILD_TYPE=Debug
Then start the application in foreground mode (-f) and post the output here

@skiv71
Copy link
Author

skiv71 commented Oct 20, 2023

Hey... thanks for reply. I actually tried that last night, with no joy.

I know event5 is the right device file as if I cat it, touchpad input fills the screen.

I'll build it again now with debug and get back to you... thanks

@skiv71
Copy link
Author

skiv71 commented Oct 20, 2023

Ok, this is what I have... I used options -f -m 0

/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:454: Parsing options...
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:465: Using backlight device: /sys/class/leds/tpacpi::kbd_backlight/brightness
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:467: Getting keyboards...
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="sleep button"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="lid switch"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="power button"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:178: Detected keyboard: n: name="at translated set 2 keyboard"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:194: Added keyboard
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="syna8017:00 06cb:ceb2 mouse"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="syna8017:00 06cb:ceb2 touchpad"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="video bus"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="intel hid events"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="thinkpad extra buttons"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="tpps/2 elan trackpoint"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="sof-hda-dsp mic"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="sof-hda-dsp headphone"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="sof-hda-dsp hdmi/dp,pcm=3"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="sof-hda-dsp hdmi/dp,pcm=4"
/home/chronos/user/Downloads/keyboard-backlight-master/kbd_backlight.cpp:180: Ignoring non keyboard device: n: name="sof-hda-dsp hdmi/dp,pcm=5"

@alexmohr
Copy link
Owner

Hmm I don't have any idea why it fails. I created a chrome-os-flex-debug with more logs. If you can repeat the test with this branch we might get an idea why it fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants