Skip to content

Commit f33ea91

Browse files
s00dcursoragent
andcommitted
fix(desktop): write_all, timeout, Android serialport split
Desktop write/write_binary flush full buffers; default timeout 1s; fix listener poll clamp. Gate serialport to desktop-only builds. Clean up mobile_api clippy warnings. Release notes for 2.23.0. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a64c3d2 commit f33ea91

17 files changed

Lines changed: 197 additions & 72 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file. See [standa
44

55
For **Android/USB-focused** details (behavior, limits, testing), see also [`android/README.md`](android/README.md).
66

7+
## [2.23.0](https://github.com/s00d/tauri-plugin-serialplugin/compare/v2.22.0...v2.23.0) (2026-07-02)
8+
9+
### Bug Fixes
10+
11+
* **desktop:** `write` / `write_binary` now flush the full buffer via `write_all` (retries partial kernel writes instead of returning after the first `write` syscall). Mitigates truncated sends on Windows and slow links ([#29](https://github.com/s00d/tauri-plugin-serialplugin/issues/29)).
12+
* **desktop:** Default open/read/write timeout raised from **200 ms** to **1000 ms** (`DEFAULT_SERIAL_TIMEOUT_MS` in JS and Rust).
13+
* **desktop:** `start_listening` listener read-poll timeout fixed: was capped at **1 ms** (`.min(1)` regression); now clamped to **1–100 ms** while the user timeout still controls buffer coalescing.
14+
15+
### Features
16+
17+
* **guest-js:** Export `DEFAULT_SERIAL_TIMEOUT_MS`; document `timeout` on `SerialportOptions`; clarify `write` / `writeBinary` return value vs payload length.
18+
19+
### Build / Android
20+
21+
* **Rust:** `serialport` is a **desktop-only** dependency (`cfg(not(android/ios))`); Android builds no longer link the unused crate. Desktop-only state (`ConnectedPort`, `PortState`, …) and `From<serialport::Error>` are gated accordingly.
22+
723
## [2.22.0](https://github.com/s00d/tauri-plugin-serialplugin/compare/v2.21.1...v2.22.0) (2026-03-21)
824

925
### Android / USB

Cargo.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tauri-plugin-serialplugin"
3-
version = "2.22.0"
3+
version = "2.23.0"
44
description = "Access the current process of your Tauri application."
55
edition = "2021"
66
authors = ["Tauri Programme within The Commons Conservancy"]
@@ -24,15 +24,17 @@ android = { level = "full", notes = "" }
2424
tauri-plugin = { version = "2.3.0", features = [ "build" ] }
2525

2626
[dependencies]
27-
serialport = "4.8.1"
2827
tauri = { version = "2.6.2", features = ["test"] }
2928
serde = { version = "1.0.219", features = ["derive"] }
3029
thiserror = "2.0.12"
3130
serde_json = "1.0.140"
3231

32+
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
33+
serialport = "4.9.0"
34+
3335
[profile.release]
3436
panic = "abort"
3537
codegen-units = 1
3638
lto = true
3739
incremental = false
38-
opt-level = "s"
40+
opt-level = "s"

examples/serialport-test/src-tauri/Cargo.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/serialport-test/src-tauri/gen/schemas/android-schema.json

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
],
3838
"definitions": {
3939
"Capability": {
40-
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows' and webviews' fine grained access to the Tauri core, application, or plugin commands. If a webview or its window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
40+
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows' and webviews' fine grained access to the Tauri core, application, or plugin commands. If a webview or its window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programmatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
4141
"type": "object",
4242
"required": [
4343
"identifier",
@@ -49,7 +49,7 @@
4949
"type": "string"
5050
},
5151
"description": {
52-
"description": "Description of what the capability is intended to allow on associated windows.\n\nIt should contain a description of what the grouped permissions should allow.\n\n## Example\n\nThis capability allows the `main` window access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.",
52+
"description": "Description of what the capability is intended to allow on associated windows.\n\nIt should contain a description of what the grouped permissions should allow.\n\n## Example\n\nThis capability allows the `main` window access to `filesystem` write related commands and `dialog` commands to enable programmatic access to files selected by the user.",
5353
"default": "",
5454
"type": "string"
5555
},
@@ -1016,6 +1016,12 @@
10161016
"const": "core:webview:allow-reparent",
10171017
"markdownDescription": "Enables the reparent command without any pre-configured scope."
10181018
},
1019+
{
1020+
"description": "Enables the set_webview_auto_resize command without any pre-configured scope.",
1021+
"type": "string",
1022+
"const": "core:webview:allow-set-webview-auto-resize",
1023+
"markdownDescription": "Enables the set_webview_auto_resize command without any pre-configured scope."
1024+
},
10191025
{
10201026
"description": "Enables the set_webview_background_color command without any pre-configured scope.",
10211027
"type": "string",
@@ -1118,6 +1124,12 @@
11181124
"const": "core:webview:deny-reparent",
11191125
"markdownDescription": "Denies the reparent command without any pre-configured scope."
11201126
},
1127+
{
1128+
"description": "Denies the set_webview_auto_resize command without any pre-configured scope.",
1129+
"type": "string",
1130+
"const": "core:webview:deny-set-webview-auto-resize",
1131+
"markdownDescription": "Denies the set_webview_auto_resize command without any pre-configured scope."
1132+
},
11211133
{
11221134
"description": "Denies the set_webview_background_color command without any pre-configured scope.",
11231135
"type": "string",
@@ -2073,10 +2085,10 @@
20732085
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
20742086
},
20752087
{
2076-
"description": "# Tauri `serialport` default permissions\n\nThis configuration file defines the default permissions granted\nto the serialport.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-write`\n- `allow-write-binary`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-cancel-read`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-managed-ports`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-read-carrier-detect`\n- `allow-read-cd`\n- `allow-read-clear-to-send`\n- `allow-read-cts`\n- `allow-read-data-set-ready`\n- `allow-read-dsr`\n- `allow-read-dtr`\n- `allow-read-ri`\n- `allow-read-ring-indicator`\n- `allow-set-baud-rate`\n- `allow-set-break`\n- `allow-set-data-bits`\n- `allow-set-flow-control`\n- `allow-set-parity`\n- `allow-set-stop-bits`\n- `allow-set-timeout`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-write`\n- `allow-write-binary`\n- `allow-write-data-terminal-ready`\n- `allow-write-dtr`\n- `allow-write-request-to-send`\n- `allow-write-rts`",
2088+
"description": "# Tauri `serialport` default permissions\n\nThis configuration file defines the default permissions granted\nto the serialport.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-write`\n- `allow-write-binary`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-cancel-read`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-managed-ports`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-read-carrier-detect`\n- `allow-read-cd`\n- `allow-read-clear-to-send`\n- `allow-read-cts`\n- `allow-read-data-set-ready`\n- `allow-read-dsr`\n- `allow-read-dtr`\n- `allow-read-ri`\n- `allow-read-ring-indicator`\n- `allow-set-baud-rate`\n- `allow-set-break`\n- `allow-set-data-bits`\n- `allow-set-flow-control`\n- `allow-set-parity`\n- `allow-set-stop-bits`\n- `allow-set-timeout`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-write`\n- `allow-write-binary`\n- `allow-write-data-terminal-ready`\n- `allow-write-dtr`\n- `allow-write-request-to-send`\n- `allow-write-rts`\n- `allow-set-log-level`\n- `allow-get-log-level`",
20772089
"type": "string",
20782090
"const": "serialplugin:default",
2079-
"markdownDescription": "# Tauri `serialport` default permissions\n\nThis configuration file defines the default permissions granted\nto the serialport.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-write`\n- `allow-write-binary`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-cancel-read`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-managed-ports`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-read-carrier-detect`\n- `allow-read-cd`\n- `allow-read-clear-to-send`\n- `allow-read-cts`\n- `allow-read-data-set-ready`\n- `allow-read-dsr`\n- `allow-read-dtr`\n- `allow-read-ri`\n- `allow-read-ring-indicator`\n- `allow-set-baud-rate`\n- `allow-set-break`\n- `allow-set-data-bits`\n- `allow-set-flow-control`\n- `allow-set-parity`\n- `allow-set-stop-bits`\n- `allow-set-timeout`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-write`\n- `allow-write-binary`\n- `allow-write-data-terminal-ready`\n- `allow-write-dtr`\n- `allow-write-request-to-send`\n- `allow-write-rts`"
2091+
"markdownDescription": "# Tauri `serialport` default permissions\n\nThis configuration file defines the default permissions granted\nto the serialport.\n\n### Granted Permissions\n\nThis default permission set enables all read-related commands and\nallows access to the `$APP` folder and sub directories created in it.\nThe location of the `$APP` folder depends on the operating system,\nwhere the application is run.\n\nIn general the `$APP` folder needs to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\n### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-write`\n- `allow-write-binary`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-available-ports`\n- `allow-available-ports-direct`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-cancel-read`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-managed-ports`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-read-carrier-detect`\n- `allow-read-cd`\n- `allow-read-clear-to-send`\n- `allow-read-cts`\n- `allow-read-data-set-ready`\n- `allow-read-dsr`\n- `allow-read-dtr`\n- `allow-read-ri`\n- `allow-read-ring-indicator`\n- `allow-set-baud-rate`\n- `allow-set-break`\n- `allow-set-data-bits`\n- `allow-set-flow-control`\n- `allow-set-parity`\n- `allow-set-stop-bits`\n- `allow-set-timeout`\n- `allow-start-listening`\n- `allow-stop-listening`\n- `allow-write`\n- `allow-write-binary`\n- `allow-write-data-terminal-ready`\n- `allow-write-dtr`\n- `allow-write-request-to-send`\n- `allow-write-rts`\n- `allow-set-log-level`\n- `allow-get-log-level`"
20802092
},
20812093
{
20822094
"description": "Enables the available_ports command without any pre-configured scope.",
@@ -2138,6 +2150,12 @@
21382150
"const": "serialplugin:allow-force-close",
21392151
"markdownDescription": "Enables the force_close command without any pre-configured scope."
21402152
},
2153+
{
2154+
"description": "Enables the get_log_level command without any pre-configured scope.",
2155+
"type": "string",
2156+
"const": "serialplugin:allow-get-log-level",
2157+
"markdownDescription": "Enables the get_log_level command without any pre-configured scope."
2158+
},
21412159
{
21422160
"description": "Enables the managed_ports command without any pre-configured scope.",
21432161
"type": "string",
@@ -2240,6 +2258,12 @@
22402258
"const": "serialplugin:allow-set-flow-control",
22412259
"markdownDescription": "Enables the set_flow_control command without any pre-configured scope."
22422260
},
2261+
{
2262+
"description": "Enables the set_log_level command without any pre-configured scope.",
2263+
"type": "string",
2264+
"const": "serialplugin:allow-set-log-level",
2265+
"markdownDescription": "Enables the set_log_level command without any pre-configured scope."
2266+
},
22432267
{
22442268
"description": "Enables the set_parity command without any pre-configured scope.",
22452269
"type": "string",
@@ -2366,6 +2390,12 @@
23662390
"const": "serialplugin:deny-force-close",
23672391
"markdownDescription": "Denies the force_close command without any pre-configured scope."
23682392
},
2393+
{
2394+
"description": "Denies the get_log_level command without any pre-configured scope.",
2395+
"type": "string",
2396+
"const": "serialplugin:deny-get-log-level",
2397+
"markdownDescription": "Denies the get_log_level command without any pre-configured scope."
2398+
},
23692399
{
23702400
"description": "Denies the managed_ports command without any pre-configured scope.",
23712401
"type": "string",
@@ -2468,6 +2498,12 @@
24682498
"const": "serialplugin:deny-set-flow-control",
24692499
"markdownDescription": "Denies the set_flow_control command without any pre-configured scope."
24702500
},
2501+
{
2502+
"description": "Denies the set_log_level command without any pre-configured scope.",
2503+
"type": "string",
2504+
"const": "serialplugin:deny-set-log-level",
2505+
"markdownDescription": "Denies the set_log_level command without any pre-configured scope."
2506+
},
24712507
{
24722508
"description": "Denies the set_parity command without any pre-configured scope.",
24732509
"type": "string",

0 commit comments

Comments
 (0)