ddvk / remarkable-update

force a full factory reset / re-update / upgrade
MIT License
170 stars 18 forks source link

Send back the update response whenever an updatecheck tag is found #1

Closed matteodelabre closed 3 years ago

matteodelabre commented 3 years ago

Currently, the update response is sent whenever an event tag with eventtype 3 or 13 is found in the request and eventresult is 0. In my tests, the client sent event tags with eventtype 3 and eventresult 2 for update check requests (see an example request from the client below). Those requests were met with an empty response from the server, because the server entered the branch on line 88.

<?xml version="1.0" encoding="UTF-8"?>
<request protocol="3.0" version="2.5.0.27" requestid="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" sessionid="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" updaterversion="0.4.2" installsource="ondemandupdate" ismachine="1">
    <os version="codex 2.5.2" platform="reMarkable2" sp="2.5.0.27_armv7l" arch="armv7l"></os>
    <app appid="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" version="2.5.0.27" track="Prod" ap="Prod" bootid="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" oem="RM110-XXX-XXXXX" oemversion="2.5.2" alephversion="2.5.0.27" machineid="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" lang="en-US" board="" hardware_class="" delta_okay="false" nextversion="0.0.0" brand="" client="" >
        <ping active="1"></ping>
        <updatecheck></updatecheck>
        <event eventtype="3" eventresult="2" previousversion=""></event>
    </app>
</request>

I believe checking for eventtype 3 or 13 and eventresult 0 is not the right way to detect whether the client wants to get update information. According to the spec, I think it is more reliable to verify whether the <updatecheck /> tag is present in the request. (Side note: The spec actually forbids the client from sending both an <updatecheck /> tag and an <event /> tag in the same request, but the reMarkable client seems to ignore this rule.)

This PR implements this logic change. I tested it successfully on my rM2 (upgraded from 2.5.0.27 to 2.6.1.71).

ddvk commented 3 years ago

i kind of didnt see the pr, i also didnt read the spec :(