palm-client: Ports diagnostics screen; make editor for clangd

The Ports screen lists Serial Manager drivers (creator, feature flags,
max baud, description) to find which one reaches the USB cradle, as a
first step toward a USB bridge for testing before the boards arrive.
make editor copies the SDK headers out of the image and writes
compile_flags.txt so the editor stops flagging Palm OS types.
This commit is contained in:
rich committed 2026-11-01 11:24:36 -05:00
1 parent 9fba1903af
commit 259c666ad8
7 files changed
+118 -3

No files matched your search

+4
View File
@@ -15,3 +15,7 @@ palm-client/build/
.DS_Store
# MeshCore build checkout (firmware/Makefile)
firmware/meshcore/
# Palm SDK headers copied out of the Docker image for the editor (see Makefile: editor)
palm-client/.sdk/
palm-client/compile_flags.txt
+13 -2
View File
@@ -3,13 +3,14 @@
# make build build/visormesh.prc (in Docker if the toolchain isn't installed)
# make test run the host-side protocol tests
# make install install the .prc over the USB cradle (press HotSync when asked)
# make editor copy the SDK headers to .sdk/ and write compile_flags.txt for clangd
# make clean
APP = visormesh
NAME = VisorMesh
CREATOR = VMsh
SRCS = src/main.c src/protocol.c src/transport_srm.c
SRCS = src/main.c src/protocol.c src/transport_srm.c src/ports.c
OBJS = $(SRCS:src/%.c=build/%.o)
CC = m68k-palmos-gcc
@@ -66,4 +67,14 @@ install: all
clean:
rm -rf build
.PHONY: all test image install clean
# Editor support: clangd can't see the SDK inside the image, so copy it out.
editor: image
rm -rf .sdk && mkdir -p .sdk
cid=$$(docker create --platform linux/amd64 $(DOCKER_IMAGE)) && \
docker cp -q $$cid:/opt/palmdev/sdk-3.5/include .sdk/sdk-3.5; docker rm $$cid >/dev/null
printf '%s\n' -std=gnu89 -D__palmos__=1 -Isrc -Wno-implicit-int -Wno-pointer-sign \
-Wno-deprecated-non-prototype -Wno-incompatible-library-redeclaration \
-Wno-ignored-attributes -Wno-pragma-once-outside-header > compile_flags.txt
find .sdk/sdk-3.5 -type d | sed 's|^|-I|' >> compile_flags.txt
.PHONY: all test image install clean editor
+10 -1
View File
@@ -11,7 +11,16 @@ BEGIN
LABEL "MeshCore client for the Visor" AUTOID AT (5 20)
LABEL "Radio:" AUTOID AT (5 45) FONT 1
LABEL "Not connected " ID MainStatusLabel AT (40 45)
BUTTON "Query radio" ID MainQueryButton AT (CENTER 140 AUTO AUTO)
BUTTON "Query radio" ID MainQueryButton AT (20 140 AUTO AUTO)
BUTTON "Ports" ID MainPortsButton AT (PREVRIGHT+10 PREVTOP AUTO AUTO)
END
FORM ID PortsForm AT (0 0 160 160)
NOFRAME
USABLE
BEGIN
TITLE "Serial Ports"
BUTTON "Done" ID PortsDoneButton AT (CENTER 145 AUTO AUTO)
END
ALERT ID RomIncompatibleAlert
+7
View File
@@ -2,6 +2,7 @@
#include "resources.h"
#include "protocol.h"
#include "transport.h"
#include "ports.h"
#define VM_MIN_ROM_VERSION sysMakeROMVersion(3, 5, 0, sysROMStageRelease, 0)
#define VM_QUERY_TIMEOUT (2 * SysTicksPerSecond())
@@ -88,6 +89,10 @@ static Boolean MainFormHandleEvent(EventType *event)
QueryRadio();
return true;
}
if (event->data.ctlSelect.controlID == MainPortsButton) {
FrmGotoForm(PortsForm);
return true;
}
break;
default:
break;
@@ -107,6 +112,8 @@ static Boolean AppHandleEvent(EventType *event)
FrmSetActiveForm(form);
if (formId == MainForm)
FrmSetEventHandler(form, MainFormHandleEvent);
else if (formId == PortsForm)
FrmSetEventHandler(form, PortsFormHandleEvent);
return true;
}
+72
View File
@@ -0,0 +1,72 @@
/*
* Diagnostics: lists the Serial Manager drivers on this device (creator,
* feature flags, description), to find which one reaches the USB cradle.
*/
#include <PalmOS.h>
#include "resources.h"
#include "ports.h"
#define LINE_H 11
#define FIRST_Y 18
#define MAX_LINES 11
static void DrawLine(UInt16 line, const Char *text)
{
WinDrawChars(text, StrLen(text), 2, FIRST_Y + line * LINE_H);
}
static void DrawPorts(void)
{
DeviceInfoType info;
UInt16 count = 0, i, line = 0;
Char buf[48];
Char crid[5];
Err err;
err = SrmGetDeviceCount(&count);
if (err != errNone) {
StrPrintF(buf, "SrmGetDeviceCount err 0x%x", err);
DrawLine(line, buf);
return;
}
StrPrintF(buf, "%u serial device(s):", count);
DrawLine(line++, buf);
for (i = 0; i < count && line + 1 < MAX_LINES; i++) {
MemSet(&info, sizeof(info), 0);
err = SrmGetDeviceInfo(i, &info);
if (err != errNone) {
StrPrintF(buf, "%u: err 0x%x", i, err);
DrawLine(line++, buf);
continue;
}
MemMove(crid, &info.serDevCreator, 4);
crid[4] = 0;
StrPrintF(buf, "%u '%s' ftr %lx max %lu", i, crid, info.serDevFtrInfo, info.serDevMaxBaudRate);
DrawLine(line++, buf);
if (info.serDevPortInfoStr) {
StrNCopy(buf, " ", sizeof(buf));
StrNCat(buf, info.serDevPortInfoStr, sizeof(buf));
DrawLine(line++, buf);
}
}
}
Boolean PortsFormHandleEvent(EventType *event)
{
switch (event->eType) {
case frmOpenEvent:
FrmDrawForm(FrmGetActiveForm());
DrawPorts();
return true;
case ctlSelectEvent:
if (event->data.ctlSelect.controlID == PortsDoneButton) {
FrmGotoForm(MainForm);
return true;
}
break;
default:
break;
}
return false;
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef VM_PORTS_H
#define VM_PORTS_H
#include <PalmOS.h>
Boolean PortsFormHandleEvent(EventType *event);
#endif
+4
View File
@@ -4,6 +4,10 @@
#define MainForm 1000
#define MainStatusLabel 1001
#define MainQueryButton 1002
#define MainPortsButton 1003
#define PortsForm 1100
#define PortsDoneButton 1101
#define RomIncompatibleAlert 2000