Commit 6a70397
Feat/android jni usb layer (#35)
* feat(android): Rust-first USB layer via JNI
Replace @command SerialPortManager with UsbBridge/UsbNative JNI path,
vendored usb-serial 3.10.0, SIOM lifecycle fixes, and unified watch/exchange API.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(android): serialize fail/shutdown on usb-io thread
Apply cubic PR #34 feedback: route SIOM onError through io executor,
shutdown executor after cleanup task, reject I/O after shutdown.
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore(example): ignore src-tauri .gradle cache
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore: repo hygiene
Stop tracking IDE metadata and npm lockfiles; publish correct LICENSE paths.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(queue): errors no longer halt the TX queue
Remove permanent halted flag; stop_on_error only aborts the current at_phases
batch. clear_halt resets drain waiters after cancel_exchange.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(desktop): lock order, Opening-state open, async enable_mux
Avoid map locks across I/O; open blocks outside serialports mutex with
Opening guard; eager RX hub start; virtual watch/close without AB deadlock.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(rx): all reads via RX hub; restart + disconnect fail-fast
Route desktop/mobile reads through RxHubShared (read_slot, idle, exchange
waiter-before-write). Remove port_io_yield; hub stop checks stop_rx during
poll reads; replay idle bytes into active exchanges; fix exchange_waiter
re-entrant lock in feed_bytes.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(android): poll read via RX hub, drop JNI pollRead
Remove Kotlin/Rust poll-read path; Android RX feeds MobileRxHub via SIOM.
Mobile exchange/read use hub read_request like desktop.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: panic/poison hardening
Add lock_or_recover for background-thread mutexes; drop unsafe Send/Sync on
Error and release-profile panic=abort.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(android): JNI exceptions, session path re-key, PendingIntent, teardown leaks
with_local_frame + Java exception clear; open returns canonical session path;
Android 14 PendingIntent flags; CoalescingRxSink shutdown on close; hub
shutdown in close_all; singlePortPerDevice parity; remove mobile_response.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(js)!: onUrc, Uint8Array raw, watch-preserving change()
Preserve onUrc across watch rebuilds; exchange raw is Uint8Array with
timedOut flag; change() reopens and re-establishes watch; isOpen guards
on control-line writes; apply canonical path from open().
Co-authored-by: Cursor <cursoragent@cursor.com>
* test: consolidate mocks + coverage
Unify desktop mocks in mock_serial.rs; add hub read_slot/idle/restart and
PTY watchdog tests; JS exchange/mux/log-level suites; Kotlin coalescer
cleanup test.
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: v3 migration, Android bridge guide, remove debug.md
Document Uint8Array raw, timedOut, canonical open path, RX hub testing,
UsbBridge/UsbPortSession, and auto-reconnect TOC updates.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ci: add fmt, clippy, pnpm check and build to test workflow
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(android): cancel_exchange wakes hub waiter; remove dead listening field
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: lock_or_recover in watch_registry and hub channel paths
Co-authored-by: Cursor <cursoragent@cursor.com>
* test: read_request guards, stop_on_error, disconnect fail-fast, auto-reconnect edges
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: CHANGELOG unreleased, fix usbserial UPDATE.md, README gaps
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(rust): split monolith into at/exchange/hub/port/state/api/android
Reorganize the plugin core into focused modules so desktop and mobile
targets share exchange/hub logic while Android JNI lives under android/.
Gate desktop-only unit tests and CMUX session tests for cargo ndk.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(android): JNI debug harness and sharedTest fakes
Expose testHarness* JNI entry points on MobileBridge and UsbBridge
integration-test helpers. Move FakeUsb/RecordingRxSink to sharedTest
for unit and instrumented reuse.
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(android): Kotlin↔JNI↔Rust integration tests
Add stable instrumented tests for RX/TX/error chains through JniSerialRxSink,
a Parcel-based FakeUsb for on-device runs, and sync script into gen/android.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ci: add android integration emulator job and windows check
Run connectedUniversalDebugAndroidTest on macOS with API 34 emulator
and cross-check the Windows MSVC target in a dedicated job.
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: integration tests guide and module layout notes
Document JNI integration test workflow, sharedTest layout, and unreleased
changelog entries for the Rust reorg and Android test harness.
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore(example): add synced androidTest sources in gen/android
Checked-in copy of JNI integration tests for Gradle/CI without a
pre-build sync step; canonical sources remain in android-integration/.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(desktop): unblock hub drain when watch is active
Return Ok(0) from poll_read_port on benign read timeout so hub_loop
can finish rx_prepare drain and AT exchange does not hang with watch.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(android): pure Rust USB serial via android-usb-serial
Replace vendored usb-serial-for-android with the android-usb-serial
crate (nusb drivers). Kotlin keeps only UsbFdBridge for enumerate,
permission, and fd handoff; Rust owns claim, I/O, and multi-port probe.
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore(changelog): update changelog for version 3.0.0 release
* chore(changelog): update changelog for version 2.24.1 release
* chore(deps): update slab version to 0.4.12 in Cargo.lock and add unix-specific tests for closing ports and CMUX session routing
* ci: fix Android targets and migrate integration to Ubuntu
Install aarch64-linux-android for host matrix cargo check/clippy.
Move android-integration off Apple Silicon macOS (emulator HVF unsupported)
to ubuntu KVM with x86_64 AVD and a prebuild/test script split.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ci: relink file: API package after build for vue-tsc
pnpm snapshots file: deps at install; dist-js appears only after
rollup, so example vue-tsc missed types in CI. Relink after build.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ci: install libudev before host android-usb-serial tests
Golden parity links serialport/nusb on linux-gnu and needs -ludev;
apt was running after the host cargo test step.
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs(android-usb-serial): rustdoc; fix PTY concurrency flake
Keep PTY master draining while exchange waits so Linux CI does not
tear down with Broken pipe or starve the RX hub on concurrent write.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ci: drop flaky Android emulator integration job
Keep Robolectric, Android cargo check/clippy, and local scripts.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ci: restore android-integration prebuild without emulator
Keep JNI harness build/sync in CI; device androidTest stays local.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 10e1c46 commit 6a70397
1,412 files changed
Lines changed: 140483 additions & 16294 deletions
File tree
- .github/workflows
- .idea
- android
- src
- main
- kotlin/app/tauri/serialplugin
- manager
- models
- test
- kotlin/app/tauri/serialplugin
- manager
- models
- crates/android-usb-serial
- src
- bin
- drivers
- tests
- fixtures
- cdc_acm
- ch34x
- chrome_ccd
- cp21xx
- ftdi
- gsm_modem
- probe
- prolific
- rx_filter
- docs/golden-recorder-archive
- examples
- serialport-test
- .vscode
- android-integration/src/androidTest/kotlin/com/serialport/test/jni
- src-tauri
- gen
- android
- app
- src/androidTest/kotlin/com/serialport/test/jni
- schemas
- src
- src
- components
- composables
- usb-driver-tester
- .gradle
- 9.6.1
- checksums
- executionHistory
- fileChanges
- fileHashes
- buildOutputCleanup
- vcs-1
- app
- build
- intermediates
- annotation_processor_list/debug/javaPreCompileDebug
- apk_ide_redirect_file/debug/createDebugApkListingFileRedirect
- app_metadata/debug/writeDebugAppMetadata
- compatible_screen_manifest/debug/createDebugCompatibleScreenManifests
- compile_and_runtime_not_namespaced_r_class_jar/debug/processDebugResources
- desugar_graph/debug/dexBuilderDebug/out/currentProject
- dirs_bucket_0
- dirs_bucket_1
- dirs_bucket_2
- dirs_bucket_3
- dirs_bucket_4
- jar_f57fc653b15b7253705965d90dd596fbedd32de10cc471fa4e85280838a77871_bucket_0
- jar_f57fc653b15b7253705965d90dd596fbedd32de10cc471fa4e85280838a77871_bucket_1
- jar_f57fc653b15b7253705965d90dd596fbedd32de10cc471fa4e85280838a77871_bucket_2
- jar_f57fc653b15b7253705965d90dd596fbedd32de10cc471fa4e85280838a77871_bucket_3
- jar_f57fc653b15b7253705965d90dd596fbedd32de10cc471fa4e85280838a77871_bucket_4
- dex_archive_input_jar_hashes/debug/dexBuilderDebug
- dex_number_of_buckets_file/debug/dexBuilderDebug
- dex/debug
- mergeExtDexDebug
- mergeProjectDexDebug
- 0
- 11
- incremental
- debug-mergeJavaRes
- zip-cache
- debug
- mergeDebugResources
- merged.dir
- values-af
- values-am
- values-ar
- values-as
- values-az
- values-b+es+419
- values-b+sr+Latn
- values-be
- values-bg
- values-bn
- values-bs
- values-ca
- values-cs
- values-da
- values-de
- values-el
- values-en-rAU
- values-en-rCA
- values-en-rGB
- values-en-rIN
- values-en-rXC
- values-es-rUS
- values-es
- values-et
- values-eu
- values-fa
- values-fi
- values-fr-rCA
- values-fr
- values-gl
- values-gu
- values-h320dp-port-v13
- values-h360dp-land-v13
- values-h480dp-land-v13
- values-h550dp-port-v13
- values-h720dp-v13
- values-hdpi-v4
- values-hi
- values-hr
- values-hu
- values-hy
- values-in
- values-is
- values-it
- values-iw
- values-ja
- values-ka
- values-kk
- values-km
- values-kn
- values-ko
- values-ky
- values-land
- values-large-v4
- values-ldltr-v21
- values-ldrtl-v17
- values-lo
- values-lt
- values-lv
- values-mk
- values-ml
- values-mn
- values-mr
- values-ms
- values-my
- values-nb
- values-ne
- values-night-v8
- values-nl
- values-or
- values-pa
- values-pl
- values-port
- values-pt-rBR
- values-pt-rPT
- values-pt
- values-ro
- values-ru
- values-si
- values-sk
- values-sl
- values-small-v4
- values-sq
- values-sr
- values-sv
- values-sw600dp-v13
- values-sw
- values-ta
- values-te
- values-th
- values-tl
- values-tr
- values-uk
- values-ur
- values-uz
- values-v16
- values-v17
- values-v18
- values-v21
- values-v22
- values-v23
- values-v24
- values-v25
- values-v26
- values-v28
- values-v31
- values-v34
- values-vi
- values-w320dp-land-v13
- values-w360dp-port-v13
- values-w400dp-port-v13
- values-w600dp-land-v13
- values-watch-v20
- values-watch-v21
- values-xlarge-v4
- values-zh-rCN
- values-zh-rHK
- values-zh-rTW
- values-zu
- values
- packageDebugResources
- mergeDebugAssets
- mergeDebugJniLibFolders
- mergeDebugShaders
- packageDebug/tmp/debug
- zip-cache
- java_res/debug/processDebugJavaRes/out/META-INF
- local_only_symbol_list/debug/parseDebugLocalResources
- manifest_merge_blame_file/debug/processDebugMainManifest
- merged_java_res/debug/mergeDebugJavaResource
- merged_jni_libs/debug/mergeDebugJniLibFolders/out/arm64-v8a
- merged_manifests/debug/processDebugManifest
- merged_manifest/debug/processDebugMainManifest
- merged_native_libs/debug/mergeDebugNativeLibs/out/lib/arm64-v8a
- merged_res_blame_folder/debug/mergeDebugResources/out
- multi-v2
- single
- merged_res/debug/mergeDebugResources
- nested_resources_validation_report/debug/generateDebugResources
- packaged_manifests/debug/processDebugManifestForPackage
- packaged_res/debug/packageDebugResources
- layout
- xml
- processed_res/debug/processDebugResources/out
- project_dex_archive/debug/dexBuilderDebug/out
- com/serialport/usbtester
- runtime_symbol_list/debug/processDebugResources
- signing_config_versions/debug/writeDebugSigningConfigVersions
- source_set_path_map/debug/mapDebugSourceSetPaths
- stable_resource_ids_file/debug/processDebugResources
- stripped_native_libs/debug/stripDebugDebugSymbols/out/lib/arm64-v8a
- symbol_list_with_package_name/debug/processDebugResources
- kotlin/compileDebugKotlin
- cacheable
- caches-jvm
- inputs
- jvm/kotlin
- lookups
- classpath-snapshot
- local-state
- outputs
- apk/debug
- logs
- tmp/kotlin-classes/debug
- META-INF
- com/serialport/usbtester
- src/main
- jniLibs/arm64-v8a
- kotlin/com/serialport/usbtester
- res
- layout
- xml
- build/reports/problems
- rust
- src
- guest-js
- permissions
- autogenerated
- commands
- schemas
- scripts
- src
- android
- api
- at
- cmux
- exchange
- hub
- port
- state
- tests
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | | - | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| 87 | + | |
| 88 | + | |
85 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
86 | 102 | | |
87 | 103 | | |
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
91 | 119 | | |
92 | 120 | | |
93 | 121 | | |
94 | | - | |
| 122 | + | |
95 | 123 | | |
96 | 124 | | |
97 | 125 | | |
| |||
106 | 134 | | |
107 | 135 | | |
108 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
5 | 84 | | |
6 | 85 | | |
7 | 86 | | |
| |||
41 | 120 | | |
42 | 121 | | |
43 | 122 | | |
44 | | - | |
| 123 | + | |
45 | 124 | | |
46 | 125 | | |
47 | 126 | | |
| |||
0 commit comments