Merge pull request #15 from D-Modem/claude/project-thread-2y4er4

Support the MultiTech MT9234MU: find it on Linux, page ATI11
This commit is contained in:
Neo authored and GitHub committed 2026-11-17 03:13:26 -08:00
commit 5a99e31910
11 files changed
+388 -4

No files matched your search

+2 -2
View File
@@ -23,7 +23,7 @@ libdmodemctl. Thus they operate in the same way.
LGPL-2.0-or-later: `core/licenses/syncterm-fonts-LGPL-2.0.txt`)
- **Settings**: each modem setting as a native control, from AT!M
- **Call Stats**: the rate, modulation, error control and line figures of the last call (AT#UD, ATI11)
- **Line settings**: a SIP account, a USB modem, or a modem that already runs
- **Line settings**: a SIP account, a USB modem, or a modem that already runs (dmodemd, or a hardware modem such as the MultiTech MT9234MU)
- **Windows 95 and later**: plain Win32, built with Open Watcom. On Windows 9x, the app connects to a modem through TCP or a COM port
| | Windows | macOS | Linux |
@@ -59,7 +59,7 @@ D-Modem 1.0.
## Documentation
- [Design](docs/design.md): how the apps are built, what they share, and the Windows 9x notes
- [Design](docs/design.md): how the apps are built, what they share, hardware modems (the MultiTech MT9234MU), and the Windows 9x notes
- [libdmodemctl](core/include/dmodemctl.h): the API of the library
- [Documentation style](docs/STYLE.md): the rules for ASD-STE100 Simplified Technical English
+39 -1
View File
@@ -43,6 +43,8 @@
/* a line longer than this keeps only its end (a configurator's
screens come with no line ends, and its OK after the last one) */
#define LINE_MAX 4096
/* the most pages of one response that the session pages on */
#define PAGES_MAX 8
/* voice: how far ahead of the line our samples go (60 ms), how many of
the far end's are kept (1 s), how many of ours may wait (a third of
@@ -120,6 +122,10 @@ struct dmc_session {
struct command *queue, *active;
int64_t active_until;
int echo_seen;
/* the pages of its response that the session paged on (a key sent
to "Press any key") */
int pages;
int prompt; /* the rest of the prompt's line: dropped */
dmc_buf response;
int next_tag;
/* the events, and the one dmc_next_event() last gave */
@@ -378,6 +384,8 @@ static void pump(dmc_session *s)
s->active = c;
s->active_until = s->now + c->timeout_ms;
s->echo_seen = 0;
s->pages = 0;
s->prompt = 0;
buf_clear(&s->response);
buf_adds(&s->out, c->cmd);
buf_addc(&s->out, '\r');
@@ -770,6 +778,17 @@ static void line_in(dmc_session *s, const char *l)
static void voice_byte(dmc_session *s, unsigned char c);
/* whether l is a pager's prompt: a modem that shows a long response in
pages (ATI11 on the Agere modems, the MultiTech MT9234 among them)
stops after each page at "Press any key to continue; ESC to quit" */
static int pager_prompt(const char *l)
{
for (; *l; l++)
if (starts_ci(l, "any key"))
return 1;
return 0;
}
void dmc_feed(dmc_session *s, const char *data, int n)
{
if (s->state == DMC_CLOSED)
@@ -783,16 +802,35 @@ void dmc_feed(dmc_session *s, const char *data, int n)
int quiet = s->active && (s->active->flags & DMC_QUIET);
if (!quiet)
buf_addc(&s->term, c);
if (c == '\n' && s->prompt) {
s->prompt = 0;
continue;
}
if (c == '\n') {
line_in(s, buf_str(&s->line));
buf_clear(&s->line);
continue;
}
if (c == '\r')
if (c == '\r') {
s->prompt = 0;
continue;
}
if (s->prompt)
continue;
if (s->line.n >= LINE_MAX)
buf_drop(&s->line, s->line.n - LINE_MAX / 2);
buf_addc(&s->line, c);
/* a command's response in pages: the next page asked for
(a space), the prompt kept out of the response */
if (s->active && (s->state == DMC_IDLE ||
s->state == DMC_ONLINE_COMMAND) &&
s->pages < PAGES_MAX && pager_prompt(buf_str(&s->line))) {
buf_addc(&s->out, ' ');
buf_clear(&s->line);
s->prompt = 1;
s->pages++;
s->active_until = s->now + s->active->timeout_ms;
}
}
}
+27
View File
@@ -140,6 +140,32 @@ static void test_command(void)
dmc_session_free(s);
}
/* a response in pages (ATI11 on an Agere modem, a MultiTech MT9234):
a space for each "Press any key", the prompt kept out of the response */
static void test_pages(void)
{
dmc_session *s = dmc_session_new();
dmc_event ev;
dmc_open(s, 0);
int tag = dmc_command(s, "ATI11", DMC_QUIET, 0);
CHECK_STR(out(s), "ATI11\r");
feed(s, "ATI11\r\r\nLast Connection V.92\r\n"
"Press any key to continue; ESC to quit");
CHECK_STR(out(s), " ");
CHECK(!next_of(s, DMC_EV_RESPONSE, &ev));
feed(s, "\r\nNear Echo Level NA\r\n\r\nOK\r\n");
CHECK_STR(out(s), "");
CHECK(next_of(s, DMC_EV_RESPONSE, &ev));
CHECK(ev.tag == tag && ev.ok);
CHECK_STR(ev.text, "Last Connection V.92\n\nNear Echo Level NA");
/* text typed in the terminal is the user's own: no key sent */
dmc_type(s, "ATI11\r", 6);
out(s);
feed(s, "ATI11\r\r\nPress any key to continue");
CHECK_STR(out(s), "");
dmc_session_free(s);
}
/* a call: dial, connect, online data, hang up through the escape */
static void test_call(void)
{
@@ -1185,6 +1211,7 @@ int main(int argc, char **argv)
const char *dir = argc > 1 ? argv[1] : ".";
CHECK(dmc_version() == DMC_VERSION);
test_command();
test_pages();
test_call();
test_unsolicited();
test_typed();
+44
View File
@@ -109,6 +109,50 @@ the pty in the group of the user (`-g`). Thus dmodemd does not need root.
Each app can also use a modem that already runs: a device path on Linux and
macOS, or a TCP address or a COM port on Windows.
## Hardware modems: the MultiTech MT9234MU
The "device" line can also open a hardware modem. The apps send AT commands
to it and read its result codes, as they do with dmodemd. The Settings page
needs `AT!M`, thus it operates only with dmodemd.
The MultiTech MultiMobile MT9234MU (USB 06E0:F114) and the MT9234ZBA-USB
(06E0:F115, 06E0:0319) are V.92 data and fax modems. They have a TI TUSB3410
USB UART. The TUSB3410 has no firmware of its own. The host downloads the
firmware into the chip each time you connect the modem.
| | Linux | macOS | Windows |
| --- | --- | --- | --- |
| Driver | `ti_usb_3410_5052` (in the kernel) | we do not know a driver for the MT9234MU. The CDC-ACM models (MT9234MU-CDC) use the driver of the system | the driver of MultiTech |
| Firmware | `mts_mt9234mu.fw` in `/lib/firmware` | not applicable | the driver of MultiTech has it |
| The port | `/dev/ttyUSB0` | `/dev/cu.usbmodem*` (CDC-ACM models) | a COM port |
Linux does not include `mts_mt9234mu.fw` after June 2026. MultiTech gave no
license that lets other persons distribute it, thus linux-firmware removed
it. This repository includes the file, with a notice
(`linux/firmware/README.md`). The AGPL-3.0 license does not apply to it.
`cmake --install` puts it in `share/dmodem-gui/firmware`, and
`-DDMODEM_GUI_INSTALL_FIRMWARE=ON` also puts it in `/lib/firmware`. Else,
copy it to `/lib/firmware` (for the MT9234ZBA-USB, as `mts_mt9234zba.fw`),
then disconnect the modem and connect it again.
On Linux, the app finds the modem in sysfs (`linux/src/usbmodem.c`). The
line settings show where the modem is, with a "Use" button. If the modem
has no firmware, they show the command that copies the file. When the app opens the port of the
modem, it sets RTS/CTS flow control (`CRTSCTS`). The modem uses `&K3` from
the factory.
Set the country of the line with `AT%T19,0,<code>` and `AT&F&W` in the
"Commands when the modem opens" field one time, or in the Terminal page.
`AT%T19,0,34` is the default (North America and Europe).
`ATI11` on these modems (and on other Agere modems) shows its report on two
pages. After each page, the modem waits for a key ("Press any key"). The
library sends a space when a command of the app gets this prompt, thus the
Call Stats page gets the full report. It does this for 8 pages at most. In
the Terminal page, you push the key.
We did not test this yet with a real MT9234MU.
## Remote logins
The Remote page logs in to a server, next to the modem, in a separate
+16
View File
@@ -5,6 +5,7 @@ add_executable(dmodem-gui
src/window.c
src/modem.c
src/config.c
src/usbmodem.c
src/settings.c
src/stats.c
src/voice.c
@@ -12,6 +13,11 @@ add_executable(dmodem-gui
src/termview.c
src/audio.c)
target_link_libraries(dmodem-gui PRIVATE dmodemctl dmodemssh PkgConfig::GTK)
# where the MT9234MU's firmware is installed, and where it is in the source
include(GNUInstallDirs)
target_compile_definitions(dmodem-gui PRIVATE
DMODEM_FIRMWARE_DIR="${CMAKE_INSTALL_FULL_DATADIR}/dmodem-gui/firmware"
DMODEM_FIRMWARE_SRC="${CMAKE_CURRENT_SOURCE_DIR}/firmware")
# the sound of voice calls: PulseAudio's client (PipeWire serves it
# too); without it the app has no sound
pkg_check_modules(PULSE IMPORTED_TARGET libpulse-mainloop-glib)
@@ -38,6 +44,16 @@ install(FILES data/io.github.d_modem.DModem.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES data/io.github.d_modem.DModem.metainfo.xml
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
# MultiTech's firmware for the MT9234MU (licence unknown: linux/firmware/README.md)
install(FILES firmware/mts_mt9234mu.fw firmware/README.md
DESTINATION ${CMAKE_INSTALL_DATADIR}/dmodem-gui/firmware)
option(DMODEM_GUI_INSTALL_FIRMWARE
"Also install mts_mt9234mu.fw (and mts_mt9234zba.fw) in /lib/firmware" OFF)
if(DMODEM_GUI_INSTALL_FIRMWARE)
install(FILES firmware/mts_mt9234mu.fw DESTINATION /lib/firmware)
install(FILES firmware/mts_mt9234mu.fw DESTINATION /lib/firmware
RENAME mts_mt9234zba.fw)
endif()
install(FILES ${PROJECT_SOURCE_DIR}/assets/dmodem.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps
RENAME io.github.d_modem.DModem.svg)
+32
View File
@@ -0,0 +1,32 @@
# 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
`ti_usb_3410_5052` driver of Linux downloads this file into the chip each
time you connect the modem. The driver looks for the file in
`/lib/firmware`. The MT9234ZBA-USB uses the name `mts_mt9234zba.fw` for the
same code.
To install it:
sudo cp linux/firmware/mts_mt9234mu.fw /lib/firmware/
sudo cp linux/firmware/mts_mt9234mu.fw /lib/firmware/mts_mt9234zba.fw
Then disconnect the modem and connect it again. `cmake --install` puts the
file in `share/dmodem-gui/firmware`. With `-DDMODEM_GUI_INSTALL_FIRMWARE=ON`,
it also puts the file in `/lib/firmware`.
Multi-Tech Systems, Inc. gave this file to the Linux kernel in 2010. 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 a search for it. 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.
Binary file not shown.
+19
View File
@@ -102,6 +102,25 @@ gboolean config_sip_ready(const Config *c);
/* the line settings dialog */
void prefs_show(App *a);
/* usbmodem.c: a MultiTech MT9234MU (or MT9234ZBA-USB) on USB, from
sysfs */
typedef struct UsbModem {
char *name; /* "MultiTech MT9234MU" */
char *tty; /* "/dev/ttyUSB0", or NULL if it has none */
gboolean no_firmware; /* in the boot ROM: no firmware loaded */
} UsbModem;
/* the first one plugged in, or NULL */
UsbModem *usbmodem_find(void);
/* what it is and where, or what it needs, for the user */
char *usbmodem_describe(const UsbModem *m);
/* whether Linux has its firmware file (mts_mt9234mu.fw) */
gboolean usbmodem_firmware_present(void);
/* the copy of mts_mt9234mu.fw that comes with the app, or NULL */
char *usbmodem_shipped_firmware(void);
/* whether tty path is such a modem's */
gboolean usbmodem_is(const char *path);
void usbmodem_free(UsbModem *m);
/* modem.c */
void modem_start(App *a);
void modem_stop(App *a);
+34 -1
View File
@@ -305,6 +305,37 @@ static AdwPreferencesGroup *group(AdwPreferencesPage *page, const char *title,
return ADW_PREFERENCES_GROUP(g);
}
static void use_found(GtkButton *b, gpointer data)
{
Prefs *p = data;
gtk_editable_set_text(GTK_EDITABLE(p->device),
g_object_get_data(G_OBJECT(b), "tty"));
}
/* a MultiTech MT9234MU plugged in: a row that says where it is (with a
button that puts it in Device), or what it needs */
static void device_found(Prefs *p)
{
UsbModem *m = usbmodem_find();
if (!m)
return;
char *d = usbmodem_describe(m);
GtkWidget *r = adw_action_row_new();
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(r), "Found");
adw_action_row_set_subtitle(ADW_ACTION_ROW(r), d);
if (m->tty) {
GtkWidget *b = gtk_button_new_with_label("Use");
gtk_widget_set_valign(b, GTK_ALIGN_CENTER);
g_object_set_data_full(G_OBJECT(b), "tty", g_strdup(m->tty),
g_free);
g_signal_connect(b, "clicked", G_CALLBACK(use_found), p);
adw_action_row_add_suffix(ADW_ACTION_ROW(r), b);
}
adw_preferences_group_add(p->device_g, r);
g_free(d);
usbmodem_free(m);
}
static char *text_of(AdwEntryRow *r)
{
return g_strstrip(g_strdup(gtk_editable_get_text(GTK_EDITABLE(r))));
@@ -388,8 +419,10 @@ void prefs_show(App *a)
p->alsa = entry(p->alsa_g, "ALSA device", c->alsa);
p->device_g = group(page, "A modem that already runs",
"dmodemd started as a service, or any modem's "
"serial port.");
"serial port (a MultiTech MT9234MU is "
"/dev/ttyUSB0).");
p->device = entry(p->device_g, "Device", c->device);
device_found(p);
AdwPreferencesGroup *adv = group(page, "Advanced", NULL);
p->init = entry(adv, "Commands when the modem opens", c->init);
+4
View File
@@ -157,6 +157,10 @@ static gboolean open_dte(App *a, const char *path)
cfsetispeed(&t, B115200);
cfsetospeed(&t, B115200);
t.c_cflag |= CLOCAL | CREAD;
/* (a MultiTech MT9234MU: RTS/CTS, its &K3, so that the
modem's buffer does not overflow in a fast call) */
if (usbmodem_is(path))
t.c_cflag |= CRTSCTS;
tcsetattr(fd, TCSANOW, &t);
}
a->fd = fd;
+171
View File
@@ -0,0 +1,171 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* usbmodem.c - hardware modems on USB that the "device" line can open:
* the MultiTech MT9234MU and MT9234ZBA-USB, found in sysfs
*
* These modems have a TI TUSB3410 USB UART. Linux's ti_usb_3410_5052
* driver downloads its firmware (mts_mt9234mu.fw) into the chip; then
* the modem is a ttyUSB. Without the firmware file the modem stays in
* the chip's boot ROM (one configuration) and has no tty.
*/
#include <glib.h>
#include <glib/gstdio.h>
#include <string.h>
#include "app.h"
/* MultiTech's vendor ID and the products with a TUSB3410 */
static const struct {
const char *product, *name;
} models[] = {
{ "f114", "MultiTech MT9234MU" },
{ "f115", "MultiTech MT9234ZBA-USB" },
{ "0319", "MultiTech MT9234ZBA-USB" },
};
/* the firmware file's places that Linux looks in */
static const char *const firmware[] = {
"/lib/firmware/updates/mts_mt9234mu.fw",
"/lib/firmware/mts_mt9234mu.fw",
"/usr/lib/firmware/updates/mts_mt9234mu.fw",
"/usr/lib/firmware/mts_mt9234mu.fw",
"/lib/firmware/mts_mt9234zba.fw",
"/usr/lib/firmware/mts_mt9234zba.fw",
NULL
};
/* the trimmed text of sysfs file dir/name, or NULL */
static char *attr(const char *dir, const char *name)
{
char *path = g_build_filename(dir, name, NULL);
char *t = NULL;
if (g_file_get_contents(path, &t, NULL, NULL))
g_strstrip(t);
g_free(path);
return t;
}
/* the first ttyUSB under USB device dir's interfaces, as /dev/ttyUSBn,
or NULL */
static char *tty_of(const char *dir)
{
char *found = NULL;
GDir *d = g_dir_open(dir, 0, NULL);
if (!d)
return NULL;
const char *e;
while (!found && (e = g_dir_read_name(d))) {
/* (its interfaces: "1-2:2.0") */
if (!strchr(e, ':'))
continue;
char *itf = g_build_filename(dir, e, NULL);
GDir *i = g_dir_open(itf, 0, NULL);
const char *t;
while (i && !found && (t = g_dir_read_name(i)))
if (g_str_has_prefix(t, "ttyUSB"))
found = g_strconcat("/dev/", t, NULL);
if (i)
g_dir_close(i);
g_free(itf);
}
g_dir_close(d);
return found;
}
gboolean usbmodem_firmware_present(void)
{
for (int i = 0; firmware[i]; i++)
if (g_file_test(firmware[i], G_FILE_TEST_EXISTS))
return TRUE;
return FALSE;
}
UsbModem *usbmodem_find(void)
{
const char *root = "/sys/bus/usb/devices";
GDir *d = g_dir_open(root, 0, NULL);
if (!d)
return NULL;
UsbModem *m = NULL;
const char *e;
while (!m && (e = g_dir_read_name(d))) {
char *dir = g_build_filename(root, e, NULL);
char *vid = attr(dir, "idVendor");
char *pid = vid ? attr(dir, "idProduct") : NULL;
for (size_t k = 0; pid && !m &&
k < sizeof(models) / sizeof(models[0]); k++) {
if (g_ascii_strcasecmp(vid, "06e0") ||
g_ascii_strcasecmp(pid, models[k].product))
continue;
m = g_new0(UsbModem, 1);
m->name = g_strdup(models[k].name);
m->tty = tty_of(dir);
char *nc = attr(dir, "bNumConfigurations");
/* (one configuration: the boot ROM's) */
m->no_firmware = !m->tty && nc && !strcmp(nc, "1");
g_free(nc);
}
g_free(vid);
g_free(pid);
g_free(dir);
}
g_dir_close(d);
return m;
}
char *usbmodem_shipped_firmware(void)
{
static const char *const dirs[] = {
DMODEM_FIRMWARE_DIR, DMODEM_FIRMWARE_SRC, NULL
};
for (int i = 0; dirs[i]; i++) {
char *p = g_build_filename(dirs[i], "mts_mt9234mu.fw", NULL);
if (g_file_test(p, G_FILE_TEST_EXISTS))
return p;
g_free(p);
}
return NULL;
}
char *usbmodem_describe(const UsbModem *m)
{
if (m->tty)
return g_strdup_printf("%s at %s", m->name, m->tty);
if (m->no_firmware && !usbmodem_firmware_present()) {
char *fw = usbmodem_shipped_firmware();
/* (the MT9234ZBA-USB's driver asks for its own name) */
const char *to = strstr(m->name, "ZBA") ?
"/lib/firmware/mts_mt9234zba.fw" : "/lib/firmware/";
char *d = g_strdup_printf("%s, with no firmware: copy %s to "
"%s (sudo cp), then connect the "
"modem again", m->name,
fw ? fw : "mts_mt9234mu.fw", to);
g_free(fw);
return d;
}
if (m->no_firmware)
return g_strdup_printf("%s, with no firmware: load the "
"ti_usb_3410_5052 driver, then connect "
"the modem again", m->name);
return g_strdup_printf("%s, with no serial port: load the "
"ti_usb_3410_5052 driver", m->name);
}
gboolean usbmodem_is(const char *path)
{
UsbModem *m = usbmodem_find();
gboolean is = m && m->tty && path && !strcmp(m->tty, path);
usbmodem_free(m);
return is;
}
void usbmodem_free(UsbModem *m)
{
if (!m)
return;
g_free(m->name);
g_free(m->tty);
g_free(m);
}