diff --git a/app/src/main/assets/firmware/README.md b/app/src/main/assets/firmware/README.md new file mode 100644 index 0000000..3419b94 --- /dev/null +++ b/app/src/main/assets/firmware/README.md @@ -0,0 +1,23 @@ +# The firmware of the MultiTech modems + +| File | For | Size (octets) | SHA-1 | License | Source | +|---|---|---|---|---|---| +| mts_mt9234mu.fw | MultiTech MT9234MU and MT9234ZBA-USB (TI TUSB3410) | 13769 | `5537e93217c509129d5a870b9fe089cd58647070` | unknown | linux-firmware, before June 2026 (`WHENCE`: "Multi-Tech USB fax modems", "Licence: Unknown") | + +The TUSB3410 of these modems has no firmware of its own. The app downloads +this file into the chip each time the line starts (`TiFirmwareLoader`). + +Multi-Tech Systems, Inc. gave this file to the Linux kernel in 2010 for the +`ti_usb_3410_5052` driver. The file is TI's TUSB3410 UART firmware, compiled +again by MultiTech with some changes. The file has no copyright text and no +license text. MultiTech did not publish a license for it. In June 2026, +linux-firmware removed it with the other files that have an unknown license. + +We include the file so that the modem operates without more steps. The +AGPL-3.0 license of D-Modem and the commercial license do not apply to this +file. Multi-Tech Systems, Inc. and Texas Instruments keep their rights in it. +If you are the holder of these rights and you do not agree, tell us and we +will remove the file. + +In Settings, Line, you can import a different firmware file. The app then +uses that file in place of this one. diff --git a/app/src/main/assets/firmware/mts_mt9234mu.fw b/app/src/main/assets/firmware/mts_mt9234mu.fw new file mode 100644 index 0000000..09c1361 Binary files /dev/null and b/app/src/main/assets/firmware/mts_mt9234mu.fw differ diff --git a/app/src/main/java/org/dmodem/app/android/bridge/TiFirmwareLoader.kt b/app/src/main/java/org/dmodem/app/android/bridge/TiFirmwareLoader.kt index f9ad86f..d4fcaa2 100644 --- a/app/src/main/java/org/dmodem/app/android/bridge/TiFirmwareLoader.kt +++ b/app/src/main/java/org/dmodem/app/android/bridge/TiFirmwareLoader.kt @@ -15,8 +15,8 @@ import java.io.IOException /** * The firmware file of the MultiTech modems with a TUSB3410 (MT9234MU, - * MT9234ZBA-USB), as the user imported it. The app has no copy of its own: - * MultiTech gave no licence that lets others distribute it. + * MT9234ZBA-USB): one the user imported, else the app's own copy of + * MultiTech's (assets/firmware, with its notice: its licence is unknown). */ object TiFirmwareStore { private const val PATH = "firmware/mts_mt9234mu.fw" @@ -25,7 +25,13 @@ object TiFirmwareStore { fun file(context: Context): File = File(context.filesDir, PATH) /** the imported file, or null if there is none */ - fun read(context: Context): ByteArray? = file(context).takeIf { it.isFile }?.readBytes() + fun imported(context: Context): ByteArray? = file(context).takeIf { it.isFile }?.readBytes() + + /** the app's own copy of MultiTech's file, or null if the build has none */ + fun builtIn(context: Context): ByteArray? = runCatching { context.assets.open(PATH).use { it.readBytes() } }.getOrNull() + + /** the file to download: the imported one, else the app's own */ + fun read(context: Context): ByteArray? = imported(context) ?: builtIn(context) /** [bytes] kept as the firmware: null, or why they can't be */ fun import(context: Context, bytes: ByteArray): String? { @@ -46,8 +52,9 @@ object TiFirmwareStore { file(context).delete() } - /** what the imported file is, for the user, or null if there is none */ - fun describe(context: Context): String? = read(context)?.let { TiFirmware.describe(it) } + /** what the file to download is, for the user, or null if there is none */ + fun describe(context: Context): String? = imported(context)?.let { "imported: " + TiFirmware.describe(it) } + ?: builtIn(context)?.let { "built in: " + TiFirmware.describe(it) } } /** diff --git a/app/src/main/java/org/dmodem/app/android/ui/PeerLineUi.kt b/app/src/main/java/org/dmodem/app/android/ui/PeerLineUi.kt index a1959c8..4d25be5 100644 --- a/app/src/main/java/org/dmodem/app/android/ui/PeerLineUi.kt +++ b/app/src/main/java/org/dmodem/app/android/ui/PeerLineUi.kt @@ -429,8 +429,8 @@ fun SerialModemFields(s: ModemSettings, onChange: (ModemSettings) -> Unit) { } /** - * The firmware of a MultiTech MT9234MU (or MT9234ZBA-USB): which file is imported, and a button to import - * one. The app has no copy of its own; the modem gets it each time it is plugged in and the line starts. + * The firmware of a MultiTech MT9234MU (or MT9234ZBA-USB): the file the modem gets each time the line starts + * (MultiTech's, built in, unless one is imported), a button to import another, and one to go back to the built-in one. */ @Composable private fun MultiTechFirmwareRow() { @@ -450,7 +450,16 @@ private fun MultiTechFirmwareRow() { style = MaterialTheme.typography.bodySmall, ) problem?.let { Text("Not imported: $it", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.error) } - OutlinedButton(onClick = { pick.launch(arrayOf("*/*")) }) { Text(if (have == null) "Import the firmware file" else "Import another firmware file") } + Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { + OutlinedButton(onClick = { pick.launch(arrayOf("*/*")) }) { Text(if (have == null) "Import the firmware file" else "Import another firmware file") } + if (org.dmodem.app.android.bridge.TiFirmwareStore.file(context).isFile) { + TextButton(onClick = { + org.dmodem.app.android.bridge.TiFirmwareStore.remove(context) + problem = null + have = org.dmodem.app.android.bridge.TiFirmwareStore.describe(context) + }) { Text("Use the built-in file") } + } + } } /** a labelled radio button, the whole row tappable */ diff --git a/app/src/test/java/org/dmodem/app/android/bridge/TiSerialTest.kt b/app/src/test/java/org/dmodem/app/android/bridge/TiSerialTest.kt index 4bd2a9d..8dad52b 100644 --- a/app/src/test/java/org/dmodem/app/android/bridge/TiSerialTest.kt +++ b/app/src/test/java/org/dmodem/app/android/bridge/TiSerialTest.kt @@ -152,6 +152,16 @@ class TiSerialTest { assertEquals(13769 - 215 * 64, p.last().size) } + /** the app's own copy of MultiTech's file: known, and a firmware the boot ROM takes */ + @Test + fun builtInFirmware() { + val f = java.io.File("src/main/assets/firmware/mts_mt9234mu.fw") + val bytes = f.readBytes() + assertEquals("MultiTech's mts_mt9234mu.fw", TiFirmware.describe(bytes)) + assertNull(TiFirmware.problem(bytes)) + assertEquals(13766, TiFirmware.image(bytes).let { (it[0].toInt() and 0xff) or ((it[1].toInt() and 0xff) shl 8) }) + } + /** an unknown file is described by its size */ @Test fun describe() { diff --git a/docs/adapters.md b/docs/adapters.md index 3151967..6bea18b 100644 --- a/docs/adapters.md +++ b/docs/adapters.md @@ -91,14 +91,18 @@ RTS/CTS on. The factory setting of the modem is `&K3`. The TUSB3410 has no firmware of its own. Each time you connect the modem, the modem shows only the boot ROM of the chip. The app must download the -firmware into the RAM of the chip before it can use the modem. The app does -not include the firmware file, because MultiTech gave no license that lets -other persons distribute it. For the same reason, linux-firmware removed the -file in 2026. Get the file `mts_mt9234mu.fw` from the Linux driver of -MultiTech or from a linux-firmware package of a Linux distribution from -before June 2026 (`/lib/firmware/mts_mt9234mu.fw`). The file -`mts_mt9234zba.fw` has the same code. Then, in Settings, Line, select -"Import the firmware file". +firmware into the RAM of the chip before it can use the modem. The app +includes the firmware file of MultiTech, `mts_mt9234mu.fw` +(`app/src/main/assets/firmware`). Thus the modem operates without more +steps. The license of this file is unknown: MultiTech did not publish one, +and linux-firmware removed the file in 2026 for this reason. The +`README.md` file in that folder gives the source and the notice. The AGPL-3.0 +license of D-Modem does not apply to the firmware file. + +To use a different firmware file, select Settings, Line, "Import another +firmware file". "Use the built-in file" goes back to the file of MultiTech. +TI's generic `ti_3410.fw` is possibly not sufficient. It does not set the +control pin (P3.0) of the modem, and its USB descriptor gives only 100 mA. When the line starts, the app does these steps: