Open sunshinetech007 opened 5 years ago
Nice idea, I never thought about this. Maybe because I (like most people) rarely reboot their kindle so it's not a big problem to start KindleLazy after each reboot. I would presonally ask at mobileread and see what advice the kindle/unix gurus give, maybe it's something simple just being overlooked?
Maybe the /dev/input/event2 device simply isn't ready at that time KindleLazy is started? That's all I can assume from the error message. Maybe it's possible with udev to make it run only after the input device is ready?
I guess it's possible to do a little investigation using the script.sh file, for example seeing if you can see if the event2 device is readable/exists at that time.
Ok I'll post there. I do think it's a timing issue and some things just are not loaded yet, and udev is sensitive about how long a script runs so I can't wait forever. One workaround is to use the "at" command to hand off script execution from udev, but that command doesn't seem to be present on the kindle. I downloaded some other arm linux distros and couldn't find "at", either.
So you said you only start kindlelazy after a reboot....whenever my kindle goes to sleep and I wake it up, I have to restart kindlelazy. Does yours stay functional as long as you don't restart it?
After it sleeps and I wake it up, everything is working technically. modules are there, events get keycodes, and kindlelazy process is present, but it won't turn the page until I go start it again. That's what I was trying to avoid with this.
Ok, I got it to work! See mobileread thread for the info if you're interested. Any interest in adding the changes here? Not sure how that works since you files have to be placed outside of /mnt/us and can't just be dropped in /mnt/us/extensions. The trick for XOpenDisplay to work under udev context was to export a display variable. Also I had to start one script, then hand off to "start.sh &" for some reason. I don't know why. Other main changes were adding some timing, and using kill -9 instead of killall. Killall wouldn't terminate process started under the udev context.
Cool that you got some progress. I'll take a look. It's only loading KindleLazy at boot, right? Or does this method make it happen at every 'wake', making it so we no longer need to run manually KindleLazy ever again? Because that would be the best thing! Kill at screen off, and start at screen on.
EDIT -- Ah, my mistake. The clue is in the word udev rules, so this runs when you plug the presenter in, fantastic!!
My kindle works exactly the same as your regarding KindleLazy, it needs to be started/restarted every once in a while etc. I haven't used it in a while to be honest so I forget the exact way to use it!
yeah so far with my testing, it loads and unloads itself under every scenario properly - definitely not for just at bootup. It loads and unloads upon wake, sleep, plug in, unplug. I have not had to manually start it once for any reason yet.
For anyone interested, the final script written by OP is here: https://www.mobileread.com/forums/showpost.php?p=3815253&postcount=261 I did some real search to find it.
Ok one more thing :) I've been trying to get KindleLazy to autostart, but it wont' start when calling start.sh from udev. It works fine if I run start.sh on the command line. It works fine if I run it from a different script. I've added some logging stuff to try and troubleshoot. Here is my start.sh at this point.
It works just fine using [root@kindle bin]# ./start.sh - I get this output:
When I call start.sh from a udev rule, I get this:
My udev rule is this, and it works fine and calls the script every time.
I tried putting a 2nd script in the KindleLazy directory that then calls bin/start.sh, because it looks like that's how the UI calls it, but that didn't help either. Calling the exact same full path to the script /mnt/us/extensions/KindleLazy/bin/start.sh also works, as long as it's command line.
The modules are all loaded.
The character devices are all there and they work.
The only difference I can find is that $USER is root at all times except when i'm calling start.sh from udev and then get the ERROR opening evdev2 device. I'm at a loss :/