Command line utility for working with Siemens Phones file system
Find a file
2026-10-01 02:46:52 -05:00
src Switch to node-sie-serial from NPM 2026-10-01 02:46:52 -05:00
tests Switch to node-sie-serial from NPM 2026-10-01 02:46:52 -05:00
.gitignore Initial slop 2026-09-19 13:04:16 -05:00
package.json Switch to node-sie-serial from NPM 2026-10-01 02:46:52 -05:00
pnpm-lock.yaml Switch to node-sie-serial from NPM 2026-10-01 02:46:52 -05:00
README.md Switch to node-sie-serial from NPM 2026-10-01 02:46:52 -05:00
tsconfig.json Initial slop 2026-09-19 13:04:16 -05:00
vitest.config.ts Initial slop 2026-09-19 13:04:16 -05:00

sieobex

OBEX (FlexMem) file operations on Siemens phones, from the terminal.

Entering OBEX mode takes seconds — an AT speed probe, the AT^SQWE mode switch, then the OBEX handshake — and the phone drops out of it when the link closes. So sieobex works like adb: connect starts a small daemon that holds the session, and every other command is a short-lived client of it.

sieobex connect /dev/ttyUSB0
sieobex ls -l Data:/Misc
sieobex pull Data:/Misc/Photo.jpg ./
sieobex push ./ringtone.mid 0:/Sounds
sieobex rm -r Data:/Misc/OldFolder
sieobex disconnect

Installing

Node 22 or newer and pnpm are the only prerequisites.

git clone <this repository> sieobex
cd sieobex
pnpm install
pnpm build

Putting sieobex on PATH

pnpm link --global

If pnpm has never had a global bin directory it stops with ERR_PNPM_NO_GLOBAL_BIN_DIR; pnpm setup creates one and puts it on PATH, then link from a new shell. The link points at this checkout rather than a copy, so a later pnpm build updates the installed command and the checkout has to stay where it is. pnpm uninstall --global sieobex removes it.

pnpm add --global . does not work here, unlike in the sibling repositories: it installs a broken link instead of the package.

Without a global install, run the built entry point through node, or alias it:

node /path/to/sieobex/dist/index.js ls /

Serial port access

On Linux the port belongs to the dialout group, and a user outside it gets Permission denied opening /dev/ttyUSB0:

sudo usermod -aG dialout $USER

Group changes only apply to new logins. A USB data cable normally shows up as /dev/ttyUSB0, Bluetooth serial as /dev/rfcomm0.

Commands

Command What it does
connect <device> Open the phone session and start the daemon
status Connection details plus capacity and free space, read fresh
ls [-l] [-a] [-h] [-t] [-S] [-r] [-U] [-1] [path...] List a directory
pull <phone-path> <local-path> Copy a file or folder off the phone
push <local-path> <phone-path> Copy a file or folder onto the phone
rm [-r] [-f] <phone-path>... Delete a file or folder
log [-f] Print the daemon log
disconnect Stop the daemon and hand the phone back to AT mode
completion <bash|zsh> Print the completion script for a shell

connect takes --baudrate N to pin the AT handshake to one speed instead of probing 115200, 57600, 19200, 230400 and 9600 in turn. --foreground runs the daemon in the terminal instead of the background, which is the easiest way to watch a session go wrong.

The device may be a serial port (/dev/ttyUSB0, COM3) or a socket, which is how the emulator is reached: tcp://127.0.0.1:35001, unix:///path/to.sock.

Connecting on demand

Every command except connect, disconnect and completion takes -d DEVICE (--device) and brings the session up itself, so a one-off job needs no separate connect:

sieobex ls -d /dev/ttyUSB0 Data:/Misc
sieobex pull -d /dev/ttyUSB0 Data:/Misc/Photo.jpg ./

The daemon is started when none is running, and left alone when it already holds that device — so the second command above reuses the session the first one opened rather than paying for the handshake again. A daemon holding a different device is disconnected first, and sieobex waits for it to release the port before opening the new one.

Two spellings of one port count as the same device: a /dev/serial/by-id/... symlink and the /dev/ttyUSB0 it points at, or tcp:host:port and tcp://host:port.

Leaving a session is the +++ escape back to the phone's AT interpreter, and disconnect waits for it — the couple of seconds it takes are the difference between a phone that answers the next command and one that stays in OBEX mode, deaf to every AT command until it is unplugged.

Should a session end without that — a daemon killed, a cable pulled — the phone is left in OBEX mode and answers nothing, which the AT probe cannot tell apart from an absent phone. connect sends the escape itself when the first handshake fails, so the next attempt gets the phone back rather than needing it unplugged.

Paths

The phone's own form is a plain rooted path, and that is what sieobex prints:

/Data/Misc/File.jpg

Two aliases are accepted as input. Any top-level folder can be written as a drive, and on SGOLD and NewSGOLD phones the Siemens numbers work too:

Input Means
/Data/Misc/File.jpg the raw form
Data:/Misc/File.jpg drive by name
0:/Misc/File.jpg drive by number

The numbers are 0: Data, 1: Cache, 2: Config, 4: MMCard. Older EGOLD phones such as the C60 have no /Data and keep Sounds, Pictures, Java and the rest directly in the root, so there only 0: exists, meaning the root itself. Which folders a phone really has is whatever sieobex ls / prints.

Listing

ls marks each entry with its type and permissions, plus h for the ones the phone keeps to itself, for example drw- or -r--. There is no owner, group or link count, because the phone does not report any.

Those hidden entries are the phone's own system folders, and -a shows them. The root is the exception and always lists everything: these phones refuse read permission on every top-level folder, which is what marks an entry hidden, so honouring the flag there would show an empty file system.

Progress and logs

push and pull show a live line with the transferred size, the percentage and the current speed, and a file counter when a whole folder is moving. When stderr is not a terminal each finished file gets one plain line instead, so piping the output stays readable.

Every session traces itself into the daemon log, in the same form the web tools show: the AT commands (atc), the BFC exchanges (bfc) and the OBEX requests and answers (obex). That is one line per exchange, and it is the first thing wanted when a phone misbehaves, so it is never off.

connect --debug adds the raw packets of both transports (bfc:trx and obex:trx), which are voluminous enough to bury everything else and are the reason the baseline stops short of them.

sieobex connect /dev/ttyUSB0            # atc, bfc, obex
sieobex connect /dev/ttyUSB0 --debug    # and the raw packets
sieobex log -f

The daemon keeps its socket, pid file and log in $XDG_RUNTIME_DIR/sieobex, falling back to ~/.sieobex. Set SIEOBEX_HOME to move them.

Completion

source <(sieobex completion bash)     # ~/.bashrc
source <(sieobex completion zsh)      # ~/.zshrc, after compinit

Then Tab completes phone paths for ls, rm, pull and push by asking the connected phone, local paths where the argument is a local one, and the value of -d from /dev. With no daemon running, Tab stays quiet.

Candidates come back as raw paths — Da completes to /Data/ — and no colon is ever put into a word that has none. Type one yourself and it is kept: Data:/Mi completes to Data:/Misc/. A number is the exception, since 0 means nothing without it and completes to 0:/.

To install either script once instead of sourcing it from an rc file:

sieobex completion bash | sudo tee /usr/share/bash-completion/completions/sieobex
sieobex completion zsh  | sudo tee /usr/share/zsh/site-functions/_sieobex

The bash directory is where the bash-completion package loads scripts on demand; the script itself needs nothing from that package and is self-contained. The zsh one may go in any directory of your $fpath (print -l $fpath lists them) and has to be named _sieobex, which is what zsh autoloads the first time a sieobex command is completed — start a new shell afterwards, or rerun compinit, so it is noticed.

Both scripts ask the daemon through the hidden sieobex __complete, so the candidates are whatever the phone really holds.

Two bash details are worth knowing, because zsh has neither problem. COMP_WORDBREAKS contains :, so bash splits Data:/Misc into three words and replaces only the fragment after the last colon; the script rebuilds the word from COMP_LINE and trims the candidates to match. And readline's filename quoting would escape that same colon — Data\:/, which completes no further — so it is left off and the spaces in phone file names are escaped by hand instead.

Developing

pnpm test          # unit tests, no hardware
pnpm dev           # tsc --watch

End-to-end tests

The e2e tests drive the built CLI against emulated phones — an EL71, an S75 and a CX70 — booting real firmware under pmb887x-emu, so they exercise a real AT interpreter and a real FlexMem server.

pnpm test:e2e

They need the emulator, a fullflash per phone, and Xvfb (QEMU opens a window even headless; tests/globalSetup.ts starts one). Point OBEX_E2E_EMU at the pmb887x-emu binary and OBEX_E2E_FULLFLASHES at the fullflash directory, or put symlinks at tests/.emu and tests/fullflashes. A phone whose fullflash is missing skips itself with the reason. These are the same variable names and defaults node-sie-serial uses, so one local setup serves both.

The CX70 is opt-in with SIEOBEX_E2E_CX70=1, because under the emulator it stalls for longer than the protocol timeout and fails tests for reasons that have nothing to do with the code. tests/README.md explains that and the other emulator quirks worth knowing before debugging a failure.

Each phone boots once per test file and the tests within a file share that session, which is why the suite runs with --no-file-parallelism: two emulators competing for CPU boot slower than the tests wait. Budget minutes, and considerably more for the CX70, whose link runs at 19200 baud.

Against a real phone

The same suite runs over a cable, which is the only way to cover a real link and a real flash:

SIEOBEX_E2E_DEVICE=/dev/ttyUSB0 pnpm test:e2e:device

It writes to the phone: inside SIEOBEX_E2E_DIR (/Data/Misc by default) it creates sieobex-e2e.bin and a sieobex-tree folder, reads them back and deletes them again. It touches nothing else, but point it at a directory of no consequence — and at one of the phone's own folders on an EGOLD phone, where /Data is refused:

SIEOBEX_E2E_DEVICE=/dev/ttyUSB0 SIEOBEX_E2E_DIR=/Sounds pnpm test:e2e:device

Before the first test it lists that directory and pushes a small file into it, so the wrong one fails in a second with the phone's own answer and a listing of the root to choose from. A hardware run also drives the phone at 115200, 57600 and 19200 baud in turn (SIEOBEX_E2E_BAUDRATES trims that) and checks that a connect given no speed finds one itself — the part no emulator can test, since QEMU ignores the host's baud rate. The model and the platform are read out of the phone rather than assumed, and each phase prints as it happens, since over a real cable there is real waiting to explain. Without SIEOBEX_E2E_DEVICE the suite skips, so pnpm test:e2e stays emulator-only. tests/README.md lists the other variables.