Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

tetherd D-Bus API (session bus)

Normative contract between tetherd and its clients (tether GTK app, tether-cli, future shell extensions). Bus name org.tether.Daemon. All strings UTF-8. Timestamps are Unix milliseconds (t).

/org/tether/Daemon — interface org.tether.Daemon1

Properties

NameTypeAccessMeaning
SelfIdsreadthis desktop’s device id (64 hex)
SelfNamesread/writeadvertised name (defaults to hostname)
Versionsreaddaemon version
Discoverablebread/writepublish mDNS + UDP beacon
ShowDesktopNotificationsbread/writemirror phone notifications to org.freedesktop.Notifications

Methods

  • ListDevices() -> (ao paths) — all known devices (paired, connected or merely discovered).
  • StartDiscovery(), StopDiscovery() — browsing is always on while the daemon runs; these are hints to burst beacons.
  • AddManualAddress(s address) — host or host:port; dials immediately and remembers the address.
  • GeneratePairingQr() -> (s uri) — returns tether://pair?... valid 5 minutes (see docs/reference/protocol.md). Calling again invalidates the previous one.
  • CancelPairingQr()

Signals

  • DeviceAdded(o path), DeviceRemoved(o path)
  • QrPairingStarted(o path) — a phone connected using the current QR; UI may show progress.

/org/tether/Devices/<id> — interface org.tether.Device1

<id> is the 64-hex device id (valid D-Bus path element).

Properties (all read-only; changes emitted via org.freedesktop.DBus.Properties.PropertiesChanged)

NameTypeMeaning
Idsdevice id
Namespeer name
Kindsdesktop / phone / tablet / unknown
Pairedbtrusted record exists
Connectedbauthenticated session up
Reachablebseen via discovery in the last 30 s
Addressesaslast known ip:port list
PairStatesnone / requested_by_us / requested_by_peer / confirming / paired
PairingSass6 digits while PairState is requested_by_peer or confirming, else ""
BatteryLeveli0..100, -1 unknown
BatteryChargingb
Modelsfrom DeviceInfo
Manufacturers
OsVersions
Capabilitiesaspeer’s Hello.capabilities
LastSeentms since epoch

Methods

  • RequestPair() — we initiate; emits PairingSas once the peer answers.
  • ConfirmPair() — user confirmed the SAS on this side.
  • RejectPair()
  • Unpair()
  • Connect() — dial known addresses now.
  • Disconnect()
  • GetNotifications() -> (aa{sv}) — currently visible notifications (dicts described below).
  • ActivateNotification(s key, i index, s reply_text) — index = -1 opens on phone; reply_text used for remote-input actions.
  • DismissNotification(s key)
  • GetAppNotificationSettings() -> (a{sb}) — package → enabled.
  • SetAppNotificationsEnabled(s package, b enabled)

Signals

  • NotificationPosted(a{sv} notification)
  • NotificationRemoved(s key)
  • ReplyRequested(s key) — the user clicked a reply action on a desktop notification; the GTK app should open its reply box for that key. For the daemon’s own message notifications (M2) key is thread:<thread_id> and the app should open that conversation’s composer instead.
  • PairingFinished(b success, s reason)

Notification dict (a{sv})

KeyTypeNotes
keys
packages
app_names
titles
texts
big_texts
sub_texts
when_mst
categorys
ongoingb
clearableb
silentb
conversationb
conversation_titles
icon_pathsabsolute path to cached PNG or ""
app_icon_pathsabsolute path or ""
has_content_intentb
actionsa(usbs)(index, title, remote_input, placeholder)
messagesa(sstb)(sender, text, ts_ms, from_self)

Files

  • Config: $XDG_CONFIG_HOME/tether/config.toml (name, discoverable, show_desktop_notifications, manual_addresses, blocked_packages per device).
  • Identity: $XDG_DATA_HOME/tether/identity.key (PKCS#8 PEM, mode 0600), identity.crt (PEM).
  • Trusted devices: $XDG_DATA_HOME/tether/trusted.toml — [[device]] id, name, kind, cert_pem, paired_at.
  • Icon cache: $XDG_CACHE_HOME/tether/blobs/<sha256>.png.
  • Logs: journald via tracing; RUST_LOG honoured.

Milestone 2 additions

Everything below is additive. org.tether.Device1 gains properties, methods and signals per feature; the daemon advertises what the peer supports through the existing Capabilities property, and clients hide UI for missing capabilities. Dicts (a{sv}) are described after the tables. Paths returned by methods are absolute and owned by the daemon’s cache; clients copy rather than move them.

org.tether.Daemon1 additions

Properties

NameTypeAccessMeaning
DownloadDirsread/writewhere received files land, default ~/Downloads/Tether
AutoAcceptFilesbread/writeaccept FileOffers from paired devices without asking (default true)
ClipboardSyncsread/writeoff / to_phone / from_phone / both (default both)
MessageNotificationsbread/writepost a desktop notification for new incoming messages (default true)

Signals

  • FileOffered(o device, s transfer_id, a(sts) files) — only when AutoAcceptFiles is false; files = (name, size, mime).

Methods

  • AcceptFileOffer(o device, s transfer_id, b accept)

org.tether.Device1 — connection

Properties

NameTypeMeaning
Heldbauto-reconnect paused after a Disconnect (either side); Connect() clears it

Method semantics change: Disconnect() now sends Disconnect{hold_seconds = 0} and holds; Connect() clears the hold and dials.

org.tether.Device1 — messages (messages, messages.mms)

Methods

  • GetConversations(u limit, u offset) -> (aa{sv}) — newest first; limit = 0 = all.
  • GetMessages(s thread_id, t before_ms, u limit) -> (aa{sv}) — newest first, before_ms = 0 = newest page.
  • GetMessage(s message_id) -> (a{sv})
  • SendMessage(as addresses, s body, i sub_id, as attachment_paths) -> (s request_id) — result arrives as MessageSendResult.
  • MarkThreadRead(s thread_id) — desktop-local read state.
  • RequestAttachment(s part_id) -> (s path) — returns the cached path if present, else "" and later AttachmentReady.
  • RefreshMessages() — force a ConversationsRequest now.
  • SearchMessages(s query, u limit) -> (aa{sv})

Signals

  • ConversationsChanged() — thread list order/snippets changed; clients re-fetch. During the initial sync this fires once per stored page instead of one MessageAdded per historical message.
  • MessageAdded(a{sv} message) — new or updated message (incoming or sent).
  • MessageRemoved(s message_id)
  • MessageSendResult(s request_id, b ok, s error, s message_id)
  • AttachmentReady(s part_id, s path) — path empty on failure.

Conversation dict: thread_id s, addresses as, display_name s (contact names joined, falls back to numbers), snippet s, date_ms t, unread_count u (desktop-local), message_count u, archived b, photo_path s (first contact’s photo or "").

Message dict: id s, thread_id s, addresses as, body s, date_ms t, type s (inbox|sent|draft|outbox|failed|queued), read b (desktop-local), sub_id i, mms b, subject s, attachments aa{sv} (part_id s, mime s, size t, name s, width u, height u, path s cached file or ""), sender_name s (resolved contact or ""), pending b (sent from this desktop, no result yet).

org.tether.Device1 — contacts (contacts)

Methods

  • GetContacts() -> (aa{sv}) — all cached contacts, sorted by display name.
  • LookupContact(s address) -> (a{sv}) — by phone number (normalised comparison) or email; empty dict if none.
  • RefreshContacts()

Signals

  • ContactsChanged()

Contact dict: uid s, display_name s, phones a(ss) ((type, number)), emails a(ss), photo_path s, starred b.

org.tether.Device1 — media and volume (media, volume)

Methods

  • GetMediaSessions() -> (aa{sv}) — first entry is the active session.
  • MediaCommand(s session_id, s action, t position_ms) — action ∈ play|pause|toggle|next|prev|stop|seek.
  • GetVolumes() -> (a(suub)) — (stream, level, max, muted), stream ∈ music|ring|call|notification|alarm.
  • SetVolume(s stream, u level)

Signals

  • MediaSessionsChanged(aa{sv} sessions)
  • VolumesChanged(a(suub) volumes)

Media session dict: id s, package s, app_name s, title s, artist s, album s, art_path s, playing b, position_ms t, position_ts_ms t, duration_ms t, can_seek b, can_next b, can_prev b, can_pause b, can_play b, playback_speed d.

The daemon additionally exports an MPRIS player per connected phone that has an active session: bus name org.mpris.MediaPlayer2.tether_<first 8 hex of id>, Identity = "<phone name>", DesktopEntry = "org.tether.Tether", with PlaybackStatus, Metadata (mpris:artUrl from art_path, xesam:title, xesam:artist, xesam:album, mpris:length), Position, Play/Pause/ PlayPause/Next/Previous/Stop/Seek/SetPosition, CanControl and the Can* flags, and Volume mapped to the music stream.

org.tether.Device1 — status and controls (dnd, ring, connectivity, clipboard)

Properties

NameTypeMeaning
DndFiltersall (off) / priority / alarms / none / unknown
DndCanChangebphone has notification-policy access
Simsa(issub)(sub_id, carrier, network_type, level_0_4, data_active)
WifiSsids"" if not on Wi-Fi
WifiLeveli0..4, -1 unknown
AirplaneModeb
Ringingbfind-my-phone in progress
LastClipboardslast text received from the phone ("" if none)

Methods

  • SetDnd(s filter)
  • RingPhone(b start)
  • SendClipboard(s text) — called by the GTK app on every desktop clipboard change (and by the daemon’s X11 poller while the app is closed).

Signals

  • ClipboardReceived(s text) — the GTK app sets the desktop clipboard; when the app is not on the bus the daemon sets it itself with wl-copy/xclip (ADR-0013 amendment).
  • ShareReceived(s text, s url, b open)

org.tether.Device1 — files (files)

Methods

  • SendFiles(as paths) -> (s transfer_id)
  • CancelTransfer(s transfer_id)
  • GetTransfers() -> (aa{sv}) — active and recently finished (last 20).

Signals

  • TransferUpdated(a{sv} transfer)
  • FileReceived(s path) — one per completed incoming file.

Transfer dict: transfer_id s, direction s (in|out), files aa{sv} (name s, size t, mime s, bytes_done t, path s, state s), bytes_done t, bytes_total t, state s (offered|accepted|running|done|failed|cancelled|rejected), error s, started_ms t.

org.tether.Device1 — photos (photos)

Methods

  • GetMediaItems(s kind, u limit, t before_ms, s album) -> (aa{sv}, b more) — kind ∈ all|image|video|screenshot; served from the daemon’s index, which it fills from the phone on demand (first call triggers a MediaQuery, result arrives via MediaItemsChanged). before_ms is inclusive (as on the wire, so items sharing a boundary timestamp are never skipped): when paging with the last item’s date_ms, the next page starts with that item again and clients de-duplicate by id.
  • RequestThumbnail(s id, u max_px) -> (s path) — cached path or "" + later ThumbnailReady.
  • FetchMedia(s id) -> (s request_id) — downloads the original into the daemon cache; MediaFetched carries the path. Clients copy it where the user wants (drag-out, Save as).
  • DeleteMedia(as ids) -> (s request_id)
  • GetAlbums() -> (as)

Signals

  • MediaItemsChanged() — index refreshed; clients re-query.
  • ThumbnailReady(s id, s path)
  • MediaFetched(s request_id, s id, s path) — path empty on failure.
  • MediaDeleted(s request_id, as deleted, as failed, b needs_confirmation)

Media item dict: id s, name s, mime s, date_ms t, size t, width u, height u, duration_ms t, album s, kind s, orientation u, thumb_path s (cached or "").

Files (M2)

  • Per-device cache: $XDG_DATA_HOME/tether/devices/<id>/cache.db (SQLite: threads, messages, attachments index, contacts, media index, transfers) and $XDG_CACHE_HOME/tether/devices/<id>/{attachments,thumbs,media,contacts}/.
  • Received files: DownloadDir (default ~/Downloads/Tether/).
  • Config additions in config.toml: download_dir, auto_accept_files, clipboard_sync, message_notifications, per-device sync_messages, sync_contacts, sync_photos (all default true).

Milestone 4 additions (enhanced tier)

Design: ADR-0016 (adb), ADR-0017 (helper), ADR-0018 (media). Wire protocol: docs/reference/protocol.md “Enhanced tier”.

org.tether.Daemon1

MemberKindSignatureMeaning
AdbStatepropertysmissing (no adb binary), too_old (< 34.0.0), ready
AdbVersionpropertyse.g. 34.0.4, empty when missing
StartAdbPairing()method→ (ss)begins Wireless debugging pairing; returns the QR payload (WIFI:T:ADB;S:…;P:…;;) and the service name. Progress in AdbPairingChanged
PairAdbWithCode(s code)methodfallback: pair with the 6-digit code against the pairing service the phone currently advertises
CancelAdbPairing()method
AdbPairingChanged(s stage, s detail)signalwaiting (for the phone to scan or show a code), pairing, connecting, linking, done, failed (detail = reason)

Config keys: adb_server = "private" | "shared", adb_path (empty = search PATH), per-device adb_serial.

org.tether.Device1

MemberKindSignatureMeaning
EnhancedStatepropertysunavailable (adb missing or too old), not_set_up (no adb device linked), debugging_off (linked, Wireless debugging off and no USB), offline (linked, device not reachable), unauthorized, starting (helper launching), ready, error
EnhancedDetailpropertyshuman-readable reason for error, unauthorized, debugging_off
EnhancedAbilitiespropertyasShellHello.abilities while ready
AdbSerialpropertyslinked adb serial, empty if none
AdbTransportpropertysusb, wifi or empty
CanRearmAdbpropertybthe app can switch Wireless debugging on (AdbWifiState.can_change)
Mirrorspropertyaa{sv}running mirrors: id, kind (main/app), package, screen_off
SetUpEnhanced()methodlink an adb device that is already connected and authorised (USB, or Wi-Fi after pairing) to this phone and start the helper
RestartHelper()method
EnableWirelessDebugging()methodAdbWifiRequest{enable = true}; fails unless CanRearmAdb
StartMirror(a{sv} options)method→ (sh)mirror id and the mirror connection as a Unix fd (shell.proto MIRROR framing, first record is MirrorMeta). Options: screen_off b, stay_awake b (default true), show_touches b, max_size u, max_fps u, bitrate u, codec s (h264)
ConfigureMirror(s id, a{sv} options)methodscreen_off b, bitrate u, max_size u, request_keyframe b
StopMirror(s id)methodclosing the fd has the same effect
MirrorEnded(s id, s reason)signal
GetGrants()method→ a(sbs)name, granted, detail for every grant item
ApplyGrants(as items)method→ a(sbs)empty list = all
SetScreenPower(b on)method

M4.2 members of org.tether.Device1:

MemberKindSignatureMeaning
GetApps()method→ aa{sv}launchable apps from the phone: package s, label s, icon s (cached PNG path, empty until fetched), system b. Needs capability apps, not adb. The daemon caches the list per device and serves the cache while the phone is away
AppsChanged()signalthe list or an icon path changed; call GetApps() again
StartMirror optionsadditionally app s (package: open this app in its own virtual display), width u, height u, dpi u (size of that display; defaults 1080 x 1920, dpi from the phone). screen_off is ignored for app mirrors
ConfigureMirror optionsadditionally width u, height u (resize an app mirror’s display)
Mirrors entrieskind = app and package for app mirrors; display_id u
StartApp(s package)methodlaunch an app on the phone’s main display
PhoneAudiopropertyb, read/writeplay the phone’s audio on this PC. Stays requested across helper restarts; capture runs while EnhancedState = ready
PhoneAudioStatepropertysoff, starting, playing, unsupported, error
PhoneAudioDetailpropertysreason for error/unsupported; while playing, the source in use (output, playback, playback_dup)

Config: phone_audio_source = "auto" | "output" | "playback" | "playback_dup" (default auto: the first the helper supports in that order), per-device phone_audio (remembers the switch).

tether-cli: apps <id>, app <id> <package> (opens the app window in the GTK app: tether --app <device id> <package>), phone-audio <id> [on|off].

Implementation notes (M4.2, tetherd):

  • Apps. GetApps serves the phone’s order from cache.db (schema v3, table apps) and works while the phone is away. Icons are fetched eight at a time; AppsChanged fires on a new list and again as icons arrive. icon can go empty again if the blob cache evicts the file.
  • App mirrors. app needs ability display.new. Defaults 1080 x 1920, dpi 0 (the phone derives it; the GTK app always sends 160 x its scale factor). width/height/dpi without app and a resize with only one of width/height answer InvalidArgs. Mirrors[].display_id is 0: the id is only in MirrorMeta, which the daemon does not read. Up to eight mirrors per phone; starting a package that is already streamed moves it and ends the old mirror with app_closed.
  • StartApp needs apps.start; an unknown package answers InvalidArgs.
  • Phone audio. The setter returns at once. With the switch on and nothing capturing, the state is off with a reason in the detail (“Waiting for the enhanced tier…”, “Paused while a call is in progress”). Capture stops while any call exists on the phone, ringing included. unsupported: built without the audio feature, no audio.* ability, or the configured source is unavailable. After a failure the daemon retries three times, 3 s apart, then shows error until the switch is toggled or the helper becomes ready again. With auto the daemon picks the source from the abilities. Pipeline: appsrc ! opusdec ! audioconvert ! audioresample ! pulsesink (40 ms buffer; pipewiresink, then autoaudiosink as fallbacks), stream named Tether: <phone name>.
  • CLI. apps <id> [--system]; app and mirror start the tether binary next to tether-cli if there is one, else the one on PATH (TETHER_APP overrides).

M4.3 members (phone as webcam, ADR-0019).

org.tether.Daemon1 (the machine’s virtual camera device):

MemberKindSignatureMeaning
WebcamSetupStatepropertysunsupported (built without the webcam feature or no v4l2sink), not_installed (no v4l2loopback module for the running kernel), not_loaded, no_device (module loaded, no device labelled Tether Phone Camera and no usable webcam_device), ready
WebcamSetupDetailpropertyshuman-readable reason or next step (e.g. the install command, a Secure Boot key rejection, the last set-up error)
WebcamDevicepropertysdevice node in use, e.g. /dev/video42; empty unless ready
WebcamPersistentpropertybthe load-at-boot files written by persist exist
WebcamOwnerpropertysdevice id of the phone whose Webcam switch is on, or empty
SetUpWebcam(s action)methodload (create the device now), persist (load and create it at every boot), remove (delete the boot files; the loaded module stays until reboot). Runs /usr/libexec/tether/tether-webcam-setup <action> through pkexec; returns when it has finished. Errors: NotSupported, InvalidArgs, Failed (detail = the script’s last line; cancelled when the polkit prompt was dismissed)
RefreshWebcamSetup()methodread the state again (after the user installed the package)

org.tether.Device1:

MemberKindSignatureMeaning
Webcampropertyb, read/writeuse this phone’s camera as the PC’s webcam. Stays requested across helper restarts; the camera runs while EnhancedState = ready and WebcamSetupState = ready. Setting it while another phone owns the webcam fails with Failed (busy)
WebcamStatepropertysoff, starting, streaming, unsupported, error
WebcamDetailpropertysreason for error/unsupported, or why the switch is on but nothing is streaming (e.g. “Waiting for the enhanced tier…”, “Set up the virtual camera first”, “The camera is in use on the phone”)
WebcamInfopropertya{sv}while streaming: camera s (Camera2 id), facing s (front/back/external), width u, height u, fps u (what the phone sends), out_width u, out_height u, out_fps u (the V4L2 device format), decoder s
Cameraspropertyaa{sv}the phone’s cameras while EnhancedState = ready (cached afterwards): id s, facing s, sensor_orientation u, sizes a(uu), fps au, torch b, max_zoom d
WebcamSettingspropertya{sv}camera s (front, back or a Camera2 id; default back), rotation u (0, 90, 180, 270 clockwise; default 0), flip b (mirror horizontally; default false), torch b, zoom d (1.0 = none). Stored per device, except torch, which is off at every start
ConfigureWebcam(a{sv} settings)methodchange any of the WebcamSettings keys; applies to a running webcam at once (a camera change restarts the capture, the V4L2 device stays open)

Config: webcam_size = "1280x720" (also 640x480, 1920x1080), webcam_fps = 30, webcam_device (empty = the loopback device labelled Tether Phone Camera); per-device webcam, webcam_camera, webcam_rotation, webcam_flip, webcam_zoom.

tether-cli: webcam <id> [status|on|off|cameras|camera <front|back|id>|rotate <0|90|180|270>|flip <on|off>|torch <on|off>|zoom <x>], webcam-setup [status|load|persist|remove].

Daemon behaviour: the capture is asked for at the listed camera size closest to the output size. The output format never changes while the daemon holds the device; the picture is letterboxed into it. After a failure the daemon retries three times, 3 s apart, then shows error until the switch is toggled or the helper becomes ready again; camera_disabled is not retried. The webcam keeps running during calls.

Implementation notes (M4.3, tetherd):

  • A dismissed polkit prompt fails with the message cancelled. persist is safe to repeat and refuses when another modprobe.d file already sets options for v4l2loopback. Under NoNewPrivileges the daemon runs pkexec through systemd-run --user.
  • webcam_device is accepted only for a virtual video device.
  • Webcam = true is accepted before the set-up is ready and triggers a new detection. WebcamOwner is the first paired device with the switch on.
  • Three retries (four attempts); the budget resets after 30 s of streaming, on a toggle, on a camera change and on a new helper. camera_disabled and not_found are not retried.
  • torch is reset when the switch is written, not at every capture start. rotation is applied as given; the sensor orientation is not added.
  • Cameras is cached per device (cameras.json) and refreshed from every new helper.
  • TETHER_WEBCAM_SETUP overrides the script path (build tree).

The daemon starts the helper whenever a linked device is authorised and the phone is connected over Tether, restarts it with back-off when it exits, and turns ClipboardWatch on while clipboard sync from the phone is enabled. All methods that need the helper fail with org.tether.Error.NotReady unless EnhancedState = ready.

tether-cli: enhance <id> [status|setup|pair|code <code>|grants [apply]|restart|rearm], mirror <id> [--screen-off] (opens the app’s mirror window; refuses unless the state is ready).

Implementation notes and deviations (M4.1, tetherd)

  • Errors. M4 members answer org.tether.Error.NotReady, NotSupported (adb missing or too old, ability missing, helper answered unsupported, EnableWirelessDebugging without CanRearmAdb), InvalidArgs (bad option type, unknown codec or mirror id, code not six digits) or Failed.
  • AdbSerial is the phone’s hardware serial (ro.serialno), stored as per-device adb_serial. Wi-Fi transport serials (ip:port) change and are mapped to it through the mDNS instance name or getprop.
  • Two adb servers in private mode. The private server (port adb_server_port, default 5038) carries Wi-Fi connections only. A phone attached by USB is reached through the user’s default server and key; the daemon watches that server and starts it only on SetUpEnhanced() or when a device has an adb_serial. USB is preferred when a transport is chosen; a running helper is not moved when a cable is plugged in later.
  • AdbPairingChanged details. pairing = ip:port, connecting = guid, linking = hardware serial, done = the Tether device id that was linked, failed = reason (cancelled after CancelAdbPairing). PairAdbWithCode returns at once, starts a session if none runs and waits up to 20 s for the phone to advertise a pairing service. A session times out after 5 minutes; StartAdbPairing replaces a running one.
  • SetUpEnhanced needs the phone connected over Tether, waits up to 10 s for AdbLink, and only refreshes when the linked serial is already authorised.
  • EnhancedState. offline also covers “adb is fine but the phone is not connected over Tether”; error also covers USB no permissions and stays shown while a failed helper start is retried; unauthorized is also set when adb connect fails to authenticate.
  • Helper. Hello timeout 20 s, request timeout 15 s, restart back-off 1 s to 60 s (reset after 30 s of ready). Its stderr is logged at debug level.
  • StartMirror hands the fd over in blocking mode; screen_off is dropped when the helper lacks mirror.screen_off. One mirror per phone in M4.1 (busy → Failed). StopMirror emits MirrorEnded(id, "stopped") at once; a helper that goes away ends its mirrors with helper_exited.
  • Re-arm. After ApplyGrants grants write_secure_settings the daemon asks the app to report again, so CanRearmAdb updates. An automatic EnableWirelessDebugging is tried exactly once per Tether session when the state is debugging_off. One UI switches the setting straight back off when the current Wi-Fi network was not allowed for Wireless debugging by the user (“Always allow on this network”), so the re-arm only works on such networks.
  • Connect port. Wireless debugging keeps its mDNS instance name and changes its port on every toggle, which a browse does not report. The daemon resolves the instance again before every adb connect, and retries for 20 s after pairing.
  • Clipboard. ShellClipboard equal to the last text sent to the phone or to LastClipboard is dropped as an echo.
  • The daemon always announces enhance, also without adb.

Milestone 3 additions (calls)

org.tether.Device1 — calls (calls, calls.dial, calllog, bluetooth)

Properties

NameTypeMeaning
Callsaa{sv}current calls (call dict below); empty when idle
CanControlCallsbphone can answer/reject/hang up
CanDialbphone can place calls
BtAddresssthe phone’s BlueZ address if known ("" otherwise)
BtStatesunavailable (no adapter/BlueZ), off (adapter powered off or rfkill), unpaired, paired (bonded, HFP not connected), connected (HFP connected, PC is hands-free)
CallAudioswhere call audio currently plays: phone, pc, none
MissedCallsuunseen missed calls (desktop-local)

Methods

  • AnswerCall(s call_id), RejectCall(s call_id), HangUpCall(s call_id), SilenceCall(s call_id)
  • Dial(s number, i sub_id) -> (s request_id)
  • SetCallMuted(s call_id, b muted)
  • SetCallAudio(s call_id, s target) — target ∈ pc|phone|speaker; pc asks the phone to route to this PC over Bluetooth; phone and speaker route back to the phone (see “SetCallAudio” below).
  • GetCallLog(t before_ms, u limit) -> (aa{sv}) — newest first; before_ms = 0 = newest.
  • MarkCallsSeen() — clears MissedCalls.
  • PairBluetooth() — starts the guided Bluetooth pairing (power on adapter if allowed, discover the phone, pair, trust, connect HFP). Progress via BtState and BluetoothPairing.
  • ConnectBluetooth() / DisconnectBluetooth()

Signals

  • CallStateChanged(aa{sv} calls) — also reflected in Calls via PropertiesChanged.
  • CallCommandFailed(s request_id, s error)
  • IncomingCall(a{sv} call) — emitted once per ringing call (the GTK app shows its banner).
  • CallLogChanged()
  • BluetoothPairing(s stage, s detail) — stage ∈ powering|discovering|pairing|confirm|connecting|done|failed; at confirm, detail is the 6-digit passkey to compare.

Call dict: id s, number s, display_name s, photo_path s, status s (ringing|dialing|active|holding|ended), direction s (incoming|outgoing), start_ms t, connected_ms t, sub_id i, muted b, route s (phone|speaker|bluetooth), audio_on_pc b.

Call log dict: id s, number s, name s (contact name, falls back to the log’s cached name), photo_path s, type s (incoming|outgoing|missed|rejected|blocked|voicemail), date_ms t, duration_s u, sub_id i, new b.

Daemon behaviour during calls

  • On IncomingCall the daemon posts a freedesktop notification with Answer and Decline actions (urgency critical, category call.incoming) and plays the ringtone (/usr/share/sounds/freedesktop/stereo/phone-incoming-call.oga through PipeWire) unless the phone is silenced or a desktop DND is active; both stop when the call leaves ringing.
  • MPRIS players on the desktop (other than Tether’s own) are paused on ringing and resumed when all calls ended, if they were playing before.
  • Call audio on the PC plays on the default sink and records from the default source (see “Call audio” below); the defaults are not changed.
  • Missed calls post a notification (“Missed call from …”) with Call back.

Daemon properties

NameTypeAccessMeaning
CallAudioOnPcbread/writeroute call audio to the PC automatically on answer (default true when BtState = connected)
CallRingtonebread/writeplay a ringtone on the PC for incoming calls (default true)
PauseMediaOnCallbread/writepause desktop MPRIS players while ringing/in call (default true)

Implementation notes and deviations (M3, tetherd)

These describe how the daemon implements the contract above; where they differ from the text above, this section wins.

  • Empty call_id. AnswerCall, RejectCall, SilenceCall with "" act on the ringing call; HangUpCall, SetCallMuted, SetCallAudio on the first non-ringing call. With no matching call the method fails (no call in progress).
  • Command results. Every call method sends a CallCommand with a fresh request id (only Dial returns it). A CallCommandResult{ok = false}, no result within 15 s, or a disconnect emits CallCommandFailed(request_id, error). A failure of an action taken on a desktop notification (Answer / Decline / Call back) is reported with an empty request_id.
  • CallStateChanged vs Calls. The signal carries the phone’s list as sent, so a call that ended appears once with status = "ended". The Calls property never contains ended calls (empty when idle).
  • GetCallLog(before_ms, …). before_ms is exclusive here, like GetMessages: page with the last row’s date_ms. The wire-level CallLogRequest.before_ms stays inclusive, and the daemon de-duplicates by id.
  • MissedCalls counts cached log entries with type = missed, the phone’s new flag set and date_ms after the desktop’s seen mark. MarkCallsSeen() moves the mark to max(now, newest entry). It never changes the phone’s call log.
  • Call audio. The phone decides where a call’s audio goes by opening or closing the Bluetooth SCO link to this PC. PipeWire creates the phone’s HFP nodes only while that link is up, as streams (Stream/Output/Audio for the caller, Stream/Input/Audio for our microphone, media.role = Communication), and WirePlumber links them to the default sink/source. CallAudio = pc means those nodes exist; the daemon checks once a second while a call is live, so the property also follows a switch made on the phone. 2.5 s after the nodes appear the daemon adds any link that is still missing between them and the default sink/source (pw-link, port by port) and never touches a direction the session manager linked elsewhere (for example to a headset). It does not change the default sink/source. If the phone’s card is not on a call profile (audio-gateway, fallback headset-head-unit) the daemon selects it and restores the previous one when the calls end. CallAudio = phone while a call exists without the nodes, none without a call.
  • Echo cancellation. When the call uses the default sink and source (the PC’s speakers and microphone, not a headset), the daemon runs PipeWire’s module-echo-cancel (WebRTC, monitor mode) in a child pipewire -c process for the duration of the calls. It records the default source, uses the default sink’s monitor as reference and offers the source tether_call_mic; the phone’s HFP microphone node is pointed at it (pw-metadata … target.object). The caller’s voice keeps playing on the default sink. Otherwise the caller hears their own voice and the phone’s echo suppressor cuts the PC side. Config key call_echo_cancel (default true).
  • SetCallAudio. Sends ROUTE to the phone. pc also needs BtState = connected; with CallAudioOnPc the daemon sends ROUTE bluetooth once per call by itself when the phone did not pick the PC. If the phone refuses (route_unsupported: its in-call service is not bound, see docs/contributing/checklists/milestone-3.md), phone is still carried out from the PC by closing the SCO link (the phone card is switched off for a moment, then back), while speaker and pc fail with CallCommandFailed and a readable reason: the PC cannot open the SCO link itself.
  • BtState. unavailable: no system bus, no org.bluez or no adapter. off: adapter not powered, whatever the reason (rfkill included). connected: the matched BlueZ device is bonded and connected, and the phone reports hfp_connected (when it sends BtIdentity). The phone is matched by the remembered address (per-device bt_address in config.toml, saved once bonded), then by Name/Alias equal to the phone’s BtIdentity.name or Tether name, preferring bonded devices. bluetooth is announced in Hello only when org.bluez owns or can activate its name at daemon start.
  • PairBluetooth. Runs in the background, one pairing at a time. Stages powering (only when the adapter is off; if BlueZ refuses, failed “Bluetooth is blocked (rfkill)”; the daemon never touches rfkill), discovering (skipped when the phone is already bonded; up to 60 s, after BtRequest{PAIR}), pairing (detail = address; an org.bluez.Agent1 with DisplayYesNo is registered at /org/tether/BluezAgent for this pairing only), confirm (6-digit passkey, auto-accepted on the PC for the matched phone only; the user confirms on the phone), connecting (Trusted = true, Device1.Connect(), then BtRequest{CONNECT}), done (detail = address), failed (detail = reason). It fails at once without BlueZ.
  • Notifications. The incoming-call notification is keyed per call (call:<id>, replaces itself) with hints urgency = 2, category = call.incoming, resident, suppress-sound, and is closed when the call leaves ringing. Missed calls (incoming, ringing → ended without becoming active, not declined from this desktop) get category = call.unanswered and a Call back action when the number is known. Both honour ShowDesktopNotifications. While calls is active, mirrored phone notifications with category = "call" (the dialer’s own) are not posted, but the NotificationPosted signal is still emitted. Desktop DND is not consulted for the ringtone yet.
  • Ringtone and media. One ringtone for the whole desktop: pw-play (else paplay) loops the sound file while any phone has a ringing call that was not silenced (SilenceCall silences the PC too). It is skipped when neither binary nor the file exists. MPRIS players other than org.mpris.MediaPlayer2.tether_* that are Playing are paused while any call exists (ringing included), and resumed afterwards only if they are still Paused.
  • Files. cache.db schema v2 adds call_log(id, number, name, type, date_ms, duration_s, sub_id, is_new). config.toml gains call_audio_on_pc, call_echo_cancel, call_ringtone, pause_media_on_call (all default true) and per-device bt_address.