|
|
#1 |
|
Connoisseur
![]() Posts: 59
Karma: 14
Join Date: Dec 2021
Device: kindle PW3
|
Kindle brightness remote ( USB or Bluetooth )
Hello,
I have some older kindles that I found for cheap in a thrift store and I would like to use them in an installation we are preparing. For this to work as we are planning it, I 'd need to be able to control the kindle's brightness and power-on remotely. Preferably via Bluetooth but I guess USB seems to be possible as well? I have found Kindle Lazy ( https://github.com/llakssz/KindleLazy ) so far, but maybe there are some other ways as well? As for the power-on, it might not work when the kindle is off but we are thinking about a mechanincally controlled magnet which would actuate the kindle magnet switch. Thanks for all help! |
|
|
|
|
|
#2 |
|
rm -rf /
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
|
Not enough info here, we'd need to hear more about your intended use case before being able to assist more.
|
|
|
|
|
|
#3 |
|
Connoisseur
![]() Posts: 59
Karma: 14
Join Date: Dec 2021
Device: kindle PW3
|
Hello and thanks for replying.
- The Kindles I have here are two jailbroken PW2s ( B0D4 ) with Fw 5.10.3 and one PW1 ( B024 ) - I was hoping to be able to run the devices on power from an usb power supply. - The "power-on" would mean "waking up" like the cover or the button would do. - The preferred connectivity would be wifi as I am planning to be able to read and display data ( letters and numbers ) from an udp connection as well, which I hope to be able to display on screen via a simple dynamic website or similar. an option would be to connect the external brightness buttons via an arduino working as a mock usb-keyboard. Thanks! |
|
|
|
|
|
#4 |
|
rm -rf /
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
|
I got bored and wrote a quick script that should handle your use case:
Code:
import subprocess
from http.server import *
class KindleLipcHandler(BaseHTTPRequestHandler):
def _set_backlight_level(self, level):
subprocess.run(
f"lipc-set-prop com.lab126.powerd flIntensity {level}",
shell=True
)
def _get_backlight_level(self):
level = subprocess.check_output(
"lipc-get-prop com.lab126.powerd flIntensity",
shell=True
)
return int(level.strip().decode())
def _wakeup(self):
subprocess.run(
"lipc-set-prop com.lab126.powerd wakeUp 1",
shell=True
)
def handle_backlight(self, path_tokens):
action = path_tokens[-1]
current_level = self._get_backlight_level()
new_level = current_level
if action == "up":
if current_level < 24:
new_level = current_level + 1
elif action == "down":
if current_level > 0:
new_level = current_level - 1
elif action.isdigit():
if int(action) in range(0,25):
new_level = int(action)
if new_level != current_level:
self._set_backlight_level(new_level)
return 1
return 0
def handle_wake(self):
self._wakeup()
return 1
def do_GET(self):
path_tokens = self.path.split("/")
t_len = len(path_tokens)
ret = 0
if t_len == 3:
if path_tokens[1] == "backlight":
ret = self.handle_backlight(path_tokens)
elif t_len == 2:
if path_tokens[1] == "wake":
ret = self.handle_wake()
if ret:
self.send_response(200)
else:
self.send_response(500)
self.send_header("Content-type", "text/html")
self.end_headers()
if ret:
res = "<html>OK</html>"
else:
res = "<html>FAIL</html>"
self.wfile.write(res.encode())
def run(server_class=HTTPServer, handler_class=KindleLipcHandler):
server_address = ('', 8000)
httpd = server_class(server_address, handler_class)
httpd.serve_forever()
run()
To run it, install NiLuJe's build of Python3 from here, save the script above to /mnt/us/server.py and run nohup python3 /mnt/us/server.py & from a shell using SSH. You'll probably need to open port 8000 on the firewall of the Kindle before you can call the endpoints over WiFi. Last edited by katadelos; 12-10-2021 at 09:42 PM. |
|
|
|
|
|
#5 |
|
Connoisseur
![]() Posts: 59
Karma: 14
Join Date: Dec 2021
Device: kindle PW3
|
Oh. Wow. Thanks so much.
As a general question: I have experience with python, apache, linux and bsd but not with the kindle yet. Is there a compendium of kindle-os specific info? so that I dont have to ask too many questions and can find out on my own? my next step would be to connect to and read udp data and/or to connect to and read from signal k running on a raspberry on the same network. Thanks a lot! |
|
|
|
|
|
#6 | |
|
rm -rf /
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
|
Quote:
Broadly speaking, the Kindle OS consists of a (usually ancient) Linux kernel and a userland that would have been considered really modern circa ~2011. Reading a few books on embedded Linux from that era will give you a good idea of how things work internally. |
|
|
|
|
|
|
#7 | |
|
Member
![]() Posts: 10
Karma: 16
Join Date: Oct 2021
Device: kindle: Voyage, Paperwhite3
|
Quote:
![]() I use this method to turn pages and exec some other commands with remote dongle. |
|
|
|
|
|
|
#8 | |
|
Connoisseur
![]() Posts: 59
Karma: 14
Join Date: Dec 2021
Device: kindle PW3
|
Quote:
|
|
|
|
|
|
|
#9 |
|
Connoisseur
![]() Posts: 59
Karma: 14
Join Date: Dec 2021
Device: kindle PW3
|
Hello.
Finally came about to testing the script. it works fine if the endpoint ist corrected to: http://{device_ip}/backlight/ instead of http://{device_ip}/brightness/ Thanks again! |
|
|
|
|
|
#10 |
|
Connoisseur
![]() Posts: 59
Karma: 14
Join Date: Dec 2021
Device: kindle PW3
|
Also:
If I want to start this script on boot and keep it alive if it should crash, is this best done with cron? |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| KindleLazy - remote control page turns + brightness | zxczxc | Kindle Developer's Corner | 333 | 01-06-2024 11:51 PM |
| best solution for remote page turns? phone? bluetooth selfie remote? bluetooth mouse | arooni | Onyx Boox | 2 | 09-13-2021 09:07 PM |
| Bluetooth remote for android? | Blackheart | Android Devices | 15 | 08-09-2017 10:58 AM |
| Bluetooth remote control | mxadler | Marvin | 8 | 11-13-2014 08:53 AM |
| 602 bluetooth function as remote control for lego NXT brick | dagplaytune | PocketBook | 3 | 03-08-2011 11:27 AM |