Created
October 4, 2022 15:17
-
-
Save warewolf/4b09c257ffdb28523b576fe9a138b393 to your computer and use it in GitHub Desktop.
rmview hack from commit 396acde73d84bf6b428f549b378c9be472aa7906
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/rmview/connection.py b/src/rmview/connection.py | |
index 7c92473..3fa8ddc 100644 | |
--- a/src/rmview/connection.py | |
+++ b/src/rmview/connection.py | |
@@ -174,16 +174,22 @@ class rMConnect(QRunnable): | |
return | |
try: | |
log.info('Connecting...') # pkey=key, | |
- self.client.connect(self.address, **self.options) | |
+ # self.client.connect(self.address, **self.options) | |
log.info("Connected to {}".format(self.address)) | |
self.client.hostname = self.address | |
- self.client.deviceVersion, self.client.fullDeviceVersion = self._getVersion() | |
- self.client.softwareVersion = self._getSwVersion() | |
+ #self.client.deviceVersion, self.client.fullDeviceVersion = self._getVersion() | |
+ #self.client.deviceVersion = "2.0" | |
+ self.client.deviceVersion = 2 | |
+ self.client.fullDeviceVersion = "reMarkable 2.0" | |
+ #self.client.softwareVersion = self._getSwVersion() | |
+ self.client.softwareVersion = 20220519120030 | |
self.signals.onConnect.emit(self.client) | |
+ | |
except Exception as e: | |
log.error("Could not connect to %s: %s", self.address, e) | |
log.info("Please check your remarkable is connected and retry.") | |
self.signals.onError.emit(e) | |
+ | |
try: | |
if self._known_hosts and os.path.isfile(self._known_hosts): | |
self.client.save_host_keys(self._known_hosts) | |
diff --git a/src/rmview/rmview.py b/src/rmview/rmview.py | |
index 2643c1e..fd6b3e1 100644 | |
--- a/src/rmview/rmview.py | |
+++ b/src/rmview/rmview.py | |
@@ -311,6 +311,7 @@ class rMViewApp(QApplication): | |
return | |
backend = self.config.get('backend', 'auto') | |
+ rmuserid = self.config.get('rmuserid', 'auto') | |
if backend == 'auto': | |
if ssh.softwareVersion >= SW_VER_TIMESTAMPS['2.9']: | |
backend = 'screenshare' | |
@@ -321,7 +322,7 @@ class rMViewApp(QApplication): | |
log.info("Using backend '%s'", backend) | |
if backend == 'screenshare': | |
- self.fbworker = ScreenShareStream(ssh) | |
+ self.fbworker = ScreenShareStream(ssh,rmuserid) | |
# does not support key/pointer events | |
self.leftAction.setEnabled(False) | |
self.rightAction.setEnabled(False) | |
@@ -340,25 +341,25 @@ class rMViewApp(QApplication): | |
return | |
self.threadpool.start(self.fbworker) | |
- if self.config.get("forward_mouse_events", False): | |
- self.viewer.pointerEvent.connect(self.fbworker.pointerEvent) | |
- | |
- self.penworker = PenTracker(ssh, path="/dev/input/event%d" % (version-1)) | |
- self.threadpool.start(self.penworker) | |
- self.pen = self.viewer.scene.addEllipse(0,0,self.pen_size,self.pen_size, | |
- pen=QPen(QColor('white')), | |
- brush=QBrush(QColor(self.config.get('pen_color', 'red')))) | |
- self.pen.lastShown = None | |
- self.pen.showDelay = self.config.get("pen_show_delay", 0.4) | |
- self.pen.hide() | |
- self.pen.setZValue(100) | |
- self.penworker.signals.onPenMove.connect(self.movePen) | |
- if self.config.get("show_pen_on_lift", True): | |
- self.penworker.signals.onPenLift.connect(self.showPen) | |
- if self.config.get("hide_pen_on_press", True): | |
- self.penworker.signals.onPenPress.connect(self.hidePen) | |
- self.penworker.signals.onPenNear.connect(self.showPenNow) | |
- self.penworker.signals.onPenFar.connect(self.hidePen) | |
+ #if self.config.get("forward_mouse_events", False): | |
+ # self.viewer.pointerEvent.connect(self.fbworker.pointerEvent) | |
+ | |
+ # self.penworker = PenTracker(ssh, path="/dev/input/event%d" % (version-1)) | |
+ #self.threadpool.start(self.penworker) | |
+ #self.pen = self.viewer.scene.addEllipse(0,0,self.pen_size,self.pen_size, | |
+ # pen=QPen(QColor('white')), | |
+ # brush=QBrush(QColor(self.config.get('pen_color', 'red')))) | |
+ #self.pen.lastShown = None | |
+ #self.pen.showDelay = self.config.get("pen_show_delay", 0.4) | |
+ #self.pen.hide() | |
+ #self.pen.setZValue(100) | |
+ #self.penworker.signals.onPenMove.connect(self.movePen) | |
+ #if self.config.get("show_pen_on_lift", True): | |
+ # self.penworker.signals.onPenLift.connect(self.showPen) | |
+ #if self.config.get("hide_pen_on_press", True): | |
+ # self.penworker.signals.onPenPress.connect(self.hidePen) | |
+ #self.penworker.signals.onPenNear.connect(self.showPenNow) | |
+ #self.penworker.signals.onPenFar.connect(self.hidePen) | |
def promptDependenciesInstall(self): | |
mbox = QMessageBox(QMessageBox.NoIcon, 'Missing components', 'Your reMarkable is missing some needed components.') | |
diff --git a/src/rmview/screenstream/screenshare.py b/src/rmview/screenstream/screenshare.py | |
index 404a180..75bd39d 100644 | |
--- a/src/rmview/screenstream/screenshare.py | |
+++ b/src/rmview/screenstream/screenshare.py | |
@@ -70,9 +70,10 @@ class ScreenShareStream(QRunnable): | |
factory = None | |
- def __init__(self, ssh): | |
+ def __init__(self, ssh, rmuserid): | |
super(ScreenShareStream, self).__init__() | |
self.ssh = ssh | |
+ self.rmuserid = rmuserid | |
self.signals = ScreenStreamSignals() | |
def needsDependencies(self): | |
@@ -96,17 +97,20 @@ class ScreenShareStream(QRunnable): | |
reads the usedId from deviceToken from the config file on the rm | |
""" | |
def get_userid(self): | |
- with self.ssh.open_sftp() as sftp: | |
- with sftp.file('/etc/remarkable.conf') as f: | |
- file_content = f.read().decode() | |
- | |
- cfg = configparser.ConfigParser(strict=False) | |
- cfg.read_string(file_content) | |
- offset = len('@ByteArray(') | |
- token = cfg.get('General', 'devicetoken')[offset:-1] | |
- d = jwt.decode(token, options={"verify_signature": False, "verify_aud": False}) | |
- | |
- return(d["auth0-userid"]) | |
+ if (self.rmuserid): | |
+ return self.rmuserid | |
+ else: | |
+ with self.ssh.open_sftp() as sftp: | |
+ with sftp.file('/etc/remarkable.conf') as f: | |
+ file_content = f.read().decode() | |
+ | |
+ cfg = configparser.ConfigParser(strict=False) | |
+ cfg.read_string(file_content) | |
+ offset = len('@ByteArray(') | |
+ token = cfg.get('General', 'devicetoken')[offset:-1] | |
+ d = jwt.decode(token, options={"verify_signature": False, "verify_aud": False}) | |
+ | |
+ return(d["auth0-userid"]) | |
def computeChallenge(self, userId, timestamp): | |
userBytes = userId.encode() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ssh": { | |
"auth_method": "key", | |
"key": "/home/warewolf/.ssh/keys/remarkable.mydomain.com", | |
"address": ["remarkable.mycomain.com"], | |
"timeout": 2 | |
}, | |
"backend": "screenshare", | |
"rmuserid": "warewolf", | |
"orientation": "auto", | |
"pen_size": 15, | |
"pen_color": "red", | |
"pen_trail": 200, | |
"background_color": "white", | |
"deviceVersion": "2.0", | |
"fullDeviceVersion": "reMarkable 2.0", | |
"softwareVersion": "20220519120030", | |
"hide_pen_on_press": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment