Author SHA1 Message Date
github-actions[bot] 887cb092d4 Bump D-Modem to c591ea2
external/D-Modem: 7e65cfc -> c591ea2 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 21:55:59 +00:00
Neo dd9881ee5c Merge pull request #92 from D-Modem/claude/project-thread-deqtlz
Build the app for Haiku (x86_64)
2026-11-28 13:44:19 -08:00
Neo-DesktopandClaude Opus 5.5 35d66c85e9 Build the app for Haiku (x86_64)
The Windows app now builds for Haiku over the new Haiku backend of
clang-retro MFC (clang-retro/mfc#176), cross-built on Linux with D-Modem's
Haiku toolchain file and sysroot script.

- cmake/haiku.cmake: the toolchain file. It includes D-Modem's and
  keeps the CMAKE_FIND_ROOT_PATH of the command line, so that libssh
  finds the bundled mbedTLS.
- winport/CMakeLists.txt: the Haiku target and its libraries (libbe,
  libdevice, libnetwork, libbsd).
- ssh/: libssh links libnetwork and libbsd on Haiku, has getaddrinfo,
  and skips the termios values that Haiku does not have.
- Look for a modem (windows/src/ports.cpp, ports_haiku.cpp): lists
  /dev/ports, names the usbN ports from the USB Kit, finds the CDC-ACM
  modems, and tells that Haiku has no driver for the MultiTech
  MT9234MU.
- CI: the winport-haiku job builds the app and uploads
  dmodem-win32-haiku-x86_64.tar.gz; the nightly release takes it.
- docs/haiku.md, and short notes in the README, building.md and
  download.md.

Tested on Haiku R1/beta6 in QEMU: the menus, the pages, the dialogs,
modal dialogs, the keyboard, moving the window, and Look for a modem
with the computer's serial port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTJUdomcnCN8okhJSr
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-28 20:11:33 +00:00
Neo 17260c78e7 Merge pull request #90 from D-Modem/bot/d-modem-bump
Bump D-Modem to 7e65cfc
2026-11-28 11:40:15 -08:00
github-actions[bot] 1732160f0b Bump D-Modem to 7e65cfc
external/D-Modem: 29fcea3 -> 7e65cfc (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 19:26:06 +00:00
Neo db55628aee Merge pull request #89 from D-Modem/bot/d-modem-bump
Bump D-Modem to 29fcea3
2026-11-28 11:01:47 -08:00
github-actions[bot] 3aa0e30269 Bump D-Modem to 29fcea3
external/D-Modem: 27536c1 -> 29fcea3 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 18:53:46 +00:00
Neo bcf6ff67a2 Merge pull request #88 from D-Modem/bot/d-modem-bump
Bump D-Modem to 27536c1
2026-11-28 10:48:46 -08:00
github-actions[bot] 199fe1693d Bump D-Modem to 27536c1
external/D-Modem: d95d15e -> 27536c1 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 18:43:02 +00:00
Neo 10d09fa159 Merge pull request #87 from D-Modem/bot/d-modem-bump
Bump D-Modem to d95d15e
2026-11-28 10:12:58 -08:00
github-actions[bot] bb08cb7d9c Bump D-Modem to d95d15e
external/D-Modem: 82631e3 -> d95d15e (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 18:01:08 +00:00
Neo 60b9aa1357 Merge pull request #86 from D-Modem/bot/d-modem-bump
Bump D-Modem to 82631e3
2026-11-28 09:53:03 -08:00
github-actions[bot] 15ffd368bf Bump D-Modem to 82631e3
external/D-Modem: 6236733 -> 82631e3 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 17:29:18 +00:00
Neo 6a73746079 Merge pull request #85 from D-Modem/bot/d-modem-bump
Bump D-Modem to 6236733
2026-11-28 08:11:25 -08:00
github-actions[bot] ce91016223 Bump D-Modem to 6236733
external/D-Modem: d886b4a -> 6236733 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 16:02:23 +00:00
Neo db1c9cd82e Merge pull request #84 from D-Modem/bot/d-modem-bump
Bump D-Modem to 6236733
2026-11-28 08:02:07 -08:00
github-actions[bot] cc48b23ede Bump D-Modem to 6236733
external/D-Modem: d886b4a -> 6236733 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 15:49:30 +00:00
Neo 08008f6341 Merge pull request #83 from D-Modem/bot/d-modem-bump
Bump D-Modem to d886b4a
2026-11-28 07:38:16 -08:00
github-actions[bot] c7c99e64c9 Bump D-Modem to d886b4a
external/D-Modem: 20c1e94 -> d886b4a (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 15:23:35 +00:00
Neo 3ab5a917e1 Merge pull request #82 from D-Modem/bot/d-modem-bump
Bump D-Modem to 20c1e94
2026-11-28 07:09:54 -08:00
github-actions[bot] 01fba1b3c4 Bump D-Modem to 20c1e94
external/D-Modem: 848a7c0 -> 20c1e94 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 14:53:39 +00:00
Neo fd53bbb1e0 Merge pull request #81 from D-Modem/bot/d-modem-bump
Bump D-Modem to 848a7c0
2026-11-28 06:30:54 -08:00
github-actions[bot] 503edd645e Bump D-Modem to 848a7c0
external/D-Modem: 88137e0 -> 848a7c0 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 14:20:22 +00:00
Neo 059e6a88ae Merge pull request #79 from D-Modem/bot/d-modem-bump
Bump D-Modem to 88137e0
2026-11-28 05:57:03 -08:00
github-actions[bot] bdea9ed1cd Bump D-Modem to 88137e0
external/D-Modem: c3ef883 -> 88137e0 (D-Modem's main).

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-28 13:46:27 +00:00
18 changed files with 516 additions and 13 deletions

No files matched your search

+47 -2
View File
@@ -1,6 +1,6 @@
# Builds and tests the app (windows/) and the library that it uses
# (core/, ssh/): on Windows 95 to Windows 11, and on Linux and macOS over
# clang-retro MFC's portable Win32 layer (winport/)
# (core/, ssh/): on Windows 95 to Windows 11, and on Linux, macOS and
# Haiku over clang-retro MFC's portable Win32 layer (winport/)
name: Build
# The nightly release (nightly.yml) takes its files from this
@@ -250,6 +250,51 @@ jobs:
name: ${{ matrix.artifact }}
path: dmodem-win32-macos-${{ matrix.arch }}.tar.gz
# The app for Haiku (x86_64), cross-built on Linux with the runner's
# clang against a sysroot of Haiku's own packages (D-Modem's
# platforms/haiku/haiku_sysroot.py, which checks them against the
# repositories' SHA-256). Nothing here runs the app: that needs a
# Haiku guest. Refer to docs/haiku.md.
winport-haiku:
name: Windows app on Haiku, the modem built in (clang-retro MFC's Win32 layer)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/checkout@v4
with:
repository: clang-retro/mfc
path: mfc
submodules: recursive
- name: Packages
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake ninja-build clang lld llvm libzstd1 python3
- name: Haiku packages cache
uses: actions/cache@v4
with:
path: haiku-packages
key: haiku-packages-${{ hashFiles('external/D-Modem/platforms/haiku/haiku_sysroot.py') }}
- name: Sysroot
run: python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot --cache haiku-packages
- name: Build
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$PWD/cmake/haiku.cmake" \
-DHAIKU_SYSROOT="$PWD/haiku-sysroot" \
-DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC="$PWD/mfc"
cmake --build build --target dmodem-win32
- name: The built-in modem is in the app
run: llvm-nm build/winport/dmodem-win32 | grep -q dmodem_embed_start
- name: Package
run: tar -C build/winport -czf dmodem-win32-haiku-x86_64.tar.gz dmodem-win32
- uses: actions/upload-artifact@v4
with:
name: dmodem-win32-haiku
path: dmodem-win32-haiku-x86_64.tar.gz
# The app for Mac OS X 10.4 (Tiger) and later, PowerPC and Intel
# (i386), as one fat program, over the Mac OS X 10.0-10.5 port of
# clang-retro MFC (cmake/macosx-legacy.cmake). All of it builds on
+2
View File
@@ -76,6 +76,7 @@ jobs:
take dmodem-win32-macos dmodem-win32-macos-arm64.tar.gz
take dmodem-win32-macos-x86_64 dmodem-win32-macos-x86_64.tar.gz
take dmodem-win32-macosx-legacy dmodem-win32-macosx10.4.tar.gz
take dmodem-win32-haiku dmodem-win32-haiku-x86_64.tar.gz
(cd out && sha256sum * > SHA256SUMS)
ls -l out
{
@@ -91,6 +92,7 @@ jobs:
echo "| \`dmodem-win32-macos-arm64.tar.gz\` | The app on macOS with the modem built in, arm64 (Apple silicon) |"
echo "| \`dmodem-win32-macos-x86_64.tar.gz\` | The app on macOS with the modem built in, x86_64 (Intel Mac) |"
echo "| \`dmodem-win32-macosx10.4.tar.gz\` | The app on Mac OS X 10.4 (Tiger) and later with the modem built in, one program for PowerPC and Intel (i386). Not tested on a Mac yet |"
echo "| \`dmodem-win32-haiku-x86_64.tar.gz\` | The app on Haiku R1/beta6 and later with the modem built in, x86_64. Needs \`pkgman install libusb\` |"
echo "| \`SHA256SUMS\` | The SHA-256 of each file |"
if [ -f missing ]; then
echo
+9 -7
View File
@@ -2,7 +2,8 @@
# D-Modem desktop app
The D-Modem desktop app is one Win32 app for Windows, macOS and Linux. The
The D-Modem desktop app is one Win32 app for Windows, macOS, Linux and
Haiku. The
site of the app is <https://d-modem.github.io/gui/>.
The app has the modem built in, so it needs no dmodemd (refer to
@@ -22,11 +23,11 @@ thin Win32 shell over one small C library, libdmodemctl.
- **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 (dmodemd, or a hardware modem such as the MultiTech MT9234MU). **Look for a modem** finds the modem and its port
| | Windows | macOS | Linux |
| --- | --- | --- | --- |
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of [clang-retro MFC](https://github.com/clang-retro/mfc) | Win32, over the X11 and Wayland layer of clang-retro MFC |
| Built with | [clang-retro](https://clang-retro.github.io/), MinGW or MSVC | clang | clang |
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386 | x86_64 |
| | Windows | macOS | Linux | Haiku |
| --- | --- | --- | --- | --- |
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of [clang-retro MFC](https://github.com/clang-retro/mfc) | Win32, over the X11 and Wayland layer of clang-retro MFC | Win32, over the Interface Kit layer of clang-retro MFC |
| Built with | [clang-retro](https://clang-retro.github.io/), MinGW or MSVC | clang | clang | clang (cross-built on Linux) |
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386 | x86_64 | R1/beta6 and later, x86_64 |
The source code of the app is the same on each system. Refer to "The
Windows app on Linux and macOS" in [Design](docs/design.md).
@@ -39,7 +40,7 @@ Windows app on Linux and macOS" in [Design](docs/design.md).
The [nightly release](https://github.com/D-Modem/gui/releases/tag/nightly)
has the app from the newest build of `main`: for Windows 95 and later, for
Windows 7 and later, for Linux, and for macOS. A workflow
Windows 7 and later, for Linux, for macOS, and for Haiku. A workflow
(`.github/workflows/nightly.yml`) replaces the release one time each day.
When `main` has no new commits, the release does not change. When the
main branch of D-Modem changes, a workflow moves the built-in modem to it
@@ -67,6 +68,7 @@ For Windows (with clang-retro) and macOS, refer to
- [The site](https://d-modem.github.io/gui/): the home page, the downloads and all the pages below
- [Features](docs/features.md): each page and menu of the app
- [Building](docs/building.md): Windows with clang-retro, and the app on Linux and macOS
- [The app on Haiku](docs/haiku.md): install, build, serial ports and limits
- [The built-in modem](docs/embedded-modem.md): the modem inside the app, with no dmodemd
- [Design](docs/design.md): how the app is built, hardware modems (the MultiTech MT9234MU), the Windows 9x notes, and the app on Linux and macOS
- [libdmodemctl](core/include/dmodemctl.h): the API of the library
+20
View File
@@ -0,0 +1,20 @@
# haiku.cmake - the toolchain file for the app on Haiku (x86_64), built
# on Linux with Clang and lld. It is the toolchain file of D-Modem
# (external/D-Modem/platforms/haiku/haiku.cmake), which the modem in the
# app uses too.
#
# python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot
# cmake -S . -B build/haiku -G Ninja -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_TOOLCHAIN_FILE=cmake/haiku.cmake -DHAIKU_SYSROOT=$PWD/haiku-sysroot \
# -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc
#
# Refer to docs/haiku.md.
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../external/D-Modem/platforms/haiku/haiku.cmake")
message(FATAL_ERROR "cmake/haiku.cmake: no external/D-Modem (git submodule update --init)")
endif()
# (the roots that a project gives, as libssh's build gets the prefix of
# mbedTLS, stay with the sysroot, which D-Modem's file sets)
set(_dmodem_find_roots ${CMAKE_FIND_ROOT_PATH})
include("${CMAKE_CURRENT_LIST_DIR}/../external/D-Modem/platforms/haiku/haiku.cmake")
list(APPEND CMAKE_FIND_ROOT_PATH ${_dmodem_find_roots})
list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH)
+5
View File
@@ -52,6 +52,11 @@ for an Intel Mac on a Mac with Apple silicon, add
`-DCMAKE_OSX_ARCHITECTURES=x86_64` to the first command. Set one
architecture only. The app cannot be a universal binary.
## Haiku
You build the app for Haiku (x86_64) on Linux, with clang and a sysroot
of Haiku's packages. Refer to [The app on Haiku](haiku.md#build).
## Mac OS X 10.4 and later (PowerPC and Intel)
The app for Mac OS X 10.4 (Tiger) and later builds on Linux. It uses the
+10
View File
@@ -20,6 +20,7 @@ When `main` has no new commits, the release does not change.
| macOS, arm64 (Apple silicon) | [`dmodem-win32-macos-arm64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos-arm64.tar.gz) | The app on macOS, with the built-in modem. |
| macOS, x86_64 (Intel Mac) | [`dmodem-win32-macos-x86_64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos-x86_64.tar.gz) | The app on macOS, with the built-in modem. |
| Mac OS X 10.4 and later, PowerPC and Intel | [`dmodem-win32-macosx10.4.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macosx10.4.tar.gz) | The app with the built-in modem. One program for PowerPC (G3, G4, G5) and Intel (i386). It is not tested on a Mac yet. |
| Haiku R1/beta6 and later, x86_64 | [`dmodem-win32-haiku-x86_64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-haiku-x86_64.tar.gz) | The app on Haiku, with the built-in modem. It needs libusb. |
| All | [`SHA256SUMS`](https://github.com/D-Modem/gui/releases/download/nightly/SHA256SUMS) | The SHA-256 of each file. |
If a file is not in the release, the newest build did not make it. The
@@ -67,6 +68,15 @@ The result for the file must be `OK`.
3. Extract the file. Type `tar -xzf dmodem-win32-linux-x86_64.tar.gz`.
4. Start the app. Type `./dmodem-win32`.
## Install on Haiku
1. Install libusb. In a Terminal, type `pkgman install libusb`.
2. Download `dmodem-win32-haiku-x86_64.tar.gz`.
3. Extract the file. Type `tar -xzf dmodem-win32-haiku-x86_64.tar.gz`.
4. Start the app. Type `./dmodem-win32`.
For more information, refer to [The app on Haiku](haiku.md).
## Build the app
To build the app from the source code, refer to [Building](building.md).
+98
View File
@@ -0,0 +1,98 @@
# The app on Haiku
The Windows app also runs on Haiku (x86_64). The app is the same Win32
source code. It runs over the portable Win32 layer of
[clang-retro MFC](https://github.com/clang-retro/mfc), which shows the
windows with Haiku's Interface Kit. The built-in modem is in the app, as
on the other systems.
<img src="images/haiku-modem.png" width="49%" alt="The Modem page of the app on Haiku"> <img src="images/haiku-line-settings.png" width="49%" alt="The Line Settings dialog of the app on Haiku">
## Requirements
- Haiku R1/beta6 or later, x86_64. The app was tested on R1/beta6.
- libusb. In a Terminal, type `pkgman install libusb`.
## Install
1. Download `dmodem-win32-haiku-x86_64.tar.gz` from the
[nightly release](https://github.com/D-Modem/gui/releases/tag/nightly).
2. Open a Terminal in the download folder.
3. Extract the file. Type `tar -xzf dmodem-win32-haiku-x86_64.tar.gz`.
4. Start the app. Type `./dmodem-win32`.
The app keeps its settings in `~/config/settings/libmfc`.
## Build
You build the app on Linux. The build uses the system's clang and a
sysroot that has Haiku's own packages.
1. Install the tools. On Ubuntu 24.04, type
`sudo apt install cmake ninja-build clang lld llvm libzstd1 python3`.
2. Get [clang-retro MFC](https://github.com/clang-retro/mfc) and the
D-Modem submodule (`git submodule update --init`).
3. Make the sysroot. The script downloads Haiku's packages and examines
them against the SHA-256 of their repositories:
python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot
4. Build the app:
cmake -S . -B build/haiku -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/haiku.cmake \
-DHAIKU_SYSROOT=$PWD/haiku-sysroot \
-DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc
cmake --build build/haiku --target dmodem-win32
The app is `build/haiku/winport/dmodem-win32`. Copy it to the Haiku
computer.
`cmake/haiku.cmake` includes the toolchain file of D-Modem
(`external/D-Modem/platforms/haiku/haiku.cmake`). The CI job
`winport-haiku` (`.github/workflows/build.yml`) does these steps. It does
not start the app.
## Serial ports and modems
Haiku keeps the serial ports in `/dev/ports`:
- `pc_serial0`, `pc_serial1` and on are the serial ports of the computer.
- `usb0`, `usb1` and on are the USB serial adapters and the CDC-ACM USB
modems. Haiku's `usb_serial` driver makes these ports.
In **Line settings**, the **Port** list shows the ports of `/dev/ports`,
for example `/dev/ports/usb0`. You can also type `COM1` (the first port
by name), `COM2` (the second port), and so on.
**Look for a modem** does these steps:
1. It finds the ports in `/dev/ports`.
2. It finds the USB devices with Haiku's USB Kit. It gives each `usbN`
port the name of its device (the maker and the product).
3. If a CDC-ACM device tells that it takes AT commands, the app selects
its port as the modem.
Haiku has no driver for the MultiTech MT9234MU. If you connect this
modem, **Look for a modem** tells you that Haiku cannot use it. Use a
modem with a serial port, or a CDC-ACM USB modem.
## Keys
The keys are those of a PC keyboard:
| Key on the keyboard | Key in the app |
| --- | --- |
| Control | Control. For example, Control+C copies. |
| Alt (Haiku's Command key, by default) | Alt. For example, Alt+M opens the **Modem** menu. |
| Windows (Haiku's Option key) | Windows |
## Limits
- The app has no sound on Haiku. The **Phone** page cannot play or
record the call.
- The app cannot print. Only "Save as PDF" is available.
- The Deskbar shows a generic icon for the app.
- The USB modems were not tested on Haiku yet. QEMU's USB serial adapter
does not operate with Haiku, so the tests used the serial port of the
computer only.
Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

+1
View File
@@ -17,6 +17,7 @@ nav:
- Features: features.md
- The built-in modem: embedded-modem.md
- Building: building.md
- The app on Haiku: haiku.md
- Design: design.md
- "libdmodemctl API": https://github.com/D-Modem/gui/blob/main/core/include/dmodemctl.h
- Documentation style: STYLE.md
+5
View File
@@ -38,6 +38,11 @@ if(WIN32)
elseif(UNIX)
find_package(Threads REQUIRED)
target_link_libraries(dmodemssh PUBLIC Threads::Threads)
# Haiku has the sockets in libnetwork and strsep (for libssh) in
# libbsd, not in libroot
if(HAIKU)
target_link_libraries(dmodemssh PUBLIC network bsd)
endif()
endif()
if(MSVC)
target_compile_options(dmodemssh PRIVATE /W4 /wd4996)
+9
View File
@@ -35,6 +35,10 @@ if(MACOSX_LEGACY_TARGET)
list(APPEND _args -D${_v}=${${_v}})
endforeach()
endif()
# (cmake/haiku.cmake: D-Modem's Haiku toolchain file)
if(HAIKU_SYSROOT)
list(APPEND _args -DHAIKU_SYSROOT=${HAIKU_SYSROOT} -DHAIKU_TRIPLE=${HAIKU_TRIPLE})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
list(APPEND _args -DCMAKE_SYSTEM_NAME=iOS)
endif()
@@ -93,6 +97,11 @@ if(CLANG_DOS)
list(APPEND _ssh_args -DHAVE_ARPA_INET_H= -DHAVE_IO_H= -DHAVE_TERMIOS_H=)
endif()
endif()
# (Haiku: getaddrinfo is in libnetwork, which libssh's check does not
# link with)
if(HAIKU)
list(APPEND _ssh_args -DHAVE_GETADDRINFO=1)
endif()
list(APPEND _ssh_args "-DCMAKE_C_FLAGS=${_ssh_cflags}")
# (WITH_SERVER: libssh runs a client's callbacks for the channels the
+28
View File
@@ -150,3 +150,31 @@ dmodem_patch(src/misc.c
#define dmodem_if_nametoindex if_nametoindex /* D-Modem */
")
# The terminal modes that Haiku's termios.h does not have (IMAXBEL,
# VREPRINT, VWERASE, VLNEXT, VDISCARD): sent only where they are.
dmodem_patch(src/ttyopts.c
" SSH_ENCODE_INPUT_OPT(IMAXBEL)
"
"#ifdef IMAXBEL /* D-Modem: not on Haiku */
SSH_ENCODE_INPUT_OPT(IMAXBEL)
#endif
")
dmodem_patch(src/ttyopts.c
" SSH_ENCODE_CC_OPT(VREPRINT)
SSH_ENCODE_CC_OPT(VWERASE)
SSH_ENCODE_CC_OPT(VLNEXT)
"
"#ifdef VREPRINT /* D-Modem: not on Haiku */
SSH_ENCODE_CC_OPT(VREPRINT)
SSH_ENCODE_CC_OPT(VWERASE)
SSH_ENCODE_CC_OPT(VLNEXT)
#endif
")
dmodem_patch(src/ttyopts.c
" SSH_ENCODE_CC_OPT(VDISCARD)
"
"#ifdef VDISCARD /* D-Modem: not on Haiku */
SSH_ENCODE_CC_OPT(VDISCARD)
#endif
")
+118
View File
@@ -13,6 +13,12 @@
* USB maker and product of each port. A MultiTech MT9234MU with no
* firmware has no port: ports_problem() tells you what to do.
* - macOS (winport/): the /dev/cu.* devices.
* - Haiku (winport/): the devices in /dev/ports: pc_serial0 and the
* other ports of the computer, and usb0 and the other USB serial
* ports and USB modems (CDC-ACM) of the usb_serial driver, with the
* USB maker and product of each one from the USB Kit
* (ports_haiku.cpp). A CDC-ACM device that takes AT commands is a
* modem.
*/
#include "app.h"
@@ -282,6 +288,118 @@ void ports_problem(char *out, int n)
out[0] = '\0';
}
#elif defined(__HAIKU__)
#include "ports_haiku.h"
/* the directory of the serial ports (a test can give another one) */
#ifndef PORTS_DEVDIR
#define PORTS_DEVDIR "/dev/ports"
#endif
/* Compares two port names for qsort: in the order of their names. */
static int by_name(const void *a, const void *b)
{
return strcmp(((const PortInfo *)a)->name, ((const PortInfo *)b)->name);
}
/* Gives the ports of /dev/ports in the order of their names, with the
names of their USB devices and the CDC-ACM modems from the USB Kit. */
int ports_list(PortInfo *out, int max)
{
int count = 0;
DIR *d = opendir(PORTS_DEVDIR);
if (!d)
return 0;
struct dirent *e;
while ((e = readdir(d)) != NULL) {
const char *n = e->d_name;
if (n[0] == '.')
continue;
char path[64];
_snprintf(path, sizeof(path), PORTS_DEVDIR "/%s", n);
path[sizeof(path) - 1] = '\0';
/* (usb_serial names each USB port usbN: a serial adapter
or a CDC-ACM modem; the ports of the computer are
pc_serialN) */
count = add(out, count, max, path,
!strncmp(n, "usb", 3) ? "USB serial port or modem" :
!strncmp(n, "pc_serial", 9) ? "Serial port" : NULL,
0);
}
closedir(d);
/* (the order of COM1, COM2 and on in clang-retro MFC) */
qsort(out, (size_t)count, sizeof(out[0]), by_name);
/* The USB devices with a usbN port, in the order of their places
on the buses, which is the order that usb_serial numbers them
in when the computer starts. When there are as many devices as
usbN ports, each port gets the maker, the product and the modem
flag of its device. */
HaikuUsbSerial usb[32];
int n_usb = haiku_usb_serial(usb, 32), n_serial = 0;
for (int i = 0; i < n_usb; i++)
if (usb[i].has_port)
usb[n_serial++] = usb[i];
int n_ports = 0;
for (int i = 0; i < count; i++)
if (!strncmp(out[i].name, PORTS_DEVDIR "/usb", sizeof(PORTS_DEVDIR "/usb") - 1))
n_ports++;
if (n_serial > 0 && n_serial == n_ports) {
int k = 0;
for (int i = 0; i < count; i++) {
if (strncmp(out[i].name, PORTS_DEVDIR "/usb", sizeof(PORTS_DEVDIR "/usb") - 1))
continue;
if (usb[k].desc[0])
copy(out[i].desc, usb[k].desc, sizeof(out[i].desc));
const char *mt = NULL;
for (int m = 0; m < N_MULTITECH; m++) {
char pid[8];
_snprintf(pid, sizeof(pid), "%04x", usb[k].product);
pid[sizeof(pid) - 1] = '\0';
if (usb[k].vendor == 0x06e0 && !_stricmp(pid, multitech[m].product))
mt = multitech[m].name;
}
if (mt)
copy(out[i].desc, mt, sizeof(out[i].desc));
out[i].modem = usb[k].modem || mt;
k++;
}
}
modems_first(out, count);
return count;
}
/* Tells why a modem that is connected has no port on Haiku (the
MultiTech MT9234MU has no driver), or gives an empty string. */
void ports_problem(char *out, int n)
{
if (n <= 0)
return;
out[0] = '\0';
/* A MultiTech modem with no usbN port: usb_serial has no driver
for its USB UART (a TI TUSB3410). */
HaikuUsbSerial usb[32];
int n_usb = haiku_usb_serial(usb, 32);
for (int i = 0; i < n_usb; i++) {
if (usb[i].vendor != 0x06e0 || usb[i].has_port)
continue;
for (int m = 0; m < N_MULTITECH; m++) {
char pid[8];
_snprintf(pid, sizeof(pid), "%04x", usb[i].product);
pid[sizeof(pid) - 1] = '\0';
if (_stricmp(pid, multitech[m].product))
continue;
_snprintf(out, (size_t)n,
"%s: Haiku has no serial port driver for "
"this modem. Use a modem with a serial port, "
"or a CDC-ACM USB modem.", multitech[m].name);
out[n - 1] = '\0';
return;
}
}
}
#else /* Linux */
/* the root of sysfs (a test can give another one) */
+115
View File
@@ -0,0 +1,115 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* ports_haiku.cpp - the USB serial devices of a Haiku computer, from
* the USB Kit, for ports.cpp ("Look for a modem").
*
* This file uses Haiku's headers and none of the Windows headers (their
* types clash). ports.cpp calls haiku_usb_serial() and matches the
* devices to the usbN ports of the usb_serial driver.
*/
#if defined(__HAIKU__)
#include "ports_haiku.h"
#include <USBKit.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <algorithm>
#include <string>
#include <vector>
/* The vendors of the USB serial adapters that usb_serial knows: FTDI,
KLSI, Prolific, Silicon Labs and WinChipHead */
static const uint16 serial_vendors[] = { 0x0403, 0x05e9, 0x067b, 0x10c4, 0x1a86 };
/* Gives the paths of the USB devices under dir (/dev/bus/usb), in the
order of their names, each hub with the devices on it after it. */
static void walk(const std::string &dir, std::vector<std::string> *out)
{
DIR *d = opendir(dir.c_str());
if (!d)
return;
std::vector<std::string> names;
struct dirent *e;
while ((e = readdir(d)) != NULL)
if (e->d_name[0] != '.')
names.push_back(e->d_name);
closedir(d);
std::sort(names.begin(), names.end());
for (const std::string &n : names) {
std::string p = dir + "/" + n;
struct stat st;
if (stat(p.c_str(), &st) != 0)
continue;
if (S_ISDIR(st.st_mode))
walk(p, out);
else if (n != "hub")
out->push_back(p);
}
}
/* Tells if a device has a CDC-ACM interface (class 2, subclass 2), and
if that interface takes AT commands (protocol 1, V.250): a modem. */
static bool acm(const BUSBDevice &dev, bool *at)
{
*at = false;
bool found = dev.Class() == 2 && dev.Subclass() == 2;
if (found && dev.Protocol() == 1)
*at = true;
const BUSBConfiguration *c = dev.ActiveConfiguration();
if (!c && dev.CountConfigurations() > 0)
c = dev.ConfigurationAt(0);
for (uint32 i = 0; c && i < c->CountInterfaces(); i++) {
const BUSBInterface *itf = c->InterfaceAt(i);
if (!itf || itf->Class() != 2 || itf->Subclass() != 2)
continue;
found = true;
if (itf->Protocol() == 1)
*at = true;
}
return found;
}
/* Gives the USB devices (at most max, hubs not included) in the order
of their places on the USB buses, with the vendors and products, if
usb_serial makes a port for each, and if each is a modem. */
int haiku_usb_serial(HaikuUsbSerial *out, int max)
{
std::vector<std::string> paths;
walk("/dev/bus/usb", &paths);
int n = 0;
for (const std::string &p : paths) {
if (n >= max)
break;
BUSBDevice dev(p.c_str());
if (dev.InitCheck() != B_OK || dev.IsHub())
continue;
bool at = false;
bool is_acm = acm(dev, &at);
bool serial = is_acm;
for (uint16 v : serial_vendors)
if (dev.VendorID() == v)
serial = true;
HaikuUsbSerial *s = &out[n];
memset(s, 0, sizeof(*s));
s->vendor = dev.VendorID();
s->product = dev.ProductID();
s->has_port = serial;
s->modem = at;
const char *maker = dev.ManufacturerString();
const char *product = dev.ProductString();
snprintf(s->desc, sizeof(s->desc), "%s%s%s", maker ? maker : "",
maker && *maker && product && *product ? " " : "",
product ? product : "");
n++;
}
return n;
}
#endif
+24
View File
@@ -0,0 +1,24 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 D-Modem Authors
*
* ports_haiku.h - the USB devices of a Haiku computer (ports_haiku.cpp),
* for ports.cpp. It uses neither the Windows headers
* nor Haiku's, so that both files can include it.
*/
#ifndef DMODEM_PORTS_HAIKU_H
#define DMODEM_PORTS_HAIKU_H
/* A USB device, as the USB Kit tells it */
typedef struct HaikuUsbSerial {
unsigned short vendor, product;
int has_port; /* usb_serial makes a usbN port for it */
int modem; /* a CDC-ACM interface that takes AT commands */
char desc[128]; /* its maker and product, from the device */
} HaikuUsbSerial;
/* Gives the USB devices (at most max, hubs not included), in the order
of their places on the USB buses. */
int haiku_usb_serial(HaikuUsbSerial *out, int max);
#endif
+24 -3
View File
@@ -1,8 +1,14 @@
# The Windows app (windows/) for Linux and macOS, over the portable Win32
# layer of clang-retro MFC (libwinport, in port/ of that project).
# The Windows app (windows/) for Linux, macOS and Haiku, over the
# portable Win32 layer of clang-retro MFC (libwinport, in port/ of that
# project).
#
# cmake -B build -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc \
# -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
#
# Haiku, from Linux (cmake/haiku.cmake and docs/haiku.md):
#
# cmake -B build -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc \
# -DCMAKE_TOOLCHAIN_FILE=cmake/haiku.cmake -DHAIKU_SYSROOT=/path/to/sysroot
enable_language(CXX)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -45,6 +51,9 @@ if(MACOSX_LEGACY_TARGET)
set(WINPORT_TARGET "${MACOSX_LEGACY_TARGET}")
elseif(APPLE)
set(WINPORT_TARGET "${_arch_apple}-apple-macos11")
elseif(HAIKU)
# (the Haiku toolchain file gives the triple and the sysroot)
set(WINPORT_TARGET "${HAIKU_TRIPLE}")
else()
set(WINPORT_TARGET "${_arch_linux}-linux-gnu")
endif()
@@ -67,6 +76,10 @@ if(MACOSX_LEGACY_TARGET)
SDK=${MACOSX_LEGACY_SDK} LIBCXX=${MACOSX_LEGACY_SYSROOT}
CCTOOLS=${MACOSX_LEGACY_CCTOOLS}/bin/powerpc-apple-darwin8-
"CXXFLAGS=-O2 -include cstdlib")
elseif(HAIKU)
# (Haiku's C++ library is libstdc++, which the sysroot has)
set(_winport_make_args STDLIB= CXX=${_winport_cxx} AR=${CMAKE_AR}
SYSROOT=${HAIKU_SYSROOT})
else()
set(_winport_make_args STDLIB= CXX=${_winport_cxx} AR=${CMAKE_AR})
endif()
@@ -120,6 +133,14 @@ if(MACOSX_LEGACY_TARGET)
target_link_libraries(dmodem-win32 PRIVATE "-framework Cocoa" "-framework OpenGL" pthread)
elseif(APPLE)
target_link_libraries(dmodem-win32 PRIVATE "-framework Cocoa" pthread)
elseif(HAIKU)
# (the USB devices for Look for a modem, from the USB Kit:
# windows/src/ports_haiku.cpp, with Haiku's headers only)
target_sources(dmodem-win32 PRIVATE "${_win}/src/ports_haiku.cpp")
# (libbe: the Interface Kit; libdevice: the USB Kit; libnetwork: the
# sockets; libbsd: dl_iterate_phdr. libroot has the rest, dlopen and
# the threads too.)
target_link_libraries(dmodem-win32 PRIVATE be device network bsd)
else()
target_link_libraries(dmodem-win32 PRIVATE dl pthread)
endif()
@@ -127,7 +148,7 @@ endif()
# The install on Linux (cmake --install): the app, its desktop entry,
# its AppStream data and its icon. Also the firmware of the MultiTech
# MT9234MU (the licence is unknown: firmware/README.md).
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT HAIKU)
include(GNUInstallDirs)
install(TARGETS dmodem-win32 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES data/io.github.d_modem.DModem.desktop