A new line, "A phone line, through a USB modem": the phone runs the
modem, a Smart Link SmartUSB56 (0483:7554) or a pico-serial Line stick
(1209:0002) plugged into it carries its samples to a real phone line,
with D-Modem-RE's usb_line.cpp as dmodemd --usb drives them (the
stick's caller ID and the country's DAA settings too).
- libusb 1.0.27 (D-Modem-RE's pinned release) built for Android
(usb/libusb.cmake); usb_line.cpp built with libusb_init,
libusb_get_device_list and libusb_open renamed to usb_android.cpp's,
which start libusb without device discovery and give it the
descriptor Android opened for the app, wrapped, as the only device.
- usb_modem.cpp: the core on that line, the run loop of dmodemd's
run_line() with a stop pipe and the engine's status; Engine::Config
usb_fd and usb_rate, through JNI.
- UsbModems: the devices by their IDs, Android's permission asked when
the modem starts, the connection held while it runs; ModemSettings
LINE_USB (no SIP account, not a peer line); the settings, Home and the
notifications say so; Android offers the app when one is plugged in.
- native-test: usb_host (the engine on D-Modem-RE's fake stick, linked
in as libusb) and usb_line_test.py: two of them through its simulated
exchange: caller ID, CONNECT 33600, data each way, hang up, unplugged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
- dmodemd --usb: the pico-serial Line stick beside the SmartUSB56, each
country's line settings in its Si3056 DAA (Host::country()).
- The country's line settings on an HD-audio Si3054.
- Windows: dmodemd.exe, the USB modems there, its own virtual modem
driver; an Alpine Dockerfile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
An app targeting API 37 may reach the LAN only with ACCESS_LOCAL_NETWORK,
which the user grants: without it a SIP server there was refused with
"Operation not permitted" (sendto's EPERM) while baresip, targeting
older, had it implicitly. It's declared and asked for at launch with
notifications; the modem says what to allow when it starts without it,
and when SIP gets EPERM.
The log screen copies its lines (Copy), and a line can be selected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
Java's keystore takes only a file's first certificate, so a bundle given
as the ca secret is split into one file for each. The syntax line made
the build fetch docker/dockerfile from Docker Hub; the built-in frontend
has secret mounts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
- Adaptive answer: slow legacy callers (V.22, V.21, Bell 103) answered
as data; fax senders with no CNG, or a cut-short one, found as fax.
- Voice mode: calling tones reported, the call kept for fax or data.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
The toolchain CI builds with (JDK 21, SDK platform 37, NDK 29, CMake
3.31.6, gawk for proot) on Ubuntu 24.04, plus the unit tests' host
compilers and SSH tools. `docker build --target apk --output out .`
gives the debug APK; the default target is an image to run Gradle in.
The submodules come from the checked-out tree (D-Modem-RE is private).
A proxy's CA can be given as a build secret, and HTTPS_PROXY is passed
on to Java.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
D-Modem-RE up to 24e48f3: its adaptive answer (AT+FAA=1: the caller's
CNG, a V.8 fax call or T.38 from the far end make it FAX, +FCLASS=1 and
a class 1 answerer; a modem's handshake makes it DATA, then CONNECT)
and its CNG detector widened to T.30's 1100 Hz +-38 Hz.
The app turns it on as the modem starts (Settings: "Fax or data, as
each call turns out", on by default). When the modem says FAX, the fax
receiver takes the DTE at once, on its reader's thread before the
CONNECT goes to the terminal, with no set-up commands (the modem is
waiting for our first frames), and receives the pages as an answered
fax always did. A data call stays the terminal's.
With it on, the incoming call popup and notification offer Answer and
Ignore (no "Answer as fax"), and the fax settings' auto-answer answers
every call adaptively.
Tests: FaxAppTest.aFaxMachinesCallAnsweredAdaptively (a fax machine
dials, a plain ATA, the page received and saved),
aDataCallAnsweredAdaptively (DATA, CONNECT, no fax).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
While the modem's line rings (its RINGs: a SIP call, the other phone,
a mobile call):
- the phone's incoming call notification (CallStyle, a new high
importance "Calls" channel with the ringtone, full screen over the
lock screen): Answer, Answer as fax, Ignore
- a popup over whatever tab the app shows, with the same three
- who's calling when the line says (the other phone's name), else the
line's word for it ("A SIP call")
Answer opens the terminal and says ATA; Answer as fax starts the fax
call; Ignore puts it out of sight while it rings on. It's over when the
modem goes off hook (answered here, by a computer on a bridge, by S0)
or no RING has come for 8 s (IncomingCalls).
Tests: IncomingCallsTest (rings, the caller's name, answered, given up,
ignored), CallShotsTest (the popup, ignored, answered to the terminal;
build/screens/call-1-incoming.png).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
A fifth line, "No line (the modem on its own)": the engine starts as on
a peer line (no SIP, no network needed) with nothing behind it. It
answers AT commands in the terminal and on the serial bridges; a dial
gets NO DIALTONE, as a modem with no phone cable plugged in (the
engine's new peer event NO LINE), an answer NO CARRIER.
Home offers "Start without a line" beside "Set up SIP" when there's no
account: the line set to none and the modem started in one tap. iOS has
the same line and button.
Tests: c_api_test (NO LINE: NO DIALTONE), DModemKitTests.testNoLine
(started without an account, a dial NO DIALTONE, commands still
answered), PeerShotsTest.noLine, DashboardShotsTest.firstRun.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
The tones popped: the player asks for 50 ms at a time, and each piece
ramped its start in from silence (a counter that began at 0 each time),
some 20 dips a second. A burst's ramps now come from where the sample is
in the tone's cadence (Tone.burst), so the pieces are exactly one sound
(CountryTonesTest.inPiecesAsInOne: the same samples in pieces as in
one, and no jump bigger than the tone's own slope).
Settings: the line (SIP, Wi-Fi, Bluetooth, mobile calls) is a drop-down
menu instead of four radio buttons (PeerShotsTest.theLineFromItsMenu).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
D-Modem-RE's ITU table (dsp/tones.cpp, 192 countries after E.180) in
the shared Kotlin (tones/: generated by tools/country_tones.py, checked
against the submodule by CountryTonesSourceTest), with a synthesizer
for its tones (two frequencies, or one modulated; the cadence, its
edges ramped).
Android:
- Settings: the country picked from the list (searched, each with its
tones, a button to hear them), for the modem (its line settings, how
it hears busy) and the tones; "Call progress tones" on or off
- dialling a directory entry plays a second of the country's dial tone
before ATD
- CallProgress plays the busy tone on BUSY, the congestion tone for a
dial that ends (NO CARRIER, NO DIALTONE) before the far end answered,
and the ringing tone while the other phone rings on the phone-to-phone
line (no network there to play one); a handshake stops them
- CallTones plays them on the phone's speaker, in their own stream
iOS: the country picker in Settings (it had the setting, not the UI).
Tests: CountryTonesTest (the table, each tone's frequencies and cadence,
on the JVM and natively), CallTonesTest (when each plays; a second of
the UK's dial tone, stopping, the preview).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
17 commits from upstream, among them:
- V.17: steady AGC and timing in the data, so a page at 14400 without
ECM no longer loses a row (the bug T30InteropTest worked around)
- each of 192 countries' ring, dial, busy and congestion tones; pulse
dialling
- voice: caller ID as V.253's event report, +VEM
- Windows (MinGW, MSVC) and musl builds; SmartUSB56 and HD-audio lines
T30InteropTest.weReceiveWithoutEcm runs at 14400 again. PeerShotsTest
looked for the mobile line's old V.21 label; it now checks V.cvm's (the
default) and V.21's current one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
pico-serial (github.com/Neo-Desktop/pico-serial) is a USB-C to DB25
adapter made for the phone to be a vintage computer's modem. Its
firmware's control protocol (firmware/PROTOCOL.md, version 1) is found
by its vendor interface (class FF, subclass 50, protocol 01) and used:
- as DCE, the modem's DCD, DSR and RI each their own (SET_OUTPUTS): a
call ringing in raises RI on the computer
- the computer's DTR from GET_INPUTS: dropping it hangs up (the CDC
driver can't read DSR, so before this it never did)
- the board's role, baud source, flow control and counters shown in the
serial port settings, and set from there (kept in its flash)
Other CDC-ACM adapters' SERIAL_STATE notifications (their interrupt
endpoint, which usb-serial-for-android doesn't read) now tell the
computer's DTR too, so it hangs up there as well.
UsbBridgeTest: the structures against bytes compiled from the
firmware's protocol.h; a board faked as its firmware answers, its lines
following the modem's and its DTR hanging up; a CDC adapter's
notifications hanging up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
- CallKit: the modem's RING rings as a phone call (answered with ATA or
turned down on the phone's screen); a call the modem dials is an
outgoing call, hung up from the call screen; both in Recents
- Fax tab: PDFs, images and text drawn at the fax's width (CoreGraphics,
then the shared FaxImage), sent; a ringing call answered as a fax, by
hand or every one; received faxes as PDFs in Documents/Faxes
- File transfers from the terminal's toolbar: ZMODEM, YMODEM, XMODEM,
Kermit; a remote's sz or kermit -s starts receiving by itself, its rz
asks for files; received files in Documents/Received (the Files app)
- Internet tab: dial-up to an ISP on the shared DialUpJob, the phone's
traffic through the new DModemTunnel packet tunnel extension, its
packets to the app's PPP over the loopback
- the log moves to a button on Home; tabs: Home, Terminal, Fax,
Internet, Settings
- PeerLine passes LogOut objects (Kotlin lambdas aren't plain closures)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
The modem's DTE lent to a job as Swift drives it: octets as Latin-1
strings, callbacks through fun interfaces (DteOut, LogOut, Changed)
rather than Kotlin lambdas, state read when it says it changed.
- FaxJob: send pages to a number, or answer and save the pages as a PDF
- TransferJob: ZMODEM/YMODEM/XMODEM/Kermit on the shared Transfer, now
in common code (the Android terminal uses the same one)
- DialUpJob: ISP dialled, login script, PPP, packets to a PacketTunnel
- FaxImage: grey pixels as fax pages, at a threshold or dithered
- nativeMain: PosixFiles/PosixFolderIncoming for files by path, and
UdpPacketTunnel relaying packets to iOS's packet tunnel extension
- PeerHost takes LogOut for its events and log (Swift can't pass a
Unit-returning Kotlin lambda as a plain closure)
JobsTest runs each job on the JVM and natively (the fax both ways on
the fake class 1 line, ZMODEM between two jobs, PPP to a fake ISP);
NativeJobsTest covers the files and the UDP relay.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
SettingsStore keeps the settings' secrets apart from the JSON in
UserDefaults: the Keychain on Apple's systems (this device only, after
first unlock), memory on Linux for the tests. A password an older
version left in the JSON is moved on its first read. Fax and dial-up
settings added for the screens to come.
ModemSession can lend its DTE to a job (claim/release): while it's
lent, what the modem says goes to the job alone, and what the job
didn't read goes back to the terminal after.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
shared (Kotlin/Native, iOS and Linux): FdDuplex (a socket: the engine's
line, a TCP connection; closing it wakes a blocked read), PosixTcpTransport
(calls taken on a port, polled so close() always ends it; host[:port] and
[IPv6]:port called within 5 s; no SIGPIPE: Linux's send flag, Apple's
socket option), and PeerHost: PeerLine on it from plain values for Swift
(no default arguments or flows there), its state as text. PosixPeerTest
(native): two phones over real TCP on the loopback, the modems socket
pairs: a call rung, answered and heard both ways, busy, the hang-up, a
wrong PIN turned away, nobody there.
DModemKit: ModemSession.onLine, the peer line's modem off hook to the
app (tested: a dial reaches it, its FAILED a NO CARRIER).
The app: the settings' line (a SIP account or another phone on Wi-Fi:
whom ATD calls, the port, the PIN, taking calls), phones found with
Bonjour (_dmodem._tcp, as the Android app's NSD offers them), this one
offered while it takes calls; Home's line its state and last failure.
And a start fixed: the modem's log while it started ended the
background audio (and now the line) before it was running.
The Swift and appleMain's Kotlin aren't built here (no Xcode); the
Kotlin is built and tested for Linux native.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
ios/DModem (XcodeGen's project.yml, iOS 16): Home (the modem's state, the
rates and what the CONNECT was, the call's time, start, hang up, stop, an
AT command line and its last words), the terminal (the shared Kotlin
emulator through TerminalBridge, drawn run by run in a Canvas; CP437 and
the VGA colours; the keyboard and a hardware one's arrows and Esc; Esc,
a sticky Ctrl, Tab and the arrows on a bar; pinch for the font), the log
(shared as text) and the settings (the SIP account or user:password@host,
incoming calls, T.38, the speaker, the AT commands at start, the log
levels). The modem's speaker on AVAudioEngine; the audio session (its
sound, or quiet) keeps a call going in the background. The DNS servers
from the resolver's state (SystemDNS.c: iOS has no resolv.conf for the
engine).
shared: TerminalBridge, the terminal for Swift (octets as Latin-1 strings
both ways, rows as runs, keys, replies, the title, the look and the
character set), tested on the JVM and natively; the framework also as an
XCFramework (assembleDModemSharedXCFramework).
CI: the macOS job builds the shared XCFramework, runs DModemKit's tests
and builds the app for the simulator; the Linux job runs DModemKit's
tests on the host engine. Not built here: no Xcode on Linux (DModemKit,
TerminalBridge and SystemDNS.c are).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
ios/DModemKit (Swift package): the engine (dmodem_engine.h) from Swift
(Engine: its config, its callbacks to a listener), its DTE (read on a
thread of its own, written), the settings (ModemSettings, as the Android
app's: the SIP account or the Wi-Fi peer line, user:password@host, kept in
UserDefaults, read leniently), ConnectInfo ("V.cvm · LAPM"), and
ModemSession (started from the settings: status, log, console, the DTE's
data, the speaker) for the views to watch. On Apple's systems the engine
is the XCFramework; on Linux the host build's libraries
(DMODEM_HOST_BUILD), so its tests run there: a session on a peer line
answering AT commands, a dial handed to the app and turned down busy.
shared: TerminalEmulator.runs(), a screen row as styled runs with their
colours resolved as TerminalView has them (the remote's palette, bold as
bright, iCE colours, inverse, faint), for a view that draws text (the iOS
app's); tested on the JVM and natively.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
D-Modem-RE's V.cvm (+MS=V_CVM), made for speech codecs: V.8, 15 to 20 s
probing the codec, a mode loaded for it, LAPM. Through AMR-NB 12.2 the
app's engines connect at CONNECT 1200/CVM/LAPM/V44 (750 to 1200 bit/s
coded each way, one renegotiation): four times V.21's 300. The mobile-
call line starts in it, S7 long enough for the start-up; V.21, V.22 and
V.22bis stay as choices (V.cvm offers modems without it V.22, which a
codec garbles: V.21 for those). Settings saved before keep their speed.
The dashboard says what the CONNECT was beyond its rate (ConnectInfo:
"V.cvm · LAPM · V.44"). CellLineTest's call in V.cvm through AMR 12.2:
the data whole each way, +CVM?'s figures; the README's mobile section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
After a damaged subpacket our ZRPOS reaches sz at once, but what it
streamed before it still comes; broken headers in that data counted as
errors in a row, each with a ZRPOS of its own (each a restart, with
leftovers of its own), until ten of them gave up on the line. For a
second after a ZRPOS a broken header is let go by; 8 KB without a
header is one missing, asked for again; a stale ZEOF is asked for again
only after the second. A ZDATA not where we are still always gets one
(sz waits for our ACKs now and then: ignoring it, both sides waited).
Found by the interop tests once they stopped tracing every byte (the
trace had slowed the line). The cancel test reads the line slowly, so sz
is mid-file when cancelled, not done with all 2 MB queued here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
build/test-runs/<date_time>/<module>-<task>/<class>/<test>.log: what
each test printed, as it printed it, and a failure's stack trace (the
root build's listener on every test task, the JVM's and Kotlin/Native's).
A task's folder goes when nothing in it failed, the run's when empty;
the build names a folder it keeps.
The line tools' logs (peer_host, codec_line's filter, fax_line,
t30_line, sip_fax_line), the class 1 and peer line logs, and the
transfer traces into the test's log (TestLogs) instead of /tmp or one
build/ file each run overwrote; peer_host's speaker recording (read by
nothing) gone. The README says where to look.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
- native-test's line tools (fax_line, codec_line, t30_line) at
LINE_SPEED times the sample clock (line_speed.h); the fax tests ask
for 2x (DMODEM_LINE_SPEED, 1 a phone line's pace): 4x leaves the DTE
a quarter second for what class 1 times in a second, too tight on a
busy machine
- t30_line's first page some 70 KB in MH, not 220 KB (still two ECM
blocks)
- the Kermit and lrzsz interop tests' byte traces only when asked
(KERMIT_TRACE, TRANSFER_TRACE): a file opened for each chunk; Kermit's
big file 64 KB
- two test JVMs at once
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
Blocking reads held on coroutines' I/O dispatcher (64 threads at most)
could leave the next background job waiting for a thread that never
came free: PeerLoopbackTest's PIN call hung in the full suite, after the
other tests' readers. The peer line, PPP and the transfers each hold a
few such threads in the app too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
T.38 tested end to end (SipFaxTest): the app's engine dialling dmodemd,
which asks for T.38 a second after it answers, before its CED; the
engine's call progress then waited for a CED that never came on audio.
D-Modem-RE's claude/t38-caller (the submodule here) takes T.38 on a fax
call still waiting for its answer tone as the answer. With ECM and
without, and on audio with T.38 off.
Fax through a mobile call's speech codec doesn't train even at 2400
bit/s (CellFaxTest: AMR-NB 12.2, about a bit in sixteen wrong), so the
app turns fax down on the mobile-call line with why.
The interop test receiving without ECM from D-Modem-RE's T.30 at 12000:
at 14400 a page's row of 1-pel runs comes spoilt the same way each time
on a clean line, before our T.30 (D-Modem-RE's DSP; ECM hides it).
sip_fax_line waits for its dmodemd to end; the README's fax section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
native-test's t30_line: a class 1 modem on a line to dsp/t30.cpp's fax
machine (ECM or not, noise if asked); sip_fax_line: the app's engine
dialling a dmodemd over loopback SIP with T.38, each DTE a pty. The
tests (T30InteropTest, SipFaxTest) drive our T.30 on them, skipped
without the programs; FaxLineProcess and Pbm shared among the fax tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
ECM when both machines have it (DIS/DCS bits 24 and 27): the page in
blocks of up to 256 FCD frames of 256 octets on the fast modulation,
RCP three times, then PPS; the receiver's MCF, or PPR with a map of the
frames that didn't come, sent again; after four PPRs CTC at a rate lower
(with the long training), after three CTCs EOR; RR for RNR; a PPS again
for an MCF lost. A class 1 modem carries ECM's HDLC as bits, so the
framing is ours (EcmHdlc: flags, zero stuffing, FCS-16).
A setting (on by default); FaxProgress.ecm. Tests: common Kotlin on
two class 1 modems in memory that spoil what they're told (PPR, CTC,
EOR, no ECM); the real modems with and without ECM; efax (no ECM) still.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
With a PIN set, the phone called answers RING with CHALLENGE <nonce>
(16 random octets), the caller AUTH <md5("DMODEM/1:" nonce ":" PIN)>:
the PIN never goes on the connection. A wrong PIN (or none) gets DENIED
before the phone rings, the caller's modem NO CARRIER (FAILED 403), and
each failure in a row a longer wait (1 s doubling, up to a minute) before
the next PIN is checked. Mobile calls have none of it.
The setting in the Wi-Fi and Bluetooth line's fields; secureRandomBytes
in the shared io (SecureRandom, /dev/urandom natively); tests in common
Kotlin and with the real modems (peer_host).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
PeerLine moves to shared/'s common Kotlin: its connections (Duplex) on
Source and Sink, its threads coroutines' I/O threads (background()), a
latch, atomicfu's locks and atomics; the transports (TCP, Bluetooth, the
mobile call) and the native modem's line stay the app's, on the same
interface.
The fax test page (a frame, bars, dashes, a checkerboard) is shared code
(FaxTestPage): the app's fax tests and T4Test both have it. (The fax
move left the app's fax tests without it: they compile again.)
PeerLoopbackTest (common: the JVM and native): two phones' lines in
memory, each modem answering every sample with its own; the call rung,
answered and heard both ways after the exchange's tones, a third phone
busy, the hang-up. The app's tests on two real modems pass on the shared
code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
T4, T30, Class1 and FaxPdf move to shared/'s common Kotlin (the PDF
written to a Sink); the documents' rendering (Android's PdfRenderer) and
the fax manager stay the app's. T4Test in common Kotlin: the JVM and
native. The app's fax tests pass on the shared code, efax's calls over
two modems among them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
Hdlc, Ip, Ppp and ChatScript move to shared/'s common Kotlin; the NAT
(its sockets) and Android's VPN stay the app's. What they needed of the
JVM, common: an IPv4 address (Inet4: on the JVM java.net.Inet4Address
itself, the app's code as it was), MD5 for CHAP, a timer (coroutines, one
piece at a time, as the scheduled executor), atomicfu's synchronized.
PppLoopbackTest (common: the JVM and native): a client and a server in
memory, the link up, the address and DNS given, IP both ways, the
hang-up; MD5 against RFC 1321's vectors. The app's PPP tests (the ISP,
the chat scripts, the internet line over two modems, the phone as an
ISP) pass on the shared code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
shared/'s io: what the shared code needs of I/O the same on the JVM and
iOS: Source and Sink (the JVM's streams through asSource()/asSink()), a
byte buffer, a queue of bytes read with a timeout (on coroutines'
channels), IOException (java.io's own on the JVM), the monotonic clock,
a sleep, the local time zone's offset.
The transfers move there (TransferIo, X/Y/ZMODEM, Kermit, the CRCs, the
files' Outgoing and Incoming); a folder of received files and a JVM file
to send stay the JVM's (FolderIncoming, Outgoing.of). Kermit's dates by
arithmetic (civil from days and back) in the local zone.
TransferLoopbackTest (common: the JVM and native): each protocol both
ways in memory, the files and their dates as sent. It found Kermit's
dates read wrong when they came as yyyymmdd (the 6-digit form matched
first): the 8-digit form first now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
The terminal's VT/xterm emulator, its screen, Sixel, the character sets,
the keys, the characters' widths and the themes move to shared/'s common
Kotlin (the same package: the app's code as it was), their JVM-only calls
in common Kotlin's ways (code points, ISO 8859-1, copyInto, Base64.Mime).
The Android app has its JVM side; iOS its framework, DModemShared (iOS
devices, simulator); Linux native runs the common tests too.
TerminalEmulatorTest in common Kotlin (kotlin.test): on the JVM and
native; XtermFeaturesTest on the JVM. CI: the shared tests on Linux
(JVM, native) and on an iOS simulator (apple.yml).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
The engine for a program in C or Swift (dmodem_engine.h): started on SIP
or a peer line, its DTE a socket, the log, status, exit, peer line and
speaker as callbacks; native-test's c_api_test drives it (AT commands, a
dial handing the program its line, BUSY, the end).
ios/build-native.sh builds the engine with D-Modem-RE, libre and Mbed
TLS for iOS (devices, simulator) and macOS into DModemEngine.xcframework;
ios/DModemSmoke's Swift tests run it on macOS through the C API. CI
(apple.yml) does both on a macOS runner; android.yml's native job runs
the engine's tests with Apple's fallbacks on Linux too.
D-Modem-RE to its claude/apple-portability branch (portable.h: Apple's
ways where Linux has its own), on top of the speaker hook.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
The modem dials and answers on the phone's mobile line: Telecom places,
answers and ends the calls, Telephony tells their state, and Android 13's
call audio interception (CALL_AUDIO_INTERCEPTION, a privileged app's) has
their sound, on PeerLine as another transport (CellTransport): the
handshake made for the call, the exchange's tones played until it is
placed, the call's sound then.
On a rooted phone the app makes itself privileged: a Magisk module with
its APK in /system/priv-app and every privileged permission it asks for
allowed (Settings, Line).
Speech codecs decide the speed: native-test's codec_line puts AMR-NB or
GSM between two modems. AMR 12.2 carries V.21 (300 bit/s); V.22 and
V.22bis connect but lose data half the time; nothing faster connects;
GSM and AMR 4.75 carry nothing reliable. So the line starts at V.21
(+MS), with 1200 and 2400 bit/s to try.
Tests: CellTransportTest (the calls placed, answered, given up),
CellLineTest (two modems on mobile calls, clean and through AMR, on the
phones' audio clock), CellSettingsTest; the settings' screenshot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
As a modem's speaker had the line: on from off hook until CONNECT (ATM1,
the modem's default), all the call with ATM2, never with ATM0, at ATL's
volume; a switch in the settings silences it. The native modem passes
the line's sound (what came, its own at half level) on a socket the
app's player reads, never waiting for it; on SIP calls and on the line
to another phone.
D-Modem-RE to its latest (the V.90/V.92 analogue modem work) with
SipModem::on_speaker() on top (its branch claude/modem-speaker).
Tests: engine_test (SIP: the speaker on until CONNECT, nothing in data
mode, quiet with ATM0), PeerLineTest (the caller's speaker on a call to
another phone), ModemSpeakerTest (the player).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
A line choice beside SIP: another phone running the app, on Wi-Fi (TCP,
found by NSD) or Bluetooth (RFCOMM). The native PeerModem hands the app
its line's samples off hook; PeerLine rings the other phone, carries the
samples both ways as they are and hangs up by closing. The loop runs on
the samples themselves (each side answers every sample, paced to the
sample clock), so nothing is lost and the phones' clocks can't drift:
the modems connect as on a perfect line (V.91, 62666 bit/s).
The calling side plays a dial tone and ringback as an exchange does, so
dialling works with X4 and S7. Busy, no answer and an unreachable phone
give BUSY, NO ANSWER and NO CARRIER.
Tests: peer_host (native-test) runs the engine on a peer line; PeerLineTest
calls between two or three of them over real TCP, through a slow and
uneven link as well. Also a missing alpha in the lights' glow colour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
A charcoal case with a row of small red LEDs under their legends: MR
(on), TR (the DTE there), CS, AA (answering calls), CD, OH, RD and SD
flickering with the octets each way (the DTE hub counts them), ARQ/FAX
lit with error correction (LAPM/MNP in the CONNECT) and blinking in a
fax call. On Home under the status card, and a compact strip under the
terminal's bar for the modem's session. What's lit read out for
accessibility; an idle panel draws nothing new.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
Bridges (TCP, Bluetooth, a USB adapter, the USB gadget) can give their
clients the internet instead of the modem: the computer dials (AT
answered OK, ATD answered CONNECT, Windows' direct cable connection's
CLIENT answered CLIENTSERVER, or PPP straight away) and gets PPP from the
phone:
- Ppp has a server role: the computer's address (10.64.64.2) and the
DNS (the phone's, at 10.64.64.1) given; no login asked
- NatStack carries its IPv4 on the phone's own network, as slirp did:
each TCP connection the phone's own socket (the computer's side kept
here: handshake, sequence numbers, retransmission, window, the ends),
UDP flows, DNS to the phone's DNS servers, pings answered when the
host is reachable
- its DCD is its PPP link; its DTR dropped ends the link
- in that mode the bridges run in a service of their own: no modem, no
SIP account; Settings' serial port section chooses what clients get
Tested: the computer's dialer and PPP against the host, a TCP download
through the NAT with a segment lost and resent, a refused connection
reset, UDP, DNS, a ping; and end to end on the TCP bridge (dial, PPP, a
web page, DTR dropped), the modem untouched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs