Firware download process
authorChristian Weiske <[email protected]>
Sat, 17 Jun 2023 12:02:48 +0000 (14:02 +0200)
committerChristian Weiske <[email protected]>
Sat, 17 Jun 2023 12:02:48 +0000 (14:02 +0200)
api/update.gamestickservices.net/check.php.response-update.json
api/update.gamestickservices.net/check.php.rst

index 592b34c5fa762dcaaa8d7c0e1d4f7b50f7c4f250..87973baa54d14a607aa5cb7dc22d25b6d9997ade 100644 (file)
@@ -7,5 +7,5 @@
     "name": "v2.23.42",
     "description": "Update now immediately! We have new features.",
     "timestamp": 1680271986000,
-    "url": "http://example.org/firmware.ext"
+    "url": "http://example.org/firmware.php?version=2071"
 }
index bdd79fe9358d2e4cdea5fe20f62bbf7bd6ea7bc0..c28e3f9e7af96a67dcce5f0de9abcad7564df236 100644 (file)
@@ -4,13 +4,21 @@
 
 Check if a new firmware update is available.
 
+Three hosts are checked one after another.
+When ``update.gamestickservices.com`` is not available,
+it may take up to two minutes until the ``.net`` host is tried.
+
 
 HTTP request
 ============
 Protocol
   ``http``
 Host
-  ``update.gamestickservices.net``
+  Three hosts are checked in firmware 2071:
+
+  1. ``update.gamestickservices.com``
+  2. ``update.gamestickservices.net``
+  3. ``54.215.8.117``
 Path
   ``check.php``
 Headers
@@ -23,7 +31,7 @@ POST parameters
         {
             "hwid": "ac:db:da:09:18:5c",
             "major": 0,
-            "minor": 1,
+            "minor": 0,
             "revision": 53,
             "platform": 0
         }
@@ -56,3 +64,33 @@ Status code
 Usage
 =====
 - ``com.playjam.gamestick.WifiTools.ChecksFragment#doUpdateConnect()``
+- ``com.playjam.UpdateService``
+
+
+
+Update download process
+=======================
+Firmware updates are downloaded by a separate downloading process
+in ``com.playjam.UpdateService``.
+
+Updates are downloaded in small chunks that are combined to a single file
+in the end.
+Firmware updates are standard Android OTA ``.zip`` update files that
+were renamed to ``.img`` by PlayJam. (``GameStick-Software-v2071.img``).
+
+The download URL given in the HTTP reponse is appended with ``&i=`` plus
+the chunk index number.
+
+Two special chunk numbers exist:
+
+``-2``
+  Returns the total size of the download (plain text ``long`` value)
+``-1``
+  Returns the number of chunks (plain text, ``int``)
+
+``-2`` is fetched first, ``-1`` second and then ``0``, ``1`` and so forth.
+
+After download and chunk combination, the file is verified by standard Android
+mechanism ``android.os.RecoverySystem.verifyPackage()``.
+
+Information about the new firmware is written to ``/data/GameStickCache/update.info``.