sammko / airplaned

Userspace airplane mode manager for linux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eventXX changing on every reboot

MicroDroid opened this issue · comments

Event codes change from reboot to reboot and thus that's not a reliable way for persistent configuration. We need to have another way of identifying the thing

Yeah. This is essentially what proved too annoying for me to continue. I came up with parsing /proc/bus/input/devices. The devices with a rfkill handler are the interesting ones. (For some reason, there can be multiple of them). However, I'm not sure whether we should depend on the rfkill handler being listed. The other option is to parse the KEY bitset. (I don't have my laptop avaiable, nor do I feel like reading the source right now, but IIRC, one of the bits in the 3rd number from the end of the line is the relevant one.) I really didn't feel like writing that up in C at the time, so I just gave up. Feel free to do it, it shouldn't be too difficult. I might get back to this project myself, one day.

Ah. I just read the README. Probably the easiest option would be to put the desired device name in a #define and find it in /proc/bus/input/devices. Not a general solution across devices (or maybe manufacturers, if we are lucky) but I'm willing to live with that. Maybe write a small script to wait for a push of the rfkill button a report the device name it came from to simplify the hunt for users of different devices. It's easier to implement than listening for events on all devices with the rfkill key, out of which all but one are probably useless.

That makes sense. Listening to all devices with the rfkill event might make sense, because, even if there are multiple devices, if they have the rfkill event, then they probably do for a good reason.

That's one way to look at it.
Another is that it's just an oversight in some driver somewhere (That's what I think it is).
And another is that maybe there are other sources for the event, but since I (the user) don't know what causes them in the first place, I don't want the system to react to them. (Maybe the EC likes to generate airplane mode button events when it feels like it, but do I want my system to react to that?)

I'm not sure what the correct decision here is, but I would probably just go with what I described in my previous comment. In any case, I won't have time for this project for the next few weeks at a minimum, so you won't be seeing any implementation from me anytime soon.

It's exactly the same for me, plus I have no idea how to implement such a thing either yet. So probably attach a help wanted label or something on this issue for now 🤔