diff --git a/.editorconfig b/.editorconfig index badeda06..61305601 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ root = true end_of_line = lf insert_final_newline = true -[*.{js,ts,svelte,html,json,mjs,cjs}] +[*.{js,ts,html,json,mjs,cjs,vue}] charset = utf-8 indent_style = space indent_size = 2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 146883a6..812d32b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,31 +67,59 @@ jobs: uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy + targets: aarch64-linux-android - name: Install cargo-nextest run: cargo install cargo-nextest --locked --force + # Before host golden/nextest: linux serialport/nusb need -ludev (and GTK for tauri later). - name: Install system dependencies (Ubuntu) if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y pkg-config libglib2.0-dev libudev-dev libgtk-3-dev libgdk-pixbuf2.0-dev libwebkit2gtk-4.1-dev + sudo apt-get install -y openjdk-17-jdk pkg-config libglib2.0-dev libudev-dev libgtk-3-dev libgdk-pixbuf2.0-dev libwebkit2gtk-4.1-dev - name: Install system dependencies (macOS) if: matrix.os == 'macos-latest' run: | brew install pkg-config + - name: Check android-usb-serial (Android target) + run: cargo check -p android-usb-serial --target aarch64-linux-android + - name: Check plugin (Android target) + run: cargo check -p tauri-plugin-serialplugin --target aarch64-linux-android + + - name: Golden parity (host) + run: cargo test -p android-usb-serial --features fake-transport + + - name: Clippy android-usb-serial (Android target) + run: cargo clippy -p android-usb-serial --target aarch64-linux-android -- -D warnings + + - name: Robolectric (Android module) + if: matrix.os == 'ubuntu-latest' + run: cd android && ./gradlew test - name: Install dependencies run: | pnpm install + - name: Rustfmt + run: cargo fmt --all -- --check + + - name: Clippy + run: cargo clippy --workspace --all-targets -- -D warnings + + - name: TypeScript check + run: pnpm check + + - name: Build JS + run: pnpm build + - name: Run Rust tests env: NEXTEST_EXPERIMENTAL_LIBTEST_JSON: 1 - run: cargo nextest run --message-format=libtest-json-plus > test-results.jsonx + run: cargo nextest run --workspace --message-format=libtest-json-plus > test-results.jsonx - name: Run JavaScript tests run: pnpm test @@ -106,3 +134,99 @@ jobs: test-results/ test-results.jsonx if-no-files-found: warn + + android-integration: + # Build/sync JNI integration harness only — no emulator (device tests stay local). + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.15.4 + + - name: Setup Java 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-linux-android + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Install Android SDK packages + run: | + yes | sdkmanager --licenses + sdkmanager \ + "platform-tools" \ + "platforms;android-34" \ + "build-tools;34.0.0" \ + "ndk;27.2.12479018" + + - name: Install cargo-ndk + run: cargo install cargo-ndk --locked + + - name: Install dependencies + run: pnpm install + + - name: Build JS + run: pnpm build + + # file: link is snapshotted at install; refresh hardlinks after dist-js appears + - name: Relink workspace packages + run: pnpm install + + - name: Prebuild Android integration artifacts + env: + ANDROID_INTEGRATION_NDK_ARCH: x86_64 + ANDROID_NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.2.12479018 + NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.2.12479018 + run: chmod +x scripts/android-integration-ci.sh && ./scripts/android-integration-ci.sh prebuild + + windows: + runs-on: windows-latest + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Rustfmt + run: cargo fmt --all -- --check + + - name: Clippy (Windows target) + run: cargo clippy --all-targets -- -D warnings + + - name: Cargo check Windows + run: cargo check --target x86_64-pc-windows-msvc + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.15.4 + + - name: Install dependencies + run: pnpm install + + - name: TypeScript check + run: pnpm check + + - name: Run JavaScript tests + run: pnpm test diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index fca4bf00..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/process.iml b/.idea/process.iml deleted file mode 100644 index 404de742..00000000 --- a/.idea/process.iml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c0d6d3..28e1dae1 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,85 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [3.0.0](https://github.com/s00d/tauri-plugin-serialplugin/compare/v2.24.1...v3.0.0) (2026-07-08) + +Major v3 release: Channel-based **`watch()`** API, native AT **`exchange`** / FIFO queue, unified **RX hub** on desktop and Android, and a **hard cut** from vendored Java `usb-serial-for-android` to the pure-Rust **`android-usb-serial`** crate (nusb). + +### Breaking Changes + +* **Streaming API:** `startListening()` / `listen()` / `disconnected()` / `cancelListen()` removed. Use **`watch({ onData, onDisconnect?, onError?, onUrc? })`** → `SerialEvent` over Tauri [`Channel`](https://v2.tauri.app/develop/calling-frontend/) (desktop + Android). +* **Capabilities:** `SerialPort.getCapabilities()` (`transport`, `platform`, `version`); commands `capabilities`, `watch`, `unwatch` replace `start_listening` / `stop_listening`. +* **Removed:** `available_ports_direct` — use `available_ports()`. +* **Removed `AtCommandQueue` / `port.at`:** Use **`sendAt()`**, **`sendAtPhases()`**, **`sendSmsPdu()`**, **`cancelAt()`**, **`configureAtSession()`**. +* **`onUrc` removed from `AtSessionOptions`:** Use **`watch({ onUrc })`** for live URC lines. +* **`exchange()`** returns **`ExchangeResponse`**, not `Uint8Array`. Use `.raw` for bytes. +* **`clearRx: true`** maps to **`purge`**; default is now **`drain`** when unset. +* **Android USB stack:** Vendored `android/usbserial` Java tree **removed**. Kotlin no longer runs serial I/O commands on the main thread — only **`UsbFdBridge`** (enumerate, permission, fd). All drivers and bulk I/O live in Rust (`android-usb-serial` + nusb). +* **Rust module layout:** Removed compat top-level modules (`desktop_api`, `mobile_api`, `port_rx_hub`, `exchange_runtime`, …). Use `api::serial`, `hub`, `exchange`, `port`, `state`, `android`. +* **guest-js:** `AtCommandResult.raw` / `ExchangeResponse.raw` are `Uint8Array`; `timedOut` is a native `boolean`. +* **`rust-version`:** **1.79** minimum. + +### Migration (v2 → v3) + +| v2 | v3 | +|----|-----| +| `startListening()` + `listen(fn)` | `watch({ onData: fn })` | +| `disconnected(fn)` | `watch({ onDisconnect: fn })` | +| `cancelListen()` / `stopListening()` | `handle.unwatch()` | +| `port.at.enable()` / `enqueue()` | `sendAt()` / `sendAtPhases()` | +| Kotlin `UsbBridge` + Java drivers | `UsbFdBridge` fd → Rust `driver_host` | + +**Android app requirements:** `uses-feature android.hardware.usb.host`, `device_filter.xml`, runtime USB permission before `openDevice()`. Do **not** `claimInterface()` in Kotlin before handing fd to Rust. See [`crates/android-usb-serial/README.md`](crates/android-usb-serial/README.md). + +### Features + +* **`android-usb-serial` crate:** Pure Rust USB serial on Android via nusb; **567** golden parity fixtures; drivers for FTDI, CP21xx, CH34x, PL2303, CDC-ACM, GSM modem, Chrome CCD ([20b54c0](https://github.com/s00d/tauri-plugin-serialplugin/commit/20b54c0bbc17227465da71728333cf93d88103aa)). +* **`UsbFdBridge`:** Kotlin provides USB fd only; Rust `driver_host` owns probe, claim, drivers, RX reader, and I/O. +* **Unified `api::serial`:** Single `serialport::SerialPort` facade on desktop and Android; `PortRxHub` poll-loop on both platforms ([4071ff6](https://github.com/s00d/tauri-plugin-serialplugin/commit/4071ff6)). +* **Rust-first Android JNI** ([29faa29](https://github.com/s00d/tauri-plugin-serialplugin/commit/29faa29)): bulk-IN reader thread, chunked write, CMUX virtual paths through Rust session. +* **Unified RX hub (desktop + Android):** Single consumer per port; `watch`, `exchange`, `read`, and drain share one hub ([7024fc0](https://github.com/s00d/tauri-plugin-serialplugin/commit/7024fc0), [caa5700](https://github.com/s00d/tauri-plugin-serialplugin/commit/caa5700)). +* **`take_idle_bytes`:** Stale RX in the hub idle buffer is replayed into the next `exchange` after write. +* **Native FIFO queue (Rust + Android):** All `exchange` / AT jobs on one port serialize in FIFO order; parallel invokes **wait** instead of `"Exchange already in progress"` ([e1eb63f](https://github.com/s00d/tauri-plugin-serialplugin/commit/e1eb63f)). +* **Native `exchange` / `cancel_exchange`:** Write + read-until terminators, idle silence, wall timeout, max response size; structured `ExchangeResponse` (`status`, `lines`, `solicitedBody`, `urcLines`, `raw`). +* **Line-framed AT completion:** Final line `OK` / `ERROR` / `+CME ERROR` / `+CMS ERROR`; `completionMode: 'substring'` for legacy/binary. +* **`rxPrepare`:** Default **`drain`**; **`purge`** opt-in; **`none`** unchanged. +* **`watchAvailablePorts()` / `watch_ports`:** Hotplug via Channel — `snapshot`, then `added` / `removed` (desktop poll; Android USB attach/detach). +* **`open()` canonical path:** Returns session key (Android device path / `device#N` for multi-port). +* **CMUX virtual `exchange`:** Paths `physical#dlci=N` routed through Rust CMUX session like desktop. +* **`usb-driver-tester`:** Standalone hardware self-test app under `examples/usb-driver-tester/`. +* **guest-js:** Modular v3 SDK; auto-reconnect restores **`open()` + `watch()`** after disconnect. +* **macOS:** `available_ports({ singlePortPerDevice: true })` — one path per device (prefers `/dev/cu.*`). +* **Extended AT grammar:** Vendor prefixes, V.250 finals, `derive_solicited_prefixes(command)`; `ExchangeDemux` for live URC before echo. +* **`pauseWatch` default `false`** — watch stays on during AT; pass `pauseWatch: true` for legacy behavior. + +### Bug Fixes + +* **Android CH340 / weak OTG:** Bulk IN reader starts after line/DTR setup; in-flight URBs reduced to 2; clearer detach reason in logs. +* **Android enumerate:** Kotlin exports `interfaces[]`; Rust expands multi-port paths (`device#N`) via `ProbeTable` without opening fd. +* **Android write after listen:** `EndpointPair::write` no longer re-opens bulk IN owned by `SerialReader` (`endpoint already in use`). +* **Android Kotlin fd bridge:** Removed pre-`claimInterface` (fixes `io interface is busy` with nusb `detach_and_claim`). +* **Android logcat:** Rust plugin logs use tag `SerialPlugin` via `__android_log_write`. +* **Android:** USB permission `PendingIntent` uses `FLAG_MUTABLE` on API 31+; detach + IO errors → `SerialEvent::Disconnect` on Channel ([#27](https://github.com/s00d/tauri-plugin-serialplugin/issues/27)). +* **Android:** `cancel_exchange` wakes hub waiter; CMUX virtual cancel clears DLCI TX queue ([c6c94dd](https://github.com/s00d/tauri-plugin-serialplugin/commit/c6c94dd)). +* **Android:** JNI exceptions, session path re-key, teardown leaks ([e9fc307](https://github.com/s00d/tauri-plugin-serialplugin/commit/e9fc307)). +* **Android:** Serialize fail/shutdown on dedicated usb-io thread ([cd74b84](https://github.com/s00d/tauri-plugin-serialplugin/commit/cd74b84)). +* **desktop:** `write` / `write_binary` flush via `write_all` ([#29](https://github.com/s00d/tauri-plugin-serialplugin/issues/29)). +* **desktop:** Unblock hub drain when watch is active ([55f1cb3](https://github.com/s00d/tauri-plugin-serialplugin/commit/55f1cb3)). +* **desktop:** Lock order, Opening-state open, async `enable_mux` ([3a4bd88](https://github.com/s00d/tauri-plugin-serialplugin/commit/3a4bd88)). +* **desktop (Windows):** Enrich truncated USB `serial_number` from WMI ([#23](https://github.com/s00d/tauri-plugin-serialplugin/issues/23)). +* **Hub / watch:** `lock_or_recover` in watch_registry and hub channel paths ([2071e15](https://github.com/s00d/tauri-plugin-serialplugin/commit/2071e15)); panic/poison hardening ([8672de9](https://github.com/s00d/tauri-plugin-serialplugin/commit/8672de9)). +* **TX queue:** Errors no longer halt the port queue until reopen ([e1eb63f](https://github.com/s00d/tauri-plugin-serialplugin/commit/e1eb63f)). +* **guest-js:** `readBinary` requires open port; watch-preserving `change()` ([9b22af7](https://github.com/s00d/tauri-plugin-serialplugin/commit/9b22af7)). + +### Build / CI / Docs + +* **CI:** `cargo fmt`, `clippy`, `pnpm check` / `build`, Windows `cargo check`, Android integration emulator job ([1aa1682](https://github.com/s00d/tauri-plugin-serialplugin/commit/1aa1682), [2e70ecf](https://github.com/s00d/tauri-plugin-serialplugin/commit/2e70ecf)). +* **Tests:** Kotlin↔JNI↔Rust instrumented integration tests with `FakeTransport` ([412b4a5](https://github.com/s00d/tauri-plugin-serialplugin/commit/412b4a5), [be77e2a](https://github.com/s00d/tauri-plugin-serialplugin/commit/be77e2a)); Jest v3 lifecycle + Rust contract tests. +* **Docs:** v3 migration guide, Android bridge docs, [`examples/serialport-test/ANDROID.md`](examples/serialport-test/ANDROID.md), [`android-usb-serial` Android usage](crates/android-usb-serial/README.md#using-on-android) ([c2d1e23](https://github.com/s00d/tauri-plugin-serialplugin/commit/c2d1e23), [b3cc7d2](https://github.com/s00d/tauri-plugin-serialplugin/commit/b3cc7d2)). +* **Workspace:** `android-test-harness` feature wires `FakeTransport` for instrumented tests. + + ### [2.24.1](https://github.com/s00d/tauri-plugin-serialplugin/compare/v2.24.0...v2.24.1) (2026-07-08) ## [2.24.0](https://github.com/s00d/tauri-plugin-serialplugin/compare/v2.21.1...v2.24.0) (2026-07-08) @@ -41,7 +120,7 @@ All notable changes to this project will be documented in this file. See [standa * **Lifecycle:** `SerialPlugin` registers `Application.ActivityLifecycleCallbacks` and runs `SerialPortManager.cleanup()` when the host `Activity` is destroyed (close USB ports, unregister permission receiver, shut down IO executor). * **Listening:** Incoming data is coalesced in `BufferedEmitter` / `SerialByteAccumulator` before `serialData` events; flush interval via `serialDataFlushIntervalMs` (native clamp typically 10–2000 ms). * **USB serial (usb-serial-for-android):** Read/write use configured timeouts; `clearBuffer` maps to `purgeHwBuffers` when supported; `setFlowControl` (RTS/CTS, XON/XOFF); `SerialInputOutputManager` errors trigger `serialError` and port cleanup. -* **`bytesToRead` / `bytesToWrite` (Android):** `bytesToRead` returns bytes buffered **in the plugin** only while `startListening` is active (not the kernel queue — not exposed by `UsbSerialPort`). `bytesToWrite` is `0` (writes complete synchronously from the app’s perspective). Documented in JSDoc on the JS API. +* **`bytesToRead` / `bytesToWrite` (Android):** With active **`watch`**, `bytesToRead` is the plugin-side buffer before the next Channel flush; `bytesToWrite` is typically `0`. * **Tooling:** Gradle wrapper and `android/` settings for local `./gradlew test`; JVM unit tests use a real `org.json` artifact (Android JSON stubs break `JSONObject.put` in tests). Kotlin tests cover models, JSON helpers, emit pipeline, `BufferedEmitter`. ### Features diff --git a/Cargo.lock b/Cargo.lock index 84edf08d..92693e48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,6 +47,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +[[package]] +name = "android-usb-serial" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "libc", + "log", + "nusb", + "serde", + "serde_json", + "serialport", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -364,9 +377,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", "libc", @@ -693,6 +706,16 @@ dependencies = [ "typeid", ] +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + [[package]] name = "fdeflate" version = "0.3.7" @@ -1462,7 +1485,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" dependencies = [ "core-foundation-sys", - "mach2", + "mach2 0.4.3", +] + +[[package]] +name = "io-kit-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d3a048d09fbb6597dbf7c69f40d14df4a49487db1487191618c893fc3b1c26" +dependencies = [ + "core-foundation-sys", + "mach2 0.5.0", ] [[package]] @@ -1619,9 +1652,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.174" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "libloading" @@ -1663,6 +1696,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + [[package]] name = "litemap" version = "0.8.0" @@ -1700,6 +1739,15 @@ dependencies = [ "libc", ] +[[package]] +name = "mach2" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea" +dependencies = [ + "libc", +] + [[package]] name = "markup5ever" version = "0.14.1" @@ -1884,6 +1932,24 @@ dependencies = [ "syn 2.0.104", ] +[[package]] +name = "nusb" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "215a49c10e8cff30a0da93b258b21846c4e9242f7683748cfa8474fdc2e4d22b" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "futures-core", + "io-kit-sys 0.5.0", + "linux-raw-sys", + "log", + "once_cell", + "rustix", + "slab", + "windows-sys 0.60.2", +] + [[package]] name = "objc-sys" version = "0.3.5" @@ -2678,6 +2744,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.9.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.60.2", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -2933,9 +3012,9 @@ dependencies = [ "cfg-if", "core-foundation", "core-foundation-sys", - "io-kit-sys", + "io-kit-sys 0.4.1", "libudev", - "mach2", + "mach2 0.4.3", "nix", "scopeguard", "unescaper", @@ -3348,14 +3427,16 @@ dependencies = [ [[package]] name = "tauri-plugin-serialplugin" -version = "2.24.1" +version = "3.0.0" dependencies = [ + "android-usb-serial", + "jni", + "log", "serde", "serde_json", "serialport", "tauri", "tauri-plugin", - "thiserror 2.0.12", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 661bcb11..4828ee4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,25 @@ +[workspace] +members = ["crates/android-usb-serial"] +exclude = [ + "examples/serialport-test/src-tauri", + "examples/usb-driver-tester/rust", +] +resolver = "2" + [package] name = "tauri-plugin-serialplugin" -version = "2.24.1" -description = "Access the current process of your Tauri application." +version = "3.0.0" +description = "Tauri plugin for serial port access (desktop and Android)." edition = "2021" authors = ["Tauri Programme within The Commons Conservancy"] license = "Apache-2.0 OR MIT" -rust-version = "1.70" +rust-version = "1.79" links = "tauri-plugin-serialplugin" repository = "https://github.com/s00d/tauri-plugin-serialplugin" +[features] +android-test-harness = ["android-usb-serial/fake-transport"] + [package.metadata.docs.rs] rustc-args = [ "--cfg", "docsrs" ] rustdoc-args = [ "--cfg", "docsrs" ] @@ -26,14 +37,18 @@ tauri-plugin = { version = "2.3.0", features = [ "build" ] } [dependencies] tauri = { version = "2.6.2", features = ["test"] } serde = { version = "1.0.219", features = ["derive"] } -thiserror = "2.0.12" serde_json = "1.0.140" +[target.'cfg(target_os = "android")'.dependencies] +jni = "0.21" +android-usb-serial = { path = "crates/android-usb-serial", version = "0.1.0" } +serialport = "4.9.0" +log = { version = "0.4", features = ["std"] } + [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] serialport = "4.9.0" [profile.release] -panic = "abort" codegen-units = 1 lto = true incremental = false diff --git a/README.md b/README.md index 8ce986ac..966d4a9d 100755 --- a/README.md +++ b/README.md @@ -9,7 +9,49 @@ A comprehensive plugin for Tauri applications to communicate with serial ports. This plugin provides a complete API for reading from and writing to serial devices, with support for various configuration options and control signals. -> **⚠️ Important Notice:** The JavaScript dependency has been renamed from `tauri-plugin-serialplugin` to `tauri-plugin-serialplugin-api`. Please update your `package.json` before updating to the latest version, following the same pattern used by other Tauri plugins. +> **v3.0 breaking change:** `listen` / `startListening` / `disconnected` were removed. Use **`watch()`** and **`SerialPort.getCapabilities()`**. See [Migrating to v3](#migrating-to-v3) below. + +--- + +## Migrating to v3 + +| v2 | v3 | +|----|-----| +| `startListening()` + `listen(fn)` | `const handle = await port.watch({ onData: fn })` | +| `disconnected(fn)` | `watch({ onDisconnect: fn })` | +| `cancelListen()` / `stopListening()` | `await handle.unwatch()` | + +Legacy Tauri events (`plugin-serialplugin-read-*`) and Android plugin triggers (`serialData`, `serialError`) are **no longer part of the public API**. + +**New in v3:** `SerialPort.getCapabilities()` — `{ transport, platform, version }` from Rust (`cfg!`), if the app needs to branch by platform (replaces ad-hoc `window` / `@tauri-apps/plugin-os` probing on the app side). + +**Breaking API changes (v3):** + +| Field / behavior | v2 | v3 | +|------------------|-----|-----| +| `AtCommandResult.raw` / `ExchangeResponse.raw` | `number[]` | `Uint8Array` | +| `AtCommandResult.timedOut` | literal `false` | `boolean` (timeouts surfaced by native layer) | +| `open()` | `void` | returns **canonical path** (Android re-keys to `UsbPath.sessionKey`; desktop echoes input) | +| `cancel_read` | also detached watch on some builds | **does not** unwatch — use `close()` or `handle.unwatch()` | +| TX queue after error | port could stay halted until reopen | next `exchange` / `sendAt` job runs normally (`stopOnError` only stops remaining phases in one `sendAtPhases` batch) | +| Early RX before `exchange` | often lost or raced with wait | native hub keeps **idle** bytes; `exchange` replays them via `take_idle_bytes` after write (no extra line response needed) | + +### Watch events (`SerialEvent`) + +| `kind` | Meaning | Port stays open? | +|--------|---------|------------------| +| `data` | Incoming bytes (decoded to `string` in JS when `decode !== false`) | Yes | +| `error` | Non-fatal notification (e.g. emitter glitch); watch continues | Yes | +| `disconnect` | Fatal end of stream (unplug, IO manager stopped); triggers auto-reconnect if enabled | No (`isOpen = false`) | + +### Watch options + +| Option | Desktop | Android | +|--------|---------|---------| +| `timeout` | Batch coalescing window (ms) | Coalescing / flush hint where supported | +| `serialDataFlushIntervalMs` | Preferred batch interval; falls back to `timeout` | `BufferedEmitter` flush (10–2000 ms) | +| `size` | Read chunk size per syscall | Reserved | +| `decode` | JS-only: `TextDecoder` on `onData` | JS-only | --- @@ -28,7 +70,8 @@ A comprehensive plugin for Tauri applications to communicate with serial ports. 7.4. [Port Configuration](#port-configuration) 7.5. [Control Signals](#control-signals) 7.6. [Buffer Management](#buffer-management) - 7.7. [Log Control](#log-control) + 7.7. [Log Control](#log-control) + 7.8. [Auto-Reconnect](#auto-reconnect-management) 8. [Common Use Cases](#common-use-cases) 9. [Android Setup](#android-setup) 10. [Contributing](#contributing) @@ -47,11 +90,6 @@ A comprehensive plugin for Tauri applications to communicate with serial ports. - **Tauri** 2.0 or higher - **Node.js** and an npm-compatible package manager (npm, yarn, pnpm) - - - -## Installation - ### Automatic Installation (Recommended) Use the Tauri CLI to automatically install both the Rust and JavaScript parts of the plugin: @@ -97,45 +135,9 @@ npm install tauri-plugin-serialplugin-api pnpm add tauri-plugin-serialplugin-api ``` -### Android Setup (Required for Android builds) +### Android -> **⚠️ Important:** If you're building for Android, you **must** configure the JitPack repository before building. The plugin will not compile without this step. - -The plugin depends on `com.github.mik3y:usb-serial-for-android:3.8.1`, which is hosted on JitPack. Add the following to your `/src-tauri/gen/android/build.gradle.kts` file: - -```kotlin -buildscript { - repositories { - google() - mavenCentral() - maven { url = uri("https://jitpack.io") } - } - dependencies { - classpath("com.android.tools.build:gradle:8.11.0") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25") - // ... your other dependencies - } -} - -allprojects { - repositories { - google() - mavenCentral() - maven { url = uri("https://jitpack.io") } - } -} - -tasks.register("clean").configure { - delete("build") -} -``` - -**Without this configuration, you will get an error:** -``` -could not find com.github.mik3y:usb-serial-for-android:3.8.1 -``` - -For more details and troubleshooting, see the [Android Setup](#android-setup) section. +USB serial on Android uses pure Rust drivers in [`crates/android-usb-serial`](crates/android-usb-serial/) (nusb). Kotlin provides USB permission, enumeration, and a dup'd fd; **no** vendored Java stack or JitPack dependency. --- @@ -185,16 +187,14 @@ For more details and troubleshooting, see the [Android Setup](#android-setup) se // Write data await port.write("Hello, Serial Port!"); - // Start port listening - await port.startListening(); - - // Start port listening - const unsubscribe = await port.listen((data) => { - console.log("Received:", data); + // Stream incoming data (desktop + Android) + const handle = await port.watch({ + onData: (data) => console.log("Received:", data), + onDisconnect: (reason) => console.log("Disconnected:", reason), }); - // Stop listening when done - await port.cancelListen(); + // Stop streaming when done + await handle.unwatch(); // Close port await port.close(); @@ -242,13 +242,12 @@ For more details and troubleshooting, see the [Android Setup](#android-setup) se } try { - // Start listening - await port.startListening(); - await port.listen((data) => { - console.log("Received:", data); + const handle = await port.watch({ + onData: (data) => console.log("Received:", data), }); + // ... use handle.unwatch() in cleanup } catch (error) { - throw new Error(`Failed to start listening: ${error}`); + throw new Error(`Failed to start watch: ${error}`); } try { @@ -270,7 +269,6 @@ For more details and troubleshooting, see the [Android Setup](#android-setup) se // Clean up if (port) { try { - await port.cancelListen(); await port.close(); } catch (error) { console.error("Error during cleanup:", error); @@ -346,8 +344,8 @@ await port.setTimeout(500); ```typescript // Set control signals -await port.setRequestToSend(true); -await port.setDataTerminalReady(true); +await port.writeRequestToSend(true); +await port.writeDataTerminalReady(true); // Alternative methods (writeRequestToSend and writeDataTerminalReady) await port.writeRequestToSend(true); @@ -437,7 +435,7 @@ use tauri::{AppHandle, State}; #[tauri::command] async fn configure_production_logging( app: AppHandle, - serial: State<'_, tauri_plugin_serialplugin::desktop_api::SerialPort> + serial: State<'_, tauri_plugin_serialplugin::api::desktop::SerialPort> ) -> Result<(), String> { // Only show errors in production set_log_level(app, serial, LogLevel::Error) @@ -463,7 +461,7 @@ await SerialPort.setLogLevel(LogLevel.None); setInterval(async () => { const ports = await SerialPort.available_ports(); - // No "listen event: plugin-serialplugin-disconnected-COM6" logs + // No extra console noise from the plugin while polling }, 1000); ``` @@ -514,7 +512,7 @@ use std::collections::HashMap; #[tauri::command] async fn rust_serial_example( app: AppHandle, - serial: State<'_, tauri_plugin_serialplugin::desktop_api::SerialPort> + serial: State<'_, tauri_plugin_serialplugin::api::desktop::SerialPort> ) -> Result<(), String> { // Get available ports let ports = available_ports(app.clone(), serial.clone()) @@ -621,7 +619,7 @@ async fn rust_serial_example( ```rust use tauri_plugin_serialplugin::commands::{ - available_ports, open, write, read, close, force_close, managed_ports, start_listening + available_ports, open, write, read, close, force_close, managed_ports, watch, unwatch }; use tauri_plugin_serialplugin::state::{DataBits, FlowControl, Parity, StopBits}; use tauri::{AppHandle, State}; @@ -630,7 +628,7 @@ use std::collections::HashMap; #[tauri::command] async fn advanced_serial_example( app: AppHandle, - serial: State<'_, tauri_plugin_serialplugin::desktop_api::SerialPort> + serial: State<'_, tauri_plugin_serialplugin::api::desktop::SerialPort> ) -> Result<(), String> { // Get available ports with error handling let ports = match available_ports(app.clone(), serial.clone()) { @@ -670,22 +668,11 @@ async fn advanced_serial_example( } } - // Start listening for data - match start_listening( - app.clone(), - serial.clone(), - port_path.clone(), - Some(1000u64), // timeout - Some(1024usize) // max bytes - ) { - Ok(_) => println!("Started listening"), - Err(e) => { - eprintln!("Failed to start listening: {}", e); - // Continue anyway, we can still read manually - } + // Poll read (for streaming use `watch` + Channel from the frontend) + match read(app.clone(), serial.clone(), port_path.clone(), Some(1000u64), Some(1024usize)) { + Ok(data) => println!("Read: {}", data), + Err(e) => eprintln!("Read failed: {}", e), } - - // Send a command and read response let command = "AT\r\n".to_string(); match write(app.clone(), serial.clone(), port_path.clone(), command) { Ok(bytes) => println!("Sent {} bytes", bytes), @@ -747,7 +734,7 @@ use tauri::{AppHandle, State}; #[tauri::command] async fn binary_data_example( app: AppHandle, - serial: State<'_, tauri_plugin_serialplugin::desktop_api::SerialPort> + serial: State<'_, tauri_plugin_serialplugin::api::desktop::SerialPort> ) -> Result<(), String> { let port_path = "COM1".to_string(); @@ -804,7 +791,7 @@ use tauri::{AppHandle, State}; #[tauri::command] async fn my_serial_function( app: AppHandle, - serial: State<'_, tauri_plugin_serialplugin::desktop_api::SerialPort> + serial: State<'_, tauri_plugin_serialplugin::api::desktop::SerialPort> ) -> Result<(), String> { // Use command functions let ports = available_ports(app.clone(), serial.clone())?; @@ -819,14 +806,14 @@ Use the SerialPort methods directly: ```rust use tauri::State; -use tauri_plugin_serialplugin::desktop_api::SerialPort; +use tauri_plugin_serialplugin::api::desktop::SerialPort; #[tauri::command] async fn my_serial_function( serial: State<'_, SerialPort> ) -> Result<(), String> { // Use serial methods directly - let ports = serial.available_ports()?; + let ports = serial.available_ports(false)?; // ... rest of your code } ``` @@ -853,7 +840,6 @@ Here are all the available command functions you can import and use. For detaile use tauri_plugin_serialplugin::commands::{ // Port discovery available_ports, // Get list of available ports - available_ports_direct, // Get ports using platform-specific commands managed_ports, // Get list of currently managed ports // Connection management @@ -868,10 +854,11 @@ use tauri_plugin_serialplugin::commands::{ read, // Read string data read_binary, // Read binary data - // Listening - start_listening, // Start listening for data - stop_listening, // Stop listening - cancel_read, // Cancel read operations + // Listening (streaming) + capabilities, // Runtime info + watch, // Stream events via Channel + unwatch, // Stop watch session + cancel_read, // Cancel poll read or active watch (shared stop channel) // Port configuration set_baud_rate, // Set baud rate @@ -950,7 +937,7 @@ pub fn write( - "Failed to open serial port: {error}" - Error opening port - "Failed to clone serial port: {error}" - Error cloning port - "Failed to set short timeout: {error}" - Error setting timeout -- "Failed to stop existing listener: {error}" - Error stopping existing listener +- "Failed to cancel serial port watch: {error}" - Error stopping watch thread - "Failed to join thread: {error}" - Error waiting for thread completion - "Failed to cancel serial port data reading: {error}" - Error canceling data reading @@ -1011,8 +998,6 @@ Below is a list of all permissions the plugin supports. Granting or denying them | `serialplugin:deny-write` | Denies writing data to serial ports | | `serialplugin:allow-write-binary` | Allows writing binary data to serial ports | | `serialplugin:deny-write-binary` | Denies writing binary data to serial ports | -| `serialplugin:allow-available-ports-direct` | Enables the `available_ports_direct` command without any pre-configured scope | -| `serialplugin:deny-available-ports-direct` | Denies the `available_ports_direct` command without any pre-configured scope | | `serialplugin:allow-set-baud-rate` | Allows changing the baud rate of serial ports | | `serialplugin:deny-set-baud-rate` | Denies changing the baud rate of serial ports | | `serialplugin:allow-set-data-bits` | Allows changing the data bits configuration | @@ -1047,10 +1032,12 @@ Below is a list of all permissions the plugin supports. Granting or denying them | `serialplugin:deny-set-break` | Denies starting break signal transmission | | `serialplugin:allow-clear-break` | Allows stopping break signal transmission | | `serialplugin:deny-clear-break` | Denies stopping break signal transmission | -| `serialplugin:allow-start-listening` | Allows starting automatic port monitoring and data listening | -| `serialplugin:deny-start-listening` | Denies starting automatic port monitoring and data listening | -| `serialplugin:allow-stop-listening` | Allows stopping automatic port monitoring and data listening | -| `serialplugin:deny-stop-listening` | Denies stopping automatic port monitoring and data listening | +| `serialplugin:allow-capabilities` | Allows reading runtime plugin capabilities | +| `serialplugin:deny-capabilities` | Denies reading runtime plugin capabilities | +| `serialplugin:allow-watch` | Allows streaming port data through a Tauri Channel | +| `serialplugin:deny-watch` | Denies streaming port data through a Tauri Channel | +| `serialplugin:allow-unwatch` | Allows stopping an active watch session | +| `serialplugin:deny-unwatch` | Denies stopping an active watch session | | `serialplugin:allow-set-log-level` | Allows setting the global log level | | `serialplugin:deny-set-log-level` | Denies setting the global log level | | `serialplugin:allow-get-log-level` | Allows getting the current log level | @@ -1071,7 +1058,6 @@ Below is a list of all permissions the plugin supports. Granting or denying them "serialplugin:allow-read", "serialplugin:allow-write", "serialplugin:allow-write-binary", - "serialplugin:allow-available-ports-direct", "serialplugin:allow-set-baud-rate", "serialplugin:allow-set-data-bits", "serialplugin:allow-set-flow-control", @@ -1089,8 +1075,9 @@ Below is a list of all permissions the plugin supports. Granting or denying them "serialplugin:allow-clear-buffer", "serialplugin:allow-set-break", "serialplugin:allow-clear-break", - "serialplugin:allow-start-listening", - "serialplugin:allow-stop-listening", + "serialplugin:allow-capabilities", + "serialplugin:allow-watch", + "serialplugin:allow-unwatch", "serialplugin:allow-set-log-level", "serialplugin:allow-get-log-level" ] @@ -1102,24 +1089,41 @@ Below is a list of all permissions the plugin supports. Granting or denying them ### Port Discovery +> **Removed in 3.0.0:** `available_ports_direct` — use `available_ports()`. + +> **macOS duplicates:** `serialport-rs` lists both `/dev/cu.*` (callout) and `/dev/tty.*` (dial-in) per device. Pass `{ singlePortPerDevice: true }` to keep one path per device (prefers `/dev/cu.*`, like Node.js `SerialPort.list()`). Default returns all paths. + ```typescript class SerialPort { /** * Lists all available serial ports on the system + * @param options.macOS `singlePortPerDevice` — see note above * @returns {Promise<{[key: string]: PortInfo}>} Map of port names to port information * @example * const ports = await SerialPort.available_ports(); + * const onePerDevice = await SerialPort.available_ports({ singlePortPerDevice: true }); * console.log(ports); */ - static async available_ports(): Promise<{ [key: string]: PortInfo }>; + static async available_ports(options?: AvailablePortsOptions): Promise<{ [key: string]: PortInfo }>; /** - * Lists ports using platform-specific commands for enhanced detection - * @returns {Promise<{[key: string]: PortInfo}>} Map of port names to port information + * Subscribe to available-port hotplug (attach/detach). Sends an initial snapshot, + * then `added` / `removed` events through a Tauri Channel. + * @param handlers Callbacks for snapshot / added / removed + * @param options `singlePortPerDevice`, `pollIntervalMs` (desktop default 2000) + * @returns Handle with `unwatch()` to stop * @example - * const ports = await SerialPort.available_ports_direct(); + * const handle = await SerialPort.watchAvailablePorts({ + * onSnapshot: (ports) => console.log('ports', ports), + * onAdded: (path, info) => console.log('plugged', path, info.type), + * onRemoved: (path) => console.log('unplugged', path), + * }, { singlePortPerDevice: true }); + * // later: await handle.unwatch(); */ - static async available_ports_direct(): Promise<{ [key: string]: PortInfo }>; + static async watchAvailablePorts( + handlers: WatchPortsHandlers, + options?: WatchPortsOptions, + ): Promise; /** * @description Lists all managed serial ports (ports that are currently open and managed by the application). @@ -1153,27 +1157,24 @@ class SerialPort { async close(): Promise; /** - * Starts listening for data on the serial port - * @returns {Promise} A promise that resolves when listening starts - * @throws {Error} If starting listener fails or port is not open + * Streams serial port events through a Tauri Channel. + * @returns {Promise} Handle with `channelId` and `unwatch()` * @example - * await port.startListening(); - * - * // Listen for data events - * port.listen((data) => { - * console.log("Data received:", data); + * const handle = await port.watch({ + * onData: (data) => console.log("Data:", data), + * onError: (message) => console.warn("Non-fatal:", message), + * onDisconnect: (reason) => console.log("Disconnected:", reason), * }); + * await handle.unwatch(); */ - async startListening(): Promise; + async watch(handlers: WatchHandlers, options?: WatchOptions): Promise; /** - * Stops listening for data on the serial port - * @returns {Promise} A promise that resolves when listening stops - * @throws {Error} If stopping listener fails or port is not open + * Runtime plugin info (transport, platform, version). * @example - * await port.stopListening(); + * const caps = await SerialPort.getCapabilities(); */ - async stopListening(): Promise; + static getCapabilities(): Promise; /** * Forces a serial port to close regardless of its state @@ -1232,29 +1233,6 @@ class SerialPort { * const bytesWritten = await port.writeBinary(data); */ async writeBinary(data: Uint8Array | number[]): Promise; - - /** - * Sets up a listener for incoming data - * @param {(data: string | Uint8Array) => void} callback Function to handle received data - * @param {boolean} [decode=true] Whether to decode data as string (true) or return raw bytes (false) - * @returns {Promise} A promise that resolves to an unlisten function - * @example - * const unsubscribe = await port.listen((data) => { - * console.log("Received:", data); - * }); - * - * // Later, to stop listening: - * unsubscribe(); - */ - async listen(callback: (data: string | Uint8Array) => void, decode?: boolean): Promise; - - /** - * Cancels listening for serial port data (does not affect disconnect listeners) - * @returns {Promise} A promise that resolves when listening is cancelled - * @example - * await port.cancelListen(); - */ - async cancelListen(): Promise; } ``` @@ -1340,24 +1318,6 @@ class SerialPort { */ async writeDataTerminalReady(level: boolean): Promise; - /** - * Alternative method to set RTS signal - * @param {boolean} value Signal level (true = high, false = low) - * @returns {Promise} - * @example - * await port.setRequestToSend(true); - */ - async setRequestToSend(value: boolean): Promise; - - /** - * Alternative method to set DTR signal - * @param {boolean} value Signal level (true = high, false = low) - * @returns {Promise} - * @example - * await port.setDataTerminalReady(true); - */ - async setDataTerminalReady(value: boolean): Promise; - /** * Reads the CTS (Clear to Send) signal state * @returns {Promise} Signal state @@ -1489,9 +1449,9 @@ class SerialPort { * @param {number} [options.interval=5000] Reconnection interval in milliseconds * @param {number | null} [options.maxAttempts=10] Maximum number of reconnection attempts (null for infinite) * @param {Function} [options.onReconnect] Callback function called on each reconnection attempt - * @returns {Promise} + * @returns {void} * @example - * await port.enableAutoReconnect({ + * port.enableAutoReconnect({ * interval: 3000, * maxAttempts: 5, * onReconnect: (success, attempt) => { @@ -1499,19 +1459,19 @@ class SerialPort { * } * }); */ - async enableAutoReconnect(options?: { + enableAutoReconnect(options?: { interval?: number; maxAttempts?: number | null; onReconnect?: (success: boolean, attempt: number) => void; - }): Promise; + }): void; /** * Disables auto-reconnect functionality - * @returns {Promise} + * @returns {void} * @example * await port.disableAutoReconnect(); */ - async disableAutoReconnect(): Promise; + disableAutoReconnect(): void; /** * Gets auto-reconnect status and configuration @@ -1553,11 +1513,13 @@ const port = new SerialPort({ }); await port.open(); -await port.startListening(); -await port.listen((data) => { - const sensorValue = parseFloat(data); - console.log("Sensor reading:", sensorValue); +const handle = await port.watch({ + onData: (data) => { + const sensorValue = parseFloat(String(data)); + console.log("Sensor reading:", sensorValue); + }, }); +// await handle.unwatch() when done ``` ### Binary Protocol Communication @@ -1574,14 +1536,12 @@ await port.open(); const command = new Uint8Array([0x02, 0x01, 0x03]); await port.writeBinary(command); -// Start listening for response -await port.startListening(); - -// Read response (raw bytes) -await port.listen((data) => { - const response = data instanceof Uint8Array ? data : new Uint8Array(); - console.log("Response:", response); -}, false); +const handle = await port.watch({ + onData: (data) => { + const response = data instanceof Uint8Array ? data : new Uint8Array(); + console.log("Response:", response); + }, +}, { decode: false }); ``` ### Modbus Communication @@ -1621,27 +1581,21 @@ const port = new SerialPort({ await port.open(); -// Enable auto-reconnect with custom settings +// Enable auto-reconnect: restores both open() and watch() after disconnect +// Reconnection uses a fixed interval (options.interval); exponential backoff is not implemented. await port.enableAutoReconnect({ - interval: 3000, // Try to reconnect every 3 seconds - maxAttempts: 5, // Maximum 5 attempts + interval: 3000, + maxAttempts: 5, onReconnect: (success, attempt) => { - if (success) { - console.log(`Reconnected successfully on attempt ${attempt}`); - } else { - console.log(`Reconnection attempt ${attempt} failed`); - } - } + console.log(success ? `Reconnected on attempt ${attempt}` : `Attempt ${attempt} failed`); + }, }); -// Set up data listener -await port.startListening(); -const unsubscribe = await port.listen((data) => { - console.log("Received data:", data); +const handle = await port.watch({ + onData: (data) => console.log("Received data:", data), + onDisconnect: () => console.log("Port disconnected — auto-reconnect will reopen and re-watch"), }); - -// The port will automatically reconnect if disconnected -// You can also manually trigger reconnection +// Manual reconnect also re-establishes watch when a session was active before disconnect const success = await port.manualReconnect(); if (success) { console.log("Manual reconnection successful"); @@ -1656,58 +1610,68 @@ console.log("Current attempts:", info.currentAttempts); await port.disableAutoReconnect(); ``` ---- - -## Android Setup - -To use this plugin on Android, you **must** add the JitPack repository to your project's `build.gradle.kts` file located at `/src-tauri/gen/android/build.gradle.kts`. This is required because the plugin depends on `com.github.mik3y:usb-serial-for-android:3.8.1`, which is hosted on JitPack. +### AT commands (native FIFO queue) + +For modems and AT devices, use **`sendAt()`** / **`sendAtPhases()`** / **`sendSmsPdu()`** — native FIFO queue over **`exchange`** with **line-framed AT completion** (`OK` / `ERROR` / `+CME ERROR` as the final line). + +| Mode | RX | Use when | +|------|-----|----------| +| `watch()` | Streaming Channel events + optional **`onUrc`** | General I/O, live URC | +| `sendAt()` | One structured response per command | AT modems, request/response scripts | + +**Capabilities (v3.0):** + +| Feature | Description | +|---------|-------------| +| `AtCommandResult` | Structured result: `command`, `response`, `status`, `lines`, `solicitedBody`, `urcLines`, `raw` | +| Native queue | Parallel `exchange()` / `sendAt()` **wait in FIFO** (no `"Exchange already in progress"`) | +| `configureAtSession()` | Session defaults: `expectOk`, `stopOnError`, `appendCr`, timeouts, `resultFormat` | +| Default `rxPrepare: 'drain'` | Soft idle drain before each command; use **`purge`** only for recovery. On **Android**, drain uses the same hub `drain()` path as desktop (Rust reader → `PortRxHub`). | +| `expectOk`, `solicitedPrefixes` | Per-command control via session + `AtCommandOptions` | +| Watch during AT | Watch stays active; live **`SerialEvent::Urc`** via `watch({ onUrc })` | +| Vendor grammar | Auto **`solicitedPrefixes`** from command (`^`, `#`, `$`, `%`, `*`) | +| `resultFormat: 'numeric'` | `ATV0` line codes (`0`/`3`/`4`…) | +| `completionMode: 'atIntermediate'` | CMGS `>` prompt and other intermediate lines | +| `sendAtPhases()` / `sendSmsPdu()` | Multi-phase SMS (prompt → PDU → `SEND OK`) | +| `exchangeBinary()` | Binary write + read-until (PDU + Ctrl+Z) | +| CMUX | `enableMux()`, `openMuxChannel(dlci)`, virtual paths `physical#dlci=N` | + +**Migration (v3.0 major):** + +| Was | Now | +|-----|-----| +| `port.at.enqueue('AT')` | `port.sendAt('AT')` | +| `port.at.enqueuePhases(...)` | `port.sendAtPhases(...)` | +| `port.at.sendSmsPdu(...)` | `port.sendSmsPdu(...)` | +| `port.at.cancel()` | `port.cancelAt()` | +| `new SerialPort({ atSession })` | `atSession` still applies on `open()` via `configureAtSession` | +| Parallel `exchange()` throws | `exchange()` awaits turn in native queue | -### Required Configuration - -Add the JitPack repository to both `buildscript` and `allprojects` sections: - -```kotlin -buildscript { - repositories { - google() - mavenCentral() - maven { url = uri("https://jitpack.io") } - } - dependencies { - classpath("com.android.tools.build:gradle:8.11.0") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25") - // ... your other dependencies - } -} +```typescript +// Session defaults (optional — also via constructor `atSession`) +await port.configureAtSession({ expectOk: true, defaultTimeoutMs: 5000 }); -allprojects { - repositories { - google() - mavenCentral() - maven { url = uri("https://jitpack.io") } - } -} +await port.sendAt('AT^SYSCFG?'); +await port.sendAt('ATV0', { resultFormat: 'numeric' }); +await port.sendSmsPdu(pduLength, pduBytes); -tasks.register("clean").configure { - delete("build") -} +// CMUX: second logical channel on same USB port +await port.enableMux({ command: 'AT+CMUX=0,0,5,31,10,2' }); +const dataPort = await port.openMuxChannel(2); +await dataPort.sendAt('AT'); ``` -### Why is this needed? +Low-level **`exchange`** / **`exchangeBinary`** return **`ExchangeResponse`** (also queued); **`cancel_exchange`** / **`cancelAt()`** cancels in-flight work and rejects queued waiters. -The plugin uses the [usb-serial-for-android](https://github.com/mik3y/usb-serial-for-android) library, which is published on JitPack rather than Maven Central. Without adding JitPack to your repositories, Gradle will fail with an error like: +--- -``` -could not find com.github.mik3y:usb-serial-for-android:3.8.1 -``` +## Android Setup -### Troubleshooting +Android USB serial runs in Rust (`android-usb-serial` + nusb). Kotlin holds the `UsbDeviceConnection` fd; the plugin duplicates it and claims interfaces in native code. Add a `device_filter.xml` in your app for your VID/PID and grant USB permission at runtime. -If you still encounter issues after adding JitPack: +If you previously added `maven { url = uri("https://jitpack.io") }` only for usb-serial-for-android, you can remove it. -1. Make sure you've added it to **both** `buildscript.repositories` and `allprojects.repositories` -2. Sync your Gradle files in your IDE -3. Clean and rebuild your project: `./gradlew clean build` +See [`android/README.md`](android/README.md) and [`android/BUILD_INSTRUCTIONS.md`](android/BUILD_INSTRUCTIONS.md). --- @@ -1730,173 +1694,40 @@ pnpm run playground ## Testing -For testing applications without physical hardware, you can use a mock implementation of the serial port. The mock port emulates all functions of a real port and allows testing the application without physical devices. - -### Using Mock Port - -```rust -use tauri_plugin_serialplugin::tests::mock::MockSerialPort; - -// Create a mock port -let mock_port = MockSerialPort::new(); - -// Configure port settings -mock_port.set_baud_rate(9600).unwrap(); -mock_port.set_data_bits(serialport::DataBits::Eight).unwrap(); -mock_port.set_flow_control(serialport::FlowControl::None).unwrap(); -mock_port.set_parity(serialport::Parity::None).unwrap(); -mock_port.set_stop_bits(serialport::StopBits::One).unwrap(); - -// Write data -mock_port.write("Test data".as_bytes()).unwrap(); +Run the full suite locally: -// Read data -let mut buffer = [0u8; 1024]; -let bytes_read = mock_port.read(&mut buffer).unwrap(); -let data = String::from_utf8_lossy(&buffer[..bytes_read]); -assert_eq!(data, "Test data"); +```bash +./scripts/verify-android-usb-migration.sh # full Android USB migration gate +cargo fmt --all -- --check +cargo clippy --all-targets -- -D warnings +cargo test +pnpm install && pnpm check && pnpm test && pnpm build +cd android && ./gradlew test ``` -### Mock Port Features - -- Complete emulation of all real port functions -- Built-in buffer for data storage -- Control signal emulation (RTS, DTR, CTS, DSR) -- Support for parallel operation testing -- No additional software required -- Works on all platforms +### Virtual serial port (desktop integration) -### Application Testing Example - -```rust -#[test] -fn test_serial_communication() { - let app = create_test_app(); - let serial_port = SerialPort::new(app.handle().clone()); - app.manage(serial_port); - - // Open mock port - app.state::>().open( - "COM1".to_string(), - 9600, - Some(DataBits::Eight), - Some(FlowControl::None), - Some(Parity::None), - Some(StopBits::One), - Some(1000), - ).unwrap(); - - // Test write and read operations - app.state::>().write( - "COM1".to_string(), - "Test data".to_string(), - ).unwrap(); - - let data = app.state::>().read( - "COM1".to_string(), - Some(1000), - Some(1024), - ).unwrap(); - assert_eq!(data, "Test data"); - - // Test port settings - app.state::>().set_baud_rate( - "COM1".to_string(), - 115200, - ).unwrap(); +For manual or integration testing without hardware, pair two PTY endpoints with **socat**: - // Close port - app.state::>().close("COM1".to_string()).unwrap(); -} +```bash +socat -d -d pty,raw,echo=0 pty,raw,echo=0 +# open the printed /dev/tty* path (or COM* on Windows with com0com) +pnpm playground ``` -### Implementing Your Own Mock Port +Use `watch()`, `exchange()`, and `sendAt()` against that path; unplugging the peer exercises disconnect fail-fast and hub restart behavior. -You can implement your own mock port by implementing the `SerialPort` trait. Here's a basic example of how to create a custom mock port: - -```rust -use std::io::{self, Read, Write}; -use serialport::{self, SerialPort}; -use std::time::Duration; +### Unit tests (no hardware) -struct CustomMockPort { - buffer: Vec, - baud_rate: u32, - data_bits: serialport::DataBits, - flow_control: serialport::FlowControl, - parity: serialport::Parity, - stop_bits: serialport::StopBits, - timeout: Duration, -} - -impl CustomMockPort { - fn new() -> Self { - Self { - buffer: Vec::new(), - baud_rate: 9600, - data_bits: serialport::DataBits::Eight, - flow_control: serialport::FlowControl::None, - parity: serialport::Parity::None, - stop_bits: serialport::StopBits::One, - timeout: Duration::from_millis(1000), - } - } -} - -// Implement Read trait for reading data -impl Read for CustomMockPort { - fn read(&mut self, buf: &mut [u8]) -> io::Result { - let len = std::cmp::min(buf.len(), self.buffer.len()); - if len > 0 { - buf[..len].copy_from_slice(&self.buffer[..len]); - self.buffer.drain(..len); - } - Ok(len) - } -} - -// Implement Write trait for writing data -impl Write for CustomMockPort { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.buffer.extend_from_slice(buf); - Ok(buf.len()) - } - - fn flush(&mut self) -> io::Result<()> { - Ok(()) - } -} - -// Implement SerialPort trait for port configuration -impl SerialPort for CustomMockPort { - fn name(&self) -> Option { - Some("CUSTOM_PORT".to_string()) - } - - fn baud_rate(&self) -> serialport::Result { - Ok(self.baud_rate) - } - - fn data_bits(&self) -> serialport::Result { - Ok(self.data_bits) - } - - // ... implement other required methods ... -} -``` +- **Rust:** `src/tests/mock_serial.rs` — scripted RX/TX mock used by `cargo test` +- **JS:** `tests/*.test.ts` — Jest mocks for `invoke` / `Channel` +- **Android:** `android/src/test/...` — Robolectric for `UsbFdBridge`; Rust driver tests in `crates/android-usb-serial` (`fake-transport`) -For a complete implementation example, see the mock port implementation in the plugin's test directory: -[`src/tests/mock.rs`](https://github.com/s00d/tauri-plugin-serialplugin/blob/main/src/tests/mock.rs) +> **Note:** `bytesToWrite()` returns **0 on Android** (writes are synchronous over JNI). Desktop returns the driver queue depth when available. -The example includes: -- Full implementation of all required traits -- Buffer management for read/write operations -- Control signal emulation -- Port configuration handling -- Error handling -- Thread safety considerations +### Known limitations -You can use this implementation as a reference when creating your own mock port with custom behavior for specific testing scenarios. +* **Windows port enumeration** uses `wmic` for supplemental metadata on some builds. This path is **not exercised in CI** and may behave differently on Windows 11 if `wmic` is unavailable or restricted. --- diff --git a/android/BUILD_INSTRUCTIONS.md b/android/BUILD_INSTRUCTIONS.md index 6addac95..79895297 100644 --- a/android/BUILD_INSTRUCTIONS.md +++ b/android/BUILD_INSTRUCTIONS.md @@ -2,105 +2,67 @@ ## Prerequisites -1. **Android Studio** (latest version) -2. **Android SDK** (API 24+) -3. **Kotlin** (1.8+) -4. **Gradle** (7.0+) -5. **Tauri CLI** (`npm install -g @tauri-apps/cli`) +1. **Android Studio** (latest) +2. **Android SDK** (API 24+, compile 34) +3. **Kotlin** 1.9+ +4. **Gradle** 8.5+ +5. **Rust** 1.79+ with Android targets (`aarch64-linux-android`, etc.) +6. **Tauri CLI** 2.x -## Building the Plugin - -### 1. Environment Setup +## Building the library module ```bash -# Make sure you have all dependencies installed cd android -./gradlew clean -``` - -### 2. Building the Library - -```bash -# Build AAR file -./gradlew assembleRelease - -# Or for debugging +export JAVA_HOME=$(/usr/libexec/java_home -v 17) # macOS ./gradlew assembleDebug ``` -### 3. Build Verification +Outputs: `build/outputs/aar/` -Built files will be located in: -- `build/outputs/aar/` - AAR library -- `build/intermediates/aar_main_jar/` - JAR files +## Rust Android check -## Testing +```bash +rustup target add aarch64-linux-android +cargo check -p android-usb-serial --target aarch64-linux-android +cargo check -p tauri-plugin-serialplugin --target aarch64-linux-android +``` -### 1. Running the Example Application +## Example app (Tauri) ```bash cd examples/serialport-test -npm install -npm run tauri android dev +pnpm install +pnpm tauri android dev ``` -### 2. Connecting USB Device +## USB on device -1. Connect USB Serial device to Android device -2. Allow USB access in the application -3. Device should appear in the list of available ports +1. Add `device_filter.xml` entries for your VID/PID in the **app** manifest. +2. Grant USB permission when prompted. +3. Port paths look like `/dev/bus/usb/001/002` (multi-interface FTDI: `#1`, `#2`, …). -### 3. Checking Logs +## Logs ```bash -# View Android logs -adb logcat | grep -E "(SerialPlugin|SerialPortManager)" - -# Or through Android Studio -# View -> Tool Windows -> Logcat +adb logcat -v time -s UsbFdBridge SerialPlugin RustStdoutStderr ``` -## Troubleshooting - -### Build Issues +## Project structure -1. **Gradle Error**: Check Gradle and Android Gradle Plugin versions -2. **Kotlin Error**: Make sure Kotlin version is 1.8+ -3. **Dependency Error**: Check repository availability - -### Runtime Issues - -1. **USB permissions not requested**: Check AndroidManifest.xml -2. **Device not detected**: Check device_filter.xml -3. **Connection errors**: Check logs and USB drivers - -### Debugging - -1. **Enable detailed logging** in SerialPortManager -2. **Check USB permissions** in Android settings -3. **Test with different devices** (FTDI, CH340, CP210x) - -## Project Structure - -``` +```text android/ -├── src/main/kotlin/ -│ ├── SerialPlugin.kt # Main plugin -│ ├── SerialPortManager.kt # USB port manager -│ └── models/ # Data models -├── src/main/AndroidManifest.xml # Application manifest -├── src/main/res/xml/ -│ └── device_filter.xml # USB device filter -├── build.gradle # Build configuration -└── README.md # Documentation +├── src/main/kotlin/app/tauri/serialplugin/ +│ ├── SerialPlugin.kt +│ ├── UsbNative.kt +│ ├── MobileBridge.kt +│ └── manager/UsbFdBridge.kt +├── src/main/res/xml/device_filter.xml +└── build.gradle + +crates/android-usb-serial/ # published-quality driver crate (nusb) +src/android/ # fd_bridge, driver_host, registry JNI ``` -## Dependencies - -- **usb-serial-for-android**: Library for USB Serial operations -- **tauri-android**: Tauri Android runtime -- **AndroidX**: Modern Android libraries - -## License +## Attribution -MIT License - see LICENSE file in the project root. +Driver logic is ported from [usb-serial-for-android](https://github.com/mik3y/usb-serial-for-android) into Rust (`android-usb-serial`). See `crates/android-usb-serial/NOTICE`. diff --git a/android/README.md b/android/README.md index 2cc3bda1..a3f547b0 100644 --- a/android/README.md +++ b/android/README.md @@ -1,43 +1,67 @@ -# Android module (Tauri serial plugin) +# Android serial plugin -## Dependency +## Architecture (fd + Rust drivers) -- [usb-serial-for-android](https://github.com/mik3y/usb-serial-for-android) (`com.github.mik3y:usb-serial-for-android`) — the `UsbSerialPort` interface: `read` / `write` with timeout, `purgeHwBuffers`, `setFlowControl`, RTS/DTR/CTS lines, etc. +```text +SerialPlugin → UsbFdBridge (Kotlin) → openDeviceFd / enumerateJson +UsbNative (JNI) ↔ fd_bridge.rs ↔ driver_host.rs ↔ android-usb-serial (nusb) +RX: Rust reader thread → PortRxHub poll-loop (same as desktop) +``` + +Kotlin keeps `UsbDeviceConnection` and the raw fd. Rust duplicates the fd (`dup`), opens `nusb::Device::from_fd`, claims interfaces, and runs vendor drivers from the `android-usb-serial` crate. There is **no** vendored `usb-serial-for-android` Java tree in this repo. -## Lifecycle / cleanup +## Consumer app requirements -`SerialPlugin` registers `Application.ActivityLifecycleCallbacks` in `load()` and calls `SerialPortManager.cleanup()` when the host `Activity` is destroyed (USB ports closed, broadcast receiver unregistered, IO executor shut down). This complements JS `close` / `closeAll` and reduces leaks or stale native work after the WebView/activity is gone. +1. Declare USB host in the app manifest (`uses-feature android.hardware.usb.host` optional). +2. Ship a `device_filter.xml` aligned with [`device_filter.xml`](src/main/res/xml/device_filter.xml) / `ProbeTable::default_table()`. +3. Request runtime USB permission before open (the plugin uses `PendingIntent.FLAG_MUTABLE` + `setPackage()`). -## Unit tests (Kotlin) +## JVM unit tests (Robolectric) -Tests live under `src/test/kotlin/`. Pure JVM tests (no Robolectric required): +Requires **JDK 17**: -- `SerialModelsTest` — model enums / defaults (`Parity` / `StopBits` round-trip, invalid `fromValue` fallbacks) -- `SerialByteAccumulatorTest` — thread-safe byte coalescing for `BufferedEmitter` -- `SerialDataEmitFieldsTest` — `serialDataPayloadFromChunk` / `flushAccumulatorToEmit` / `applyToJSObject` (binary + UTF-8) -- `SerialPluginConversionTest` — `Map.toJSObject` / `List.toJSArray` helpers from `SerialPlugin.kt` -- `BufferedEmitterTest` — `pendingByteCount()` before flush +```bash +export JAVA_HOME=$(/usr/libexec/java_home -v 17) # macOS +cd android && ./gradlew test +``` -JVM unit tests use **`testImplementation("org.json:json:…")`** so `JSONObject.put` is not the Android stub that throws (“Method … not mocked”). +## Kotlin ↔ Rust JNI integration tests (instrumented) -`BufferedEmitter` itself still schedules timers and builds `JSObject` on device; the buffer + flush pipeline is covered by the tests above. +Stable sources: [`examples/serialport-test/android-integration/`](../examples/serialport-test/android-integration/). -Run from the `android/` directory (Android SDK, **JDK 17+** for Gradle; use **17** if Gradle errors on JDK 25): +Uses `FakeTransport` via `android-test-harness` (no Kotlin USB fakes). ```bash -cd android -export JAVA_HOME=$(/usr/libexec/java_home -v 17) # macOS; use JDK 17 on Linux/Windows -./gradlew test +cd examples/serialport-test +pnpm android:integration-test ``` -This repo includes a Gradle wrapper (`gradlew`, `gradle/wrapper/`). The module depends on `:tauri-android` from `.tauri/tauri-api` (bundled under `android/.tauri/tauri-api` or generated by Tauri). +Debug harness JNI (`test_harness.rs`): `testHarnessReset`, `testOpenFakePort`, `testFakeInjectRx`, `testFakeTakeTx`, `testFakeInjectError`, `testHubBufferedLen`, `testInvokeWrite`, `testRegistryHasPort`. + +## Layout + +| File | Role | +|------|------| +| `SerialPlugin` | Tauri plugin load → `UsbFdBridge` | +| `UsbFdBridge` | enumerate, permission, fd open/close, attach/detach | +| `UsbNative` | JNI for enumerate + fd lifecycle | +| `MobileBridge` | JNI callbacks (`onUsbError`, `onDeviceDetached`, port list change, …) | + +## Golden fixture regen + +Rust drivers are verified against frozen JSON fixtures (`crates/android-usb-serial/tests/fixtures/`). + +```bash +cargo run -p android-usb-serial --features fake-transport --bin golden_record +cargo test -p android-usb-serial --features fake-transport --test golden_parity +``` + +See [`docs/golden-recorder-archive/README.md`](../docs/golden-recorder-archive/README.md) for the retired JVM recorder workflow. + +Logcat: `adb logcat -s UsbFdBridge SerialPlugin RustStdoutStderr` -## Behavior tied to the library +## CMUX virtual paths -| Plugin API | Implementation | -|------------|----------------| -| `setTimeout` | Stored in `SerialPortConfig.timeout` and used for `write()` and as a fallback for `read()` when the call passes `timeout == 0`. | -| `clearBuffer` | `UsbSerialPort.purgeHwBuffers()` (when supported by the driver). | -| `setFlowControl` | `UsbSerialPort.setFlowControl(RTS_CTS / XON_XOFF / NONE)`. | -| `bytesToRead` | With **listening** (`startListening`): bytes in the plugin’s [BufferedEmitter] before the next `serialData` flush (not the kernel queue). Without listening: `0`. | -| `bytesToWrite` | Always `0`: writes are synchronous; usb-serial exposes no TX backlog. | +* **`exchange` / `at` on `physical#dlci=N`:** Routed through the Rust CMUX session (same as desktop). +* **`cancel_exchange`:** Sets the virtual cancel flag, fails the active DLCI waiter, and clears the virtual TX queue. +* **`rx_prepare: drain`:** Uses the shared RX hub drain before write (idle bytes may still be replayed via `take_idle_bytes`). diff --git a/android/build.gradle b/android/build.gradle index 16b1be90..7c189fd9 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -17,7 +17,6 @@ android { buildTypes { release { -// isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" @@ -25,11 +24,16 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" + } + testOptions { + unitTests { + includeAndroidResources = true + } } } @@ -37,13 +41,16 @@ dependencies { implementation("androidx.core:core-ktx:1.9.0") implementation("androidx.appcompat:appcompat:1.6.0") implementation("com.google.android.material:material:1.7.0") - implementation("com.fasterxml.jackson.core:jackson-databind:2.15.3") + testImplementation("androidx.test:core:1.5.0") testImplementation("junit:junit:4.13.2") - // Real org.json for JVM unit tests (Android stubs throw on JSONObject.put — see not-mocked) - testImplementation("org.json:json:20240303") + testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0") + testImplementation("org.robolectric:robolectric:4.14.1") + testImplementation("com.google.code.gson:gson:2.10.1") androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + androidTestImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0") implementation(project(":tauri-android")) implementation("com.google.code.gson:gson:2.10.1") - implementation("com.github.mik3y:usb-serial-for-android:3.8.1") -} \ No newline at end of file + implementation("androidx.annotation:annotation:1.9.1") +} + diff --git a/android/consumer-rules.pro b/android/consumer-rules.pro new file mode 100644 index 00000000..78c88fb4 --- /dev/null +++ b/android/consumer-rules.pro @@ -0,0 +1,3 @@ +# Consumer ProGuard rules for tauri-plugin-serialplugin Android module. +-keep class app.tauri.serialplugin.UsbNative { *; } +-keep class app.tauri.serialplugin.MobileBridge { *; } diff --git a/android/settings.gradle b/android/settings.gradle index aa26926f..22c74029 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -15,7 +15,6 @@ dependencyResolutionManagement { repositories { mavenCentral() google() - maven { url 'https://jitpack.io' } } } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 70f85715..14ffb286 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -4,12 +4,7 @@ android:hardwareAccelerated="true"> - - - - - - + diff --git a/android/src/main/kotlin/app/tauri/serialplugin/MobileBridge.kt b/android/src/main/kotlin/app/tauri/serialplugin/MobileBridge.kt new file mode 100644 index 00000000..123be022 --- /dev/null +++ b/android/src/main/kotlin/app/tauri/serialplugin/MobileBridge.kt @@ -0,0 +1,59 @@ +package app.tauri.serialplugin + +/** + * JNI entry points into the Tauri Rust library (loaded by the host app). + * RX is polled via Rust USB reader → [PortRxHub] (see [android/jni.rs]). + */ +object MobileBridge { + @JvmStatic + external fun onUsbError(path: String, reason: String) + + @JvmStatic + external fun onDeviceDetached(deviceName: String) + + @JvmStatic + external fun onPortListChange() + + @JvmStatic + external fun onAppDestroy() + + /** Debug-only: reset Rust port registry between integration tests. */ + @JvmStatic + external fun testHarnessReset() + + /** Debug-only: register path in Rust registry with a fresh PortRxHub. */ + @JvmStatic + external fun testRegisterPort(path: String) + + /** Debug-only: idle + read-slot bytes buffered in the Rust hub for [path]. */ + @JvmStatic + external fun testHubBufferedLen(path: String): Long + + /** Debug-only: take idle bytes from the Rust hub (exchange replay path). */ + @JvmStatic + external fun testHubTakeIdle(path: String): ByteArray + + /** Debug-only: whether [path] is still registered after USB teardown. */ + @JvmStatic + external fun testRegistryHasPort(path: String): Boolean + + /** Debug-only: invoke Rust TX path (driver_host write). Returns bytes written or -1. */ + @JvmStatic + external fun testInvokeWrite(path: String, data: ByteArray): Long + + /** Debug-only: inject CDC fake device, open port, register hub. Returns session path. */ + @JvmStatic + external fun testOpenFakePort(deviceName: String): String + + /** Debug-only: push scripted bulk-IN bytes into the fake transport. */ + @JvmStatic + external fun testFakeInjectRx(deviceName: String, data: ByteArray): Boolean + + /** Debug-only: take bytes written to the fake bulk-OUT endpoint. */ + @JvmStatic + external fun testFakeTakeTx(deviceName: String): ByteArray + + /** Debug-only: fail the next bulk-IN read (reader → onUsbError). */ + @JvmStatic + external fun testFakeInjectError(deviceName: String, reason: String): Boolean +} diff --git a/android/src/main/kotlin/app/tauri/serialplugin/SerialPlugin.kt b/android/src/main/kotlin/app/tauri/serialplugin/SerialPlugin.kt index cf842181..a16e47e7 100644 --- a/android/src/main/kotlin/app/tauri/serialplugin/SerialPlugin.kt +++ b/android/src/main/kotlin/app/tauri/serialplugin/SerialPlugin.kt @@ -5,693 +5,43 @@ package app.tauri.serialplugin import android.app.Activity import android.app.Application import android.os.Bundle -import app.tauri.annotation.Command -import app.tauri.annotation.InvokeArg +import android.util.Log +import android.webkit.WebView import app.tauri.annotation.TauriPlugin -import app.tauri.plugin.Invoke -import app.tauri.plugin.JSObject import app.tauri.plugin.Plugin -import app.tauri.serialplugin.manager.SerialPortManager -import app.tauri.serialplugin.models.* -import android.webkit.WebView -import android.util.Log -import app.tauri.plugin.JSArray -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors -import java.util.concurrent.RejectedExecutionException -// --- Reused from previous answer (Converts a Map to a JSObject) --- -fun Map.toJSObject(): JSObject { - val jsObject = JSObject() - for ((key, value) in this) { - val convertedValue: Any? = when (value) { - is Map<*, *> -> @Suppress("UNCHECKED_CAST") (value as Map).toJSObject() - is List<*> -> @Suppress("UNCHECKED_CAST") value.toJSArray() // Call the new list utility - else -> value - } - jsObject.put(key, convertedValue) - } - return jsObject -} - -// --- NEW Utility: Converts a List to a JSArray --- -fun List.toJSArray(): JSArray { - val jsArray = JSArray() - - for (item in this) { - val convertedItem: Any? = when (item) { - is Map<*, *> -> { - // If the item is a Map, convert it to a JSObject - @Suppress("UNCHECKED_CAST") - (item as Map).toJSObject() - } - is List<*> -> { - // If the item is a nested List, convert it to a JSArray (for list of lists) - @Suppress("UNCHECKED_CAST") - item.toJSArray() - } - else -> item // Primitives (String, Int, Boolean, etc.) can be put directly - } - // Add the converted item to the JSArray - jsArray.put(convertedItem) - } - - return jsArray -} -@InvokeArg -class PortConfigArgs { - lateinit var path: String - var baudRate: Int = 9600 - var dataBits: Any? = null - val size: Int? = null - var flowControl: Any? = null - var parity: Any? = null - var stopBits: Any? = null - var timeout: Int = 1000 -} - -@InvokeArg -class WriteArgs { - lateinit var path: String - lateinit var value: String -} - -@InvokeArg -class WriteBinaryArgs { - lateinit var path: String - lateinit var value: List -} - -@InvokeArg -class CloseArgs { - lateinit var path: String -} - -@InvokeArg -class StartListenArgs { - lateinit var path: String - /** Flush interval for batched serialData events (ms). Default 100; clamped 10–2000 on native side. */ - var serialDataFlushIntervalMs: Long = 100L -} +import app.tauri.serialplugin.manager.UsbFdBridge @TauriPlugin class SerialPlugin(private val activity: Activity) : Plugin(activity) { - private var webView: WebView? = null - private lateinit var serialPortManager: SerialPortManager - /** Unregistered after [activity] is destroyed so we do not leak the callback. */ - private var activityDestroyCallback: Application.ActivityLifecycleCallbacks? = null - - /** - * Plugin commands are dispatched synchronously on the Android main looper, so a - * blocking `UsbSerialPort.read`/`write`/permission wait inside a command freezes the - * UI (polled reads block the main thread for up to the read timeout, per chunk). - * Every command that touches [SerialPortManager] runs here instead: its internal - * state (`portMap`) is not thread-safe, so funneling all access through one thread - * both keeps the main thread free and preserves command ordering. - */ - private val ioExecutor: ExecutorService = Executors.newSingleThreadExecutor { r -> - Thread(r, "serialplugin-io") - } - - private fun runOnIoThread(invoke: Invoke, block: () -> Unit) { - try { - ioExecutor.execute(block) - } catch (e: RejectedExecutionException) { - invoke.reject("Serial IO executor is shut down") - } - } + private lateinit var usb: UsbFdBridge + private var destroyCb: Application.ActivityLifecycleCallbacks? = null override fun load(webView: WebView) { super.load(webView) - serialPortManager = SerialPortManager(activity) { path, message -> - try { - val errorData = JSObject() - errorData.put("path", path) - errorData.put("error", message) - trigger("serialError", errorData) - } catch (e: Exception) { - Log.e("SerialPlugin", "serialError trigger failed: ${e.message}", e) - } - } - this.webView = webView - registerActivityDestroyCleanup() - - Log.d("SerialPlugin", "SerialPlugin loaded successfully") - } - - /** - * [Plugin] has no `onDestroy()`. When the host [Activity] is destroyed (back, process kill path), - * release USB threads/receiver/ports so we do not leak or fire stale events after WebView is gone. - */ - private fun registerActivityDestroyCleanup() { - unregisterActivityDestroyCleanup() + Log.i(TAG, "load: binding UsbFdBridge") + usb = UsbFdBridge(activity.applicationContext) + UsbNative.bind(usb) val app = activity.application - val cb = object : Application.ActivityLifecycleCallbacks { - override fun onActivityDestroyed(destroyed: Activity) { - if (destroyed !== activity) return - try { - Log.d("SerialPlugin", "Activity destroyed — releasing USB serial resources") - // Enqueue cleanup behind any pending IO so queued read/write tasks - // do not run against already-released ports, then stop the executor. - ioExecutor.execute { - try { - serialPortManager.cleanup() - } catch (e: Exception) { - Log.e("SerialPlugin", "cleanup on activity destroy failed: ${e.message}", e) - } - } - } catch (e: RejectedExecutionException) { - // Executor already stopped; release directly. - serialPortManager.cleanup() - } finally { - ioExecutor.shutdown() - unregisterActivityDestroyCleanup() - } - } - - override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {} - override fun onActivityStarted(activity: Activity) {} - override fun onActivityResumed(activity: Activity) {} - override fun onActivityPaused(activity: Activity) {} - override fun onActivityStopped(activity: Activity) {} - override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} - } - activityDestroyCallback = cb - app.registerActivityLifecycleCallbacks(cb) - } - - private fun unregisterActivityDestroyCleanup() { - activityDestroyCallback?.let { cb -> - try { - activity.application.unregisterActivityLifecycleCallbacks(cb) - } catch (_: Exception) { - } - activityDestroyCallback = null - } - } - - @Command - fun availablePorts(invoke: Invoke) = runOnIoThread(invoke) { - try { - Log.d("SerialPlugin", "Fetching available ports") - val ports = serialPortManager.getAvailablePorts() - Log.d("SerialPlugin", "Available ports fetched successfully: ${ports.size} ports") - val result = JSObject() - - result.put("ports", ports.toJSObject()) - invoke.resolve(result) - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to get available ports: ${e.message}", e) - invoke.reject("Failed to get available ports: ${e.message}") - } - } - - @Command - fun managedPorts(invoke: Invoke) = runOnIoThread(invoke) { - try { - val managedPorts = serialPortManager.getManagedPorts() - Log.d("SerialPlugin", "Managed ports: ${managedPorts.size} ports") - val result = JSObject() - result.put("ports", managedPorts) - invoke.resolve(result) - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to get managed ports: ${e.message}", e) - invoke.reject("Failed to get managed ports: ${e.message}") - } - } - - @Command - fun open(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - Log.d("SerialPlugin", "Opening port: ${args.path}") - - val dataBits = when (args.dataBits) { - is String -> DataBits.valueOf(args.dataBits as String) - is Number -> DataBits.fromValue((args.dataBits as Number).toInt()) - null -> DataBits.EIGHT - else -> throw IllegalArgumentException("Invalid data bits type") - } - - val flowControl = when (args.flowControl) { - is String -> FlowControl.valueOf(args.flowControl as String) - is Number -> FlowControl.fromValue((args.flowControl as Number).toInt()) - null -> FlowControl.NONE - else -> throw IllegalArgumentException("Invalid flow control type") - } - - val parity = when (args.parity) { - is String -> Parity.valueOf(args.parity as String) - is Number -> Parity.fromValue((args.parity as Number).toInt()) - null -> Parity.NONE - else -> throw IllegalArgumentException("Invalid parity type") - } - - val stopBits = when (args.stopBits) { - is String -> StopBits.valueOf(args.stopBits as String) - is Number -> StopBits.fromValue((args.stopBits as Number).toInt()) - null -> StopBits.ONE - else -> throw IllegalArgumentException("Invalid stop bits type") - } - - val serialConfig = SerialPortConfig( - path = args.path, - baudRate = args.baudRate, - dataBits = dataBits, - flowControl = flowControl, - parity = parity, - stopBits = stopBits, - timeout = args.timeout - ) - - val success = serialPortManager.openPort(serialConfig) - if (success) { - Log.d("SerialPlugin", "Port opened successfully: ${args.path}") - invoke.resolve() - } else { - Log.e("SerialPlugin", "Failed to open port: ${args.path}") - invoke.reject("Failed to open port") - } - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to open port: ${e.message}", e) - invoke.reject("Failed to open port: ${e.message}") - } - } - - @Command - fun write(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(WriteArgs::class.java) - Log.d("SerialPlugin", "Writing to port: ${args.path}, data: ${args.value}") - val bytesWritten = serialPortManager.writeToPort(args.path, args.value.toByteArray()) - val result = JSObject() - result.put("bytesWritten", bytesWritten) - Log.d("SerialPlugin", "Write successful: $bytesWritten bytes written") - invoke.resolve(result) - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to write data: ${e.message}", e) - invoke.reject("Failed to write data: ${e.message}") - } - } - - @Command - fun close(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - Log.d("SerialPlugin", "Closing port: ${args.path}") - serialPortManager.closePort(args.path) - Log.d("SerialPlugin", "Port closed successfully: ${args.path}") - invoke.resolve() - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to close port: ${e.message}", e) - invoke.reject("Failed to close port: ${e.message}") - } - } - - @Command - fun closeAll(invoke: Invoke) = runOnIoThread(invoke) { - try { - Log.d("SerialPlugin", "Closing all ports") - serialPortManager.closeAllPorts() - Log.d("SerialPlugin", "All ports closed successfully") - invoke.resolve() - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to close all ports: ${e.message}", e) - invoke.reject("Failed to close all ports: ${e.message}") - } - } - - @Command - fun forceClose(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - Log.d("SerialPlugin", "Force closing port: ${args.path}") - serialPortManager.closePort(args.path) - Log.d("SerialPlugin", "Port force closed successfully: ${args.path}") - invoke.resolve() - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to force close port: ${e.message}", e) - invoke.reject("Failed to force close port: ${e.message}") - } - } - - @Command - fun writeBinary(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(WriteBinaryArgs::class.java) - Log.d("SerialPlugin", "Writing binary to port: ${args.path}") - val bytesToSend = args.value.map { it.toByte() }.toByteArray() - val bytesWritten = serialPortManager.writeToPort(args.path, bytesToSend) - val result = JSObject() - result.put("bytesWritten", bytesWritten) - Log.d("SerialPlugin", "Binary write successful: $bytesWritten bytes written") - invoke.resolve(result) - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to write binary data: ${e.message}", e) - invoke.reject("Failed to write binary data: ${e.message}") - } - } - - @Command - fun read(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - Log.d("SerialPlugin", "Reading from port: ${args.path}") - val data = serialPortManager.readFromPort(args.path, args.timeout, args.size) - val result = JSObject() - result.put("data", String(data)) - Log.d("SerialPlugin", "Read successful: ${data.size} bytes read") - invoke.resolve(result) - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to read data: ${e.message}", e) - invoke.reject("Failed to read data: ${e.message}") - } - } - - @Command - fun readBinary(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - Log.d("SerialPlugin", "Reading binary from port: ${args.path}") - val data = serialPortManager.readFromPort(args.path, args.timeout, args.size) - val result = JSObject().apply { - put("data", data.toList().map { it.toInt() and 0xFF }.toJSArray()) - } - Log.d("SerialPlugin", "Binary read successful: ${data.size} bytes read") - invoke.resolve(result) - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to read binary data: ${e.message}", e) - invoke.reject("Failed to read binary data: ${e.message}") - } - } - - @Command - fun startListening(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(StartListenArgs::class.java) - val path = args.path - val flushMs = args.serialDataFlushIntervalMs.coerceIn(10L, 2000L) - Log.d("SerialPlugin", "Starting listening on port: $path (flush ${flushMs}ms)") - - serialPortManager.startListening(path, flushMs) { eventData: JSObject -> - try { - Log.d("SerialPlugin", "Emitting serialData batch for $path") - trigger("serialData", eventData) - } catch (e: Exception) { - Log.e("SerialPlugin", "Error in serialData emit: ${e.message}", e) - } - } - Log.d("SerialPlugin", "Listening started successfully on port: $path") - invoke.resolve() - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to start listening: ${e.message}", e) - invoke.reject("Failed to start listening: ${e.message}") - } - } - - @Command - fun stopListening(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - Log.d("SerialPlugin", "Stopping listening on port: ${args.path}") - serialPortManager.stopListening(args.path) - Log.d("SerialPlugin", "Listening stopped successfully on port: ${args.path}") - invoke.resolve() - } catch (e: Exception) { - Log.e("SerialPlugin", "Failed to stop listening: ${e.message}", e) - invoke.reject("Failed to stop listening: ${e.message}") - } - } - - @Command - fun setBaudRate(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val success = serialPortManager.setBaudRate(args.path, args.baudRate) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set baud rate") - } - } catch (e: Exception) { - invoke.reject("Failed to set baud rate: ${e.message}") - } - } - - @Command - fun setDataBits(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val dataBits = when (args.dataBits) { - is String -> DataBits.valueOf(args.dataBits as String) - is Number -> DataBits.fromValue((args.dataBits as Number).toInt()) - null -> DataBits.EIGHT - else -> throw IllegalArgumentException("Invalid data bits type") - } - val success = serialPortManager.setDataBits(args.path, dataBits) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set data bits") - } - } catch (e: Exception) { - invoke.reject("Failed to set data bits: ${e.message}") - } - } - - @Command - fun setFlowControl(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val flowControl = when (args.flowControl) { - is String -> FlowControl.valueOf(args.flowControl as String) - is Number -> FlowControl.fromValue((args.flowControl as Number).toInt()) - null -> FlowControl.NONE - else -> throw IllegalArgumentException("Invalid flow control type") - } - val success = serialPortManager.setFlowControl(args.path, flowControl) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set flow control") - } - } catch (e: Exception) { - invoke.reject("Failed to set flow control: ${e.message}") - } - } - - @Command - fun setParity(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val parity = when (args.parity) { - is String -> Parity.valueOf(args.parity as String) - is Number -> Parity.fromValue((args.parity as Number).toInt()) - null -> Parity.NONE - else -> throw IllegalArgumentException("Invalid parity type") - } - val success = serialPortManager.setParity(args.path, parity) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set parity") - } - } catch (e: Exception) { - invoke.reject("Failed to set parity: ${e.message}") - } - } - - @Command - fun setStopBits(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val stopBits = when (args.stopBits) { - is String -> StopBits.valueOf(args.stopBits as String) - is Number -> StopBits.fromValue((args.stopBits as Number).toInt()) - null -> StopBits.ONE - else -> throw IllegalArgumentException("Invalid stop bits type") - } - val success = serialPortManager.setStopBits(args.path, stopBits) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set stop bits") - } - } catch (e: Exception) { - invoke.reject("Failed to set stop bits: ${e.message}") - } - } - - @Command - fun setTimeout(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val success = serialPortManager.setTimeout(args.path, args.timeout) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set timeout") - } - } catch (e: Exception) { - invoke.reject("Failed to set timeout: ${e.message}") - } - } - - @Command - fun writeRequestToSend(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val success = serialPortManager.writeRequestToSend(args.path, args.flowControl == "HARDWARE") - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set RTS") - } - } catch (e: Exception) { - invoke.reject("Failed to set RTS: ${e.message}") - } - } - - @Command - fun writeDataTerminalReady(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val success = serialPortManager.writeDataTerminalReady(args.path, args.flowControl == "HARDWARE") - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set DTR") - } - } catch (e: Exception) { - invoke.reject("Failed to set DTR: ${e.message}") - } - } - - @Command - fun readClearToSend(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val state = serialPortManager.readClearToSend(args.path) - val result = JSObject() - result.put("state", state) - invoke.resolve(result) - } catch (e: Exception) { - invoke.reject("Failed to read CTS: ${e.message}") - } - } - - @Command - fun readDataSetReady(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val state = serialPortManager.readDataSetReady(args.path) - val result = JSObject() - result.put("state", state) - invoke.resolve(result) - } catch (e: Exception) { - invoke.reject("Failed to read DSR: ${e.message}") - } - } - - @Command - fun readRingIndicator(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val state = serialPortManager.readRingIndicator(args.path) - val result = JSObject() - result.put("state", state) - invoke.resolve(result) - } catch (e: Exception) { - invoke.reject("Failed to read RI: ${e.message}") - } - } - - @Command - fun readCarrierDetect(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val state = serialPortManager.readCarrierDetect(args.path) - val result = JSObject() - result.put("state", state) - invoke.resolve(result) - } catch (e: Exception) { - invoke.reject("Failed to read CD: ${e.message}") - } - } - - @Command - fun bytesToRead(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val bytes = serialPortManager.bytesToRead(args.path) - val result = JSObject() - result.put("bytes", bytes) - invoke.resolve(result) - } catch (e: Exception) { - invoke.reject("Failed to get bytes to read: ${e.message}") - } - } - - @Command - fun bytesToWrite(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val bytes = serialPortManager.bytesToWrite(args.path) - val result = JSObject() - result.put("bytes", bytes) - invoke.resolve(result) - } catch (e: Exception) { - invoke.reject("Failed to get bytes to write: ${e.message}") - } - } - - @Command - fun clearBuffer(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(PortConfigArgs::class.java) - val bufferType = when (args.dataBits) { - is String -> ClearBuffer.fromValue(args.dataBits as String) - is Number -> ClearBuffer.INPUT // By default we use INPUT for numeric values - null -> ClearBuffer.INPUT - else -> throw IllegalArgumentException("Invalid buffer type") - } - val success = serialPortManager.clearBuffer(args.path, bufferType.name.lowercase()) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to clear buffer") - } - } catch (e: Exception) { - invoke.reject("Failed to clear buffer: ${e.message}") - } - } - - @Command - fun setBreak(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val success = serialPortManager.setBreak(args.path) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to set break") - } - } catch (e: Exception) { - invoke.reject("Failed to set break: ${e.message}") - } - } - - @Command - fun clearBreak(invoke: Invoke) = runOnIoThread(invoke) { - try { - val args = invoke.parseArgs(CloseArgs::class.java) - val success = serialPortManager.clearBreak(args.path) - if (success) { - invoke.resolve() - } else { - invoke.reject("Failed to clear break") - } - } catch (e: Exception) { - invoke.reject("Failed to clear break: ${e.message}") - } + destroyCb = object : Application.ActivityLifecycleCallbacks { + override fun onActivityDestroyed(a: Activity) { + if (a !== activity) return + usb.shutdown() + MobileBridge.onAppDestroy() + app.unregisterActivityLifecycleCallbacks(this) + destroyCb = null + } + override fun onActivityCreated(a: Activity, s: Bundle?) {} + override fun onActivityStarted(a: Activity) {} + override fun onActivityResumed(a: Activity) {} + override fun onActivityPaused(a: Activity) {} + override fun onActivityStopped(a: Activity) {} + override fun onActivitySaveInstanceState(a: Activity, s: Bundle) {} + } + app.registerActivityLifecycleCallbacks(destroyCb!!) + Log.i(TAG, "load: ready") + } + + companion object { + private const val TAG = "SerialPlugin" } } diff --git a/android/src/main/kotlin/app/tauri/serialplugin/UsbNative.kt b/android/src/main/kotlin/app/tauri/serialplugin/UsbNative.kt new file mode 100644 index 00000000..a6672a2b --- /dev/null +++ b/android/src/main/kotlin/app/tauri/serialplugin/UsbNative.kt @@ -0,0 +1,34 @@ +package app.tauri.serialplugin + +import app.tauri.serialplugin.manager.UsbFdBridge +import org.json.JSONObject + +/** Static JNI facade: Rust calls fd + enumerate only. */ +object UsbNative { + @Volatile + private var bridge: UsbFdBridge? = null + + @JvmStatic + fun bind(usb: UsbFdBridge) { + bridge = usb + nativeInit() + } + + @JvmStatic + private external fun nativeInit() + + private fun usb(): UsbFdBridge = + bridge ?: throw IllegalStateException("UsbNative not bound") + + @JvmStatic + fun enumerateJson(): String = usb().runOnIoSync { usb().enumerateJson() } + + @JvmStatic + fun openDeviceFd(deviceName: String): Int = + usb().runOnIoSync { usb().openDeviceFd(deviceName) } + + @JvmStatic + fun closeDeviceFd(deviceName: String) { + usb().runOnIoSync { usb().closeDeviceFd(deviceName) } + } +} diff --git a/android/src/main/kotlin/app/tauri/serialplugin/manager/BufferedEmitter.kt b/android/src/main/kotlin/app/tauri/serialplugin/manager/BufferedEmitter.kt deleted file mode 100644 index 1581019f..00000000 --- a/android/src/main/kotlin/app/tauri/serialplugin/manager/BufferedEmitter.kt +++ /dev/null @@ -1,78 +0,0 @@ -package app.tauri.serialplugin.manager - -import android.util.Log -import app.tauri.plugin.JSObject -import java.util.concurrent.Executors -import java.util.concurrent.ScheduledFuture -import java.util.concurrent.TimeUnit - -/** - * Coalesces high-frequency [onNewData] chunks and emits at most once per [flushIntervalMs] - * to reduce WebView/JS pressure (backpressure). - */ -internal class BufferedEmitter( - private val path: String, - flushIntervalMs: Long, - private val emit: (JSObject) -> Unit, -) { - private val accumulator = SerialByteAccumulator() - private val scheduler = Executors.newSingleThreadScheduledExecutor { r -> - Thread(r, "serial-emit-$path").apply { isDaemon = true } - } - private val scheduled: ScheduledFuture<*> - - init { - val interval = flushIntervalMs.coerceIn(10L, 2000L) - scheduled = scheduler.scheduleAtFixedRate( - { - try { - flushOnce() - } catch (e: Exception) { - Log.e("BufferedEmitter", "flush: ${e.message}", e) - } - }, - interval, - interval, - TimeUnit.MILLISECONDS, - ) - } - - private fun flushOnce() { - flushAccumulatorToEmit(path, accumulator) { fields -> - val eventData = JSObject() - fields.applyToJSObject(eventData) - emit(eventData) - } - } - - fun addData(data: ByteArray) { - accumulator.append(data) - } - - /** - * Bytes received via [addData] but not yet emitted to JS (waiting for the next flush). - * Does not include data still inside the USB/driver stack — only this plugin buffer. - */ - fun pendingByteCount(): Int = accumulator.pendingByteCount() - - fun stop() { - scheduled.cancel(false) - scheduler.shutdown() - try { - if (!scheduler.awaitTermination(300, TimeUnit.MILLISECONDS)) { - scheduler.shutdownNow() - } - } catch (_: InterruptedException) { - scheduler.shutdownNow() - } - try { - flushAccumulatorToEmit(path, accumulator) { fields -> - val eventData = JSObject() - fields.applyToJSObject(eventData) - emit(eventData) - } - } catch (e: Exception) { - Log.w("BufferedEmitter", "final flush: ${e.message}") - } - } -} diff --git a/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialByteAccumulator.kt b/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialByteAccumulator.kt deleted file mode 100644 index b52e8221..00000000 --- a/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialByteAccumulator.kt +++ /dev/null @@ -1,34 +0,0 @@ -package app.tauri.serialplugin.manager - -import java.io.ByteArrayOutputStream - -/** - * Thread-safe byte buffer for coalescing serial chunks before emitting to JS. - * Pure JVM logic — unit-testable without Robolectric. - */ -internal class SerialByteAccumulator { - private val lock = Any() - private val stream = ByteArrayOutputStream() - - fun append(data: ByteArray) { - if (data.isEmpty()) return - synchronized(lock) { - stream.write(data) - } - } - - /** - * Returns all accumulated bytes and clears the buffer. - * Returns an empty array if nothing was pending. - */ - fun drain(): ByteArray { - synchronized(lock) { - if (stream.size() == 0) return ByteArray(0) - val b = stream.toByteArray() - stream.reset() - return b - } - } - - fun pendingByteCount(): Int = synchronized(lock) { stream.size() } -} diff --git a/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialDataEmitFields.kt b/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialDataEmitFields.kt deleted file mode 100644 index 5371c1b8..00000000 --- a/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialDataEmitFields.kt +++ /dev/null @@ -1,39 +0,0 @@ -package app.tauri.serialplugin.manager - -import app.tauri.plugin.JSObject - -/** - * Payload fields for the `serialData` plugin event (mirrors what we put on [JSObject]). - * Kept as a plain Kotlin type so tests do not need [JSObject]. - */ -internal data class SerialDataEmitFields( - val path: String, - val dataAsString: String, - val size: Int, -) - -internal fun serialDataPayloadFromChunk(path: String, chunk: ByteArray): SerialDataEmitFields = - SerialDataEmitFields( - path = path, - dataAsString = String(chunk), - size = chunk.size, - ) - -internal fun SerialDataEmitFields.applyToJSObject(target: JSObject) { - target.put("path", path) - target.put("data", dataAsString) - target.put("size", size) -} - -/** - * Drains [accumulator] and invokes [emitFields] once if there was data. - */ -internal fun flushAccumulatorToEmit( - path: String, - accumulator: SerialByteAccumulator, - emitFields: (SerialDataEmitFields) -> Unit, -) { - val chunk = accumulator.drain() - if (chunk.isEmpty()) return - emitFields(serialDataPayloadFromChunk(path, chunk)) -} diff --git a/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialPortManager.kt b/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialPortManager.kt deleted file mode 100644 index 4b82b7a7..00000000 --- a/android/src/main/kotlin/app/tauri/serialplugin/manager/SerialPortManager.kt +++ /dev/null @@ -1,736 +0,0 @@ -package app.tauri.serialplugin.manager - -import android.app.PendingIntent -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import android.content.IntentFilter -import android.hardware.usb.UsbDevice -import android.hardware.usb.UsbManager -import android.os.Build -import com.hoho.android.usbserial.driver.UsbSerialPort -import com.hoho.android.usbserial.driver.UsbSerialProber -import com.hoho.android.usbserial.util.SerialInputOutputManager -import com.hoho.android.usbserial.driver.ProbeTable -import app.tauri.plugin.JSObject -import app.tauri.serialplugin.models.* -import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.Executors -import java.io.IOException -import android.util.Log -import androidx.core.content.ContextCompat -import java.util.concurrent.CompletableFuture -import java.util.concurrent.TimeUnit - -data class ManagedPort ( - val port: UsbSerialPort, - val config: SerialPortConfig -) - -/** - * @param onIoRunError Optional: invoked on [SerialInputOutputManager.Listener.onRunError] before [closePort] - * (e.g. emit plugin event so JS can set isOpen = false). - */ -class SerialPortManager( - private val context: Context, - private val onIoRunError: ((path: String, message: String) -> Unit)? = null, -) { - private val usbManager: UsbManager = context.getSystemService(Context.USB_SERVICE) as UsbManager - private val portMap = mutableMapOf() - /** Active [SerialInputOutputManager] per path; must be stopped on close/stop/replace to avoid thread leaks. */ - private val ioManagers = ConcurrentHashMap() - /** Batched emission to WebView (one per path while listening). */ - private val emitters = ConcurrentHashMap() - private val executor = Executors.newCachedThreadPool() - private val permissionFutures = mutableMapOf>() - - private val ACTION_USB_PERMISSION = "app.tauri.serialplugin.USB_PERMISSION" - - // Custom prober for unknown devices (custom VID/PID only) - private val customProber: UsbSerialProber by lazy { - val customTable = ProbeTable() - - // Add only devices with custom VID/PID not covered by the default table - // Example: device with VID=0x1234 and PID=0x0001 compatible with FTDI - // customTable.addProduct(0x1234, 0x0001, FtdiSerialDriver::class.java) - - UsbSerialProber(customTable) - } - - private val usbReceiver = object : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - if (ACTION_USB_PERMISSION == intent.action) { - synchronized(this) { - val device: UsbDevice? = if (Build.VERSION.SDK_INT >= 33) { - intent.getParcelableExtra(UsbManager.EXTRA_DEVICE, UsbDevice::class.java) - } else { - @Suppress("DEPRECATION") - intent.getParcelableExtra(UsbManager.EXTRA_DEVICE) as UsbDevice? - } - - val permissionGranted = intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false) - val deviceName = device?.deviceName - - Log.d("SerialPortManager", "USB permission result for $deviceName: $permissionGranted") - - deviceName?.let { name -> - permissionFutures[name]?.complete(permissionGranted) - permissionFutures.remove(name) - } - } - } - } - } - - fun registerReceiver() { - val filter = IntentFilter(ACTION_USB_PERMISSION) - - if (Build.VERSION.SDK_INT >= 33) { - context.registerReceiver(usbReceiver, filter, Context.RECEIVER_EXPORTED) - } else { - ContextCompat.registerReceiver( - context, - usbReceiver, - filter, - ContextCompat.RECEIVER_NOT_EXPORTED - ) - } - } - - fun unregisterReceiver() { - try { - context.unregisterReceiver(usbReceiver) - } catch (_: IllegalArgumentException) { - Log.w("SerialPortManager", "Receiver not registered") - } - } - - init { - registerReceiver() - } - - fun getAvailablePorts(): Map> { - val result = mutableMapOf>() - - try { - // Use default prober first - val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(usbManager) - Log.d("SerialPortManager", "Available drivers (default prober): ${availableDrivers.size}") - - availableDrivers.forEach { driver -> - val device = driver.device - Log.d("SerialPortManager", "Found device: ${device.deviceName}, Vendor ID: ${device.vendorId}, Product ID: ${device.productId}") - - result[device.deviceName] = mapOf( - "type" to "USB", - "vid" to device.vendorId.toString(), - "pid" to device.productId.toString(), - "manufacturer" to (device.manufacturerName ?: "Unknown"), - "product" to (device.productName ?: "Unknown"), - "serial_number" to (device.serialNumber ?: "Unknown") - ) - - Log.d("SerialPortManager", "Device Info: ${result[device.deviceName]}") - } - - // Also check for custom prober devices - val customDrivers = customProber.findAllDrivers(usbManager) - Log.d("SerialPortManager", "Available drivers (custom prober): ${customDrivers.size}") - - customDrivers.forEach { driver -> - val device = driver.device - if (!result.containsKey(device.deviceName)) { - Log.d("SerialPortManager", "Found custom device: ${device.deviceName}, Vendor ID: ${device.vendorId}, Product ID: ${device.productId}") - - result[device.deviceName] = mapOf( - "type" to "USB (Custom)", - "vid" to device.vendorId.toString(), - "pid" to device.productId.toString(), - "manufacturer" to (device.manufacturerName ?: "Unknown"), - "product" to (device.productName ?: "Unknown"), - "serial_number" to (device.serialNumber ?: "Unknown") - ) - } - } - - } catch (e: Exception) { - Log.e("SerialPortManager", "Error getting available ports: ${e.message}", e) - } - - Log.d("SerialPortManager", "Total available ports: ${result.size}") - return result - } - - fun getManagedPorts(): List { - return portMap.keys.toList() - } - - fun openPort(config: SerialPortConfig): Boolean { - try { - Log.d("SerialPortManager", "Opening port: ${config.path}") - - // Find the device by name - val device = findDeviceByName(config.path) - ?: throw IOException("Device not found: ${config.path}") - - // Probe for driver using default prober first - var driver = UsbSerialProber.getDefaultProber().probeDevice(device) - - // If no driver found, try custom prober - if (driver == null) { - driver = customProber.probeDevice(device) - Log.d("SerialPortManager", "Device found via custom prober: ${device.deviceName}") - } - - if (driver == null) { - throw IOException("No driver found for device: ${config.path}") - } - - // Check permissions - if (!usbManager.hasPermission(device)) { - Log.d("SerialPortManager", "Requesting USB permission for device: ${device.deviceName}") - - val permissionFuture = CompletableFuture() - permissionFutures[device.deviceName] = permissionFuture - - val flags = - PendingIntent.FLAG_IMMUTABLE - - val permissionIntent = PendingIntent.getBroadcast( - context, - 0, - Intent(ACTION_USB_PERMISSION), - flags - ) - usbManager.requestPermission(device, permissionIntent) - - // Wait for permission result with timeout - val permissionGranted = permissionFuture.get(10, TimeUnit.SECONDS) - if (!permissionGranted) { - throw IOException("USB permission denied for device: ${config.path}") - } - } - - // Open connection - val connection = usbManager.openDevice(device) - ?: throw IOException("Failed to open device: ${config.path}") - - // Get port (most devices have just one port) - val port = driver.ports[0] - - // Open port - port.open(connection) - Log.d("SerialPortManager", "Setting port parameters: baudRate=${config.baudRate}, dataBits=${config.dataBits.value}, stopBits=${config.stopBits.value}, parity=${config.parity.value}") - - try { - port.setParameters( - config.baudRate, - config.dataBits.value, - config.stopBits.value, - config.parity.value - ) - Log.d("SerialPortManager", "Port parameters set successfully") - } catch (_: UnsupportedOperationException) { - Log.w("SerialPortManager", "setParameters not supported for this device, using default settings") - // Some devices don't support parameter changes, continue with defaults - } catch (e: Exception) { - Log.w("SerialPortManager", "Failed to set parameters: ${e.message}, using default settings") - // Continue with default parameters - } - - // Flow control — [UsbSerialPort.setFlowControl](https://github.com/mik3y/usb-serial-for-android) - when (config.flowControl) { - FlowControl.NONE -> { - try { - port.setFlowControl(UsbSerialPort.FlowControl.NONE) - Log.d("SerialPortManager", "Flow control: NONE") - } catch (e: Exception) { - Log.w("SerialPortManager", "setFlowControl(NONE): ${e.message}") - } - } - FlowControl.HARDWARE -> { - Log.d("SerialPortManager", "Enabling RTS/CTS flow control") - try { - port.setFlowControl(UsbSerialPort.FlowControl.RTS_CTS) - Log.d("SerialPortManager", "Hardware (RTS/CTS) flow control set") - } catch (_: UnsupportedOperationException) { - Log.w("SerialPortManager", "RTS/CTS not supported, falling back to DTR/RTS pins") - try { - port.dtr = true - port.rts = true - } catch (e: Exception) { - Log.w("SerialPortManager", "Fallback DTR/RTS failed: ${e.message}") - } - } catch (e: Exception) { - Log.w("SerialPortManager", "Failed to set RTS/CTS: ${e.message}") - } - } - FlowControl.SOFTWARE -> { - Log.d("SerialPortManager", "Enabling XON/XOFF flow control") - try { - port.setFlowControl(UsbSerialPort.FlowControl.XON_XOFF) - Log.d("SerialPortManager", "Software flow control set") - } catch (e: Exception) { - Log.w("SerialPortManager", "XON/XOFF not supported: ${e.message}") - } - } - } - - portMap[config.path] = ManagedPort(port, config) - Log.d("SerialPortManager", "Port opened successfully: ${config.path}") - return true - - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to open port: ${e.message}", e) - throw IOException("Failed to open port: ${e.message}") - } - } - - private fun findDeviceByName(deviceName: String): UsbDevice? { - return usbManager.deviceList.values.find { it.deviceName == deviceName } - } - - private fun startIoManager( - path: String, - port: UsbSerialPort, - flushIntervalMs: Long, - emit: (JSObject) -> Unit, - ) { - // Replace existing reader: stop previous manager so threads are not leaked - emitters.remove(path)?.stop() - ioManagers.remove(path)?.let { old -> - try { - old.stop() - } catch (e: Exception) { - Log.w("SerialPortManager", "Failed to stop previous IO manager for $path: ${e.message}") - } - } - - val emitter = BufferedEmitter(path, flushIntervalMs, emit) - emitters[path] = emitter - - val ioManager = SerialInputOutputManager(port, object : SerialInputOutputManager.Listener { - override fun onNewData(data: ByteArray) { - try { - Log.d("SerialPortManager", "Data received on $path: ${data.size} bytes") - emitter.addData(data) - } catch (e: Exception) { - Log.e("SerialPortManager", "Error in data callback for $path: ${e.message}", e) - } - } - - override fun onRunError(e: Exception) { - Log.e("SerialPortManager", "IO Manager error for $path: ${e.message}", e) - val msg = e.message ?: e.toString() - try { - onIoRunError?.invoke(path, msg) - } catch (cb: Exception) { - Log.e("SerialPortManager", "onIoRunError callback failed: ${cb.message}", cb) - } - closePort(path) - } - }) - - ioManagers[path] = ioManager - - try { - executor.submit { - try { - ioManager.start() - Log.d("SerialPortManager", "IO Manager started successfully for $path") - } catch (e: Exception) { - Log.e( - "SerialPortManager", - "Failed to start IO Manager for $path: ${e.message}", - e - ) - ioManagers.remove(path) - emitters.remove(path)?.stop() - closePort(path) - } - } - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to submit IO Manager task for $path: ${e.message}", e) - ioManagers.remove(path) - emitters.remove(path)?.stop() - closePort(path) - } - } - - fun writeToPort(path: String, data: ByteArray): Int { - try { - val port = portMap[path] ?: throw IOException("Port not found") - - Log.d("SerialPortManager", "Writing to port $path: ${data.size} bytes") - - val writeTimeout = port.config.timeout.coerceIn(1, 600_000) - port.port.write(data, writeTimeout) - val bytesWritten = data.size - - return bytesWritten - } catch (e: IOException) { - Log.e("SerialPortManager", "Write failed: ${e.message}") - throw e - } catch (e: Exception) { - Log.e("SerialPortManager", "Unexpected error during write: ${e.message}", e) - throw IOException("Failed to write data: ${e.message}") - } - } - - fun closePort(path: String) { - try { - emitters.remove(path)?.stop() - ioManagers[path]?.let { mgr -> - try { - mgr.stop() - } catch (e: Exception) { - Log.w("SerialPortManager", "Failed to stop IO manager for $path: ${e.message}") - } - } - ioManagers.remove(path) - portMap[path]?.port?.close() - portMap.remove(path) - Log.d("SerialPortManager", "Port closed: $path") - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to close port $path: ${e.message}", e) - throw IOException("Failed to close port: ${e.message}") - } - } - - fun closeAllPorts() { - val exceptions = mutableListOf() - - portMap.keys.toList().forEach { path -> - try { - closePort(path) - } catch (e: Exception) { - exceptions.add(e) - } - } - - if (exceptions.isNotEmpty()) { - throw IOException("Failed to close all ports: ${exceptions.joinToString(", ") { it.message ?: "" }}") - } - } - - fun setPortParameters(path: String, config: SerialPortConfig): Boolean { - return try { - portMap[path]?.let { port -> - port.port.setParameters( - config.baudRate, - config.dataBits.value, - config.stopBits.value, - config.parity.value - ) - true - } ?: false - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set port parameters: ${e.message}", e) - false - } - } - - fun readFromPort(path: String, timeout: Int, size: Int?): ByteArray { - return try { - val port = portMap[path] ?: throw IOException("Port not found") - - val targetSize = size ?: 1024 - val maxPacketSize = port.port.readEndpoint.maxPacketSize - val bufferSize = minOf(targetSize, maxPacketSize) - - val buffer = ByteArray(bufferSize) - // Prefer invoke timeout; fall back to open/config timeout (usb-serial: read timeout in ms) - val stored = port.config.timeout - val adjustedTimeout = (if (timeout > 0) timeout else stored).coerceAtLeast(200) - - Log.d("SerialPortManager", "Reading from port $path: bufferSize=$bufferSize, timeout=$adjustedTimeout") - - val bytesRead = port.port.read(buffer, adjustedTimeout) - - if (bytesRead > 0) { - Log.d("SerialPortManager", "Read successful: $bytesRead bytes") - buffer.copyOf(bytesRead) - } else { - Log.w("SerialPortManager", "Read timeout: no data received within $adjustedTimeout ms") - throw IOException("Read timeout: no data received within $adjustedTimeout ms") - } - } catch (e: IOException) { - Log.e("SerialPortManager", "Read failed: ${e.message}") - throw e - } catch (e: Exception) { - Log.e("SerialPortManager", "Unexpected error during read: ${e.message}", e) - throw IOException("Failed to read data: ${e.message}") - } - } - - fun readFullyFromPort(path: String, timeout: Int, size: Int?): ByteArray { - val port = portMap[path] ?: throw IOException("Port not found") - val buffer = mutableListOf() - val startTime = System.currentTimeMillis() - - val targetSize = size ?: 1024 - val maxPacketSize = port.port.readEndpoint.maxPacketSize - - while (buffer.size < targetSize && (System.currentTimeMillis() - startTime) < timeout) { - val remainingTime = timeout - (System.currentTimeMillis() - startTime).toInt() - if (remainingTime <= 0) break - - val chunkSize = minOf(targetSize - buffer.size, maxPacketSize) - val tempBuffer = ByteArray(chunkSize) - val bytesRead = port.port.read(tempBuffer, remainingTime.coerceAtLeast(200)) - - if (bytesRead > 0) { - buffer.addAll(tempBuffer.copyOf(bytesRead).toList()) - } else { - throw IOException("Read timeout: no data received within $timeout ms") - } - } - - return if (buffer.isEmpty()) { - throw IOException("Read timeout: no data received within $timeout ms") - } else { - buffer.toByteArray() - } - } - - fun setBaudRate(path: String, baudRate: Int): Boolean { - return try { - val port = portMap[path] ?: return false - port.config.baudRate = baudRate - port.port.setParameters(port.config.baudRate, port.config.dataBits.value, port.config.stopBits.value, port.config.parity.value) - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set baud rate: ${e.message}", e) - false - } - } - - fun setDataBits(path: String, dataBits: DataBits): Boolean { - return try { - val port = portMap[path] ?: return false - port.config.dataBits = dataBits - port.port.setParameters(port.config.baudRate, port.config.dataBits.value, port.config.stopBits.value, port.config.parity.value) - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set data bits: ${e.message}", e) - false - } - } - - fun setFlowControl(path: String, flowControl: FlowControl): Boolean { - return try { - val p = portMap[path]?.port ?: return false - when (flowControl) { - FlowControl.NONE -> p.setFlowControl(UsbSerialPort.FlowControl.NONE) - FlowControl.HARDWARE -> p.setFlowControl(UsbSerialPort.FlowControl.RTS_CTS) - FlowControl.SOFTWARE -> p.setFlowControl(UsbSerialPort.FlowControl.XON_XOFF) - } - portMap[path]?.let { it.config.flowControl = flowControl } - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set flow control: ${e.message}", e) - false - } - } - - fun setParity(path: String, parity: Parity): Boolean { - return try { - val port = portMap[path] ?: return false - port.config.parity = parity - port.port.setParameters(port.config.baudRate, port.config.dataBits.value, port.config.stopBits.value, port.config.parity.value) - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set parity: ${e.message}", e) - false - } - } - - fun setStopBits(path: String, stopBits: StopBits): Boolean { - return try { - val port = portMap[path] ?: return false - port.config.stopBits = stopBits - port.port.setParameters(port.config.baudRate, port.config.dataBits.value, port.config.stopBits.value, port.config.parity.value) - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set stop bits: ${e.message}", e) - false - } - } - - fun setTimeout(path: String, timeout: Int): Boolean { - return try { - val managed = portMap[path] ?: return false - // No USB-level "read timeout" register — store for read()/write() (see usb-serial read/write timeout args) - managed.config.timeout = timeout.coerceIn(1, 600_000) - Log.d("SerialPortManager", "Read/write timeout preference set to ${managed.config.timeout} ms for $path") - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set timeout: ${e.message}", e) - false - } - } - - fun writeRequestToSend(path: String, level: Boolean): Boolean { - return try { - portMap[path]?.port?.rts = level - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set RTS: ${e.message}", e) - false - } - } - - fun writeDataTerminalReady(path: String, level: Boolean): Boolean { - return try { - portMap[path]?.port?.dtr = level - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set DTR: ${e.message}", e) - false - } - } - - fun readClearToSend(path: String): Boolean { - return try { - portMap[path]?.port?.cts ?: false - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to read CTS: ${e.message}", e) - false - } - } - - fun readDataSetReady(path: String): Boolean { - return try { - portMap[path]?.port?.dsr ?: false - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to read DSR: ${e.message}", e) - false - } - } - - fun readRingIndicator(path: String): Boolean { - return try { - portMap[path]?.port?.ri ?: false - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to read RI: ${e.message}", e) - false - } - } - - fun readCarrierDetect(path: String): Boolean { - return try { - portMap[path]?.port?.cd ?: false - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to read CD: ${e.message}", e) - false - } - } - - /** - * When [startListening] is active, returns bytes accumulated in [BufferedEmitter] before the next - * `serialData` flush — **not** the OS/driver queue (UsbSerialPort exposes no such API). - * Without an active listener, returns `0`. - */ - fun bytesToRead(path: String): Int { - return try { - if (!portMap.containsKey(path)) throw IOException("Port not found") - emitters[path]?.pendingByteCount() ?: 0 - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to get bytes to read: ${e.message}", e) - 0 - } - } - - /** - * [UsbSerialPort] does not expose a pending TX queue; [writeToPort] is synchronous, so there is - * nothing application-level queued after a successful write — always `0` here. - */ - fun bytesToWrite(path: String): Int { - return try { - if (!portMap.containsKey(path)) throw IOException("Port not found") - 0 - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to get bytes to write: ${e.message}", e) - 0 - } - } - - /** [UsbSerialPort.purgeHwBuffers](https://github.com/mik3y/usb-serial-for-android) */ - fun clearBuffer(path: String, bufferType: String): Boolean { - return try { - val p = portMap[path]?.port ?: return false - when (bufferType.lowercase()) { - "input" -> p.purgeHwBuffers(false, true) - "output" -> p.purgeHwBuffers(true, false) - "all" -> p.purgeHwBuffers(true, true) - else -> return false - } - true - } catch (e: UnsupportedOperationException) { - Log.w("SerialPortManager", "purgeHwBuffers not supported: ${e.message}") - false - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to clear buffer: ${e.message}", e) - false - } - } - - fun setBreak(path: String): Boolean { - return try { - portMap[path]?.port?.setBreak(true) - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to set break: ${e.message}", e) - false - } - } - - fun clearBreak(path: String): Boolean { - return try { - portMap[path]?.port?.setBreak(false) - true - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to clear break: ${e.message}", e) - false - } - } - - /** - * @param flushIntervalMs how often to flush buffered bytes to [emit] (10–2000 ms). - */ - fun startListening( - path: String, - flushIntervalMs: Long, - emit: (JSObject) -> Unit, - ) { - val port = portMap[path] ?: throw IOException("Port not found") - startIoManager(path, port.port, flushIntervalMs, emit) - } - - fun stopListening(path: String) { - try { - emitters.remove(path)?.stop() - ioManagers[path]?.let { mgr -> - try { - mgr.stop() - } catch (e: Exception) { - Log.w("SerialPortManager", "Failed to stop IO manager for $path: ${e.message}") - } - } - ioManagers.remove(path) - Log.d("SerialPortManager", "Stopped listening on port: $path") - } catch (e: Exception) { - Log.e("SerialPortManager", "Failed to stop listening: ${e.message}", e) - } - } - - fun cleanup() { - try { - closeAllPorts() - unregisterReceiver() - executor.shutdown() - } catch (e: Exception) { - Log.e("SerialPortManager", "Error during cleanup: ${e.message}", e) - } - } -} diff --git a/android/src/main/kotlin/app/tauri/serialplugin/manager/UsbFdBridge.kt b/android/src/main/kotlin/app/tauri/serialplugin/manager/UsbFdBridge.kt new file mode 100644 index 00000000..3b0aea6a --- /dev/null +++ b/android/src/main/kotlin/app/tauri/serialplugin/manager/UsbFdBridge.kt @@ -0,0 +1,303 @@ +package app.tauri.serialplugin.manager + +import android.app.PendingIntent +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.hardware.usb.UsbDevice +import android.hardware.usb.UsbDeviceConnection +import android.hardware.usb.UsbManager +import android.os.Build +import android.util.Log +import androidx.core.content.ContextCompat +import org.json.JSONArray +import org.json.JSONObject +import java.io.IOException +import java.util.concurrent.CompletableFuture +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.Executor +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.RejectedExecutionException +import java.util.concurrent.TimeUnit +import java.util.concurrent.TimeoutException + +/** + * USB fd provider for Rust [android-usb-serial] (no vendored usbserial). + */ +class UsbFdBridge private constructor( + private val context: Context?, + private val nativeSink: NativeSink, + private val registerReceiver: Boolean, + private val testMode: Boolean, +) { + constructor(context: Context) : this( + context, + JniNativeSink, + true, + false, + ) + + companion object { + private const val TAG = "UsbFdBridge" + private const val ACTION_USB_PERMISSION = "app.tauri.serialplugin.USB_PERMISSION" + + fun forTesting(sink: NativeSink = object : NativeSink { + override fun onPortListChange() {} + override fun onDeviceDetached(deviceName: String) {} + }): UsbFdBridge = UsbFdBridge(null, sink, false, true) + + /** Robolectric: real [Context] + receiver registration, synchronous IO. */ + fun forTesting( + context: Context, + sink: NativeSink = object : NativeSink { + override fun onPortListChange() {} + override fun onDeviceDetached(deviceName: String) {} + }, + ): UsbFdBridge = UsbFdBridge(context, sink, registerReceiver = true, testMode = true) + + @JvmStatic + fun forIntegrationTest(): UsbFdBridge = forTesting(JniNativeSink) + } + + interface NativeSink { + fun onPortListChange() + fun onDeviceDetached(deviceName: String) + } + + @Volatile private var shutDown = false + + private val ioExecutor: Executor = if (testMode) { + Executor { it.run() } + } else { + Executors.newSingleThreadExecutor { r -> Thread(r, "usb-fd-io").apply { isDaemon = true } } + } + private val usbManager = context?.getSystemService(Context.USB_SERVICE) as? UsbManager + private val connections = ConcurrentHashMap() + private val permissionFutures = ConcurrentHashMap>() + + private val usbReceiver = object : BroadcastReceiver() { + override fun onReceive(ctx: Context, intent: Intent) { + when (intent.action) { + ACTION_USB_PERMISSION -> { + val device = deviceFromIntent(intent) + val granted = intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false) + device?.deviceName?.let { permissionFutures[it]?.complete(granted) } + } + UsbManager.ACTION_USB_DEVICE_DETACHED -> { + val device = deviceFromIntent(intent) + val name = device?.deviceName + if (name != null) { + closeDeviceFd(name) + nativeSink.onDeviceDetached(name) + } + nativeSink.onPortListChange() + } + UsbManager.ACTION_USB_DEVICE_ATTACHED -> nativeSink.onPortListChange() + } + } + } + + init { + if (registerReceiver && context != null) { + val filter = IntentFilter(ACTION_USB_PERMISSION).apply { + addAction(UsbManager.ACTION_USB_DEVICE_DETACHED) + addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED) + } + if (Build.VERSION.SDK_INT >= 33 || testMode) { + context.registerReceiver(usbReceiver, filter, Context.RECEIVER_EXPORTED) + } else { + ContextCompat.registerReceiver( + context, usbReceiver, filter, ContextCompat.RECEIVER_NOT_EXPORTED, + ) + } + } + } + + /** Test-only: invoke the USB broadcast receiver directly (Robolectric). */ + fun deliverBroadcastForTest(intent: Intent) { + check(testMode) + val ctx = context ?: throw IllegalStateException("no context") + usbReceiver.onReceive(ctx, intent) + } + + /** Test-only: complete a pending USB permission request without a broadcast. */ + fun completePermissionForTest(deviceName: String, granted: Boolean) { + check(testMode) + permissionFutures[deviceName]?.complete(granted) + } + + fun shutdown() { + if (testMode) { + connections.keys.toList().forEach { closeDeviceFd(it) } + if (registerReceiver && context != null) { + try { + context.unregisterReceiver(usbReceiver) + } catch (_: IllegalArgumentException) { + } + } + return + } + shutDown = true + val pool = ioExecutor as ExecutorService + val ctx = context + val shouldUnregister = registerReceiver + try { + pool.execute { + try { + connections.keys.toList().forEach { closeDeviceFd(it) } + } finally { + if (shouldUnregister && ctx != null) { + try { + ctx.unregisterReceiver(usbReceiver) + } catch (_: IllegalArgumentException) { + } + } + pool.shutdown() + } + } + } catch (_: RejectedExecutionException) { + connections.keys.toList().forEach { closeDeviceFd(it) } + if (shouldUnregister && ctx != null) { + try { + ctx.unregisterReceiver(usbReceiver) + } catch (_: IllegalArgumentException) { + } + } + pool.shutdown() + } + } + + fun runOnIoSync(block: () -> Unit) { + runOnIoSync { block() } + } + + fun runOnIoSync(block: () -> T): T { + if (shutDown) throw IOException("USB fd bridge shut down") + if (testMode) return block() + return CompletableFuture.supplyAsync(block, ioExecutor).get() + } + + fun enumerateJson(): String { + val mgr = usbManager ?: run { + Log.w(TAG, "enumerateJson: no UsbManager") + return JSONObject().put("ports", JSONObject()).toString() + } + val ports = JSONObject() + mgr.deviceList.values.forEach { device -> + val key = device.deviceName + try { + ports.put(key, deviceInfo(device)) + } catch (e: Exception) { + Log.e(TAG, "enumerateJson: skip $key: ${e.message}", e) + } + } + val json = JSONObject().put("ports", ports).toString() + Log.i(TAG, "enumerateJson: ${ports.length()} device(s) json=$json") + return json + } + + fun openDeviceFd(deviceName: String): Int { + connections[deviceName]?.let { + Log.i(TAG, "openDeviceFd reuse $deviceName fd=${it.fileDescriptor}") + return it.fileDescriptor + } + val mgr = usbManager ?: throw IOException("no UsbManager") + val device = mgr.deviceList.values.find { it.deviceName == deviceName } + ?: throw IOException("device not found: $deviceName") + if (!mgr.hasPermission(device)) requestPermission(device) + // Do NOT claimInterface here — Rust nusb detach_and_claim owns claiming. + // Pre-claim makes the same fd report "io interface is busy" on open. + val conn = mgr.openDevice(device) ?: throw IOException("open failed: $deviceName") + connections[deviceName] = conn + Log.i( + TAG, + "openDeviceFd $deviceName fd=${conn.fileDescriptor} ifaces=${device.interfaceCount} (unclaimed for nusb)", + ) + return conn.fileDescriptor + } + + fun closeDeviceFd(deviceName: String) { + connections.remove(deviceName)?.close() + } + + /** Test-only: inject a pre-opened connection (Robolectric / harness). */ + fun adoptConnectionForTest(deviceName: String, connection: UsbDeviceConnection) { + check(testMode) + connections[deviceName] = connection + } + + /** Nested [JSONObject] (not Map) — avoids ambiguous `JSONObject.put` wrap. */ + private fun deviceInfo(device: UsbDevice): JSONObject { + fun safeName(block: () -> String?): String = try { + block() ?: "" + } catch (e: SecurityException) { + Log.w(TAG, "deviceInfo string denied for ${device.deviceName}: ${e.message}") + "" + } + val ifaces = JSONArray() + for (i in 0 until device.interfaceCount) { + val iface = device.getInterface(i) + ifaces.put( + JSONObject() + .put("id", iface.id) + .put("class", iface.interfaceClass) + .put("subclass", iface.interfaceSubclass) + .put("protocol", iface.interfaceProtocol), + ) + } + return JSONObject() + .put("type", "Usb") + .put("vid", "0x%04X".format(device.vendorId)) + .put("pid", "0x%04X".format(device.productId)) + .put("manufacturer", safeName { device.manufacturerName }) + .put("product", safeName { device.productName }) + .put("serial_number", safeName { device.serialNumber }) + .put("interfaces", ifaces) + } + + private fun requestPermission(device: UsbDevice) { + val mgr = usbManager ?: throw IOException("no UsbManager") + val ctx = context ?: throw IOException("no context") + val name = device.deviceName + val fut = CompletableFuture() + permissionFutures[name] = fut + val intent = Intent(ACTION_USB_PERMISSION).apply { + setPackage(ctx.packageName) + } + val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + PendingIntent.FLAG_MUTABLE + } else { + 0 + } + val pi = PendingIntent.getBroadcast(ctx, 0, intent, flags) + mgr.requestPermission(device, pi) + val granted = try { + if (testMode) { + fut.get(200, TimeUnit.MILLISECONDS) + } else { + fut.get(30, TimeUnit.SECONDS) + } + } catch (_: TimeoutException) { + false + } + if (!granted) { + throw IOException("USB permission denied for $name") + } + } + + private fun deviceFromIntent(intent: Intent): UsbDevice? = + if (Build.VERSION.SDK_INT >= 33) { + intent.getParcelableExtra(UsbManager.EXTRA_DEVICE, UsbDevice::class.java) + } else { + @Suppress("DEPRECATION") + intent.getParcelableExtra(UsbManager.EXTRA_DEVICE) + } +} + +private object JniNativeSink : UsbFdBridge.NativeSink { + override fun onPortListChange() = app.tauri.serialplugin.MobileBridge.onPortListChange() + override fun onDeviceDetached(deviceName: String) = + app.tauri.serialplugin.MobileBridge.onDeviceDetached(deviceName) +} diff --git a/android/src/main/kotlin/app/tauri/serialplugin/models/SerialPortConfig.kt b/android/src/main/kotlin/app/tauri/serialplugin/models/SerialPortConfig.kt deleted file mode 100644 index b1b8927c..00000000 --- a/android/src/main/kotlin/app/tauri/serialplugin/models/SerialPortConfig.kt +++ /dev/null @@ -1,82 +0,0 @@ -package app.tauri.serialplugin.models - -import com.hoho.android.usbserial.driver.UsbSerialPort - -enum class DataBits(val value: Int) { - FIVE(5), - SIX(6), - SEVEN(7), - EIGHT(8); - - companion object { - fun fromValue(value: Int): DataBits { - return DataBits.entries.find { it.value == value } ?: EIGHT - } - } -} - -enum class FlowControl { - NONE, - SOFTWARE, - HARDWARE; - - companion object { - fun fromValue(value: Int): FlowControl { - return when (value) { - 1 -> SOFTWARE - 2 -> HARDWARE - else -> NONE - } - } - } -} - -enum class Parity(val value: Int) { - NONE(UsbSerialPort.PARITY_NONE), - ODD(UsbSerialPort.PARITY_ODD), - EVEN(UsbSerialPort.PARITY_EVEN); - - companion object { - fun fromValue(value: Int): Parity { - return Parity.entries.find { it.value == value } ?: NONE - } - } -} - -enum class StopBits(val value: Int) { - ONE(UsbSerialPort.STOPBITS_1), - TWO(UsbSerialPort.STOPBITS_2); - - companion object { - fun fromValue(value: Int): StopBits { - return StopBits.entries.find { it.value == value } ?: ONE - } - } -} - -enum class ClearBuffer { - INPUT, - OUTPUT, - ALL; - - companion object { - fun fromValue(value: String): ClearBuffer { - return when (value.lowercase()) { - "input" -> INPUT - "output" -> OUTPUT - "all" -> ALL - else -> INPUT - } - } - } -} - -data class SerialPortConfig( - var path: String, - var baudRate: Int = 9600, - var dataBits: DataBits = DataBits.EIGHT, - var flowControl: FlowControl = FlowControl.NONE, - var parity: Parity = Parity.NONE, - var stopBits: StopBits = StopBits.ONE, - var timeout: Int = 1000 -) diff --git a/android/src/test/AndroidManifest.xml b/android/src/test/AndroidManifest.xml new file mode 100644 index 00000000..f0251043 --- /dev/null +++ b/android/src/test/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/android/src/test/kotlin/app/tauri/serialplugin/SerialPluginConversionTest.kt b/android/src/test/kotlin/app/tauri/serialplugin/SerialPluginConversionTest.kt deleted file mode 100644 index 1e44f089..00000000 --- a/android/src/test/kotlin/app/tauri/serialplugin/SerialPluginConversionTest.kt +++ /dev/null @@ -1,68 +0,0 @@ -package app.tauri.serialplugin - -import org.junit.Assert.assertEquals -import org.junit.Assert.assertNotNull -import org.junit.Test - -/** - * Tests for package-level [Map.toJSObject] and [List.toJSArray] helpers used by [SerialPlugin]. - */ -class SerialPluginConversionTest { - @Test - fun toJSObject_flatPrimitives() { - val m = mapOf( - "n" to 42, - "s" to "hello", - "b" to true, - ) - val o = m.toJSObject() - assertEquals(42, o.getInteger("n")) - assertEquals("hello", o.getString("s")) - assertEquals(true, o.getBoolean("b")) - } - - @Test - fun toJSObject_nestedMap() { - val inner = mapOf("k" to "v", "x" to 1) - val m = mapOf("outer" to inner) - val o = m.toJSObject() - val innerObj = o.getJSObject("outer") - assertNotNull(innerObj) - assertEquals("v", innerObj!!.getString("k")) - assertEquals(1, innerObj.getInteger("x")) - } - - @Test - fun toJSArray_listOfMaps() { - val list: List = listOf( - mapOf("a" to 1), - mapOf("b" to 2), - ) - val arr = list.toJSArray() - assertEquals(2, arr.length()) - val first = arr.getJSONObject(0) - assertEquals(1, first.getInt("a")) - } - - @Test - fun toJSArray_mixedPrimitives() { - val list: List = listOf("x", 3, false) - val arr = list.toJSArray() - assertEquals(3, arr.length()) - assertEquals("x", arr.getString(0)) - assertEquals(3, arr.getInt(1)) - assertEquals(false, arr.getBoolean(2)) - } - - @Test - fun toJSArray_nestedListOfInts() { - val inner: List = listOf(1, 2) - val outer: List = listOf(inner) - val arr = outer.toJSArray() - assertEquals(1, arr.length()) - val nested = arr.getJSONArray(0) - assertEquals(2, nested.length()) - assertEquals(1, nested.getInt(0)) - assertEquals(2, nested.getInt(1)) - } -} diff --git a/android/src/test/kotlin/app/tauri/serialplugin/manager/BufferedEmitterTest.kt b/android/src/test/kotlin/app/tauri/serialplugin/manager/BufferedEmitterTest.kt deleted file mode 100644 index e919fc3c..00000000 --- a/android/src/test/kotlin/app/tauri/serialplugin/manager/BufferedEmitterTest.kt +++ /dev/null @@ -1,19 +0,0 @@ -package app.tauri.serialplugin.manager - -import org.junit.Assert.assertEquals -import org.junit.Test - -class BufferedEmitterTest { - @Test - fun pendingByteCount_tracks_data_before_flush() { - // Max flush interval (2000 ms) so the first scheduled flush is late; we only assert immediately. - val emitter = BufferedEmitter("/dev/usbX", 2000L) { _ -> } - try { - assertEquals(0, emitter.pendingByteCount()) - emitter.addData(byteArrayOf(10, 20, 30)) - assertEquals(3, emitter.pendingByteCount()) - } finally { - emitter.stop() - } - } -} diff --git a/android/src/test/kotlin/app/tauri/serialplugin/manager/SerialByteAccumulatorTest.kt b/android/src/test/kotlin/app/tauri/serialplugin/manager/SerialByteAccumulatorTest.kt deleted file mode 100644 index 566adef8..00000000 --- a/android/src/test/kotlin/app/tauri/serialplugin/manager/SerialByteAccumulatorTest.kt +++ /dev/null @@ -1,56 +0,0 @@ -package app.tauri.serialplugin.manager - -import org.junit.Assert.assertArrayEquals -import org.junit.Assert.assertEquals -import org.junit.Test - -class SerialByteAccumulatorTest { - @Test - fun append_empty_is_noop() { - val acc = SerialByteAccumulator() - acc.append(ByteArray(0)) - assertEquals(0, acc.pendingByteCount()) - assertArrayEquals(ByteArray(0), acc.drain()) - } - - @Test - fun append_then_drain_preserves_order() { - val acc = SerialByteAccumulator() - acc.append(byteArrayOf(1, 2)) - acc.append(byteArrayOf(3)) - assertEquals(3, acc.pendingByteCount()) - assertArrayEquals(byteArrayOf(1, 2, 3), acc.drain()) - assertEquals(0, acc.pendingByteCount()) - assertArrayEquals(ByteArray(0), acc.drain()) - } - - @Test - fun drain_when_empty_returns_empty() { - val acc = SerialByteAccumulator() - assertArrayEquals(ByteArray(0), acc.drain()) - } - - @Test - fun concurrent_appends_merge_consistently() { - val acc = SerialByteAccumulator() - val threads = List(8) { i -> - Thread { - repeat(100) { - acc.append(byteArrayOf(i.toByte())) - } - } - } - threads.forEach { it.start() } - threads.forEach { it.join() } - val out = acc.drain() - assertEquals(800, out.size) - // All bytes are in 0..7 — count occurrences - val counts = IntArray(8) - for (b in out) { - counts[b.toInt() and 0xff]++ - } - for (i in 0 until 8) { - assertEquals(100, counts[i]) - } - } -} diff --git a/android/src/test/kotlin/app/tauri/serialplugin/manager/SerialDataEmitFieldsTest.kt b/android/src/test/kotlin/app/tauri/serialplugin/manager/SerialDataEmitFieldsTest.kt deleted file mode 100644 index b4b46659..00000000 --- a/android/src/test/kotlin/app/tauri/serialplugin/manager/SerialDataEmitFieldsTest.kt +++ /dev/null @@ -1,63 +0,0 @@ -package app.tauri.serialplugin.manager - -import app.tauri.plugin.JSObject -import org.junit.Assert.assertEquals -import org.junit.Test - -class SerialDataEmitFieldsTest { - @Test - fun payload_from_chunk_preserves_utf8_string() { - val chunk = "café 🚀".toByteArray(Charsets.UTF_8) - val p = serialDataPayloadFromChunk("/dev/usb", chunk) - assertEquals("/dev/usb", p.path) - assertEquals("café 🚀", p.dataAsString) - assertEquals(chunk.size, p.size) - } - - @Test - fun payload_from_chunk_preserves_nul_and_binary_bytes() { - val chunk = byteArrayOf(0x48, 0x00, 0x01.toByte()) - val p = serialDataPayloadFromChunk("/dev/usb", chunk) - assertEquals(3, p.size) - assertEquals(3, p.dataAsString.length) - assertEquals('\u0000', p.dataAsString[1]) - assertEquals(1.toChar(), p.dataAsString[2]) - } - - @Test - fun applyToJSObject_sets_path_data_size() { - val p = SerialDataEmitFields( - path = "/dev/tty", - dataAsString = "ab", - size = 2, - ) - val o = JSObject() - p.applyToJSObject(o) - assertEquals("/dev/tty", o.getString("path")) - assertEquals("ab", o.getString("data")) - assertEquals(2, o.getInteger("size")) - } - - @Test - fun flush_accumulator_invokes_emit_once_with_merged_bytes() { - val acc = SerialByteAccumulator() - acc.append(byteArrayOf(65, 66)) - acc.append(byteArrayOf(67)) - val captured = mutableListOf() - flushAccumulatorToEmit("COM1", acc) { captured.add(it) } - assertEquals(1, captured.size) - assertEquals("COM1", captured[0].path) - assertEquals("ABC", captured[0].dataAsString) - assertEquals(3, captured[0].size) - } - - @Test - fun flush_accumulator_skips_emit_when_empty() { - val acc = SerialByteAccumulator() - assertEquals(0, acc.pendingByteCount()) - assertEquals(0, acc.drain().size) - val captured = mutableListOf() - flushAccumulatorToEmit("COM1", acc) { captured.add(it) } - assertEquals(0, captured.size) - } -} diff --git a/android/src/test/kotlin/app/tauri/serialplugin/manager/UsbFdBridgeTest.kt b/android/src/test/kotlin/app/tauri/serialplugin/manager/UsbFdBridgeTest.kt new file mode 100644 index 00000000..bfc59089 --- /dev/null +++ b/android/src/test/kotlin/app/tauri/serialplugin/manager/UsbFdBridgeTest.kt @@ -0,0 +1,252 @@ +package app.tauri.serialplugin.manager + +import android.app.PendingIntent +import android.content.Context +import android.content.ContextWrapper +import android.content.Intent +import android.hardware.usb.UsbDevice +import android.hardware.usb.UsbDeviceConnection +import android.hardware.usb.UsbManager +import androidx.test.core.app.ApplicationProvider +import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentMatchers.anyInt +import org.mockito.Mockito.mockStatic +import org.mockito.kotlin.any +import org.mockito.kotlin.doAnswer +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.times +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config +import java.io.IOException +import java.util.concurrent.atomic.AtomicInteger + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [28]) +class UsbFdBridgeTest { + + private companion object { + const val DEVICE = "/dev/bus/usb/001/001" + const val ACTION_USB_PERMISSION = "app.tauri.serialplugin.USB_PERMISSION" + } + + private class RecordingSink : UsbFdBridge.NativeSink { + val portListChanges = AtomicInteger(0) + val detached = mutableListOf() + + override fun onPortListChange() { + portListChanges.incrementAndGet() + } + + override fun onDeviceDetached(deviceName: String) { + detached.add(deviceName) + } + } + + private data class UsbHarness( + val bridge: UsbFdBridge, + val usbManager: UsbManager, + val context: Context, + val sink: RecordingSink, + ) + + private fun usbHarness(sink: RecordingSink = RecordingSink()): UsbHarness { + val base = ApplicationProvider.getApplicationContext() + val usbManager = mock() + val context = object : ContextWrapper(base) { + override fun getSystemService(name: String): Any? = + if (Context.USB_SERVICE == name) usbManager else super.getSystemService(name) + } + val bridge = UsbFdBridge.forTesting(context, sink) + return UsbHarness(bridge, usbManager, context, sink) + } + + private fun mockDevice(name: String = DEVICE): UsbDevice { + val device = mock() + whenever(device.deviceName).thenReturn(name) + whenever(device.vendorId).thenReturn(0x0403) + whenever(device.productId).thenReturn(0x6001) + whenever(device.interfaceCount).thenReturn(1) + val iface = mock() + whenever(iface.id).thenReturn(0) + whenever(iface.interfaceClass).thenReturn(255) + whenever(iface.interfaceSubclass).thenReturn(255) + whenever(iface.interfaceProtocol).thenReturn(255) + whenever(device.getInterface(0)).thenReturn(iface) + return device + } + + private fun mockConn(fd: Int): UsbDeviceConnection { + val conn = mock() + whenever(conn.fileDescriptor).thenReturn(fd) + return conn + } + + private fun stubDeviceList(usbManager: UsbManager, device: UsbDevice) { + whenever(usbManager.deviceList).thenReturn(hashMapOf("key" to device)) + } + + @Test + fun enumerateJson_emptyWithoutUsbManager() { + val bridge = UsbFdBridge.forTesting() + val json = bridge.enumerateJson() + assertTrue(json.contains("\"ports\"")) + } + + @Test + fun enumerateJson_includesInterfaces() { + val harness = usbHarness() + val device = mockDevice() + stubDeviceList(harness.usbManager, device) + val json = harness.bridge.enumerateJson() + assertTrue(json.contains("\"interfaces\"")) + assertTrue(json.contains("\"class\":255")) + } + + @Test + fun adoptConnection_roundtripFd() { + val bridge = UsbFdBridge.forTesting() + val conn = mockConn(99) + bridge.adoptConnectionForTest(DEVICE, conn) + assertEquals(99, bridge.openDeviceFd(DEVICE)) + bridge.closeDeviceFd(DEVICE) + } + + @Test + fun openDeviceFd_permissionGranted() { + val harness = usbHarness() + val device = mockDevice() + stubDeviceList(harness.usbManager, device) + whenever(harness.usbManager.hasPermission(device)).thenReturn(false) + val conn = mockConn(42) + whenever(harness.usbManager.openDevice(device)).thenReturn(conn) + doAnswer { + harness.bridge.completePermissionForTest(DEVICE, true) + null + }.whenever(harness.usbManager).requestPermission(eq(device), any()) + + assertEquals(42, harness.bridge.openDeviceFd(DEVICE)) + } + + @Test + fun openDeviceFd_permissionDenied() { + val harness = usbHarness() + val device = mockDevice() + stubDeviceList(harness.usbManager, device) + whenever(harness.usbManager.hasPermission(device)).thenReturn(false) + doAnswer { + harness.bridge.completePermissionForTest(DEVICE, false) + null + }.whenever(harness.usbManager).requestPermission(eq(device), any()) + + val err = assertThrows(IOException::class.java) { + harness.bridge.openDeviceFd(DEVICE) + } + assertTrue(err.message!!.contains("permission denied")) + } + + @Test + fun openDeviceFd_permissionTimeout() { + val harness = usbHarness() + val device = mockDevice() + stubDeviceList(harness.usbManager, device) + whenever(harness.usbManager.hasPermission(device)).thenReturn(false) + + val err = assertThrows(IOException::class.java) { + harness.bridge.openDeviceFd(DEVICE) + } + assertTrue(err.message!!.contains("permission denied")) + verify(harness.usbManager, never()).openDevice(device) + } + + @Test + @Config(sdk = [31]) + fun requestPermission_usesMutablePendingIntentOnApi31() { + val harness = usbHarness() + val device = mockDevice() + stubDeviceList(harness.usbManager, device) + whenever(harness.usbManager.hasPermission(device)).thenReturn(false) + val conn = mockConn(7) + whenever(harness.usbManager.openDevice(device)).thenReturn(conn) + + mockStatic(PendingIntent::class.java).use { mocked -> + mocked.`when` { + PendingIntent.getBroadcast(any(), anyInt(), any(), anyInt()) + }.thenAnswer { inv -> + val flags = inv.arguments[3] as Int + assertEquals(PendingIntent.FLAG_MUTABLE, flags and PendingIntent.FLAG_MUTABLE) + mock() + } + doAnswer { + harness.bridge.completePermissionForTest(DEVICE, true) + null + }.whenever(harness.usbManager).requestPermission(eq(device), any()) + + assertEquals(7, harness.bridge.openDeviceFd(DEVICE)) + } + } + + @Test + fun onDeviceDetached_notifiesSinkAndClosesConnection() { + val sink = RecordingSink() + val harness = usbHarness(sink) + val device = mockDevice() + val conn = mockConn(11) + harness.bridge.adoptConnectionForTest(DEVICE, conn) + + harness.bridge.deliverBroadcastForTest( + Intent(UsbManager.ACTION_USB_DEVICE_DETACHED).apply { + putExtra(UsbManager.EXTRA_DEVICE, device) + }, + ) + + assertEquals(listOf(DEVICE), sink.detached) + assertTrue(sink.portListChanges.get() >= 1) + verify(conn).close() + } + + @Test + fun onDeviceAttached_notifiesPortListChange() { + val sink = RecordingSink() + val harness = usbHarness(sink) + val before = sink.portListChanges.get() + + harness.bridge.deliverBroadcastForTest(Intent(UsbManager.ACTION_USB_DEVICE_ATTACHED)) + + assertEquals(before + 1, sink.portListChanges.get()) + assertTrue(sink.detached.isEmpty()) + } + + @Test + fun shutdown_unregistersReceiver() { + val sink = RecordingSink() + val harness = usbHarness(sink) + val before = sink.portListChanges.get() + + harness.bridge.shutdown() + + harness.context.sendBroadcast(Intent(UsbManager.ACTION_USB_DEVICE_ATTACHED)) + assertEquals(before, sink.portListChanges.get()) + } + + @Test + fun openDeviceFd_reusesExistingConnection() { + val harness = usbHarness() + val device = mockDevice() + stubDeviceList(harness.usbManager, device) + whenever(harness.usbManager.hasPermission(device)).thenReturn(true) + val conn = mockConn(55) + whenever(harness.usbManager.openDevice(device)).thenReturn(conn) + + assertEquals(55, harness.bridge.openDeviceFd(DEVICE)) + assertEquals(55, harness.bridge.openDeviceFd(DEVICE)) + verify(harness.usbManager, times(1)).openDevice(device) + } +} diff --git a/android/src/test/kotlin/app/tauri/serialplugin/models/SerialModelsTest.kt b/android/src/test/kotlin/app/tauri/serialplugin/models/SerialModelsTest.kt deleted file mode 100644 index 5be20a79..00000000 --- a/android/src/test/kotlin/app/tauri/serialplugin/models/SerialModelsTest.kt +++ /dev/null @@ -1,58 +0,0 @@ -package app.tauri.serialplugin.models - -import org.junit.Assert.assertEquals -import org.junit.Test - -class SerialModelsTest { - @Test - fun clearBuffer_fromValue_isCaseInsensitive() { - assertEquals(ClearBuffer.INPUT, ClearBuffer.fromValue("input")) - assertEquals(ClearBuffer.OUTPUT, ClearBuffer.fromValue("OUTPUT")) - assertEquals(ClearBuffer.ALL, ClearBuffer.fromValue("All")) - } - - @Test - fun dataBits_fromValue_roundTrip() { - assertEquals(DataBits.EIGHT, DataBits.fromValue(8)) - assertEquals(DataBits.FIVE, DataBits.fromValue(5)) - } - - @Test - fun flowControl_fromValue() { - assertEquals(FlowControl.NONE, FlowControl.fromValue(0)) - assertEquals(FlowControl.SOFTWARE, FlowControl.fromValue(1)) - assertEquals(FlowControl.HARDWARE, FlowControl.fromValue(2)) - } - - @Test - fun serialPortConfig_defaultTimeout() { - val c = SerialPortConfig(path = "/dev/usb", baudRate = 115200) - assertEquals(1000, c.timeout) - } - - @Test - fun dataBits_fromValue_unknownDefaultsToEight() { - assertEquals(DataBits.EIGHT, DataBits.fromValue(999)) - } - - @Test - fun parity_roundTrip_and_unknownDefaultsToNone() { - Parity.entries.forEach { p -> - assertEquals(p, Parity.fromValue(p.value)) - } - assertEquals(Parity.NONE, Parity.fromValue(-1)) - } - - @Test - fun stopBits_roundTrip_and_unknownDefaultsToOne() { - StopBits.entries.forEach { s -> - assertEquals(s, StopBits.fromValue(s.value)) - } - assertEquals(StopBits.ONE, StopBits.fromValue(-99)) - } - - @Test - fun clearBuffer_unknownDefaultsToInput() { - assertEquals(ClearBuffer.INPUT, ClearBuffer.fromValue("not-a-buffer")) - } -} diff --git a/build.rs b/build.rs index 33b7ee08..a64fe4a5 100755 --- a/build.rs +++ b/build.rs @@ -4,7 +4,6 @@ const COMMANDS: &[&str] = &[ "available_ports", - "available_ports_direct", "managed_ports", "cancel_read", "close", @@ -13,8 +12,11 @@ const COMMANDS: &[&str] = &[ "open", "read", "read_binary", - "start_listening", - "stop_listening", + "capabilities", + "watch", + "unwatch", + "watch_ports", + "unwatch_ports", "write", "write_binary", "set_baud_rate", @@ -34,17 +36,26 @@ const COMMANDS: &[&str] = &[ "clear_buffer", "set_break", "clear_break", - "write_rts", - "write_dtr", - "read_cts", - "read_dsr", - "read_ri", - "read_cd", "set_log_level", "get_log_level", + "exchange", + "exchange_binary", + "cancel_exchange", + "at", + "at_phases", + "send_sms_pdu", + "configure_at_session", + "enable_mux", + "open_mux_channel", + "disable_mux", ]; fn main() { + let target = std::env::var("TARGET").unwrap_or_default(); + if target.contains("android") { + println!("cargo:rustc-link-lib=log"); + } + let result = tauri_plugin::Builder::new(COMMANDS) .android_path("android") .try_build(); diff --git a/crates/android-usb-serial/CHANGELOG.md b/crates/android-usb-serial/CHANGELOG.md new file mode 100644 index 00000000..330d565a --- /dev/null +++ b/crates/android-usb-serial/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +## 0.1.0 + +- Initial release: FTDI, CP21xx, CH34x, Prolific, CDC-ACM, GSM modem, Chrome CCD drivers on `nusb` +- `from_raw_fd` / `NusbTransport` for Android `UsbDeviceConnection` fds +- `ProbeTable`, `SerialPortHandle`, optional `serialport-compat` and `fake-transport` +- Golden parity fixtures (≥560 Java-sourced control sequences) diff --git a/crates/android-usb-serial/Cargo.toml b/crates/android-usb-serial/Cargo.toml new file mode 100644 index 00000000..a8f2c366 --- /dev/null +++ b/crates/android-usb-serial/Cargo.toml @@ -0,0 +1,66 @@ +[package] +name = "android-usb-serial" +version = "0.1.0" +description = "Pure Rust USB serial drivers for Android (and Linux), built on nusb" +edition = "2021" +rust-version = "1.79" +license = "Apache-2.0 OR MIT" +readme = "README.md" +repository = "https://github.com/s00d/tauri-plugin-serialplugin" +homepage = "https://github.com/s00d/tauri-plugin-serialplugin/tree/master/crates/android-usb-serial" +documentation = "https://docs.rs/android-usb-serial" +authors = ["s00d"] +keywords = ["usb", "serial", "android", "nusb", "serialport"] +categories = ["hardware-support", "os::android-apis", "embedded"] +# Library package; lockfile not required for consumers. Golden fixtures stay in crate. +exclude = [ + "/target/", + "Cargo.lock", +] + +[package.metadata.docs.rs] +all-features = false +features = ["serialport-compat", "fake-transport"] +targets = ["x86_64-unknown-linux-gnu", "x86_64-linux-android"] +rustdoc-args = ["--cfg", "docsrs"] + +[features] +default = ["serialport-compat"] +# In-memory FakeTransport + golden_record binary (tests / harnesses). +fake-transport = ["dep:serde", "dep:serde_json", "dep:base64"] +# serialport::SerialPort adapter for drop-in desktop/mobile facades. +serialport-compat = ["dep:serialport"] + +[dependencies] +log = "0.4" + +[dependencies.serde] +version = "1.0" +features = ["derive"] +optional = true + +[dependencies.serde_json] +version = "1.0" +optional = true + +[dependencies.base64] +version = "0.22" +optional = true + +[dependencies.serialport] +version = "4.9" +optional = true + +[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies] +nusb = "0.2" +libc = "0.2" + +[dev-dependencies] +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +base64 = "0.22" + +[[bin]] +name = "golden_record" +path = "src/bin/golden_record.rs" +required-features = ["fake-transport"] diff --git a/crates/android-usb-serial/LICENSE-APACHE b/crates/android-usb-serial/LICENSE-APACHE new file mode 100755 index 00000000..4947287f --- /dev/null +++ b/crates/android-usb-serial/LICENSE-APACHE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/crates/android-usb-serial/LICENSE-MIT b/crates/android-usb-serial/LICENSE-MIT new file mode 100755 index 00000000..4d754725 --- /dev/null +++ b/crates/android-usb-serial/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 - Present Tauri Apps Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/crates/android-usb-serial/NOTICE b/crates/android-usb-serial/NOTICE new file mode 100644 index 00000000..343149f4 --- /dev/null +++ b/crates/android-usb-serial/NOTICE @@ -0,0 +1,9 @@ +android-usb-serial +Copyright (c) s00d and contributors + +Portions of driver logic are derived from usb-serial-for-android +(https://github.com/mik3y/usb-serial-for-android), Copyright (c) Mike Wakerly +and contributors, licensed under the MIT License. + +The MIT License above and the dual Apache-2.0 OR MIT license of this crate +apply to those derived portions as described in LICENSE-MIT and LICENSE-APACHE. diff --git a/crates/android-usb-serial/README.md b/crates/android-usb-serial/README.md new file mode 100644 index 00000000..4dea6e93 --- /dev/null +++ b/crates/android-usb-serial/README.md @@ -0,0 +1,356 @@ +# android-usb-serial + +Pure Rust USB serial drivers for **Android** (and Linux), built on [nusb](https://docs.rs/nusb). + +Ported from [usb-serial-for-android](https://github.com/mik3y/usb-serial-for-android) driver +protocol logic — verified byte-for-byte against **567 golden JSON fixtures**. + +[![Crates.io](https://img.shields.io/crates/v/android-usb-serial.svg)](https://crates.io/crates/android-usb-serial) +[![Docs.rs](https://docs.rs/android-usb-serial/badge.svg)](https://docs.rs/android-usb-serial) +[![License](https://img.shields.io/crates/l/android-usb-serial.svg)](LICENSE-APACHE) + +## Supported chips + +| Driver | Examples (VID:PID) | +|--------|--------------------| +| FTDI | FT232R `0403:6001`, FT2232H `0403:6010` | +| Silicon Labs CP21xx | CP2102 `10C4:EA60`, CP2105 `10C4:EA70` | +| WCH CH34x | CH340 `1A86:7523` | +| Prolific PL2303 | HX / HXN / type 0x01 / TA | +| CDC ACM | Castrated single-iface, IAD, multi-port | +| GSM modem | Fibocom-style vendor ports | +| Chrome CCD / CR50 | `18D1:5014` (3 ports) | + +## Install + +```toml +[dependencies] +android-usb-serial = "0.1" + +# Optional: serialport::SerialPort facade (enabled by default) +# android-usb-serial = { version = "0.1", default-features = false } + +# Host / instrumentation tests +# android-usb-serial = { version = "0.1", features = ["fake-transport"] } +``` + +Requires **Rust 1.79+**. Real USB needs `target_os = "android"` or `"linux"` (pulls in `nusb` + `libc`). + +## Quick start (Android fd) + +Kotlin/Java keeps `UsbDeviceConnection` and grants USB permission. Pass the raw fd into Rust: + +```rust +use android_usb_serial::{ + from_raw_fd, open_port, DataBits, LineConfig, NusbTransport, Parity, StopBits, Transport, +}; +use std::os::fd::RawFd; +use std::sync::Arc; + +fn open_android_port(fd: RawFd) -> android_usb_serial::Result<()> { + let device = from_raw_fd(fd)?; + let transport = Arc::new(NusbTransport::from_device(device)?) as Arc; + let mut port = open_port(transport, 0)?; + port.set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + })?; + port.set_dtr(true)?; + port.write(b"AT\r\n")?; + Ok(()) +} +``` + +`from_raw_fd` **`dup`s** the fd so Java can keep owning `UsbDeviceConnection`. + +## Using on Android + +This crate talks USB only through a **raw file descriptor** from Android's +`UsbDeviceConnection`. It does **not** call `UsbManager`, does **not** show +permission dialogs, and does **not** register broadcast receivers — your app +(or a thin Kotlin bridge) owns all of that. + +```text +App (Kotlin) android-usb-serial (Rust) +───────────────────────────────────────────────────────────── +UsbManager.deviceList ProbeTable::find(vid, pid, ifaces) +enumerateJson + interfaces[] → expand to port keys (device / device#N) +requestPermission + openDevice → from_raw_fd → NusbTransport → open_port +keep UsbDeviceConnection alive dup(fd); claim interfaces inside nusb +closeDeviceFd on detach/close driver I/O (write, reader, modem lines) +``` + +### Manifest + +Declare USB host support and (optionally) attach a device filter so Android +can launch your activity when a known adapter is plugged in: + +```xml + + + + + + + + + + +``` + +`device_filter.xml` should list VID/PID pairs you care about. Align entries with +[`ProbeTable::default_table()`](src/probe.rs) — a full filter ships with +[tauri-plugin-serialplugin](../../../android/src/main/res/xml/device_filter.xml). +A catch-all `` at the end also matches generic CDC ACM devices. + +### USB permission + +Android requires **runtime permission per device** before `openDevice()`: + +1. Check `usbManager.hasPermission(device)`. +2. If false, call `usbManager.requestPermission(device, pendingIntent)`. +3. Handle the result in a `BroadcastReceiver` (`EXTRA_PERMISSION_GRANTED`). +4. On API 31+, use `PendingIntent.FLAG_MUTABLE` on the permission intent. +5. Set `intent.setPackage(packageName)` when building the permission `Intent` + (see [UsbFdBridge](../../../android/src/main/kotlin/app/tauri/serialplugin/manager/UsbFdBridge.kt)). + +Minimal pattern (standalone app): + +```kotlin +private const val ACTION_USB_PERMISSION = "your.app.USB_PERMISSION" + +fun openWithPermission(device: UsbDevice) { + val mgr = getSystemService(USB_SERVICE) as UsbManager + if (!mgr.hasPermission(device)) { + val pi = PendingIntent.getBroadcast( + this, 0, + Intent(ACTION_USB_PERMISSION), + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE, + ) + mgr.requestPermission(device, pi) + return + } + val conn = mgr.openDevice(device) ?: return + val fd = conn.fileDescriptor + // pass fd to Rust (JNI) — keep `conn` alive until close + nativeOpenPort(fd, device.vendorId, device.productId) +} +``` + +Register for `UsbManager.ACTION_USB_DEVICE_ATTACHED` / `DETACHED` to refresh the +port list and close fds when the cable is unplugged. + +### Open fd — do **not** pre-claim interfaces + +After permission is granted: + +```kotlin +val conn = usbManager.openDevice(device) ?: throw IOException("open failed") +// Do NOT call conn.claimInterface() here. +val fd = conn.fileDescriptor +``` + +Rust/nusb calls `detach_and_claim` on the duplicated fd. If Kotlin claims the +interface first, open fails with **`io interface is busy`**. The reference +implementation lives in +[`UsbFdBridge.openDeviceFd`](../../../android/src/main/kotlin/app/tauri/serialplugin/manager/UsbFdBridge.kt). + +Keep the `UsbDeviceConnection` open for the whole session; call `close()` only +after Rust has closed the port and released endpoints. + +### Enumerate (no fd, no claim) + +List attached devices from Kotlin and pass metadata to Rust for driver probing. +Include **USB interface descriptors** so multi-port chips (FT2232, dual CDC, +etc.) expand to separate port keys: + +```json +{ + "ports": { + "/dev/bus/usb/001/002": { + "type": "Usb", + "vid": "0x1A86", + "pid": "0x7523", + "manufacturer": "", + "product": "", + "serial_number": "", + "interfaces": [ + { "id": 0, "class": 255, "subclass": 0, "protocol": 0 } + ] + } + } +} +``` + +Rust maps each entry to one or more paths: `deviceName` or `deviceName#N` +(port index). `manufacturer` / `product` / `serial_number` may be empty when +Android denies string reads (`SecurityException`) — probing uses VID/PID + +`interfaces[]` only. + +### JNI / Rust entry + +Typical sequence after you have `fd`: + +```rust +let device = from_raw_fd(fd as RawFd)?; +let transport = Arc::new(NusbTransport::from_device(device)?); +let mut port = open_port(transport, port_index)?; // 0 for single-port CH340 +port.set_line_config(LineConfig { baud_rate: 115_200, .. })?; +port.set_dtr(true)?; +port.start_reader()?; // optional background bulk IN +port.write(b"AT\r\n")?; +``` + +- `write()` opens **bulk OUT** only; bulk IN belongs to the reader (do not + reopen IN in `write` — see `EndpointPair::write`). +- Prefer `start_reader()` **after** line config and DTR/RTS — some chips (CH340) + misbehave if bulk IN starts too early. +- On detach, expect errors like `USB device detached (unplug, power loss, or + protocol error on bulk IN)`. + +Build the native library for Android: + +```bash +cargo ndk -t arm64-v8a -o app/src/main/jniLibs build --release +# or: aarch64-linux-android, armeabi-v7a, x86_64 as needed +``` + +Link `liblog` if you emit Android logcat from Rust (`__android_log_write`). + +### Examples in this repository + +| Example | Purpose | +|---------|---------| +| [`examples/usb-driver-tester`](../../../examples/usb-driver-tester/) | Minimal standalone app: permission → fd → `from_raw_fd` → probe/open/write/read. **Self-test** runs fake-transport matrix; **Device test** hits real hardware. Use to isolate CH340 power vs plugin bugs. | +| [`examples/serialport-test`](../../../examples/serialport-test/) | Full Tauri Android app (`pnpm tauri android build`). See [`ANDROID.md`](../../../examples/serialport-test/ANDROID.md) for wireless ADB, install, and logcat tags. | +| [`android/`](../../../android/) | Tauri plugin Kotlin bridge (`UsbFdBridge`, `UsbNative`, `SerialPlugin`). | +| [`examples/serialport-test/android-integration/`](../../../examples/serialport-test/android-integration/) | Instrumented JNI tests with `FakeTransport` (no real USB). | + +**usb-driver-tester** build: + +```bash +cd examples/usb-driver-tester/rust +cargo ndk -t arm64-v8a -o ../app/src/main/jniLibs build --release +cd .. && gradle assembleDebug +``` + +**serialport-test** on device: + +```bash +cd examples/serialport-test +pnpm tauri android build --debug +adb install -r src-tauri/gen/android/app/build/outputs/apk/universal/debug/app-universal-debug.apk +adb logcat -s UsbFdBridge SerialPlugin Console +``` + +### Debugging checklist + +| Symptom | Likely cause | +|---------|----------------| +| `io interface is busy` | Kotlin called `claimInterface` before Rust | +| `endpoint already in use` | bulk IN opened twice (writer + reader) | +| `USB permission denied` | user declined dialog or `PendingIntent` not mutable | +| Device listed, UI empty | enumerate JSON missing `interfaces[]` or wrong port key | +| CH340 vanishes after open (`URB ep 82 status=-71`) | OTG power / cable — confirm with **usb-driver-tester** on same phone + cable | +| `enumerateJson: 0` after disconnect | normal after detach; replug or powered USB hub | + +### Tauri plugin consumers + +If you use [tauri-plugin-serialplugin](https://github.com/s00d/tauri-plugin-serialplugin) +instead of wiring JNI yourself, merge the plugin's `device_filter.xml`, ensure +USB host feature in your app manifest, and let the plugin handle enumerate / +permission / fd. Your frontend calls the same serial API as on desktop. + +## Fake transport (tests) + +```rust +#[cfg(feature = "fake-transport")] +fn example() { + use android_usb_serial::{open_port, FakeTransport, Transport}; + use std::sync::Arc; + + let fake = FakeTransport::cdc_single_iface(); + let transport: Arc = Arc::new(fake.clone()); + let mut port = open_port(transport, 0).unwrap(); + port.write(b"PING").unwrap(); + assert_eq!(fake.take_tx(), b"PING"); +} +``` + +## Features + +| Feature | Default | Description | +|---------|---------|-------------| +| `serialport-compat` | yes | Implements `serialport::SerialPort` | +| `fake-transport` | no | `FakeTransport` + `golden_record` binary | + +## Architecture + +```text +UsbManager (Kotlin) → permission → UsbDeviceConnection → fd (unclaimed) + ↓ + from_raw_fd / NusbTransport (this crate) + ↓ + ProbeTable → Ftdi / Cp21xx / Ch34x / … drivers + ↓ + SerialPortHandle (write / reader / modem / purge) +``` + +See **[Using on Android](#using-on-android)** for manifest, permissions, enumerate +JSON, and example apps. Kotlin owns USB policy; Rust owns protocol + bulk I/O. + +## Golden fixtures + +```bash +# Full parity gate (Java-sourced controls + bulkOut + rx_filter + probe) +cargo test -p android-usb-serial --features fake-transport --test golden_parity + +# All crate tests +cargo test -p android-usb-serial --features fake-transport + +# Optional: regen Rust-only driver fixtures (never overwrites source=java) +cargo run -p android-usb-serial --features fake-transport --bin golden_record +``` + +Breakdown: **560** Java control sequences, **6** RX-filter pairs, **1** probe table → **567** JSON files under `tests/fixtures/`. + +## Hardware spike + +```bash +# On device: ANDROID_USB_SPIKE_FD= +cargo test -p android-usb-serial --features fake-transport spike_fd_hardware -- --ignored +``` + +## License + +Licensed under either of + +- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE)) +- MIT license ([LICENSE-MIT](LICENSE-MIT)) + +at your option. + +Driver protocols include logic derived from usb-serial-for-android (MIT); see [NOTICE](NOTICE). + +## Publish (maintainers) + +```bash +# From workspace root +cargo test -p android-usb-serial --features fake-transport +cargo package -p android-usb-serial --allow-dirty # review pack list +cargo publish -p android-usb-serial --dry-run +cargo publish -p android-usb-serial +``` + +Version bumps: edit `version` in this crate’s `Cargo.toml` and the `android-usb-serial = { …, version = "…" }` entry in the workspace plugin `Cargo.toml`. + +## Related + +- [tauri-plugin-serialplugin](https://github.com/s00d/tauri-plugin-serialplugin) — Tauri integration (`UsbFdBridge` → this crate) +- [examples/usb-driver-tester](../../../examples/usb-driver-tester/) — standalone hardware tester +- [examples/serialport-test/ANDROID.md](../../../examples/serialport-test/ANDROID.md) — Tauri Android dev workflow +- Standalone apps can depend on this crate alone + a thin Kotlin fd bridge diff --git a/crates/android-usb-serial/src/bin/golden_record.rs b/crates/android-usb-serial/src/bin/golden_record.rs new file mode 100644 index 00000000..cde96315 --- /dev/null +++ b/crates/android-usb-serial/src/bin/golden_record.rs @@ -0,0 +1,464 @@ +//! Record golden USB control-transfer fixtures from Rust drivers (regen tool). +//! +//! Run: `cargo run -p android-usb-serial --features fake-transport --bin golden_record` + +use android_usb_serial::config::{DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits}; +use android_usb_serial::drivers::create_driver; +use android_usb_serial::fake::{FakeTransport, RecordedControl}; +use android_usb_serial::probe::DriverType; +use android_usb_serial::transport::{EndpointInfo, InterfaceInfo, Transport}; +use base64::Engine; +use serde::Serialize; +use std::fs; +use std::path::{Path, PathBuf}; +use std::sync::Arc; + +#[derive(Clone)] +struct Preset { + driver: &'static str, + driver_type: DriverType, + vendor_id: u16, + product_id: u16, + port_index: usize, + interfaces: Vec, + build_fake: fn() -> FakeTransport, +} + +#[derive(Serialize)] +struct GoldenFixture { + driver: String, + scenario: String, + #[serde(rename = "vendorId")] + vendor_id: u16, + #[serde(rename = "productId")] + product_id: u16, + #[serde(rename = "portIndex")] + port_index: usize, + interfaces: Vec, + controls: Vec, +} + +#[derive(Serialize, Clone)] +struct GoldenInterface { + id: u8, + #[serde(rename = "classId")] + class_id: u8, + subclass: u8, + protocol: u8, + #[serde(rename = "bulkIn")] + bulk_in: Option, + #[serde(rename = "bulkOut")] + bulk_out: Option, + #[serde(rename = "interruptIn")] + interrupt_in: Option, + #[serde(rename = "maxPacketSize")] + max_packet_size: u16, +} + +#[derive(Serialize)] +struct GoldenControl { + #[serde(rename = "requestType")] + request_type: u8, + request: u8, + value: u16, + index: u16, + data: String, +} + +fn fixture_dir() -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures") +} + +fn encode_controls(controls: &[RecordedControl]) -> Vec { + controls + .iter() + .map(|c| GoldenControl { + request_type: c.request_type, + request: c.request, + value: c.value, + index: c.index, + data: base64::engine::general_purpose::STANDARD.encode(&c.data), + }) + .collect() +} + +fn iface_layout( + id: u8, + class_id: u8, + bulk_in: u8, + bulk_out: u8, + interrupt_in: Option, +) -> (InterfaceInfo, GoldenInterface, (u8, Vec)) { + let info = InterfaceInfo { + id, + class: class_id, + subclass: 0, + protocol: 0, + }; + let golden = GoldenInterface { + id, + class_id, + subclass: 0, + protocol: 0, + bulk_in: Some(bulk_in), + bulk_out: Some(bulk_out), + interrupt_in, + max_packet_size: 64, + }; + let mut eps = vec![ + EndpointInfo { + address: bulk_in, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: bulk_out, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ]; + if let Some(int_ep) = interrupt_in { + eps.insert( + 0, + EndpointInfo { + address: int_ep, + attributes: 3, + max_packet_size: 64, + interval: 1, + }, + ); + } + (info, golden, (id, eps)) +} + +fn build_ftdi() -> FakeTransport { + let fake = FakeTransport::ftdi_ft232r(); + let (i0, _, e0) = iface_layout(0, 255, 0x81, 0x02, None); + fake.set_interfaces(vec![i0]); + fake.configure_endpoints(&[e0]); + fake +} + +fn build_cp21xx() -> FakeTransport { + let fake = FakeTransport::cp2102(); + let (i0, _, e0) = iface_layout(0, 255, 0x81, 0x02, None); + fake.set_interfaces(vec![i0]); + fake.configure_endpoints(&[e0]); + fake +} + +fn build_ch34x() -> FakeTransport { + let fake = FakeTransport::ch340_dual_iface(); + for _ in 0..4 { + fake.script_control_in_response(vec![0, 0]); + } + let (i0, _, _) = iface_layout(0, 255, 0x81, 0x02, None); + let (_, _, e1) = iface_layout(1, 255, 0x82, 0x03, None); + fake.set_interfaces(vec![ + i0, + InterfaceInfo { + id: 1, + class: 255, + subclass: 0, + protocol: 0, + }, + ]); + fake.configure_endpoints(&[e1]); + fake +} + +fn build_prolific() -> FakeTransport { + let fake = FakeTransport::pl2303_hx(); + fake.script_control_in_response(vec![0]); + let (i0, _, e0) = iface_layout(0, 255, 0x83, 0x02, Some(0x81)); + fake.set_interfaces(vec![i0]); + fake.configure_endpoints(&[e0]); + fake +} + +fn build_cdc() -> FakeTransport { + let fake = FakeTransport::cdc_single_iface(); + fake.set_vendor_product(0x2341, 0x0043); + let i0 = InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }; + let i1 = InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }; + let (_, _, e0) = iface_layout(0, 2, 0x81, 0x02, None); + let (_, _, e1) = iface_layout(1, 10, 0x83, 0x04, None); + fake.set_interfaces(vec![i0, i1]); + fake.configure_endpoints(&[e0, e1]); + fake +} + +fn build_gsm() -> FakeTransport { + let fake = FakeTransport::cdc_single_iface(); + fake.set_vendor_product(0x1782, 0x4D10); + let (i0, _, e0) = iface_layout(0, 255, 0x81, 0x02, None); + fake.set_interfaces(vec![i0]); + fake.configure_endpoints(&[e0]); + fake +} + +fn build_ccd() -> FakeTransport { + let fake = FakeTransport::cdc_single_iface(); + fake.set_vendor_product(0x18D1, 0x5014); + let mut ifaces = Vec::new(); + let mut eps = Vec::new(); + for n in 0..3u8 { + let (i, _, e) = iface_layout(n, 255, 0x81 + n * 2, 0x02 + n * 2, None); + ifaces.push(i); + eps.push(e); + } + fake.set_interfaces(ifaces); + fake.configure_endpoints(&eps); + fake +} + +fn presets() -> Vec { + let (_, g_ftdi, _) = iface_layout(0, 255, 0x81, 0x02, None); + let (_, g_cp, _) = iface_layout(0, 255, 0x81, 0x02, None); + let (_, g_ch, _) = iface_layout(1, 255, 0x82, 0x03, None); + let (_, g_pl, _) = iface_layout(0, 255, 0x83, 0x02, Some(0x81)); + let g_cdc0 = GoldenInterface { + id: 0, + class_id: 2, + subclass: 2, + protocol: 0, + bulk_in: Some(0x81), + bulk_out: Some(0x02), + interrupt_in: None, + max_packet_size: 64, + }; + let (_, g_cdc1, _) = iface_layout(1, 10, 0x83, 0x04, None); + let (_, g_gsm, _) = iface_layout(0, 255, 0x81, 0x02, None); + let mut ccd_golden = Vec::new(); + for n in 0..3u8 { + let (_, g, _) = iface_layout(n, 255, 0x81 + n * 2, 0x02 + n * 2, None); + ccd_golden.push(g); + } + + vec![ + Preset { + driver: "ftdi", + driver_type: DriverType::Ftdi, + vendor_id: 0x0403, + product_id: 0x6001, + port_index: 0, + interfaces: vec![g_ftdi], + build_fake: build_ftdi, + }, + Preset { + driver: "cp21xx", + driver_type: DriverType::Cp21xx, + vendor_id: 0x10C4, + product_id: 0xEA60, + port_index: 0, + interfaces: vec![g_cp], + build_fake: build_cp21xx, + }, + Preset { + driver: "ch34x", + driver_type: DriverType::Ch34x, + vendor_id: 0x1A86, + product_id: 0x7523, + port_index: 0, + interfaces: vec![g_ch], + build_fake: build_ch34x, + }, + Preset { + driver: "prolific", + driver_type: DriverType::Prolific, + vendor_id: 0x067B, + product_id: 0x2303, + port_index: 0, + interfaces: vec![g_pl], + build_fake: build_prolific, + }, + Preset { + driver: "cdc_acm", + driver_type: DriverType::CdcAcm, + vendor_id: 0x2341, + product_id: 0x0043, + port_index: 0, + interfaces: vec![g_cdc0, g_cdc1], + build_fake: build_cdc, + }, + Preset { + driver: "gsm_modem", + driver_type: DriverType::GsmModem, + vendor_id: 0x1782, + product_id: 0x4D10, + port_index: 0, + interfaces: vec![g_gsm], + build_fake: build_gsm, + }, + Preset { + driver: "chrome_ccd", + driver_type: DriverType::ChromeCcd, + vendor_id: 0x18D1, + product_id: 0x5014, + port_index: 0, + interfaces: ccd_golden, + build_fake: build_ccd, + }, + ] +} + +fn record_scenario( + preset: &Preset, + scenario: &str, + run: impl FnOnce(&mut dyn android_usb_serial::drivers::Driver, &Preset), +) { + let fake = (preset.build_fake)(); + let transport: Arc = Arc::new(fake.clone()); + let mut driver = create_driver(preset.driver_type, preset.port_index); + driver.open(&transport).expect("open"); + run(driver.as_mut(), preset); + driver.close().expect("close"); + + let fixture = GoldenFixture { + driver: preset.driver.to_string(), + scenario: scenario.to_string(), + vendor_id: preset.vendor_id, + product_id: preset.product_id, + port_index: preset.port_index, + interfaces: preset.interfaces.clone(), + controls: encode_controls(&fake.recorded_controls()), + }; + + let dir = fixture_dir().join(preset.driver); + fs::create_dir_all(&dir).expect("mkdir"); + let path = dir.join(format!("{scenario}.json")); + if path.exists() { + let existing = fs::read_to_string(&path).unwrap_or_default(); + if existing.contains("\"source\":\"java\"") || existing.contains("\"source\": \"java\"") { + eprintln!("skip (java): {}", path.display()); + return; + } + } + let json = serde_json::to_string_pretty(&fixture).expect("json"); + fs::write(&path, json).expect("write"); + eprintln!("wrote {}", path.display()); +} + +fn line_115200() -> LineConfig { + LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + } +} + +fn supported_flows(driver: &str) -> Vec { + match driver { + "ftdi" => vec![ + FlowControl::None, + FlowControl::RtsCts, + FlowControl::DtrDsr, + FlowControl::XonXoffInline, + ], + "cp21xx" => vec![ + FlowControl::None, + FlowControl::RtsCts, + FlowControl::DtrDsr, + FlowControl::XonXoff, + ], + "prolific" => vec![ + FlowControl::None, + FlowControl::RtsCts, + FlowControl::XonXoffInline, + ], + _ => vec![FlowControl::None, FlowControl::RtsCts, FlowControl::DtrDsr], + } +} + +fn main() { + let baud_rates = [ + 300, 1200, 9600, 19200, 38400, 57600, 115_200, 230_400, 460_800, 921_600, + ]; + + for preset in presets() { + record_scenario(&preset, "open_default", |d, p| { + if p.driver != "gsm_modem" && p.driver != "chrome_ccd" { + d.set_line_config(line_115200()).ok(); + } + let _ = d.set_dtr(true); + let _ = d.set_rts(true); + }); + + if preset.driver == "cdc_acm" { + record_scenario(&preset, "open_line_config", |d, _| { + d.set_line_config(line_115200()).expect("line"); + let _ = d.set_dtr(true); + let _ = d.set_rts(true); + }); + } + + if !matches!(preset.driver, "gsm_modem" | "chrome_ccd") { + for &baud in &baud_rates { + let name = format!("set_baud_{baud}"); + record_scenario(&preset, &name, |d, _| { + let mut cfg = line_115200(); + cfg.baud_rate = baud; + d.set_line_config(cfg).ok(); + }); + } + + for flow in supported_flows(preset.driver) { + let name = format!("flow_{flow:?}"); + record_scenario(&preset, &name, |d, _| { + d.set_line_config(line_115200()).ok(); + d.set_flow_control(flow).ok(); + }); + } + + record_scenario(&preset, "dtr_on", |d, _| { + d.set_dtr(true).ok(); + }); + record_scenario(&preset, "dtr_off", |d, _| { + d.set_dtr(false).ok(); + }); + record_scenario(&preset, "rts_on", |d, _| { + d.set_rts(true).ok(); + }); + record_scenario(&preset, "rts_off", |d, _| { + d.set_rts(false).ok(); + }); + record_scenario(&preset, "break_on", |d, _| { + d.set_break(true).ok(); + }); + record_scenario(&preset, "break_off", |d, _| { + d.set_break(false).ok(); + }); + record_scenario(&preset, "purge_rx", |d, _| { + d.purge(PurgeKind::Rx).ok(); + }); + record_scenario(&preset, "purge_tx", |d, _| { + d.purge(PurgeKind::Tx).ok(); + }); + record_scenario(&preset, "purge_both", |d, _| { + d.purge(PurgeKind::Both).ok(); + }); + record_scenario(&preset, "modem_status", |d, _| { + let _ = d.modem_status(); + }); + } + + record_scenario(&preset, "close", |d, p| { + if p.driver != "gsm_modem" && p.driver != "chrome_ccd" { + d.set_line_config(line_115200()).ok(); + } + }); + } +} diff --git a/crates/android-usb-serial/src/config.rs b/crates/android-usb-serial/src/config.rs new file mode 100644 index 00000000..3a91a21e --- /dev/null +++ b/crates/android-usb-serial/src/config.rs @@ -0,0 +1,73 @@ +//! Line configuration types (no plugin dependency). + +/// ASCII XON (DC1). +pub const CHAR_XON: u8 = 17; +/// ASCII XOFF (DC3). +pub const CHAR_XOFF: u8 = 19; + +/// Number of data bits in the serial frame. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum DataBits { + Five, + Six, + Seven, + Eight, +} + +/// Parity bit mode. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Parity { + None, + Odd, + Even, + Mark, + Space, +} + +/// Stop bits. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum StopBits { + One, + OnePointFive, + Two, +} + +/// Hardware / software flow control. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum FlowControl { + None, + RtsCts, + DtrDsr, + /// Host software XON/XOFF (CP21xx). + XonXoff, + /// Inline filter on RX (FTDI, PL2303). + XonXoffInline, +} + +/// Which UART buffers to purge. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum PurgeKind { + Rx, + Tx, + Both, +} + +/// Baud rate and framing for [`crate::SerialPortHandle::set_line_config`]. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct LineConfig { + pub baud_rate: u32, + pub data_bits: DataBits, + pub parity: Parity, + pub stop_bits: StopBits, +} + +impl Default for LineConfig { + fn default() -> Self { + Self { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + } + } +} diff --git a/crates/android-usb-serial/src/device.rs b/crates/android-usb-serial/src/device.rs new file mode 100644 index 00000000..e6aa8e85 --- /dev/null +++ b/crates/android-usb-serial/src/device.rs @@ -0,0 +1,73 @@ +//! Device discovery and port enumeration. +//! +//! Use [`describe_device`] after the transport is ready (interfaces readable) to learn +//! how many serial ports the chip exposes, then [`open_port`] with a zero-based index. + +use crate::drivers::create_driver; +use crate::error::{Result, UsbSerialError}; +use crate::probe::{DriverType, ProbeTable}; +use crate::transport::SharedTransport; + +/// One logical serial port exposed by a USB composite / multi-interface device. +#[derive(Debug, Clone)] +pub struct PortDescriptor { + /// Zero-based index passed to [`open_port`]. + pub port_index: usize, + /// Driver selected by [`ProbeTable`] for this product. + pub driver: DriverType, + pub vendor_id: u16, + pub product_id: u16, +} + +/// USB device identify + probed driver and ports. +#[derive(Debug, Clone)] +pub struct DeviceDescriptor { + pub vendor_id: u16, + pub product_id: u16, + pub driver: DriverType, + /// One entry per openable port (`port_index` 0..n). + pub ports: Vec, +} + +/// Probe VID/PID + interface layout without opening a driver session. +pub fn describe_device(transport: &SharedTransport) -> Result { + let desc = transport.raw_device_descriptor(); + let vendor_id = u16::from_le_bytes([desc[8], desc[9]]); + let product_id = u16::from_le_bytes([desc[10], desc[11]]); + let table = ProbeTable::default_table(); + let ifaces = transport.interfaces(); + let driver = table.find(vendor_id, product_id, &ifaces); + let count = table.port_count(driver, &ifaces).max(1); + let ports = (0..count) + .map(|i| PortDescriptor { + port_index: i, + driver, + vendor_id, + product_id, + }) + .collect(); + Ok(DeviceDescriptor { + vendor_id, + product_id, + driver, + ports, + }) +} + +/// Open port `port_index` (0 for single-port chips like CH340). +/// +/// Claims / initializes the matching vendor driver on `transport`. The reader is **not** +/// started here — call [`crate::SerialPortHandle::start_reader`] after line config / DTR. +pub fn open_port( + transport: SharedTransport, + port_index: usize, +) -> Result { + let device = describe_device(&transport)?; + let port = device + .ports + .get(port_index) + .ok_or_else(|| UsbSerialError::Unsupported(format!("port {port_index}")))?; + let mut driver = create_driver(port.driver, port_index); + driver.open(&transport)?; + Ok(crate::port::SerialPortHandle::new(transport, driver)) +} diff --git a/crates/android-usb-serial/src/drivers/cdc_acm.rs b/crates/android-usb-serial/src/drivers/cdc_acm.rs new file mode 100644 index 00000000..e2f539e0 --- /dev/null +++ b/crates/android-usb-serial/src/drivers/cdc_acm.rs @@ -0,0 +1,201 @@ +//! CDC ACM driver. + +use super::{line_coding_bytes, Driver, EndpointPair, ModemStatus, WRITE_TIMEOUT_MS}; +use crate::config::{FlowControl, LineConfig, PurgeKind}; +use crate::error::{Result, UsbSerialError}; +use crate::reader::SerialReader; +use crate::transport::{ControlRequest, SharedTransport, USB_RECIP_INTERFACE, USB_TYPE_CLASS}; + +const USB_SUBCLASS_ACM: u8 = 2; +const SET_LINE_CODING: u8 = 0x20; +const SET_CONTROL_LINE_STATE: u8 = 0x22; +const SEND_BREAK: u8 = 0x23; + +pub struct CdcAcmDriver { + port_index: usize, + control_index: u8, + control_iface: u8, + data_iface: u8, + dtr: bool, + rts: bool, + endpoints: Option, + transport: Option, + reader: Option, +} + +impl CdcAcmDriver { + pub fn new(port_index: usize) -> Self { + Self { + port_index, + control_index: 0, + control_iface: 0, + data_iface: 0, + dtr: false, + rts: false, + endpoints: None, + transport: None, + reader: None, + } + } + + fn acm_control(&self, request: u8, value: u16, data: Vec) -> Result<()> { + let transport = self.transport.as_ref().unwrap(); + let req = ControlRequest { + request_type: USB_TYPE_CLASS | USB_RECIP_INTERFACE, + request, + value, + index: self.control_index as u16, + data, + timeout_ms: WRITE_TIMEOUT_MS, + }; + transport.control_out(&req)?; + Ok(()) + } + + fn resolve_interfaces(&mut self, transport: &SharedTransport) -> Result<()> { + let ifaces = transport.interfaces(); + let desc = transport.raw_device_descriptor(); + let is_iad = desc.len() >= 7 && desc[4] == 0xEF && desc[5] == 0x02 && desc[6] == 0x01; + if is_iad { + if let Some((ctrl, data)) = resolve_iad_pair(transport, self.port_index) { + self.control_iface = ctrl; + self.data_iface = data; + self.control_index = ctrl; + return Ok(()); + } + } + let comm: Vec = ifaces + .iter() + .filter(|i| i.class == 2 && i.subclass == USB_SUBCLASS_ACM) + .map(|i| i.id) + .collect(); + let data: Vec = ifaces + .iter() + .filter(|i| i.class == 10) + .map(|i| i.id) + .collect(); + if comm.is_empty() && data.is_empty() { + // single-interface castrated ACM + if let Some(iface) = ifaces.first() { + self.control_iface = iface.id; + self.data_iface = iface.id; + self.control_index = iface.id; + return Ok(()); + } + return Err(UsbSerialError::ProbeFailed("no CDC interfaces".into())); + } + if comm.is_empty() { + return Err(UsbSerialError::ProbeFailed("no CDC comm interfaces".into())); + } + let idx = self.port_index.min(comm.len() - 1); + self.control_iface = comm[idx]; + self.data_iface = data.get(idx).copied().unwrap_or(comm[idx]); + self.control_index = self.control_iface; + Ok(()) + } +} + +fn resolve_iad_pair(transport: &SharedTransport, port_index: usize) -> Option<(u8, u8)> { + let raw = transport.raw_descriptors(); + let mut iad_ports: Vec<(u8, u8)> = Vec::new(); + let mut pos = 0usize; + while pos + 2 <= raw.len() { + let len = raw[pos] as usize; + if len < 2 || pos + len > raw.len() { + break; + } + if raw[pos + 1] == 0x0B && len >= 8 && raw[pos + 4] == 2 && raw[pos + 5] == 2 { + let first = raw[pos + 2]; + let count = raw[pos + 3]; + if count >= 2 { + iad_ports.push((first, first + 1)); + } + } + pos += len; + } + iad_ports.get(port_index).copied() +} + +impl Driver for CdcAcmDriver { + fn open(&mut self, transport: &SharedTransport) -> Result<()> { + self.transport = Some(transport.clone()); + self.resolve_interfaces(transport)?; + transport.claim_interface(self.control_iface)?; + if self.data_iface != self.control_iface { + transport.claim_interface(self.data_iface)?; + } + self.endpoints = Some(EndpointPair::open(transport, self.data_iface)?); + Ok(()) + } + + fn close(&mut self) -> Result<()> { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + if let Some(t) = &self.transport { + let _ = t.release_interface(self.data_iface); + if self.control_iface != self.data_iface { + let _ = t.release_interface(self.control_iface); + } + } + self.endpoints = None; + Ok(()) + } + + fn write(&mut self, data: &[u8]) -> Result { + let transport = self.transport.as_ref().unwrap(); + self.endpoints.as_mut().unwrap().write(transport, data) + } + + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + Ok(0) + } + + fn set_line_config(&mut self, cfg: LineConfig) -> Result<()> { + self.acm_control(SET_LINE_CODING, 0, line_coding_bytes(&cfg).to_vec()) + } + + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + if flow == FlowControl::None { + Ok(()) + } else { + Err(UsbSerialError::Unsupported("flow control".into())) + } + } + + fn set_dtr(&mut self, value: bool) -> Result<()> { + self.dtr = value; + let v = (self.rts as u16) << 1 | (self.dtr as u16); + self.acm_control(SET_CONTROL_LINE_STATE, v, vec![]) + } + + fn set_rts(&mut self, value: bool) -> Result<()> { + self.rts = value; + let v = (self.rts as u16) << 1 | (self.dtr as u16); + self.acm_control(SET_CONTROL_LINE_STATE, v, vec![]) + } + + fn set_break(&mut self, enabled: bool) -> Result<()> { + self.acm_control(SEND_BREAK, if enabled { 0xffff } else { 0 }, vec![]) + } + + fn purge(&mut self, _kind: PurgeKind) -> Result<()> { + Ok(()) + } + + fn modem_status(&mut self) -> Result { + Ok(ModemStatus::default()) + } + + fn bulk_in_mps(&self) -> u16 { + self.endpoints.as_ref().map(|e| e.mps).unwrap_or(64) + } + + fn take_bulk_in(&mut self) -> Option> { + let transport = self.transport.as_ref()?; + self.endpoints.as_mut()?.take_in(transport) + } +} diff --git a/crates/android-usb-serial/src/drivers/ch34x.rs b/crates/android-usb-serial/src/drivers/ch34x.rs new file mode 100644 index 00000000..d1c46a39 --- /dev/null +++ b/crates/android-usb-serial/src/drivers/ch34x.rs @@ -0,0 +1,281 @@ +//! WCH CH34x driver. + +use super::{Driver, EndpointPair, ModemStatus, WRITE_TIMEOUT_MS}; +use crate::config::{DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits}; +use crate::error::{Result, UsbSerialError}; +use crate::reader::SerialReader; +use crate::transport::{ControlRequest, SharedTransport}; + +const LCR_ENABLE_RX: u16 = 0x80; +const LCR_ENABLE_TX: u16 = 0x40; +const LCR_MARK_SPACE: u16 = 0x20; +const LCR_PAR_EVEN: u16 = 0x10; +const LCR_ENABLE_PAR: u16 = 0x08; +const LCR_STOP_BITS_2: u16 = 0x04; +const LCR_CS8: u16 = 0x03; +const LCR_CS7: u16 = 0x02; +const LCR_CS6: u16 = 0x01; +const LCR_CS5: u16 = 0x00; + +const GCL_CTS: u8 = 0x01; +const GCL_DSR: u8 = 0x02; +const GCL_RI: u8 = 0x04; +const GCL_CD: u8 = 0x08; +const SCL_DTR: u16 = 0x20; +const SCL_RTS: u16 = 0x40; + +const DEFAULT_BAUD_RATE: u32 = 9600; + +pub struct Ch34xDriver { + #[allow(dead_code)] + port_index: usize, + iface: u8, + dtr: bool, + rts: bool, + endpoints: Option, + transport: Option, + reader: Option, +} + +impl Ch34xDriver { + pub fn new(port_index: usize) -> Self { + Self { + port_index, + iface: 0, + dtr: false, + rts: false, + endpoints: None, + transport: None, + reader: None, + } + } + + fn vendor_out(&self, request: u8, value: u16, index: u16) -> Result<()> { + self.transport + .as_ref() + .unwrap() + .control_out(&ControlRequest { + request_type: 0x40, + request, + value, + index, + data: vec![], + timeout_ms: WRITE_TIMEOUT_MS, + }) + .map(|_| ()) + } + + fn vendor_in(&self, request: u8, value: u16, index: u16, len: usize) -> Result> { + self.transport + .as_ref() + .unwrap() + .control_in(&ControlRequest::vendor_in(request, value, index, len)) + } + + fn check_state(&self, request: u8, value: u16, expected: &[Option]) -> Result<()> { + let buf = self.vendor_in(request, value, 0, expected.len())?; + if buf.len() != expected.len() { + return Err(UsbSerialError::Io(format!( + "checkState: expected {} bytes, got {}", + expected.len(), + buf.len() + ))); + } + for (i, exp) in expected.iter().enumerate() { + if let Some(want) = exp { + if buf[i] != *want { + return Err(UsbSerialError::Io(format!( + "checkState byte[{i}]: expected 0x{want:02x}, got 0x{:02x}", + buf[i] + ))); + } + } + } + Ok(()) + } + + fn get_status(&self) -> Result { + let buf = self.vendor_in(0x95, 0x0706, 0, 2)?; + Ok(buf[0]) + } +} + +impl Driver for Ch34xDriver { + fn open(&mut self, transport: &SharedTransport) -> Result<()> { + self.transport = Some(transport.clone()); + for iface in transport.interfaces() { + transport.claim_interface(iface.id)?; + } + self.iface = transport.interfaces().last().map(|i| i.id).unwrap_or(0); + self.endpoints = Some(EndpointPair::open(transport, self.iface)?); + self.initialize()?; + self.set_baud(DEFAULT_BAUD_RATE)?; + Ok(()) + } + + fn close(&mut self) -> Result<()> { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + if let Some(t) = &self.transport { + for iface in t.interfaces() { + let _ = t.release_interface(iface.id); + } + } + self.endpoints = None; + Ok(()) + } + + fn write(&mut self, data: &[u8]) -> Result { + let t = self.transport.as_ref().unwrap(); + self.endpoints.as_mut().unwrap().write(t, data) + } + + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + Ok(0) + } + + fn set_line_config(&mut self, cfg: LineConfig) -> Result<()> { + if cfg.baud_rate == 0 { + return Err(UsbSerialError::Unsupported("invalid baud rate".into())); + } + self.set_baud(cfg.baud_rate)?; + + let mut lcr = LCR_ENABLE_RX | LCR_ENABLE_TX; + lcr |= match cfg.data_bits { + DataBits::Five => LCR_CS5, + DataBits::Six => LCR_CS6, + DataBits::Seven => LCR_CS7, + DataBits::Eight => LCR_CS8, + }; + if cfg.stop_bits == StopBits::Two { + lcr |= LCR_STOP_BITS_2; + } else if cfg.stop_bits == StopBits::OnePointFive { + return Err(UsbSerialError::Unsupported("stop bits 1.5".into())); + } + lcr |= match cfg.parity { + Parity::None => 0, + Parity::Odd => LCR_ENABLE_PAR, + Parity::Even => LCR_ENABLE_PAR | LCR_PAR_EVEN, + Parity::Mark => LCR_ENABLE_PAR | LCR_MARK_SPACE, + Parity::Space => LCR_ENABLE_PAR | LCR_MARK_SPACE | LCR_PAR_EVEN, + }; + self.vendor_out(0x9A, 0x2518, lcr) + } + + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + if flow == FlowControl::None { + Ok(()) + } else { + Err(UsbSerialError::Unsupported("flow control".into())) + } + } + + fn set_dtr(&mut self, value: bool) -> Result<()> { + self.dtr = value; + self.set_control_lines() + } + + fn set_rts(&mut self, value: bool) -> Result<()> { + self.rts = value; + self.set_control_lines() + } + + fn set_break(&mut self, enabled: bool) -> Result<()> { + let mut req = self.vendor_in(0x95, 0x1805, 0, 2)?; + if enabled { + req[0] &= !1; + req[1] &= !0x40; + } else { + req[0] |= 1; + req[1] |= 0x40; + } + let val = ((req[1] as u16) << 8) | (req[0] as u16); + self.vendor_out(0x9A, 0x1805, val) + } + + fn purge(&mut self, _kind: PurgeKind) -> Result<()> { + Ok(()) + } + + fn modem_status(&mut self) -> Result { + let status = self.get_status()?; + Ok(ModemStatus { + cts: (status & GCL_CTS) == 0, + dsr: (status & GCL_DSR) == 0, + ri: (status & GCL_RI) == 0, + cd: (status & GCL_CD) == 0, + }) + } + + fn bulk_in_mps(&self) -> u16 { + self.endpoints.as_ref().map(|e| e.mps).unwrap_or(64) + } + + fn take_bulk_in(&mut self) -> Option> { + let transport = self.transport.as_ref()?; + self.endpoints.as_mut()?.take_in(transport) + } +} + +impl Ch34xDriver { + fn initialize(&self) -> Result<()> { + self.check_state(0x5F, 0, &[None, Some(0x00)])?; + self.vendor_out(0xA1, 0, 0)?; + self.set_baud(DEFAULT_BAUD_RATE)?; + self.check_state(0x95, 0x2518, &[None, Some(0x00)])?; + self.vendor_out(0x9A, 0x2518, LCR_ENABLE_RX | LCR_ENABLE_TX | LCR_CS8)?; + self.check_state(0x95, 0x0706, &[None, None])?; + self.vendor_out(0xA1, 0x501F, 0xD90A)?; + self.set_baud(DEFAULT_BAUD_RATE)?; + self.set_control_lines()?; + self.check_state(0x95, 0x0706, &[None, None])?; + Ok(()) + } + + fn set_baud(&self, baud: u32) -> Result<()> { + let (val1, val2) = if baud == 921_600 { + let divisor = 7u16 | 0x0080; + let factor = 0xF300u16; + let val1 = (factor & 0xFF00) | divisor; + let val2 = factor & 0xFF; + (val1, val2) + } else { + const BAUDBASE_FACTOR: u64 = 1_532_620_800; + const BAUDBASE_DIVMAX: u32 = 3; + + let mut factor = BAUDBASE_FACTOR / baud as u64; + let mut divisor = BAUDBASE_DIVMAX; + while factor > 0xfff0 && divisor > 0 { + factor >>= 3; + divisor -= 1; + } + if factor > 0xfff0 { + return Err(UsbSerialError::Unsupported(format!( + "unsupported baud rate: {baud}" + ))); + } + factor = 0x10000 - factor; + let divisor = divisor | 0x0080; + let val1 = ((factor & 0xff00) as u16) | divisor as u16; + let val2 = (factor & 0xff) as u16; + (val1, val2) + }; + self.vendor_out(0x9A, 0x1312, val1)?; + self.vendor_out(0x9A, 0x0F2C, val2) + } + + fn set_control_lines(&self) -> Result<()> { + let mut value = 0u16; + if self.dtr { + value |= SCL_DTR; + } + if self.rts { + value |= SCL_RTS; + } + self.vendor_out(0xA4, !value, 0) + } +} diff --git a/crates/android-usb-serial/src/drivers/chrome_ccd.rs b/crates/android-usb-serial/src/drivers/chrome_ccd.rs new file mode 100644 index 00000000..31c070c4 --- /dev/null +++ b/crates/android-usb-serial/src/drivers/chrome_ccd.rs @@ -0,0 +1,100 @@ +//! Google Chrome OS CCD (3 ports — interface N = port N, no CDC init). + +use super::{Driver, EndpointPair, ModemStatus}; +use crate::config::{FlowControl, LineConfig, PurgeKind}; +use crate::error::{Result, UsbSerialError}; +use crate::reader::SerialReader; +use crate::transport::SharedTransport; + +pub struct ChromeCcdDriver { + port_index: usize, + iface: u8, + endpoints: Option, + transport: Option, + reader: Option, +} + +impl ChromeCcdDriver { + pub fn new(port_index: usize) -> Self { + Self { + port_index, + iface: port_index as u8, + endpoints: None, + transport: None, + reader: None, + } + } +} + +impl Driver for ChromeCcdDriver { + fn open(&mut self, transport: &SharedTransport) -> Result<()> { + self.transport = Some(transport.clone()); + self.iface = self.port_index as u8; + transport.claim_interface(self.iface)?; + self.endpoints = Some(EndpointPair::open(transport, self.iface)?); + Ok(()) + } + + fn close(&mut self) -> Result<()> { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + if let Some(t) = &self.transport { + let _ = t.release_interface(self.iface); + } + self.endpoints = None; + Ok(()) + } + + fn write(&mut self, data: &[u8]) -> Result { + let t = self.transport.as_ref().unwrap(); + self.endpoints.as_mut().unwrap().write(t, data) + } + + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + Ok(0) + } + + fn set_line_config(&mut self, _cfg: LineConfig) -> Result<()> { + Err(UsbSerialError::Unsupported("line config".into())) + } + + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + if flow != FlowControl::None { + return Err(UsbSerialError::Unsupported("flow control".into())); + } + Ok(()) + } + + fn set_dtr(&mut self, _value: bool) -> Result<()> { + Err(UsbSerialError::Unsupported("dtr".into())) + } + + fn set_rts(&mut self, _value: bool) -> Result<()> { + Err(UsbSerialError::Unsupported("rts".into())) + } + + fn set_break(&mut self, _enabled: bool) -> Result<()> { + Err(UsbSerialError::Unsupported("break".into())) + } + + fn purge(&mut self, _kind: PurgeKind) -> Result<()> { + Err(UsbSerialError::Unsupported("purge".into())) + } + + fn modem_status(&mut self) -> Result { + Ok(ModemStatus::default()) + } + + fn bulk_in_mps(&self) -> u16 { + self.endpoints.as_ref().map(|e| e.mps).unwrap_or(64) + } + + fn take_bulk_in(&mut self) -> Option> { + let transport = self.transport.as_ref()?; + self.endpoints.as_mut()?.take_in(transport) + } +} diff --git a/crates/android-usb-serial/src/drivers/cp21xx.rs b/crates/android-usb-serial/src/drivers/cp21xx.rs new file mode 100644 index 00000000..e93d0e7b --- /dev/null +++ b/crates/android-usb-serial/src/drivers/cp21xx.rs @@ -0,0 +1,321 @@ +//! Silicon Labs CP21xx driver. + +use super::{Driver, EndpointPair, ModemStatus, WRITE_TIMEOUT_MS}; +use crate::config::{ + DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits, CHAR_XOFF, CHAR_XON, +}; +use crate::error::{Result, UsbSerialError}; +use crate::reader::SerialReader; +use crate::transport::{ControlRequest, SharedTransport}; + +const REQTYPE_HOST_TO_DEVICE: u8 = 0x41; +const REQTYPE_DEVICE_TO_HOST: u8 = 0xC1; + +const SILABSER_IFC_ENABLE_REQUEST_CODE: u8 = 0x00; +const SILABSER_SET_LINE_CTL_REQUEST_CODE: u8 = 0x03; +const SILABSER_SET_BREAK_REQUEST_CODE: u8 = 0x05; +const SILABSER_SET_MHS_REQUEST_CODE: u8 = 0x07; +const SILABSER_GET_MDMSTS_REQUEST_CODE: u8 = 0x08; +const SILABSER_SET_XON_REQUEST_CODE: u8 = 0x09; +const SILABSER_SET_XOFF_REQUEST_CODE: u8 = 0x0A; +const SILABSER_FLUSH_REQUEST_CODE: u8 = 0x12; +const SILABSER_SET_FLOW_REQUEST_CODE: u8 = 0x13; +const SILABSER_SET_CHARS_REQUEST_CODE: u8 = 0x19; +const SILABSER_SET_BAUDRATE_REQUEST_CODE: u8 = 0x1E; + +const UART_ENABLE: u16 = 0x0001; +const UART_DISABLE: u16 = 0x0000; + +const DTR_ENABLE: u16 = 0x0101; +const DTR_DISABLE: u16 = 0x0100; +const RTS_ENABLE: u16 = 0x0202; +const RTS_DISABLE: u16 = 0x0200; + +const STATUS_CTS: u8 = 0x10; +const STATUS_DSR: u8 = 0x20; +const STATUS_RI: u8 = 0x40; +const STATUS_CD: u8 = 0x80; + +pub struct Cp21xxDriver { + port_index: usize, + iface: u8, + dtr: bool, + rts: bool, + is_restricted_port: bool, + endpoints: Option, + transport: Option, + reader: Option, +} + +impl Cp21xxDriver { + pub fn new(port_index: usize) -> Self { + Self { + port_index, + iface: port_index as u8, + dtr: false, + rts: false, + is_restricted_port: false, + endpoints: None, + transport: None, + reader: None, + } + } + + fn cfg_out(&self, request: u8, value: u16) -> Result<()> { + self.transport + .as_ref() + .unwrap() + .control_out(&ControlRequest { + request_type: REQTYPE_HOST_TO_DEVICE, + request, + value, + index: self.port_index as u16, + data: vec![], + timeout_ms: WRITE_TIMEOUT_MS, + })?; + Ok(()) + } + + fn cfg_out_data(&self, request: u8, value: u16, data: Vec) -> Result<()> { + self.transport + .as_ref() + .unwrap() + .control_out(&ControlRequest { + request_type: REQTYPE_HOST_TO_DEVICE, + request, + value, + index: self.port_index as u16, + data, + timeout_ms: WRITE_TIMEOUT_MS, + })?; + Ok(()) + } + + fn cfg_in(&self, request: u8, value: u16, length: usize) -> Result> { + self.transport + .as_ref() + .unwrap() + .control_in(&ControlRequest { + request_type: REQTYPE_DEVICE_TO_HOST, + request, + value, + index: self.port_index as u16, + data: vec![0; length], + timeout_ms: WRITE_TIMEOUT_MS, + }) + } + + fn set_xon(&self, value: bool) -> Result<()> { + self.cfg_out( + if value { + SILABSER_SET_XON_REQUEST_CODE + } else { + SILABSER_SET_XOFF_REQUEST_CODE + }, + 0, + ) + } +} + +impl Driver for Cp21xxDriver { + fn open(&mut self, transport: &SharedTransport) -> Result<()> { + self.transport = Some(transport.clone()); + let iface_count = transport.interfaces().len(); + if self.port_index >= iface_count { + return Err(UsbSerialError::Io(format!( + "unknown port number {}", + self.port_index + ))); + } + self.is_restricted_port = iface_count == 2 && self.port_index == 1; + self.iface = self.port_index as u8; + transport.claim_interface(self.iface)?; + self.endpoints = Some(EndpointPair::open(transport, self.iface)?); + self.cfg_out(SILABSER_IFC_ENABLE_REQUEST_CODE, UART_ENABLE)?; + self.cfg_out( + SILABSER_SET_MHS_REQUEST_CODE, + (if self.dtr { DTR_ENABLE } else { DTR_DISABLE }) + | (if self.rts { RTS_ENABLE } else { RTS_DISABLE }), + )?; + self.set_flow_control(FlowControl::None)?; + Ok(()) + } + + fn close(&mut self) -> Result<()> { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + let _ = self.cfg_out(SILABSER_IFC_ENABLE_REQUEST_CODE, UART_DISABLE); + if let Some(t) = &self.transport { + let _ = t.release_interface(self.iface); + } + self.endpoints = None; + Ok(()) + } + + fn write(&mut self, data: &[u8]) -> Result { + let t = self.transport.as_ref().unwrap(); + self.endpoints.as_mut().unwrap().write(t, data) + } + + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + Ok(0) + } + + fn set_line_config(&mut self, cfg: LineConfig) -> Result<()> { + if cfg.baud_rate == 0 { + return Err(UsbSerialError::Unsupported("invalid baud rate".into())); + } + self.cfg_out_data( + SILABSER_SET_BAUDRATE_REQUEST_CODE, + 0, + vec![ + (cfg.baud_rate & 0xff) as u8, + ((cfg.baud_rate >> 8) & 0xff) as u8, + ((cfg.baud_rate >> 16) & 0xff) as u8, + ((cfg.baud_rate >> 24) & 0xff) as u8, + ], + )?; + + let mut bits = 0u16; + match cfg.data_bits { + DataBits::Five => { + if self.is_restricted_port { + return Err(UsbSerialError::Unsupported("data bits 5".into())); + } + bits |= 0x0500; + } + DataBits::Six => { + if self.is_restricted_port { + return Err(UsbSerialError::Unsupported("data bits 6".into())); + } + bits |= 0x0600; + } + DataBits::Seven => { + if self.is_restricted_port { + return Err(UsbSerialError::Unsupported("data bits 7".into())); + } + bits |= 0x0700; + } + DataBits::Eight => bits |= 0x0800, + }; + match cfg.parity { + Parity::None => {} + Parity::Odd => bits |= 0x0010, + Parity::Even => bits |= 0x0020, + Parity::Mark => { + if self.is_restricted_port { + return Err(UsbSerialError::Unsupported("parity mark".into())); + } + bits |= 0x0030; + } + Parity::Space => { + if self.is_restricted_port { + return Err(UsbSerialError::Unsupported("parity space".into())); + } + bits |= 0x0040; + } + } + match cfg.stop_bits { + StopBits::One => {} + StopBits::OnePointFive => { + return Err(UsbSerialError::Unsupported("stop bits 1.5".into())); + } + StopBits::Two => { + if self.is_restricted_port { + return Err(UsbSerialError::Unsupported("stop bits 2".into())); + } + bits |= 2; + } + } + self.cfg_out(SILABSER_SET_LINE_CTL_REQUEST_CODE, bits) + } + + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + if flow == FlowControl::XonXoffInline { + return Err(UsbSerialError::Unsupported("xon/xoff inline".into())); + } + + let mut data = vec![0u8; 16]; + if flow == FlowControl::RtsCts { + data[4] |= 0b1000_0000; + data[0] |= 0b0000_1000; + } else if self.rts { + data[4] |= 0b0100_0000; + } + if flow == FlowControl::DtrDsr { + data[0] |= 0b0000_0010; + data[0] |= 0b0001_0000; + } else if self.dtr { + data[0] |= 0b0000_0001; + } + if flow == FlowControl::XonXoff { + self.cfg_out_data( + SILABSER_SET_CHARS_REQUEST_CODE, + 0, + vec![0, 0, 0, 0, CHAR_XON, CHAR_XOFF], + )?; + data[4] |= 0b0000_0011; + data[7] |= 0b1000_0000; + data[8] = 128; + data[12] = 128; + } + self.cfg_out_data(SILABSER_SET_FLOW_REQUEST_CODE, 0, data)?; + if flow == FlowControl::XonXoff { + self.set_xon(true)?; + } + Ok(()) + } + + fn set_dtr(&mut self, value: bool) -> Result<()> { + self.dtr = value; + self.cfg_out( + SILABSER_SET_MHS_REQUEST_CODE, + if value { DTR_ENABLE } else { DTR_DISABLE }, + ) + } + + fn set_rts(&mut self, value: bool) -> Result<()> { + self.rts = value; + self.cfg_out( + SILABSER_SET_MHS_REQUEST_CODE, + if value { RTS_ENABLE } else { RTS_DISABLE }, + ) + } + + fn set_break(&mut self, enabled: bool) -> Result<()> { + self.cfg_out(SILABSER_SET_BREAK_REQUEST_CODE, if enabled { 1 } else { 0 }) + } + + fn purge(&mut self, kind: PurgeKind) -> Result<()> { + let v = match kind { + PurgeKind::Rx => 0x0005, + PurgeKind::Tx => 0x000a, + PurgeKind::Both => 0x000f, + }; + self.cfg_out(SILABSER_FLUSH_REQUEST_CODE, v) + } + + fn modem_status(&mut self) -> Result { + let buf = self.cfg_in(SILABSER_GET_MDMSTS_REQUEST_CODE, 0, 1)?; + let status = buf[0]; + Ok(ModemStatus { + cts: (status & STATUS_CTS) != 0, + dsr: (status & STATUS_DSR) != 0, + ri: (status & STATUS_RI) != 0, + cd: (status & STATUS_CD) != 0, + }) + } + + fn bulk_in_mps(&self) -> u16 { + self.endpoints.as_ref().map(|e| e.mps).unwrap_or(64) + } + + fn take_bulk_in(&mut self) -> Option> { + let transport = self.transport.as_ref()?; + self.endpoints.as_mut()?.take_in(transport) + } +} diff --git a/crates/android-usb-serial/src/drivers/ftdi.rs b/crates/android-usb-serial/src/drivers/ftdi.rs new file mode 100644 index 00000000..173bab4f --- /dev/null +++ b/crates/android-usb-serial/src/drivers/ftdi.rs @@ -0,0 +1,286 @@ +//! FTDI driver (vendor control + 2-byte RX header strip). + +use super::{Driver, EndpointPair, ModemStatus}; +use crate::config::{ + DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits, CHAR_XOFF, CHAR_XON, +}; +use crate::error::{Result, UsbSerialError}; +use crate::reader::SerialReader; +use crate::rx_filter::{FtdiHeaderFilter, XonXoffRxFilter}; +use crate::transport::{ControlRequest, SharedTransport}; + +pub struct FtdiDriver { + port_index: usize, + iface: u8, + dtr: bool, + rts: bool, + baud_with_port: bool, + flow: FlowControl, + break_enabled: bool, + data_config: u16, + endpoints: Option, + transport: Option, + reader: Option, +} + +impl FtdiDriver { + pub fn new(port_index: usize) -> Self { + Self { + port_index, + iface: port_index as u8, + dtr: false, + rts: false, + baud_with_port: false, + flow: FlowControl::None, + break_enabled: false, + data_config: 0, + endpoints: None, + transport: None, + reader: None, + } + } + + fn w_index(&self) -> u16 { + (self.port_index + 1) as u16 + } + + fn vendor_out(&self, request: u8, value: u16, index: u16) -> Result<()> { + self.transport + .as_ref() + .unwrap() + .control_out(&ControlRequest::vendor_out(request, value, index, vec![]))?; + Ok(()) + } + + fn vendor_in(&self, request: u8, value: u16, index: u16, len: usize) -> Result> { + self.transport + .as_ref() + .unwrap() + .control_in(&ControlRequest::vendor_in(request, value, index, len)) + } +} + +impl Driver for FtdiDriver { + fn open(&mut self, transport: &SharedTransport) -> Result<()> { + self.transport = Some(transport.clone()); + self.iface = self.port_index as u8; + transport.claim_interface(self.iface)?; + self.endpoints = Some(EndpointPair::open(transport, self.iface)?); + self.vendor_out(0, 0, self.w_index())?; + let modem = if self.dtr { 0x0101 } else { 0x0100 } | if self.rts { 0x0202 } else { 0x0200 }; + self.vendor_out(1, modem, self.w_index())?; + self.set_flow_control(FlowControl::None)?; + self.baud_with_port = transport.interfaces().len() > 1; + let raw = transport.raw_descriptors(); + if raw.len() >= 14 { + let device_type = raw[13]; + self.baud_with_port = + self.baud_with_port || device_type == 7 || device_type == 8 || device_type == 9; + } + Ok(()) + } + + fn close(&mut self) -> Result<()> { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + if let Some(t) = &self.transport { + let _ = t.release_interface(self.iface); + } + self.endpoints = None; + Ok(()) + } + + fn write(&mut self, data: &[u8]) -> Result { + let t = self.transport.as_ref().unwrap(); + self.endpoints.as_mut().unwrap().write(t, data) + } + + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + Ok(0) + } + + fn set_line_config(&mut self, cfg: LineConfig) -> Result<()> { + self.set_baud(cfg.baud_rate)?; + match cfg.data_bits { + DataBits::Seven | DataBits::Eight => {} + _ => return Err(UsbSerialError::Unsupported("data bits".into())), + } + if cfg.stop_bits == StopBits::OnePointFive { + return Err(UsbSerialError::Unsupported("stop bits".into())); + } + self.data_config = ftdi_line_config_value(cfg, self.break_enabled); + self.vendor_out(4, self.data_config, self.w_index()) + } + + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + self.flow = flow; + let mut value = 0u16; + let mut index = self.w_index(); + match flow { + FlowControl::None => {} + FlowControl::RtsCts => index |= 0x100, + FlowControl::DtrDsr => index |= 0x200, + FlowControl::XonXoffInline => { + value = u16::from(CHAR_XON) | (u16::from(CHAR_XOFF) << 8); + index |= 0x400; + } + _ => return Err(UsbSerialError::Unsupported("flow control".into())), + } + self.vendor_out(2, value, index) + } + + fn set_dtr(&mut self, value: bool) -> Result<()> { + self.dtr = value; + let v = if value { 0x0101 } else { 0x0100 }; + self.vendor_out(1, v, self.w_index()) + } + + fn set_rts(&mut self, value: bool) -> Result<()> { + self.rts = value; + let v = if value { 0x0202 } else { 0x0200 }; + self.vendor_out(1, v, self.w_index()) + } + + fn set_break(&mut self, enabled: bool) -> Result<()> { + self.break_enabled = enabled; + if enabled { + self.data_config |= 0x4000; + } else { + self.data_config &= !0x4000; + } + self.vendor_out(4, self.data_config, self.w_index()) + } + + fn purge(&mut self, kind: PurgeKind) -> Result<()> { + match kind { + PurgeKind::Rx => self.vendor_out(0, 1, self.w_index()), + PurgeKind::Tx => self.vendor_out(0, 2, self.w_index()), + PurgeKind::Both => { + self.vendor_out(0, 1, self.w_index())?; + self.vendor_out(0, 2, self.w_index()) + } + } + } + + fn modem_status(&mut self) -> Result { + let data = self.vendor_in(5, 0, self.w_index(), 2)?; + let status = data.first().copied().unwrap_or(0); + Ok(ModemStatus { + cts: status & 0x10 != 0, + dsr: status & 0x20 != 0, + ri: status & 0x40 != 0, + cd: status & 0x80 != 0, + }) + } + + fn bulk_in_mps(&self) -> u16 { + self.endpoints.as_ref().map(|e| e.mps).unwrap_or(64) + } + + fn take_bulk_in(&mut self) -> Option> { + let transport = self.transport.as_ref()?; + self.endpoints.as_mut()?.take_in(transport) + } + + fn rx_filters(&self) -> Vec> { + let mut filters: Vec> = + vec![Box::new(FtdiHeaderFilter::new(self.bulk_in_mps()))]; + if self.flow == FlowControl::XonXoffInline { + filters.push(Box::new(XonXoffRxFilter::new(true))); + } + filters + } +} + +impl FtdiDriver { + fn set_baud(&self, baud: u32) -> Result<()> { + if baud > 3_500_000 { + return Err(UsbSerialError::Unsupported("baud too high".into())); + } + let (value, index) = ftdi_baud_encoding(baud, self.baud_with_port, self.port_index)?; + self.vendor_out(3, value, index) + } +} + +fn ftdi_line_config_value(cfg: LineConfig, break_enabled: bool) -> u16 { + let mut config = match cfg.data_bits { + DataBits::Seven => 7, + DataBits::Eight => 8, + _ => 0, + }; + config |= match cfg.parity { + Parity::None => 0, + Parity::Odd => 0x100, + Parity::Even => 0x200, + Parity::Mark => 0x300, + Parity::Space => 0x400, + }; + if cfg.stop_bits == StopBits::Two { + config |= 0x1000; + } + if break_enabled { + config |= 0x4000; + } + config +} + +/// FTDI baud encoding (ported from FtdiSerialDriver.java). +pub fn ftdi_baud_encoding( + baud: u32, + baud_with_port: bool, + port_index: usize, +) -> Result<(u16, u16)> { + let (divisor, subdivisor, _) = if baud >= 2_500_000 { + (0u32, 0u32, 3_000_000u32) + } else if baud >= 1_750_000 { + (1, 0, 2_000_000) + } else { + let mut d = (24_000_000u32 << 1) / baud; + d = (d + 1) >> 1; + let sub = d & 0x07; + d >>= 3; + if d > 0x3fff { + return Err(UsbSerialError::Unsupported("baud too low".into())); + } + let effective = (24_000_000u32 << 1) / ((d << 3) + sub); + let effective = (effective + 1) >> 1; + let err = (1.0 - (effective as f64 / baud as f64)).abs(); + if err >= 0.031 { + return Err(UsbSerialError::Unsupported(format!( + "baud deviation {:.1}%", + err * 100.0 + ))); + } + (d, sub, effective) + }; + let mut value = divisor as u16; + let mut index = 0u16; + match subdivisor { + 0 => {} + 4 => value |= 0x4000, + 2 => value |= 0x8000, + 1 => value |= 0xc000, + 3 => index |= 1, + 5 => { + value |= 0x4000; + index |= 1; + } + 6 => { + value |= 0x8000; + index |= 1; + } + 7 => { + value |= 0xc000; + index |= 1; + } + _ => {} + } + if baud_with_port { + index = (index << 8) | (port_index as u16 + 1); + } + Ok((value, index)) +} diff --git a/crates/android-usb-serial/src/drivers/gsm_modem.rs b/crates/android-usb-serial/src/drivers/gsm_modem.rs new file mode 100644 index 00000000..e98a8ee7 --- /dev/null +++ b/crates/android-usb-serial/src/drivers/gsm_modem.rs @@ -0,0 +1,102 @@ +//! Fibocom GSM modem (interface 0, minimal init — not CDC ACM). + +use super::{Driver, EndpointPair, ModemStatus}; +use crate::config::{FlowControl, LineConfig, PurgeKind}; +use crate::error::{Result, UsbSerialError}; +use crate::reader::SerialReader; +use crate::transport::{ControlRequest, SharedTransport}; + +pub struct GsmModemDriver { + #[allow(dead_code)] + port_index: usize, + iface: u8, + endpoints: Option, + transport: Option, + reader: Option, +} + +impl GsmModemDriver { + pub fn new(port_index: usize) -> Self { + Self { + port_index, + iface: 0, + endpoints: None, + transport: None, + reader: None, + } + } +} + +impl Driver for GsmModemDriver { + fn open(&mut self, transport: &SharedTransport) -> Result<()> { + self.transport = Some(transport.clone()); + self.iface = 0; + transport.claim_interface(self.iface)?; + self.endpoints = Some(EndpointPair::open(transport, self.iface)?); + transport.control_out(&ControlRequest::class_out(0x22, 0x01, 0, vec![]))?; + Ok(()) + } + + fn close(&mut self) -> Result<()> { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + if let Some(t) = &self.transport { + let _ = t.release_interface(self.iface); + } + self.endpoints = None; + Ok(()) + } + + fn write(&mut self, data: &[u8]) -> Result { + let t = self.transport.as_ref().unwrap(); + self.endpoints.as_mut().unwrap().write(t, data) + } + + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + Ok(0) + } + + fn set_line_config(&mut self, _cfg: LineConfig) -> Result<()> { + Err(UsbSerialError::Unsupported("line config".into())) + } + + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + if flow != FlowControl::None { + return Err(UsbSerialError::Unsupported("flow control".into())); + } + Ok(()) + } + + fn set_dtr(&mut self, _value: bool) -> Result<()> { + Err(UsbSerialError::Unsupported("dtr".into())) + } + + fn set_rts(&mut self, _value: bool) -> Result<()> { + Err(UsbSerialError::Unsupported("rts".into())) + } + + fn set_break(&mut self, _enabled: bool) -> Result<()> { + Err(UsbSerialError::Unsupported("break".into())) + } + + fn purge(&mut self, _kind: PurgeKind) -> Result<()> { + Err(UsbSerialError::Unsupported("purge".into())) + } + + fn modem_status(&mut self) -> Result { + Ok(ModemStatus::default()) + } + + fn bulk_in_mps(&self) -> u16 { + self.endpoints.as_ref().map(|e| e.mps).unwrap_or(64) + } + + fn take_bulk_in(&mut self) -> Option> { + let transport = self.transport.as_ref()?; + self.endpoints.as_mut()?.take_in(transport) + } +} diff --git a/crates/android-usb-serial/src/drivers/mod.rs b/crates/android-usb-serial/src/drivers/mod.rs new file mode 100644 index 00000000..17be9707 --- /dev/null +++ b/crates/android-usb-serial/src/drivers/mod.rs @@ -0,0 +1,183 @@ +//! USB serial driver implementations. +//! +//! Each chip family implements the [`Driver`](crate::drivers::Driver) trait. Prefer +//! [`crate::open_port`], which calls [`create_driver`](crate::drivers::create_driver) +//! after [`crate::ProbeTable`] selection. + +mod cdc_acm; +mod ch34x; +mod chrome_ccd; +mod cp21xx; +mod ftdi; +mod gsm_modem; +mod prolific; + +pub use cdc_acm::CdcAcmDriver; +pub use ch34x::Ch34xDriver; +pub use chrome_ccd::ChromeCcdDriver; +pub use cp21xx::Cp21xxDriver; +pub use ftdi::ftdi_baud_encoding; +pub use ftdi::FtdiDriver; +pub use gsm_modem::GsmModemDriver; +pub use prolific::ProlificDriver; + +use crate::config::{FlowControl, LineConfig, PurgeKind}; +use crate::error::Result; +use crate::probe::DriverType; +use crate::reader::SerialReader; +use crate::rx_filter::RxFilter; +use crate::transport::{BulkIn, BulkOut, SharedTransport}; + +/// Default bulk OUT timeout used by drivers. +pub const WRITE_TIMEOUT_MS: u32 = 5000; + +/// Modem status lines reported by chips that support them. +#[derive(Debug, Clone, Copy, Default)] +pub struct ModemStatus { + pub cts: bool, + pub dsr: bool, + pub ri: bool, + pub cd: bool, +} + +/// Chip-specific USB serial protocol (control transfers + bulk endpoints). +pub trait Driver: Send { + fn open(&mut self, transport: &SharedTransport) -> Result<()>; + fn close(&mut self) -> Result<()>; + fn write(&mut self, data: &[u8]) -> Result; + fn read(&mut self, buf: &mut [u8]) -> Result; + fn set_line_config(&mut self, cfg: LineConfig) -> Result<()>; + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()>; + fn set_dtr(&mut self, value: bool) -> Result<()>; + fn set_rts(&mut self, value: bool) -> Result<()>; + fn set_break(&mut self, enabled: bool) -> Result<()>; + fn purge(&mut self, kind: PurgeKind) -> Result<()>; + fn modem_status(&mut self) -> Result; + fn bulk_in_mps(&self) -> u16; + fn take_bulk_in(&mut self) -> Option>; + fn rx_filters(&self) -> Vec> { + Vec::new() + } + fn start_reader(&mut self) -> Result { + let bulk = self + .take_bulk_in() + .ok_or_else(|| crate::error::UsbSerialError::Io("no bulk in".into()))?; + Ok(SerialReader::start( + bulk, + self.bulk_in_mps(), + 200, + self.rx_filters(), + )) + } +} + +/// Construct an uninitialized driver for `driver_type` / `port_index`. +pub fn create_driver(driver_type: DriverType, port_index: usize) -> Box { + match driver_type { + DriverType::CdcAcm => Box::new(CdcAcmDriver::new(port_index)), + DriverType::Ftdi => Box::new(FtdiDriver::new(port_index)), + DriverType::Cp21xx => Box::new(Cp21xxDriver::new(port_index)), + DriverType::Ch34x => Box::new(Ch34xDriver::new(port_index)), + DriverType::Prolific => Box::new(ProlificDriver::new(port_index)), + DriverType::GsmModem => Box::new(GsmModemDriver::new(port_index)), + DriverType::ChromeCcd => Box::new(ChromeCcdDriver::new(port_index)), + } +} + +pub fn line_coding_bytes(cfg: &LineConfig) -> [u8; 7] { + let stop = match cfg.stop_bits { + crate::config::StopBits::One => 0u8, + crate::config::StopBits::OnePointFive => 1, + crate::config::StopBits::Two => 2, + }; + let parity = match cfg.parity { + crate::config::Parity::None => 0, + crate::config::Parity::Odd => 1, + crate::config::Parity::Even => 2, + crate::config::Parity::Mark => 3, + crate::config::Parity::Space => 4, + }; + let data = match cfg.data_bits { + crate::config::DataBits::Five => 5, + crate::config::DataBits::Six => 6, + crate::config::DataBits::Seven => 7, + crate::config::DataBits::Eight => 8, + }; + [ + (cfg.baud_rate & 0xff) as u8, + ((cfg.baud_rate >> 8) & 0xff) as u8, + ((cfg.baud_rate >> 16) & 0xff) as u8, + ((cfg.baud_rate >> 24) & 0xff) as u8, + stop, + parity, + data, + ] +} + +struct EndpointPair { + bulk_in: Option>, + bulk_out: Option>, + in_ep: u8, + out_ep: u8, + mps: u16, +} + +impl EndpointPair { + pub(crate) fn from_addresses(in_ep: u8, out_ep: u8, mps: u16) -> Self { + Self { + bulk_in: None, + bulk_out: None, + in_ep, + out_ep, + mps, + } + } + + fn open(transport: &SharedTransport, iface: u8) -> Result { + let eps = transport.endpoints(iface); + let in_ep = eps + .iter() + .find(|e| e.is_bulk_in()) + .ok_or_else(|| crate::error::UsbSerialError::ProbeFailed("no bulk in".into()))?; + let out_ep = eps + .iter() + .find(|e| e.is_bulk_out()) + .ok_or_else(|| crate::error::UsbSerialError::ProbeFailed("no bulk out".into()))?; + Ok(Self { + bulk_in: None, + bulk_out: None, + in_ep: in_ep.address, + out_ep: out_ep.address, + mps: in_ep.max_packet_size, + }) + } + + fn ensure_out(&mut self, transport: &SharedTransport) -> Result<()> { + if self.bulk_out.is_none() { + self.bulk_out = Some(transport.open_bulk_out(self.out_ep, self.mps)?); + } + Ok(()) + } + + fn ensure_in(&mut self, transport: &SharedTransport) -> Result<()> { + if self.bulk_in.is_none() { + self.bulk_in = Some(transport.open_bulk_in(self.in_ep, self.mps)?); + } + Ok(()) + } + + fn write(&mut self, transport: &SharedTransport, data: &[u8]) -> Result { + // Only claim OUT — IN may already be owned by SerialReader after take_in(). + // Opening IN again hits nusb "endpoint already in use". + self.ensure_out(transport)?; + self.bulk_out + .as_mut() + .unwrap() + .write(data, WRITE_TIMEOUT_MS) + } + + fn take_in(&mut self, transport: &SharedTransport) -> Option> { + self.ensure_in(transport).ok()?; + self.bulk_in.take() + } +} diff --git a/crates/android-usb-serial/src/drivers/prolific.rs b/crates/android-usb-serial/src/drivers/prolific.rs new file mode 100644 index 00000000..609741c5 --- /dev/null +++ b/crates/android-usb-serial/src/drivers/prolific.rs @@ -0,0 +1,695 @@ +//! Prolific PL2303 driver (ported from ProlificSerialDriver.java). + +use super::{line_coding_bytes, Driver, ModemStatus, WRITE_TIMEOUT_MS}; +use crate::config::{DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits}; +use crate::error::{Result, UsbSerialError}; +use crate::reader::SerialReader; +use crate::rx_filter::XonXoffRxFilter; +use crate::transport::{BulkIn, ControlRequest, EndpointInfo, SharedTransport}; +use std::sync::atomic::{AtomicBool, AtomicU8, Ordering}; +use std::sync::{Arc, Mutex}; +use std::thread::{self, JoinHandle}; + +const WRITE_ENDPOINT: u8 = 0x02; +const READ_ENDPOINT: u8 = 0x83; +const INTERRUPT_ENDPOINT: u8 = 0x81; + +const VENDOR_READ_REQUEST: u8 = 0x01; +const VENDOR_WRITE_REQUEST: u8 = 0x01; +const VENDOR_READ_HXN_REQUEST: u8 = 0x81; +const VENDOR_WRITE_HXN_REQUEST: u8 = 0x80; + +const RESET_HXN_REQUEST: u8 = 0x07; +const FLUSH_RX_REQUEST: u8 = 0x08; +const FLUSH_TX_REQUEST: u8 = 0x09; +const SET_LINE_REQUEST: u8 = 0x20; +const SET_CONTROL_REQUEST: u8 = 0x22; +const SEND_BREAK_REQUEST: u8 = 0x23; +const GET_CONTROL_HXN_REQUEST: u8 = 0x80; +const GET_CONTROL_REQUEST: u8 = 0x87; +const STATUS_NOTIFICATION: u8 = 0xa1; + +const RESET_HXN_RX_PIPE: u16 = 1; +const RESET_HXN_TX_PIPE: u16 = 2; + +const CONTROL_DTR: u16 = 0x01; +const CONTROL_RTS: u16 = 0x02; + +const GET_CONTROL_FLAG_CD: u8 = 0x02; +const GET_CONTROL_FLAG_DSR: u8 = 0x04; +const GET_CONTROL_FLAG_RI: u8 = 0x01; +const GET_CONTROL_FLAG_CTS: u8 = 0x08; + +const GET_CONTROL_HXN_FLAG_CD: u8 = 0x40; +const GET_CONTROL_HXN_FLAG_DSR: u8 = 0x20; +const GET_CONTROL_HXN_FLAG_RI: u8 = 0x80; +const GET_CONTROL_HXN_FLAG_CTS: u8 = 0x08; + +const STATUS_FLAG_CD: u8 = 0x01; +const STATUS_FLAG_DSR: u8 = 0x02; +const STATUS_FLAG_RI: u8 = 0x08; +const STATUS_FLAG_CTS: u8 = 0x80; + +const STATUS_BUFFER_SIZE: usize = 10; +const STATUS_BYTE_IDX: usize = 8; + +const STANDARD_BAUD_RATES: &[u32] = &[ + 75, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 14400, 19200, 28800, 38400, 57600, + 115200, 128000, 134400, 161280, 201600, 230400, 268800, 403200, 460800, 614400, 806400, 921600, + 1228800, 2457600, 3000000, 6000000, +]; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum DeviceType { + Type01, + TypeT, + TypeHx, + TypeHxn, +} + +struct ProlificEndpoints { + data: super::EndpointPair, + interrupt_ep: u8, + interrupt_mps: u16, +} + +pub struct ProlificDriver { + #[allow(dead_code)] + port_index: usize, + iface: u8, + device_type: DeviceType, + control_lines: u16, + flow: FlowControl, + baud_rate: i32, + data_bits: i32, + stop_bits: i32, + parity: i32, + endpoints: Option, + transport: Option, + reader: Option, + status: Arc, + status_thread: Option>, + stop_status_thread: Arc, + status_error: Arc>>, + status_started: bool, +} + +impl ProlificDriver { + pub fn new(port_index: usize) -> Self { + Self { + port_index, + iface: 0, + device_type: DeviceType::TypeHx, + control_lines: 0, + flow: FlowControl::None, + baud_rate: -1, + data_bits: -1, + stop_bits: -1, + parity: -1, + endpoints: None, + transport: None, + reader: None, + status: Arc::new(AtomicU8::new(0)), + status_thread: None, + stop_status_thread: Arc::new(AtomicBool::new(false)), + status_error: Arc::new(Mutex::new(None)), + status_started: false, + } + } + + fn vendor_read_request(&self) -> u8 { + if self.device_type == DeviceType::TypeHxn { + VENDOR_READ_HXN_REQUEST + } else { + VENDOR_READ_REQUEST + } + } + + fn vendor_write_request(&self) -> u8 { + if self.device_type == DeviceType::TypeHxn { + VENDOR_WRITE_HXN_REQUEST + } else { + VENDOR_WRITE_REQUEST + } + } + + fn vendor_in(&self, value: u16, index: u16, length: usize) -> Result> { + self.transport + .as_ref() + .unwrap() + .control_in(&ControlRequest { + request_type: 0xC0, + request: self.vendor_read_request(), + value, + index, + data: vec![0; length], + timeout_ms: WRITE_TIMEOUT_MS, + }) + } + + fn vendor_out(&self, value: u16, index: u16, data: Vec) -> Result<()> { + self.transport + .as_ref() + .unwrap() + .control_out(&ControlRequest { + request_type: 0x40, + request: self.vendor_write_request(), + value, + index, + data, + timeout_ms: WRITE_TIMEOUT_MS, + })?; + Ok(()) + } + + fn ctrl_out(&self, request: u8, value: u16, index: u16, data: Vec) -> Result<()> { + self.transport + .as_ref() + .unwrap() + .control_out(&ControlRequest::class_out(request, value, index, data))?; + Ok(()) + } + + fn detect_device_type(&mut self, transport: &SharedTransport) -> Result<()> { + let raw = transport.raw_descriptors(); + let desc = if raw.len() >= 14 { + raw + } else { + transport.raw_device_descriptor().to_vec() + }; + if desc.len() < 14 { + return Err(UsbSerialError::Io( + "could not get device descriptors".into(), + )); + } + let usb_version = u16::from_le_bytes([desc[2], desc[3]]); + let device_version = u16::from_le_bytes([desc[12], desc[13]]); + let max_packet_size0 = desc[7]; + let device_class = transport.device_class(); + + self.device_type = if device_class == 0x02 || max_packet_size0 != 64 { + DeviceType::Type01 + } else if usb_version == 0x200 { + if (device_version == 0x300 || device_version == 0x500) && self.test_hx_status() { + DeviceType::TypeT + } else { + DeviceType::TypeHxn + } + } else { + DeviceType::TypeHx + }; + Ok(()) + } + + fn test_hx_status(&self) -> bool { + self.transport + .as_ref() + .unwrap() + .control_in(&ControlRequest { + request_type: 0xC0, + request: VENDOR_READ_REQUEST, + value: 0x8080, + index: 0, + data: vec![0; 1], + timeout_ms: WRITE_TIMEOUT_MS, + }) + .is_ok() + } + + fn reset_device(&self) -> Result<()> { + self.purge_hw_buffers(true, true) + } + + fn purge_hw_buffers(&self, purge_write: bool, purge_read: bool) -> Result<()> { + if self.device_type == DeviceType::TypeHxn { + let mut index = 0u16; + if purge_write { + index |= RESET_HXN_RX_PIPE; + } + if purge_read { + index |= RESET_HXN_TX_PIPE; + } + if index != 0 { + self.vendor_out(RESET_HXN_REQUEST as u16, index, vec![])?; + } + } else { + if purge_write { + self.vendor_out(FLUSH_RX_REQUEST as u16, 0, vec![])?; + } + if purge_read { + self.vendor_out(FLUSH_TX_REQUEST as u16, 0, vec![])?; + } + } + Ok(()) + } + + fn do_black_magic(&self) -> Result<()> { + if self.device_type == DeviceType::TypeHxn { + return Ok(()); + } + self.vendor_in(0x8484, 0, 1)?; + self.vendor_out(0x0404, 0, vec![])?; + self.vendor_in(0x8484, 0, 1)?; + self.vendor_in(0x8383, 0, 1)?; + self.vendor_in(0x8484, 0, 1)?; + self.vendor_out(0x0404, 1, vec![])?; + self.vendor_in(0x8484, 0, 1)?; + self.vendor_in(0x8383, 0, 1)?; + self.vendor_out(0, 1, vec![])?; + self.vendor_out(1, 0, vec![])?; + let magic = if self.device_type == DeviceType::Type01 { + 0x24u16 + } else { + 0x44 + }; + self.vendor_out(2, magic, vec![]) + } + + fn set_control_lines(&mut self, value: u16) -> Result<()> { + self.ctrl_out(SET_CONTROL_REQUEST, value, 0, vec![])?; + self.control_lines = value; + Ok(()) + } + + fn open_endpoints(transport: &SharedTransport, iface: u8) -> Result { + let eps = transport.endpoints(iface); + let find = |addr: u8| -> Result { + eps.iter() + .find(|e| e.address == addr) + .copied() + .ok_or_else(|| { + UsbSerialError::ProbeFailed(format!("missing endpoint 0x{addr:02x}")) + }) + }; + let in_ep = find(READ_ENDPOINT)?; + let out_ep = find(WRITE_ENDPOINT)?; + let int_ep = find(INTERRUPT_ENDPOINT)?; + Ok(ProlificEndpoints { + data: super::EndpointPair::from_addresses( + in_ep.address, + out_ep.address, + in_ep.max_packet_size, + ), + interrupt_ep: int_ep.address, + interrupt_mps: int_ep.max_packet_size, + }) + } + + fn ensure_status_thread(&mut self) -> Result<()> { + if self.status_started { + return Ok(()); + } + self.status.store(0, Ordering::Relaxed); + + let initial = if self.device_type == DeviceType::TypeHxn { + let data = self.vendor_in(GET_CONTROL_HXN_REQUEST as u16, 0, 1)?; + decode_vendor_status_hxn(data[0]) + } else { + let data = self.vendor_in(GET_CONTROL_REQUEST as u16, 0, 1)?; + decode_vendor_status(data[0]) + }; + self.status.store(initial, Ordering::Relaxed); + + let transport = self.transport.as_ref().unwrap().clone(); + let interrupt_ep = self.endpoints.as_ref().unwrap().interrupt_ep; + let interrupt_mps = self.endpoints.as_ref().unwrap().interrupt_mps; + let stop = self.stop_status_thread.clone(); + let status = self.status.clone(); + let status_error = self.status_error.clone(); + + stop.store(false, Ordering::Relaxed); + let handle = thread::spawn(move || { + let mut interrupt = match transport.open_interrupt_in(interrupt_ep, interrupt_mps) { + Ok(ep) => ep, + Err(e) => { + *status_error.lock().unwrap() = Some(e.to_string()); + return; + } + }; + let mut buffer = vec![0u8; STATUS_BUFFER_SIZE]; + while !stop.load(Ordering::Relaxed) { + match interrupt.read(&mut buffer, 500) { + Ok(crate::error::ReadOutcome::Data(data)) => { + if data.len() != STATUS_BUFFER_SIZE { + *status_error.lock().unwrap() = Some(format!( + "invalid status notification, expected {STATUS_BUFFER_SIZE} bytes, got {}", + data.len() + )); + break; + } + if data[0] != STATUS_NOTIFICATION { + *status_error.lock().unwrap() = Some(format!( + "invalid status notification, expected 0x{STATUS_NOTIFICATION:02x}, got 0x{:02x}", + data[0] + )); + break; + } + status.store(data[STATUS_BYTE_IDX], Ordering::Relaxed); + } + Ok(crate::error::ReadOutcome::TimedOut) + | Ok(crate::error::ReadOutcome::Cancelled) => {} + Err(e) => { + if !stop.load(Ordering::Relaxed) { + *status_error.lock().unwrap() = Some(e.to_string()); + } + break; + } + } + } + }); + self.status_thread = Some(handle); + self.status_started = true; + Ok(()) + } + + fn get_status(&mut self) -> Result { + self.ensure_status_thread()?; + if let Some(msg) = self.status_error.lock().unwrap().take() { + return Err(UsbSerialError::Io(msg)); + } + Ok(self.status.load(Ordering::Relaxed)) + } + + fn stop_status_thread(&mut self) { + self.stop_status_thread.store(true, Ordering::Relaxed); + if let Some(handle) = self.status_thread.take() { + let _ = handle.join(); + } + self.stop_status_thread.store(false, Ordering::Relaxed); + self.status_started = false; + *self.status_error.lock().unwrap() = None; + } + + fn filter_baud_rate(&self, baud_rate: u32) -> Result { + if baud_rate == 0 { + return Err(UsbSerialError::Unsupported(format!( + "invalid baud rate: {baud_rate}" + ))); + } + if self.device_type == DeviceType::TypeHxn { + return Ok(baud_rate); + } + if STANDARD_BAUD_RATES.contains(&baud_rate) { + return Ok(baud_rate); + } + + let baseline = 12000000u64 * 32; + let mut mantissa = (baseline / baud_rate as u64) as u32; + if mantissa == 0 { + return Err(UsbSerialError::Unsupported("baud rate too high".into())); + } + + let (buf, effective) = if self.device_type == DeviceType::TypeT { + let mut exponent = 0u32; + while mantissa >= 2048 { + if exponent < 15 { + mantissa >>= 1; + exponent += 1; + } else { + return Err(UsbSerialError::Unsupported("baud rate too low".into())); + } + } + let buf = mantissa + ((exponent & !1) << 12) + ((exponent & 1) << 16) + (1 << 31); + let effective = (baseline / mantissa as u64) >> exponent; + (buf, effective) + } else { + let mut exponent = 0u32; + while mantissa >= 512 { + if exponent < 7 { + mantissa >>= 2; + exponent += 1; + } else { + return Err(UsbSerialError::Unsupported("baud rate too low".into())); + } + } + let buf = mantissa + (exponent << 9) + (1 << 31); + let effective = (baseline / mantissa as u64) >> (exponent * 2); + (buf, effective) + }; + + let error = (1.0 - (effective as f64 / baud_rate as f64)).abs(); + if error >= 0.031 { + return Err(UsbSerialError::Unsupported(format!( + "baud rate deviation {:.1}% is higher than allowed 3%", + error * 100.0 + ))); + } + Ok(buf) + } + + fn line_request_data(&self, cfg: &LineConfig, baud: u32) -> Result> { + let stop = match cfg.stop_bits { + StopBits::One => 0u8, + StopBits::OnePointFive => 1, + StopBits::Two => 2, + }; + let parity = match cfg.parity { + Parity::None => 0, + Parity::Odd => 1, + Parity::Even => 2, + Parity::Mark => 3, + Parity::Space => 4, + }; + let data_bits = match cfg.data_bits { + DataBits::Five => 5, + DataBits::Six => 6, + DataBits::Seven => 7, + DataBits::Eight => 8, + }; + let mut line = line_coding_bytes(cfg); + line[0] = (baud & 0xff) as u8; + line[1] = ((baud >> 8) & 0xff) as u8; + line[2] = ((baud >> 16) & 0xff) as u8; + line[3] = ((baud >> 24) & 0xff) as u8; + line[4] = stop; + line[5] = parity; + line[6] = data_bits; + Ok(line.to_vec()) + } +} + +fn decode_vendor_status(byte: u8) -> u8 { + let mut status = 0u8; + if byte & GET_CONTROL_FLAG_CTS == 0 { + status |= STATUS_FLAG_CTS; + } + if byte & GET_CONTROL_FLAG_DSR == 0 { + status |= STATUS_FLAG_DSR; + } + if byte & GET_CONTROL_FLAG_CD == 0 { + status |= STATUS_FLAG_CD; + } + if byte & GET_CONTROL_FLAG_RI == 0 { + status |= STATUS_FLAG_RI; + } + status +} + +fn decode_vendor_status_hxn(byte: u8) -> u8 { + let mut status = 0u8; + if byte & GET_CONTROL_HXN_FLAG_CTS == 0 { + status |= STATUS_FLAG_CTS; + } + if byte & GET_CONTROL_HXN_FLAG_DSR == 0 { + status |= STATUS_FLAG_DSR; + } + if byte & GET_CONTROL_HXN_FLAG_CD == 0 { + status |= STATUS_FLAG_CD; + } + if byte & GET_CONTROL_HXN_FLAG_RI == 0 { + status |= STATUS_FLAG_RI; + } + status +} + +fn status_flag_to_modem(status: u8) -> ModemStatus { + ModemStatus { + cts: status & STATUS_FLAG_CTS != 0, + dsr: status & STATUS_FLAG_DSR != 0, + ri: status & STATUS_FLAG_RI != 0, + cd: status & STATUS_FLAG_CD != 0, + } +} + +impl Driver for ProlificDriver { + fn open(&mut self, transport: &SharedTransport) -> Result<()> { + self.transport = Some(transport.clone()); + self.iface = 0; + transport.claim_interface(self.iface)?; + self.endpoints = Some(Self::open_endpoints(transport, self.iface)?); + self.detect_device_type(transport)?; + self.reset_device()?; + self.do_black_magic()?; + self.set_control_lines(self.control_lines)?; + self.set_flow_control(self.flow)?; + Ok(()) + } + + fn close(&mut self) -> Result<()> { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + self.stop_status_thread(); + let _ = self.reset_device(); + if let Some(t) = &self.transport { + let _ = t.release_interface(self.iface); + } + self.endpoints = None; + Ok(()) + } + + fn write(&mut self, data: &[u8]) -> Result { + let t = self.transport.as_ref().unwrap(); + self.endpoints.as_mut().unwrap().data.write(t, data) + } + + fn read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + Ok(0) + } + + fn set_line_config(&mut self, cfg: LineConfig) -> Result<()> { + let baud = self.filter_baud_rate(cfg.baud_rate)?; + let data_bits = match cfg.data_bits { + DataBits::Five => 5, + DataBits::Six => 6, + DataBits::Seven => 7, + DataBits::Eight => 8, + }; + let stop_bits = match cfg.stop_bits { + StopBits::One => 1, + StopBits::OnePointFive => 3, + StopBits::Two => 2, + }; + let parity = match cfg.parity { + Parity::None => 0, + Parity::Odd => 1, + Parity::Even => 2, + Parity::Mark => 3, + Parity::Space => 4, + }; + + if self.baud_rate == baud as i32 + && self.data_bits == data_bits + && self.stop_bits == stop_bits + && self.parity == parity + { + return Ok(()); + } + + let line = self.line_request_data(&cfg, baud)?; + self.ctrl_out(SET_LINE_REQUEST, 0, 0, line)?; + self.reset_device()?; + + self.baud_rate = baud as i32; + self.data_bits = data_bits; + self.stop_bits = stop_bits; + self.parity = parity; + Ok(()) + } + + fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + match flow { + FlowControl::None => { + if self.device_type == DeviceType::TypeHxn { + self.vendor_out(0x0a, 0xff, vec![])?; + } else { + self.vendor_out(0, 0, vec![])?; + } + } + FlowControl::RtsCts => { + if self.device_type == DeviceType::TypeHxn { + self.vendor_out(0x0a, 0xfa, vec![])?; + } else { + self.vendor_out(0, 0x61, vec![])?; + } + } + FlowControl::XonXoffInline => { + if self.device_type == DeviceType::TypeHxn { + self.vendor_out(0x0a, 0xee, vec![])?; + } else { + self.vendor_out(0, 0xc1, vec![])?; + } + } + _ => return Err(UsbSerialError::Unsupported("flow control".into())), + } + self.flow = flow; + Ok(()) + } + + fn set_dtr(&mut self, value: bool) -> Result<()> { + let new_lines = if value { + self.control_lines | CONTROL_DTR + } else { + self.control_lines & !CONTROL_DTR + }; + self.set_control_lines(new_lines) + } + + fn set_rts(&mut self, value: bool) -> Result<()> { + let new_lines = if value { + self.control_lines | CONTROL_RTS + } else { + self.control_lines & !CONTROL_RTS + }; + self.set_control_lines(new_lines) + } + + fn set_break(&mut self, enabled: bool) -> Result<()> { + let value = if enabled { 0xffffu16 } else { 0 }; + self.ctrl_out(SEND_BREAK_REQUEST, value, 0, vec![]) + } + + fn purge(&mut self, kind: PurgeKind) -> Result<()> { + match kind { + PurgeKind::Rx => self.purge_hw_buffers(true, false), + PurgeKind::Tx => self.purge_hw_buffers(false, true), + PurgeKind::Both => self.purge_hw_buffers(true, true), + } + } + + fn modem_status(&mut self) -> Result { + let status = self.get_status()?; + Ok(status_flag_to_modem(status)) + } + + fn bulk_in_mps(&self) -> u16 { + self.endpoints.as_ref().map(|e| e.data.mps).unwrap_or(64) + } + + fn take_bulk_in(&mut self) -> Option> { + let transport = self.transport.as_ref()?; + self.endpoints.as_mut()?.data.take_in(transport) + } + + fn rx_filters(&self) -> Vec> { + if self.flow == FlowControl::XonXoffInline { + vec![Box::new(XonXoffRxFilter::new(true))] + } else { + vec![] + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn filter_standard_baud() { + let mut d = ProlificDriver::new(0); + d.device_type = DeviceType::TypeHx; + assert_eq!(d.filter_baud_rate(115200).unwrap(), 115200); + } + + #[test] + fn filter_custom_baud_hx() { + let mut d = ProlificDriver::new(0); + d.device_type = DeviceType::TypeHx; + let encoded = d.filter_baud_rate(500_000).unwrap(); + assert_ne!(encoded, 500_000); + assert!(encoded & (1 << 31) != 0); + } +} diff --git a/crates/android-usb-serial/src/error.rs b/crates/android-usb-serial/src/error.rs new file mode 100644 index 00000000..06f68ad0 --- /dev/null +++ b/crates/android-usb-serial/src/error.rs @@ -0,0 +1,69 @@ +//! USB serial driver errors. + +use std::fmt; + +/// High-level driver / transport failure. +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum UsbSerialError { + /// Operation or chip feature not supported. + Unsupported(String), + /// I/O or USB transfer failure (including stall mapped to a message). + Io(String), + /// Transfer timed out. + TimedOut, + /// Device unplugged or USB link lost (bulk IN detach / EPROTO, etc.). + Disconnected, + /// Transfer cancelled by the host. + Cancelled, + /// Could not identify / open a suitable driver. + ProbeFailed(String), +} + +impl fmt::Display for UsbSerialError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Unsupported(msg) => write!(f, "unsupported: {msg}"), + Self::Io(msg) => write!(f, "io: {msg}"), + Self::TimedOut => write!(f, "timed out"), + Self::Disconnected => write!(f, "disconnected"), + Self::Cancelled => write!(f, "cancelled"), + Self::ProbeFailed(msg) => write!(f, "probe failed: {msg}"), + } + } +} + +impl std::error::Error for UsbSerialError {} + +/// Result alias for this crate. +pub type Result = std::result::Result; + +/// Low-level USB transfer failure (maps into [`UsbSerialError`]). +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum TransferError { + TimedOut, + Stall, + Disconnected, + Cancelled, + Other(String), +} + +impl From for UsbSerialError { + fn from(value: TransferError) -> Self { + match value { + TransferError::TimedOut => Self::TimedOut, + TransferError::Disconnected => Self::Disconnected, + TransferError::Cancelled => Self::Cancelled, + TransferError::Stall => Self::Io("stall".into()), + TransferError::Other(msg) => Self::Io(msg), + } + } +} + +/// Bulk/control transfer outcome for [`crate::transport::BulkIn::read`]. +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ReadOutcome { + /// Payload bytes received. + Data(Vec), + TimedOut, + Cancelled, +} diff --git a/crates/android-usb-serial/src/fake.rs b/crates/android-usb-serial/src/fake.rs new file mode 100644 index 00000000..259906e9 --- /dev/null +++ b/crates/android-usb-serial/src/fake.rs @@ -0,0 +1,793 @@ +//! In-memory transport for golden parity and on-device harness. +//! +//! Enable with Cargo feature `fake-transport`. Script control/bulk responses, then open a port +//! with [`crate::open_port`] exactly as on hardware. + +use crate::error::{ReadOutcome, Result, UsbSerialError}; +use crate::transport::{BulkIn, BulkOut, ControlRequest, EndpointInfo, InterfaceInfo, Transport}; +use std::collections::VecDeque; +use std::sync::{Arc, Mutex}; + +/// Captured control transfer (for golden parity assertions). +#[derive(Debug, Clone)] +pub struct RecordedControl { + pub request_type: u8, + pub request: u8, + pub value: u16, + pub index: u16, + pub data: Vec, +} + +/// Captured bulk OUT payload. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct RecordedBulkOut { + pub endpoint: u8, + pub data: Vec, +} + +#[derive(Debug, Default)] +struct FakeState { + device_descriptor: [u8; 18], + raw_descriptors: Vec, + interfaces: Vec, + endpoints: Vec<(u8, EndpointInfo)>, + recorded: Vec, + recorded_bulk_out: Vec, + control_in_responses: Vec>, + interrupt_in_queue: VecDeque, + rx_queue: VecDeque, + tx_log: Vec, + bulk_read_error: Option, + claimed: Vec, + /// Mimic nusb: endpoint address may only be opened once until dropped. + open_endpoints: Vec, +} + +/// Thread-safe fake USB device for tests ([`crate::Transport`] implementor). +#[derive(Debug, Clone)] +pub struct FakeTransport { + inner: Arc>, +} + +impl Default for FakeTransport { + fn default() -> Self { + Self::new() + } +} + +impl FakeTransport { + /// Same as [`Self::cdc_single_iface`]. + pub fn new() -> Self { + Self::cdc_single_iface() + } + + /// Single CDC ACM interface with bulk IN/OUT endpoints (castrated single-iface layout). + pub fn cdc_single_iface() -> Self { + let t = Self { + inner: Arc::new(Mutex::new(FakeState::default())), + }; + { + let mut s = t.inner.lock().unwrap(); + s.device_descriptor = [ + 18, 1, 0x00, 0x02, 0x02, 0x00, 0x00, 64, 0x34, 0x12, 0x78, 0x56, 0x00, 0x01, 0x01, + 0x02, 0x00, 1, + ]; + s.interfaces = vec![InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }]; + s.endpoints = vec![ + ( + 0, + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ), + ( + 0, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ), + ]; + } + t + } + + /// FT232R-shaped single-interface layout (`0403:6001`). + pub fn ftdi_ft232r() -> Self { + let t = Self::cdc_single_iface(); + t.set_vendor_product(0x0403, 0x6001); + t.set_interfaces(vec![InterfaceInfo { + id: 0, + class: 255, + subclass: 0, + protocol: 0, + }]); + t.configure_endpoints(&[( + 0, + vec![ + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )]); + t + } + + pub fn ftdi_ft2232() -> Self { + let t = Self::ftdi_ft232r(); + t.set_vendor_product(0x0403, 0x6010); + t.set_interfaces(vec![ + InterfaceInfo { + id: 0, + class: 255, + subclass: 0, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 255, + subclass: 0, + protocol: 0, + }, + ]); + t.configure_endpoints(&[ + ( + 0, + vec![ + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + ), + ( + 1, + vec![ + EndpointInfo { + address: 0x83, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x04, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + ), + ]); + t.patch_device_descriptor(|d| d[13] = 7); + t + } + + pub fn cp2102() -> Self { + Self::ftdi_ft232r().also(|t| t.set_vendor_product(0x10C4, 0xEA60)) + } + + pub fn cp2105() -> Self { + let t = Self::cp2102(); + t.set_vendor_product(0x10C4, 0xEA70); + t.set_interfaces(vec![ + InterfaceInfo { + id: 0, + class: 255, + subclass: 0, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 255, + subclass: 0, + protocol: 0, + }, + ]); + t.configure_endpoints(&[ + ( + 0, + vec![ + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + ), + ( + 1, + vec![ + EndpointInfo { + address: 0x83, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x04, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + ), + ]); + t + } + + pub fn ch340_dual_iface() -> Self { + let t = Self::cdc_single_iface(); + t.set_vendor_product(0x1A86, 0x7523); + t.set_interfaces(vec![ + InterfaceInfo { + id: 0, + class: 255, + subclass: 0, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 255, + subclass: 0, + protocol: 0, + }, + ]); + t.configure_endpoints(&[( + 1, + vec![ + EndpointInfo { + address: 0x82, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x03, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )]); + t + } + + pub fn pl2303_hx() -> Self { + let t = Self::cdc_single_iface(); + t.set_vendor_product(0x067B, 0x2303); + t.patch_device_descriptor(|d| d[4] = 0); + t.configure_endpoints(&[( + 0, + vec![ + EndpointInfo { + address: 0x81, + attributes: 3, + max_packet_size: 64, + interval: 1, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x83, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )]); + t.set_interfaces(vec![InterfaceInfo { + id: 0, + class: 255, + subclass: 0, + protocol: 0, + }]); + t + } + + pub fn pl2303_hxn() -> Self { + let t = Self::pl2303_hx(); + t.patch_device_descriptor(|d| { + d[4] = 0x00; + d[7] = 64; + d[2] = 0x00; + d[3] = 0x02; + }); + t + } + + pub fn pl2303_type01() -> Self { + let t = Self::pl2303_hx(); + t.patch_device_descriptor(|d| d[4] = 0x02); + t + } + + pub fn pl2303_ta() -> Self { + let t = Self::pl2303_hx(); + t.patch_device_descriptor(|d| { + d[2] = 0x00; + d[3] = 0x02; + d[12] = 0x00; + d[13] = 0x03; + }); + t + } + + pub fn cdc_iad() -> Self { + let t = Self::cdc_single_iface(); + t.set_vendor_product(0x2341, 0x0043); + t.patch_device_descriptor(|d| { + d[4] = 0xEF; + d[5] = 0x02; + d[6] = 0x01; + }); + let i0 = InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }; + let i1 = InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }; + t.set_interfaces(vec![i0, i1]); + t.configure_endpoints(&[ + ( + 0, + vec![EndpointInfo { + address: 0x81, + attributes: 3, + max_packet_size: 64, + interval: 1, + }], + ), + ( + 1, + vec![ + EndpointInfo { + address: 0x82, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x03, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + ), + ]); + // minimal IAD descriptor in raw config + t.set_raw_descriptors(vec![ + 9, 4, 0, 0, 1, 2, 2, 0, 0, 7, 5, 0x81, 3, 64, 0, 1, 9, 4, 1, 0, 2, 10, 0, 0, 7, 5, + 0x82, 2, 64, 0, 7, 5, 0x03, 2, 64, 0, 8, 11, 0, 2, 2, 2, 0, 0, + ]); + t + } + + pub fn cdc_multi() -> Self { + let t = Self::cdc_iad(); + t.set_interfaces(vec![ + InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }, + InterfaceInfo { + id: 2, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 3, + class: 10, + subclass: 0, + protocol: 0, + }, + ]); + t.configure_endpoints(&[ + ( + 1, + vec![ + EndpointInfo { + address: 0x82, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x03, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + ), + ( + 3, + vec![ + EndpointInfo { + address: 0x84, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x05, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + ), + ]); + t + } + + pub fn gsm_modem() -> Self { + let t = Self::cdc_single_iface(); + t.set_vendor_product(0x1782, 0x4D10); + t.set_interfaces(vec![InterfaceInfo { + id: 0, + class: 255, + subclass: 0, + protocol: 0, + }]); + t.configure_endpoints(&[( + 0, + vec![ + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )]); + t + } + + pub fn chrome_ccd_3port() -> Self { + let t = Self::cdc_single_iface(); + t.set_vendor_product(0x18D1, 0x5014); + let mut ifaces = Vec::new(); + let mut eps = Vec::new(); + for n in 0..3u8 { + ifaces.push(InterfaceInfo { + id: n, + class: 255, + subclass: 0, + protocol: 0, + }); + eps.push(( + n, + vec![ + EndpointInfo { + address: 0x81 + n * 2, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02 + n * 2, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )); + } + t.set_interfaces(ifaces); + t.configure_endpoints(&eps); + t + } + + fn also(self, f: F) -> Self { + f(&self); + self + } + + pub fn recorded_bulk_out(&self) -> Vec { + self.inner.lock().unwrap().recorded_bulk_out.clone() + } + + pub fn push_rx(&self, data: &[u8]) { + let mut s = self.inner.lock().unwrap(); + s.rx_queue.extend(data); + } + + pub fn push_interrupt_in(&self, data: &[u8]) { + let mut s = self.inner.lock().unwrap(); + s.interrupt_in_queue.extend(data); + } + + /// Drain and return bytes written to bulk OUT (test asserts). + pub fn take_tx(&self) -> Vec { + let mut s = self.inner.lock().unwrap(); + std::mem::take(&mut s.tx_log) + } + + /// Snapshot recorded control transfers. + pub fn recorded_controls(&self) -> Vec { + self.inner.lock().unwrap().recorded.clone() + } + + pub fn clear_recorded(&self) { + let mut s = self.inner.lock().unwrap(); + s.recorded.clear(); + s.recorded_bulk_out.clear(); + } + + pub fn claimed_interfaces(&self) -> Vec { + self.inner.lock().unwrap().claimed.clone() + } + + /// Queue the next `control_in` response payload (FIFO). + pub fn script_control_in_response(&self, data: Vec) { + self.inner.lock().unwrap().control_in_responses.push(data); + } + + pub fn inject_bulk_read_error(&self, msg: impl Into) { + self.inner.lock().unwrap().bulk_read_error = Some(msg.into()); + } + + pub fn set_interfaces(&self, interfaces: Vec) { + self.inner.lock().unwrap().interfaces = interfaces; + } + + pub fn configure_endpoints(&self, layout: &[(u8, Vec)]) { + let mut s = self.inner.lock().unwrap(); + s.endpoints = layout + .iter() + .flat_map(|(iface, eps)| eps.iter().map(move |ep| (*iface, *ep))) + .collect(); + } + + pub fn set_raw_descriptors(&self, raw: Vec) { + self.inner.lock().unwrap().raw_descriptors = raw; + } + + pub fn set_vendor_product(&self, vendor_id: u16, product_id: u16) { + let mut s = self.inner.lock().unwrap(); + s.device_descriptor[8] = (vendor_id & 0xff) as u8; + s.device_descriptor[9] = (vendor_id >> 8) as u8; + s.device_descriptor[10] = (product_id & 0xff) as u8; + s.device_descriptor[11] = (product_id >> 8) as u8; + } + + pub fn patch_device_descriptor(&self, mut patch: impl FnMut(&mut [u8; 18])) { + let mut s = self.inner.lock().unwrap(); + patch(&mut s.device_descriptor); + } +} + +struct FakeBulkIn { + inner: Arc>, + interrupt: bool, + endpoint: u8, +} + +impl Drop for FakeBulkIn { + fn drop(&mut self) { + if let Ok(mut s) = self.inner.lock() { + s.open_endpoints.retain(|&e| e != self.endpoint); + } + } +} + +impl BulkIn for FakeBulkIn { + fn read(&mut self, buf: &mut [u8], _timeout_ms: u32) -> Result { + let mut s = self.inner.lock().unwrap(); + if let Some(err) = s.bulk_read_error.take() { + return Err(UsbSerialError::Io(err)); + } + let queue = if self.interrupt { + &mut s.interrupt_in_queue + } else { + &mut s.rx_queue + }; + if queue.is_empty() { + return Ok(ReadOutcome::TimedOut); + } + let n = buf.len().min(queue.len()); + for (i, byte) in queue.drain(..n).enumerate() { + buf[i] = byte; + } + Ok(ReadOutcome::Data(buf[..n].to_vec())) + } + + fn cancel_all(&mut self) {} + + fn clear_halt(&mut self) -> Result<()> { + Ok(()) + } +} + +struct FakeBulkOut { + inner: Arc>, + endpoint: u8, +} + +impl Drop for FakeBulkOut { + fn drop(&mut self) { + if let Ok(mut s) = self.inner.lock() { + s.open_endpoints.retain(|&e| e != self.endpoint); + } + } +} + +impl BulkOut for FakeBulkOut { + fn write(&mut self, data: &[u8], _timeout_ms: u32) -> Result { + let mut s = self.inner.lock().unwrap(); + s.tx_log.extend_from_slice(data); + s.recorded_bulk_out.push(RecordedBulkOut { + endpoint: self.endpoint, + data: data.to_vec(), + }); + Ok(data.len()) + } + + fn clear_halt(&mut self) -> Result<()> { + Ok(()) + } +} + +impl Transport for FakeTransport { + fn raw_device_descriptor(&self) -> [u8; 18] { + self.inner.lock().unwrap().device_descriptor + } + + fn raw_descriptors(&self) -> Vec { + self.inner.lock().unwrap().raw_descriptors.clone() + } + + fn device_class(&self) -> u8 { + self.raw_device_descriptor()[4] + } + + fn interfaces(&self) -> Vec { + self.inner.lock().unwrap().interfaces.clone() + } + + fn endpoints(&self, interface: u8) -> Vec { + self.inner + .lock() + .unwrap() + .endpoints + .iter() + .filter(|(iface, _)| *iface == interface) + .map(|(_, ep)| *ep) + .collect() + } + + fn claim_interface(&self, interface: u8) -> Result<()> { + self.inner.lock().unwrap().claimed.push(interface); + Ok(()) + } + + fn release_interface(&self, interface: u8) -> Result<()> { + let mut s = self.inner.lock().unwrap(); + s.claimed.retain(|&i| i != interface); + Ok(()) + } + + fn control_out(&self, req: &ControlRequest) -> Result { + let mut s = self.inner.lock().unwrap(); + s.recorded.push(RecordedControl { + request_type: req.request_type, + request: req.request, + value: req.value, + index: req.index, + data: req.data.clone(), + }); + Ok(req.data.len()) + } + + fn control_in(&self, req: &ControlRequest) -> Result> { + let mut s = self.inner.lock().unwrap(); + s.recorded.push(RecordedControl { + request_type: req.request_type, + request: req.request, + value: req.value, + index: req.index, + data: req.data.clone(), + }); + if let Some(resp) = s.control_in_responses.pop() { + return Ok(resp); + } + Ok(req.data.clone()) + } + + fn open_bulk_in(&self, endpoint: u8, _max_packet_size: u16) -> Result> { + self.mark_endpoint_open(endpoint)?; + Ok(Box::new(FakeBulkIn { + inner: self.inner.clone(), + interrupt: false, + endpoint, + })) + } + + fn open_bulk_out(&self, endpoint: u8, _max_packet_size: u16) -> Result> { + self.mark_endpoint_open(endpoint)?; + Ok(Box::new(FakeBulkOut { + inner: self.inner.clone(), + endpoint, + })) + } + + fn open_interrupt_in(&self, endpoint: u8, _max_packet_size: u16) -> Result> { + self.mark_endpoint_open(endpoint)?; + Ok(Box::new(FakeBulkIn { + inner: self.inner.clone(), + interrupt: true, + endpoint, + })) + } +} + +impl FakeTransport { + fn mark_endpoint_open(&self, endpoint: u8) -> Result<()> { + let mut s = self.inner.lock().unwrap(); + if s.open_endpoints.contains(&endpoint) { + return Err(UsbSerialError::Io("endpoint already in use".into())); + } + s.open_endpoints.push(endpoint); + Ok(()) + } +} diff --git a/crates/android-usb-serial/src/lib.rs b/crates/android-usb-serial/src/lib.rs new file mode 100644 index 00000000..598f2840 --- /dev/null +++ b/crates/android-usb-serial/src/lib.rs @@ -0,0 +1,138 @@ +//! Pure Rust USB serial drivers for Android (and Linux), built on [nusb](https://docs.rs/nusb). +//! +//! Protocol logic is ported from +//! [usb-serial-for-android](https://github.com/mik3y/usb-serial-for-android) and checked against +//! golden USB control-transfer fixtures under `tests/fixtures/`. +//! +//! ## Overview +//! +//! This crate does **not** talk to Android `UsbManager`. The host app (typically Kotlin) owns +//! USB permission, opens a `UsbDeviceConnection`, and passes its raw file descriptor into Rust. +//! The crate then: +//! +//! 1. [`from_raw_fd`] — `dup`s the fd so Java can keep the connection alive. +//! 2. [`NusbTransport`] — claims interfaces via nusb (`detach_and_claim`). +//! 3. [`ProbeTable`] / [`open_port`] — selects a vendor driver and returns a [`SerialPortHandle`]. +//! +//! ```text +//! UsbManager (Kotlin) → permission → UsbDeviceConnection → fd (unclaimed) +//! ↓ +//! from_raw_fd / NusbTransport +//! ↓ +//! ProbeTable → Ftdi / Cp21xx / Ch34x / … drivers +//! ↓ +//! SerialPortHandle (write / reader / modem / purge) +//! ``` +//! +//! ## Android usage +//! +//! - Declare `android.hardware.usb.host` and a `device_filter.xml` in the app. +//! - Request runtime USB permission before `UsbManager.openDevice()`. +//! - **Do not** call `UsbDeviceConnection.claimInterface()` in Kotlin — nusb claims after +//! [`from_raw_fd`]. Pre-claim causes `io interface is busy`. +//! - Keep the `UsbDeviceConnection` open for the whole session; close it only after Rust +//! [`SerialPortHandle::close`]. +//! - Prefer [`SerialPortHandle::start_reader`] **after** line config and DTR/RTS (important for +//! weak OTG / CH340). +//! - Multi-port chips: pass `port_index` to [`open_port`] (`0`, `1`, …). App-level enumerate +//! often exposes paths as `deviceName` / `deviceName#N`. +//! +//! Full Kotlin/permission walkthrough: crate README (*Using on Android*) in the repository. +//! +//! ## Quick start (real USB fd) +//! +//! ```ignore +//! // fd from UsbDeviceConnection.fileDescriptor (dup'd inside from_raw_fd) +//! use android_usb_serial::{from_raw_fd, open_port, NusbTransport, Transport}; +//! use std::sync::Arc; +//! +//! let device = from_raw_fd(fd)?; +//! let transport = Arc::new(NusbTransport::from_device(device)?) as Arc; +//! let mut port = open_port(transport, 0)?; +//! port.write(b"AT\r\n")?; +//! ``` +//! +//! ## Quick start (`fake-transport`) +//! +//! ``` +//! # #[cfg(feature = "fake-transport")] +//! # { +//! use android_usb_serial::{open_port, FakeTransport, Transport}; +//! use std::sync::Arc; +//! +//! let fake = FakeTransport::cdc_single_iface(); +//! let transport: Arc = Arc::new(fake.clone()); +//! let mut port = open_port(transport, 0).unwrap(); +//! port.write(b"PING").unwrap(); +//! assert_eq!(fake.take_tx(), b"PING"); +//! # } +//! ``` +//! +//! ## Features +//! +//! | Feature | Default | Description | +//! |---------|---------|-------------| +//! | `serialport-compat` | yes | [`serialport::SerialPort`] adapter ([`serialport_compat`]) | +//! | `fake-transport` | no | [`FakeTransport`] + `golden_record` binary | +//! +//! ## Platform notes +//! +//! - **Android / Linux:** real USB via nusb ([`from_raw_fd`], [`NusbTransport`]). +//! - **Other hosts:** drivers + [`fake`] for tests; supply your own [`Transport`] +//! for hardware. + +#![cfg_attr(docsrs, feature(doc_cfg))] + +/// Line / flow / purge configuration types. +pub mod config; +/// Device probe and port open helpers. +pub mod device; +/// Chip-specific USB serial drivers. +pub mod drivers; +/// Error types. +pub mod error; +/// High-level serial port handle. +pub mod port; +/// VID/PID probe table (ported from usb-serial-for-android). +pub mod probe; +/// Continuous bulk-IN reader thread. +pub mod reader; +/// RX filter chain (FTDI header strip, XON/XOFF). +pub mod rx_filter; +/// USB transport trait and request types. +pub mod transport; +/// XON/XOFF inline filter. +pub mod xonxoff; + +#[cfg(feature = "fake-transport")] +#[cfg_attr(docsrs, doc(cfg(feature = "fake-transport")))] +/// In-memory [`Transport`](crate::transport::Transport) for golden parity and harnesses. +pub mod fake; + +#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg_attr(docsrs, doc(cfg(any(target_os = "android", target_os = "linux"))))] +/// `nusb`-backed transport (`from_raw_fd` / Android `UsbDeviceConnection`). +pub mod nusb_transport; + +#[cfg(feature = "serialport-compat")] +#[cfg_attr(docsrs, doc(cfg(feature = "serialport-compat")))] +/// Adapter implementing [`serialport::SerialPort`]. +pub mod serialport_compat; + +pub use config::*; +pub use device::{describe_device, open_port, DeviceDescriptor, PortDescriptor}; +pub use drivers::ModemStatus; +pub use error::{ReadOutcome, Result, TransferError, UsbSerialError}; +pub use port::SerialPortHandle; +pub use probe::{DriverType, ProbeTable}; +pub use transport::{ + BulkIn, BulkOut, ControlRequest, EndpointInfo, InterfaceInfo, SharedTransport, Transport, +}; + +#[cfg(feature = "fake-transport")] +#[cfg_attr(docsrs, doc(cfg(feature = "fake-transport")))] +pub use fake::FakeTransport; + +#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg_attr(docsrs, doc(cfg(any(target_os = "android", target_os = "linux"))))] +pub use nusb_transport::{from_raw_fd, NusbTransport}; diff --git a/crates/android-usb-serial/src/nusb_transport.rs b/crates/android-usb-serial/src/nusb_transport.rs new file mode 100644 index 00000000..e54d3718 --- /dev/null +++ b/crates/android-usb-serial/src/nusb_transport.rs @@ -0,0 +1,441 @@ +//! nusb-backed transport (Linux / Android). +//! +//! Obtain an [`nusb::Device`] with [`from_raw_fd`] (Android `UsbDeviceConnection` fd) or open +//! via nusb on Linux, then wrap it in [`NusbTransport`]. + +use crate::error::{ReadOutcome, Result, TransferError, UsbSerialError}; +use crate::transport::{ + parse_control_recipient, BulkIn, BulkOut, ControlRequest, EndpointInfo, InterfaceInfo, + Transport, +}; +use nusb::io::EndpointRead; +use nusb::transfer::{ + Bulk, ControlIn, ControlOut, ControlType, In, Interrupt, Out, Recipient, + TransferError as NusbXfer, +}; +use nusb::{Device, Interface, MaybeFuture}; +use std::collections::HashMap; +use std::io::{ErrorKind, Read}; +use std::os::fd::{FromRawFd, OwnedFd, RawFd}; +use std::sync::Mutex; +use std::time::Duration; + +/// Fewer in-flight bulk IN URBs on Android OTG reduces EPROTO/detach on weak ports (CH340). +const IN_FLIGHT_TRANSFERS: usize = 2; + +/// Duplicate an Android `UsbDeviceConnection` fd and open via nusb. +/// +/// Calls `libc::dup` so Java/Kotlin may keep owning the original connection. Do **not** +/// claim interfaces on the Kotlin side before this — nusb uses `detach_and_claim`. +pub fn from_raw_fd(fd: RawFd) -> Result { + let dup_fd = unsafe { libc::dup(fd) }; + if dup_fd < 0 { + return Err(UsbSerialError::Io(format!( + "dup failed: {}", + std::io::Error::last_os_error() + ))); + } + let owned = unsafe { OwnedFd::from_raw_fd(dup_fd) }; + Device::from_fd(owned) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string())) +} + +/// [`crate::Transport`] over a live [`nusb::Device`] (claim, control, bulk endpoints). +pub struct NusbTransport { + device: Device, + claimed: Mutex>, + interfaces: Vec, + endpoints: HashMap>, + device_descriptor: [u8; 18], + raw_config_descriptors: Vec, +} + +impl NusbTransport { + /// Build a transport from an already-opened nusb device (parses config descriptors). + pub fn from_device(device: Device) -> Result { + let config = device + .active_configuration() + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + let raw_config_descriptors = config.as_bytes().to_vec(); + let mut interfaces = Vec::new(); + let mut endpoints = HashMap::new(); + for iface_group in config.interfaces() { + let info = iface_group.first_alt_setting(); + let id = iface_group.interface_number(); + interfaces.push(InterfaceInfo { + id, + class: info.class(), + subclass: info.subclass(), + protocol: info.protocol(), + }); + let eps: Vec = info + .endpoints() + .map(|ep| EndpointInfo { + address: ep.address(), + attributes: ep.attributes(), + max_packet_size: ep.max_packet_size() as u16, + interval: ep.interval(), + }) + .collect(); + endpoints.insert(id, eps); + } + let mut device_descriptor = [0u8; 18]; + let desc = device.device_descriptor(); + let raw = desc.as_bytes(); + let n = raw.len().min(18); + device_descriptor[..n].copy_from_slice(&raw[..n]); + Ok(Self { + device, + claimed: Mutex::new(HashMap::new()), + interfaces, + endpoints, + device_descriptor, + raw_config_descriptors, + }) + } + + fn interface(&self, interface: u8) -> Result { + let mut claimed = self.claimed.lock().unwrap(); + if let Some(iface) = claimed.get(&interface) { + return Ok(iface.clone()); + } + let iface = self + .device + .detach_and_claim_interface(interface) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + claimed.insert(interface, iface.clone()); + Ok(iface) + } +} + +struct NusbPipelinedIn { + reader: Mutex>>, + bufsize: usize, + default_timeout_ms: u32, +} + +impl NusbPipelinedIn { + fn new(endpoint: nusb::Endpoint, bufsize: usize, timeout_ms: u32) -> Self { + let reader = endpoint + .reader(bufsize) + .with_num_transfers(IN_FLIGHT_TRANSFERS) + .with_read_timeout(Duration::from_millis(timeout_ms as u64)); + Self { + reader: Mutex::new(Some(reader)), + bufsize, + default_timeout_ms: timeout_ms, + } + } + + fn read_inner(&self, buf: &mut [u8], timeout_ms: u32) -> Result { + let mut guard = self.reader.lock().unwrap(); + let reader = guard + .as_mut() + .ok_or_else(|| UsbSerialError::Io("endpoint closed".into()))?; + reader.set_read_timeout(Duration::from_millis(timeout_ms as u64)); + match reader.read(buf) { + Ok(0) => Ok(ReadOutcome::TimedOut), + Ok(n) => Ok(ReadOutcome::Data(buf[..n].to_vec())), + Err(e) if e.kind() == ErrorKind::TimedOut => Ok(ReadOutcome::TimedOut), + Err(e) => Err(map_io_err(&e)), + } + } + + fn cancel_all(&self) { + if let Ok(mut guard) = self.reader.lock() { + if let Some(reader) = guard.as_mut() { + reader.cancel_all(); + } + } + } + + fn clear_halt(&self) -> Result<()> { + let mut guard = self.reader.lock().unwrap(); + let reader = guard + .take() + .ok_or_else(|| UsbSerialError::Io("endpoint closed".into()))?; + let mut ep = reader.into_inner(); + ep.clear_halt() + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + let new_reader = ep + .reader(self.bufsize) + .with_num_transfers(IN_FLIGHT_TRANSFERS) + .with_read_timeout(Duration::from_millis(self.default_timeout_ms as u64)); + *guard = Some(new_reader); + Ok(()) + } +} + +struct NusbBulkIn { + inner: NusbPipelinedIn, +} + +impl BulkIn for NusbBulkIn { + fn read(&mut self, buf: &mut [u8], timeout_ms: u32) -> Result { + self.inner.read_inner(buf, timeout_ms) + } + + fn cancel_all(&mut self) { + self.inner.cancel_all(); + } + + fn clear_halt(&mut self) -> Result<()> { + self.inner.clear_halt() + } +} + +struct NusbInterruptIn { + inner: NusbPipelinedIn, +} + +impl BulkIn for NusbInterruptIn { + fn read(&mut self, buf: &mut [u8], timeout_ms: u32) -> Result { + self.inner.read_inner(buf, timeout_ms) + } + + fn cancel_all(&mut self) { + self.inner.cancel_all(); + } + + fn clear_halt(&mut self) -> Result<()> { + self.inner.clear_halt() + } +} + +struct NusbBulkOut { + ep: Mutex>, +} + +impl BulkOut for NusbBulkOut { + fn write(&mut self, data: &[u8], timeout_ms: u32) -> Result { + let mut ep = self.ep.lock().unwrap(); + let timeout = Duration::from_millis(timeout_ms as u64); + let comp = ep.transfer_blocking(data.to_vec().into(), timeout); + comp.status.map_err(|e| map_transfer_err(&e))?; + Ok(comp.actual_len) + } + + fn clear_halt(&mut self) -> Result<()> { + let mut ep = self.ep.lock().unwrap(); + ep.clear_halt() + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + Ok(()) + } +} + +fn map_transfer_err(e: &NusbXfer) -> UsbSerialError { + match e { + NusbXfer::Cancelled => UsbSerialError::from(TransferError::Cancelled), + NusbXfer::Stall => UsbSerialError::from(TransferError::Stall), + NusbXfer::Disconnected => UsbSerialError::from(TransferError::Disconnected), + _ => UsbSerialError::Io(e.to_string()), + } +} + +fn map_io_err(e: &std::io::Error) -> UsbSerialError { + if e.kind() == ErrorKind::TimedOut { + return UsbSerialError::TimedOut; + } + let msg = e.to_string().to_lowercase(); + if msg.contains("stall") { + return UsbSerialError::from(TransferError::Stall); + } + if msg.contains("disconnect") { + return UsbSerialError::from(TransferError::Disconnected); + } + if msg.contains("cancel") { + return UsbSerialError::from(TransferError::Cancelled); + } + UsbSerialError::Io(e.to_string()) +} + +/// Parse USB control setup fields (exported for unit tests on linux/android). +pub fn parse_control(req: &ControlRequest) -> (ControlType, Recipient, bool) { + let (recipient_bits, direction_in) = parse_control_recipient(req.request_type); + let control_type = match req.request_type & 0x60 { + 0x00 => ControlType::Standard, + 0x20 => ControlType::Class, + _ => ControlType::Vendor, + }; + let recipient = match recipient_bits { + 0x00 => Recipient::Device, + 0x01 => Recipient::Interface, + 0x02 => Recipient::Endpoint, + _ => Recipient::Other, + }; + (control_type, recipient, direction_in) +} + +impl Transport for NusbTransport { + fn raw_device_descriptor(&self) -> [u8; 18] { + self.device_descriptor + } + + fn raw_descriptors(&self) -> Vec { + self.raw_config_descriptors.clone() + } + + fn device_class(&self) -> u8 { + self.device_descriptor[4] + } + + fn interfaces(&self) -> Vec { + self.interfaces.clone() + } + + fn endpoints(&self, interface: u8) -> Vec { + self.endpoints.get(&interface).cloned().unwrap_or_default() + } + + fn claim_interface(&self, interface: u8) -> Result<()> { + let _ = self.interface(interface)?; + Ok(()) + } + + fn release_interface(&self, interface: u8) -> Result<()> { + self.claimed.lock().unwrap().remove(&interface); + Ok(()) + } + + fn control_out(&self, req: &ControlRequest) -> Result { + let (control_type, recipient, _) = parse_control(req); + let timeout = Duration::from_millis(req.timeout_ms as u64); + let data = ControlOut { + control_type, + recipient, + request: req.request, + value: req.value, + index: req.index, + data: &req.data, + }; + match recipient { + Recipient::Device => self + .device + .control_out(data, timeout) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?, + Recipient::Interface => { + let iface_num = (req.index & 0xff) as u8; + self.interface(iface_num)? + .control_out(data, timeout) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + } + _ => { + let iface_num = endpoint_interface(&self.endpoints, (req.index & 0xff) as u8) + .or(Ok::(0))?; + self.interface(iface_num)? + .control_out(data, timeout) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + } + } + Ok(req.data.len()) + } + + fn control_in(&self, req: &ControlRequest) -> Result> { + let (control_type, recipient, _) = parse_control(req); + let timeout = Duration::from_millis(req.timeout_ms as u64); + let length = req.data.len().min(u16::MAX as usize) as u16; + let data = ControlIn { + control_type, + recipient, + request: req.request, + value: req.value, + index: req.index, + length, + }; + let bytes = match recipient { + Recipient::Device => self + .device + .control_in(data, timeout) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?, + Recipient::Interface => self + .interface((req.index & 0xff) as u8)? + .control_in(data, timeout) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?, + _ => self + .interface( + endpoint_interface(&self.endpoints, (req.index & 0xff) as u8).unwrap_or(0), + )? + .control_in(data, timeout) + .wait() + .map_err(|e| UsbSerialError::Io(e.to_string()))?, + }; + Ok(bytes) + } + + fn open_bulk_in(&self, endpoint: u8, max_packet_size: u16) -> Result> { + let iface_num = endpoint_interface(&self.endpoints, endpoint)?; + let iface = self.interface(iface_num)?; + let ep = iface + .endpoint::(endpoint) + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + let bufsize = (max_packet_size as usize).saturating_mul(4).max(64); + Ok(Box::new(NusbBulkIn { + inner: NusbPipelinedIn::new(ep, bufsize, 200), + })) + } + + fn open_bulk_out(&self, endpoint: u8, _max_packet_size: u16) -> Result> { + let iface_num = endpoint_interface(&self.endpoints, endpoint)?; + let iface = self.interface(iface_num)?; + let ep = iface + .endpoint::(endpoint) + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + Ok(Box::new(NusbBulkOut { ep: Mutex::new(ep) })) + } + + fn open_interrupt_in(&self, endpoint: u8, max_packet_size: u16) -> Result> { + let iface_num = endpoint_interface(&self.endpoints, endpoint)?; + let iface = self.interface(iface_num)?; + let ep = iface + .endpoint::(endpoint) + .map_err(|e| UsbSerialError::Io(e.to_string()))?; + let bufsize = (max_packet_size as usize).max(8); + Ok(Box::new(NusbInterruptIn { + inner: NusbPipelinedIn::new(ep, bufsize, 200), + })) + } +} + +fn endpoint_interface(endpoints: &HashMap>, ep_addr: u8) -> Result { + for (iface, eps) in endpoints { + if eps.iter().any(|e| e.address == ep_addr) { + return Ok(*iface); + } + } + Err(UsbSerialError::Io(format!( + "endpoint {ep_addr:#x} not found" + ))) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::transport::USB_RECIP_DEVICE; + + #[test] + fn parse_vendor_device_out() { + let req = ControlRequest::vendor_out(0x01, 0, 0, vec![]); + let (_, recipient, dir_in) = parse_control(&req); + assert!(!dir_in); + assert_eq!(recipient, Recipient::Device); + assert_eq!(req.request_type & USB_RECIP_DEVICE, 0); + } + + #[test] + fn parse_class_interface_in() { + let req = ControlRequest::class_in(0x20, 0, 0, 7); + let (ty, recipient, dir_in) = parse_control(&req); + assert!(dir_in); + assert_eq!(recipient, Recipient::Interface); + assert_eq!(ty, ControlType::Class); + } +} diff --git a/crates/android-usb-serial/src/port.rs b/crates/android-usb-serial/src/port.rs new file mode 100644 index 00000000..175df8b8 --- /dev/null +++ b/crates/android-usb-serial/src/port.rs @@ -0,0 +1,123 @@ +//! High-level serial port handle over a proprietary USB serial driver. +//! +//! Prefer this API for Android/Linux USB adapters. With feature `serialport-compat`, wrap +//! the handle in [`crate::serialport_compat`] for a `serialport::SerialPort` facade. + +use crate::config::{FlowControl, LineConfig, PurgeKind}; +use crate::drivers::{Driver, ModemStatus}; +use crate::error::Result; +use crate::reader::SerialReader; +use crate::transport::SharedTransport; + +/// Open USB serial session: sync I/O plus optional background bulk-IN reader. +pub struct SerialPortHandle { + transport: SharedTransport, + driver: Box, + reader: Option, + closed: bool, +} + +impl SerialPortHandle { + pub(crate) fn new(transport: SharedTransport, driver: Box) -> Self { + Self { + transport, + driver, + reader: None, + closed: false, + } + } + + /// Bulk OUT write. Opens OUT only — IN belongs to the optional [`Self::start_reader`]. + pub fn write(&mut self, data: &[u8]) -> Result { + self.driver.write(data) + } + + /// Blocking/synchronous bulk IN read through the driver (not the background reader). + pub fn read(&mut self, buf: &mut [u8]) -> Result { + self.driver.read(buf) + } + + /// Baud / framing line coding. + pub fn set_line_config(&mut self, cfg: LineConfig) -> Result<()> { + self.driver.set_line_config(cfg) + } + + pub fn set_flow_control(&mut self, flow: FlowControl) -> Result<()> { + self.driver.set_flow_control(flow) + } + + pub fn set_dtr(&mut self, value: bool) -> Result<()> { + self.driver.set_dtr(value) + } + + pub fn set_rts(&mut self, value: bool) -> Result<()> { + self.driver.set_rts(value) + } + + pub fn set_break(&mut self, enabled: bool) -> Result<()> { + self.driver.set_break(enabled) + } + + /// Clear RX and/or TX driver buffers (host-side purge). + pub fn purge(&mut self, kind: PurgeKind) -> Result<()> { + self.driver.purge(kind) + } + + /// Alias for [`Self::purge`] (clear input/output buffers). + pub fn clear(&mut self, kind: PurgeKind) -> Result<()> { + self.purge(kind) + } + + /// Latched modem status lines (CTS/DSR/RI/CD), when the chip reports them. + pub fn modem_status(&mut self) -> Result { + self.driver.modem_status() + } + + /// Stop the bulk-IN reader, close the driver, then mark closed (idempotent). + pub fn close(&mut self) { + if self.closed { + return; + } + self.stop_reader(); + let _ = self.driver.close(); + self.closed = true; + } + + /// Start the background bulk-IN reader (takes ownership of the driver's IN endpoint). + /// + /// Call **after** [`Self::set_line_config`] and DTR/RTS on weak OTG / CH340 adapters. + pub fn start_reader(&mut self) -> Result<()> { + if self.reader.is_some() { + return Ok(()); + } + let reader = self.driver.start_reader()?; + self.reader = Some(reader); + Ok(()) + } + + /// Non-blocking read from the background reader if running; else [`Self::read`]. + pub fn try_read(&mut self, buf: &mut [u8]) -> Result { + if let Some(reader) = &mut self.reader { + return reader.try_read(buf); + } + self.read(buf) + } + + /// Stop and join the background reader without closing the port. + pub fn stop_reader(&mut self) { + if let Some(mut r) = self.reader.take() { + r.stop(); + } + } + + /// Shared transport (for advanced control or re-probe). + pub fn transport(&self) -> &SharedTransport { + &self.transport + } +} + +impl Drop for SerialPortHandle { + fn drop(&mut self) { + self.close(); + } +} diff --git a/crates/android-usb-serial/src/probe.rs b/crates/android-usb-serial/src/probe.rs new file mode 100644 index 00000000..ec01fd56 --- /dev/null +++ b/crates/android-usb-serial/src/probe.rs @@ -0,0 +1,169 @@ +//! Driver probing (ported from ProbeTable.java / UsbId.java). +//! +//! [`ProbeTable::default_table`] lists known VID/PID pairs. Unknown CDC composites fall +//! back to [`DriverType::CdcAcm`] when communication/data interfaces are present. + +use crate::transport::InterfaceInfo; + +/// Vendor driver family selected for a USB product. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum DriverType { + CdcAcm, + Cp21xx, + Ftdi, + Prolific, + Ch34x, + GsmModem, + ChromeCcd, +} + +/// One VID/PID → driver binding. +#[derive(Debug, Clone)] +pub struct ProbeEntry { + pub vendor_id: u16, + pub product_id: u16, + pub driver: DriverType, +} + +/// Lookup table used by [`crate::describe_device`] / [`crate::open_port`]. +#[derive(Debug, Clone, Default)] +pub struct ProbeTable { + entries: Vec, +} + +impl ProbeTable { + /// Built-in VID/PID map aligned with usb-serial-for-android defaults. + pub fn default_table() -> Self { + let mut table = Self::default(); + // Order matches Java getDefaultProbeTable driver registration for probe-fn fallback. + table.add_product(0x0403, 0x6001, DriverType::Ftdi); + table.add_product(0x0403, 0x6010, DriverType::Ftdi); + table.add_product(0x0403, 0x6011, DriverType::Ftdi); + table.add_product(0x0403, 0x6014, DriverType::Ftdi); + table.add_product(0x0403, 0x6015, DriverType::Ftdi); + table.add_product(0x10C4, 0xEA60, DriverType::Cp21xx); + table.add_product(0x10C4, 0xEA70, DriverType::Cp21xx); + table.add_product(0x10C4, 0xEA71, DriverType::Cp21xx); + table.add_product(0x067B, 0x2303, DriverType::Prolific); + table.add_product(0x067B, 0x23A3, DriverType::Prolific); + table.add_product(0x067B, 0x23B3, DriverType::Prolific); + table.add_product(0x067B, 0x23C3, DriverType::Prolific); + table.add_product(0x067B, 0x23D3, DriverType::Prolific); + table.add_product(0x067B, 0x23E3, DriverType::Prolific); + table.add_product(0x067B, 0x23F3, DriverType::Prolific); + table.add_product(0x1A86, 0x7523, DriverType::Ch34x); + table.add_product(0x1A86, 0x5523, DriverType::Ch34x); + table.add_product(0x18D1, 0x5014, DriverType::ChromeCcd); + table.add_product(0x1782, 0x4D10, DriverType::GsmModem); + table.add_product(0x1782, 0x4D12, DriverType::GsmModem); + table + } + + /// Register a product binding (last write wins on duplicates). + pub fn add_product(&mut self, vendor_id: u16, product_id: u16, driver: DriverType) { + self.entries.push(ProbeEntry { + vendor_id, + product_id, + driver, + }); + } + + /// Resolve driver for `(vid, pid)`; falls back to CDC-ACM when interfaces look CDC. + pub fn find( + &self, + vendor_id: u16, + product_id: u16, + interfaces: &[InterfaceInfo], + ) -> DriverType { + if let Some(entry) = self + .entries + .iter() + .find(|e| e.vendor_id == vendor_id && e.product_id == product_id) + { + return entry.driver; + } + if cdc_acm_port_count(interfaces) > 0 { + return DriverType::CdcAcm; + } + DriverType::CdcAcm // unreachable for unknown; caller checks port_count + } + + /// How many serial ports this driver + interface layout exposes. + pub fn port_count(&self, driver: DriverType, interfaces: &[InterfaceInfo]) -> usize { + match driver { + DriverType::CdcAcm => cdc_acm_port_count(interfaces), + DriverType::Ftdi | DriverType::Cp21xx => interfaces.len().max(1), + DriverType::ChromeCcd => 3, + DriverType::Ch34x | DriverType::Prolific | DriverType::GsmModem => 1, + } + } + + /// Port count when interface list is not yet known (enumeration / probe_table fixtures). + pub fn port_count_product( + &self, + vendor_id: u16, + product_id: u16, + driver: DriverType, + interfaces: &[InterfaceInfo], + ) -> usize { + if !interfaces.is_empty() { + return self.port_count(driver, interfaces); + } + match (vendor_id, product_id) { + (0x0403, 0x6010 | 0x6011 | 0x6014 | 0x6015) => 2, + (0x10C4, 0xEA70 | 0xEA71) => 2, + (0x18D1, 0x5014) => 3, + _ => self.port_count(driver, interfaces), + } + } + + /// Immutable view of registered bindings. + pub fn entries(&self) -> &[ProbeEntry] { + &self.entries + } +} + +/// Count CDC ACM data/comm interface pairs. +pub fn cdc_acm_port_count(interfaces: &[InterfaceInfo]) -> usize { + let comm = interfaces + .iter() + .filter(|i| i.class == 2 && i.subclass == 2) + .count(); + let data = interfaces.iter().filter(|i| i.class == 10).count(); + comm.min(data) + .max(if comm == 0 && data == 0 { 0 } else { 1 }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn default_table_finds_ftdi() { + let table = ProbeTable::default_table(); + let driver = table.find(0x0403, 0x6001, &[]); + assert_eq!(driver, DriverType::Ftdi); + } + + #[test] + fn cdc_probe_fn_fallback() { + let table = ProbeTable::default_table(); + let ifaces = vec![ + InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }, + ]; + let driver = table.find(0x9999, 0x0001, &ifaces); + assert_eq!(driver, DriverType::CdcAcm); + assert_eq!(table.port_count(driver, &ifaces), 1); + } +} diff --git a/crates/android-usb-serial/src/reader.rs b/crates/android-usb-serial/src/reader.rs new file mode 100644 index 00000000..adfd41ab --- /dev/null +++ b/crates/android-usb-serial/src/reader.rs @@ -0,0 +1,177 @@ +//! Background bulk-IN reader (2–4 in-flight transfers + RX filter chain). +//! +//! Started via [`crate::SerialPortHandle::start_reader`]. Owns the driver's bulk IN endpoint +//! for the lifetime of the reader; [`SerialPortHandle::write`] must not reopen that IN. + +use crate::error::{ReadOutcome, Result, TransferError, UsbSerialError}; +use crate::rx_filter::{apply_filters, RxFilter}; +use crate::transport::BulkIn; +use std::sync::mpsc::{self, Receiver, Sender, TryRecvError}; +use std::sync::{Arc, Mutex}; +use std::thread::{self, JoinHandle}; +use std::time::Duration; + +const STOP_JOIN_TIMEOUT: Duration = Duration::from_secs(1); + +/// Thread that continuously reads bulk IN and pushes filtered chunks into a channel. +pub struct SerialReader { + rx: Receiver>, + stop_tx: Option>, + join: Option>, + error: Arc>>, +} + +impl SerialReader { + /// Spawn the reader thread over `bulk_in` with optional RX filters (FTDI header, XON/XOFF). + pub fn start( + bulk_in: Box, + max_packet_size: u16, + read_timeout_ms: u32, + filters: Vec>, + ) -> Self { + let bufsize = (max_packet_size as usize).saturating_mul(4).max(64); + let (data_tx, data_rx) = mpsc::channel(); + let (stop_tx, stop_rx) = mpsc::channel(); + let error = Arc::new(Mutex::new(None)); + let err_clone = error.clone(); + let join = thread::spawn(move || { + reader_loop( + bulk_in, + bufsize, + read_timeout_ms, + filters, + &data_tx, + &stop_rx, + &err_clone, + ); + }); + Self { + rx: data_rx, + stop_tx: Some(stop_tx), + join: Some(join), + error, + } + } + + /// Non-blocking: copy one queued chunk into `buf`, or `Ok(0)` if empty. + pub fn try_read(&mut self, buf: &mut [u8]) -> Result { + if let Some(err) = self.error.lock().unwrap().take() { + return Err(err); + } + match self.rx.try_recv() { + Ok(chunk) => { + let n = chunk.len().min(buf.len()); + buf[..n].copy_from_slice(&chunk[..n]); + Ok(n) + } + Err(TryRecvError::Empty) => Ok(0), + Err(TryRecvError::Disconnected) => { + if let Some(err) = self.error.lock().unwrap().take() { + return Err(err); + } + Err(UsbSerialError::Disconnected) + } + } + } + + /// Signal stop and join the reader (best-effort within a short timeout). + pub fn stop(&mut self) { + if let Some(tx) = self.stop_tx.take() { + let _ = tx.send(()); + } + if let Some(j) = self.join.take() { + let (done_tx, done_rx) = mpsc::channel(); + thread::spawn(move || { + let _ = j.join(); + let _ = done_tx.send(()); + }); + let _ = done_rx.recv_timeout(STOP_JOIN_TIMEOUT); + } + } +} + +impl Drop for SerialReader { + fn drop(&mut self) { + self.stop(); + } +} + +fn is_stall(err: &UsbSerialError) -> bool { + matches!(err, UsbSerialError::Io(msg) if msg == "stall") +} + +fn reader_loop( + mut bulk_in: Box, + bufsize: usize, + timeout_ms: u32, + mut filters: Vec>, + data_tx: &Sender>, + stop_rx: &Receiver<()>, + error: &Arc>>, +) { + let mut buf = vec![0u8; bufsize]; + let mut consecutive_stalls = 0u32; + loop { + if stop_rx.try_recv().is_ok() { + bulk_in.cancel_all(); + break; + } + match bulk_in.read(&mut buf, timeout_ms) { + Ok(ReadOutcome::Data(data)) if !data.is_empty() => { + consecutive_stalls = 0; + let filtered = if filters.is_empty() { + data + } else { + apply_filters(&mut filters, &data) + }; + if !filtered.is_empty() && data_tx.send(filtered).is_err() { + break; + } + } + Ok(ReadOutcome::TimedOut) | Ok(ReadOutcome::Data(_)) => {} + Ok(ReadOutcome::Cancelled) => break, + Err(e) if is_stall(&e) => { + if consecutive_stalls == 0 { + consecutive_stalls += 1; + if bulk_in.clear_halt().is_err() { + *error.lock().unwrap() = Some(e); + break; + } + continue; + } + *error.lock().unwrap() = Some(UsbSerialError::from(TransferError::Stall)); + break; + } + Err(e) => { + *error.lock().unwrap() = Some(e); + break; + } + } + } +} + +#[cfg(all(test, feature = "fake-transport"))] +mod tests { + use super::*; + use crate::fake::FakeTransport; + use crate::transport::Transport; + use std::time::Instant; + + #[test] + fn reader_delivers_injected_rx() { + let fake = FakeTransport::cdc_single_iface(); + fake.push_rx(b"hello"); + let bulk = fake.open_bulk_in(0x81, 64).unwrap(); + let mut reader = SerialReader::start(bulk, 64, 100, vec![]); + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 8]; + let mut n = 0; + while n == 0 && Instant::now() < deadline { + n = reader.try_read(&mut out).unwrap(); + std::thread::sleep(Duration::from_millis(5)); + } + assert_eq!(n, 5); + assert_eq!(&out[..5], b"hello"); + reader.stop(); + } +} diff --git a/crates/android-usb-serial/src/rx_filter.rs b/crates/android-usb-serial/src/rx_filter.rs new file mode 100644 index 00000000..03d88e90 --- /dev/null +++ b/crates/android-usb-serial/src/rx_filter.rs @@ -0,0 +1,88 @@ +//! RX filter chain (FTDI header strip, XON/XOFF inline). + +use crate::xonxoff::XonXoffFilter; + +const FTDI_READ_HEADER: usize = 2; + +/// Strip FTDI 2-byte status headers from bulk IN data. +pub fn strip_ftdi_header(packet: &[u8], mps: usize) -> Vec { + let mut out = Vec::new(); + let mut pos = 0; + while pos < packet.len() { + let chunk = (pos + mps).min(packet.len()); + if chunk - pos <= FTDI_READ_HEADER { + break; + } + out.extend_from_slice(&packet[pos + FTDI_READ_HEADER..chunk]); + pos += mps; + } + out +} + +pub trait RxFilter: Send { + fn filter(&mut self, input: &[u8]) -> Vec; +} + +pub struct FtdiHeaderFilter { + mps: usize, +} + +impl FtdiHeaderFilter { + pub fn new(mps: u16) -> Self { + Self { + mps: mps.max(1) as usize, + } + } +} + +impl RxFilter for FtdiHeaderFilter { + fn filter(&mut self, input: &[u8]) -> Vec { + strip_ftdi_header(input, self.mps) + } +} + +pub struct XonXoffRxFilter { + inner: XonXoffFilter, +} + +impl XonXoffRxFilter { + pub fn new(enabled: bool) -> Self { + Self { + inner: XonXoffFilter::new(enabled), + } + } +} + +impl RxFilter for XonXoffRxFilter { + fn filter(&mut self, input: &[u8]) -> Vec { + self.inner.filter(input) + } +} + +pub struct ChainedRxFilter { + filters: Vec>, +} + +impl ChainedRxFilter { + pub fn new(filters: Vec>) -> Self { + Self { filters } + } +} + +impl RxFilter for ChainedRxFilter { + fn filter(&mut self, input: &[u8]) -> Vec { + let mut data = input.to_vec(); + for f in &mut self.filters { + data = f.filter(&data); + } + data + } +} + +pub fn apply_filters(filters: &mut [Box], input: &[u8]) -> Vec { + let mut data = input.to_vec(); + for f in filters.iter_mut() { + data = f.filter(&data); + } + data +} diff --git a/crates/android-usb-serial/src/serialport_compat.rs b/crates/android-usb-serial/src/serialport_compat.rs new file mode 100644 index 00000000..b730ea06 --- /dev/null +++ b/crates/android-usb-serial/src/serialport_compat.rs @@ -0,0 +1,502 @@ +//! `serialport` crate compatibility layer — full [`serialport::SerialPort`] on Android USB. +//! +//! Enable with Cargo feature `serialport-compat` (default). Wrap a [`crate::SerialPortHandle`] +//! in [`SerialPortAdapter`](crate::serialport_compat::SerialPortAdapter) after +//! [`crate::open_port`]. + +use crate::config::{DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits}; +use crate::error::UsbSerialError; +use crate::port::SerialPortHandle; +use serialport::{ + ClearBuffer, DataBits as SpDataBits, FlowControl as SpFlowControl, Parity as SpParity, + SerialPort, StopBits as SpStopBits, +}; +use std::collections::VecDeque; +use std::io::{self, Read, Write}; +use std::sync::{Arc, Mutex}; +use std::thread; +use std::time::{Duration, Instant}; + +const DEFAULT_WRITE_CHUNK: usize = 512; +const READ_POLL_MS: u64 = 1; + +/// USB bulk-OUT timeout per chunk: `max(clamp(port_timeout_ms, 1, 600_000), 2000)`. +pub fn chunk_write_timeout_ms(port_timeout: Duration) -> u32 { + let ms = port_timeout.as_millis() as u64; + ms.clamp(1, 600_000).max(2000) as u32 +} + +fn usb_err(e: UsbSerialError) -> io::Error { + io::Error::other(e.to_string()) +} + +fn sp_err(e: UsbSerialError) -> serialport::Error { + serialport::Error::new(serialport::ErrorKind::Unknown, e.to_string()) +} + +struct SerialPortInner { + handle: Mutex, + name: String, + timeout: Mutex, + line_config: Mutex, + flow_control: Mutex, + rx_ring: Mutex>, + write_chunk: usize, + reader_started: Mutex, +} + +impl SerialPortInner { + fn new( + handle: SerialPortHandle, + name: String, + line_config: LineConfig, + flow_control: FlowControl, + write_chunk: usize, + ) -> Self { + Self { + handle: Mutex::new(handle), + name, + timeout: Mutex::new(Duration::from_millis(1000)), + line_config: Mutex::new(line_config), + flow_control: Mutex::new(flow_control), + rx_ring: Mutex::new(VecDeque::new()), + write_chunk: write_chunk.max(64), + reader_started: Mutex::new(false), + } + } + + fn start_reader(&self) -> io::Result<()> { + let mut started = self.reader_started.lock().unwrap(); + if *started { + return Ok(()); + } + self.handle + .lock() + .unwrap() + .start_reader() + .map_err(usb_err)?; + *started = true; + Ok(()) + } + + fn ensure_reader_started(&self) -> io::Result<()> { + if *self.reader_started.lock().unwrap() { + return Ok(()); + } + self.start_reader() + } + + fn timeout(&self) -> Duration { + *self.timeout.lock().unwrap() + } + + fn drain_ring(&self, buf: &mut [u8]) -> usize { + let mut ring = self.rx_ring.lock().unwrap(); + let n = ring.len().min(buf.len()); + for (dst, src) in buf[..n].iter_mut().zip(ring.drain(..n)) { + *dst = src; + } + n + } + + fn push_ring(&self, data: &[u8]) { + if data.is_empty() { + return; + } + self.rx_ring.lock().unwrap().extend(data); + } + + fn ring_len(&self) -> usize { + self.rx_ring.lock().unwrap().len() + } + + fn clear_ring(&self) { + self.rx_ring.lock().unwrap().clear(); + } + + fn refill_from_reader(&self, scratch: &mut [u8]) -> io::Result { + let mut handle = self.handle.lock().unwrap(); + handle.try_read(scratch).map_err(usb_err) + } + + fn map_purge(kind: ClearBuffer) -> PurgeKind { + match kind { + ClearBuffer::Input => PurgeKind::Rx, + ClearBuffer::Output => PurgeKind::Tx, + ClearBuffer::All => PurgeKind::Both, + } + } +} + +/// Shared [`serialport::SerialPort`] adapter over [`SerialPortHandle`] + background reader. +#[derive(Clone)] +pub struct SerialPortAdapter { + inner: Arc, +} + +impl SerialPortAdapter { + /// Wrap an open [`SerialPortHandle`]. Call [`Self::start_reader`] after line/DTR setup. + pub fn new( + handle: SerialPortHandle, + name: impl Into, + line_config: LineConfig, + flow_control: FlowControl, + ) -> io::Result { + Ok(Self { + inner: Arc::new(SerialPortInner::new( + handle, + name.into(), + line_config, + flow_control, + DEFAULT_WRITE_CHUNK, + )), + }) + } + + /// Start background bulk-IN reader after line/DTR setup (avoids racing driver init on OTG). + pub fn start_reader(&self) -> io::Result<()> { + self.inner.start_reader() + } + + /// Stop background reader and close the USB driver (idempotent). + pub fn shutdown(&self) { + let mut handle = self.inner.handle.lock().unwrap(); + handle.stop_reader(); + handle.close(); + self.inner.clear_ring(); + } + + pub fn with_write_chunk(mut self, chunk: usize) -> Self { + if let Some(inner) = Arc::get_mut(&mut self.inner) { + inner.write_chunk = chunk.max(64); + } + self + } +} + +impl Read for SerialPortAdapter { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + if buf.is_empty() { + return Ok(0); + } + self.inner.ensure_reader_started()?; + let deadline = Instant::now() + self.inner.timeout(); + let mut scratch = [0u8; 4096]; + loop { + let n = self.inner.drain_ring(buf); + if n > 0 { + return Ok(n); + } + match self.inner.refill_from_reader(&mut scratch) { + Ok(0) => { + if Instant::now() >= deadline { + return Ok(0); + } + thread::sleep(Duration::from_millis(READ_POLL_MS)); + } + Ok(n) => self.inner.push_ring(&scratch[..n]), + Err(e) => { + let kind = e.kind(); + if kind == io::ErrorKind::TimedOut || kind == io::ErrorKind::WouldBlock { + if Instant::now() >= deadline { + return Ok(0); + } + thread::sleep(Duration::from_millis(READ_POLL_MS)); + } else { + return Err(e); + } + } + } + } + } +} + +impl Write for SerialPortAdapter { + fn write(&mut self, buf: &[u8]) -> io::Result { + if buf.is_empty() { + return Ok(0); + } + let chunk = self.inner.write_chunk; + let mut handle = self.inner.handle.lock().unwrap(); + let mut offset = 0usize; + while offset < buf.len() { + let end = (offset + chunk).min(buf.len()); + let n = handle.write(&buf[offset..end]).map_err(usb_err)?; + if n == 0 { + return Err(io::Error::new( + io::ErrorKind::WriteZero, + "USB write returned 0", + )); + } + offset += n; + } + Ok(buf.len()) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl SerialPort for SerialPortAdapter { + fn name(&self) -> Option { + Some(self.inner.name.clone()) + } + + fn baud_rate(&self) -> serialport::Result { + Ok(self.inner.line_config.lock().unwrap().baud_rate) + } + + fn data_bits(&self) -> serialport::Result { + Ok(match self.inner.line_config.lock().unwrap().data_bits { + DataBits::Five => SpDataBits::Five, + DataBits::Six => SpDataBits::Six, + DataBits::Seven => SpDataBits::Seven, + DataBits::Eight => SpDataBits::Eight, + }) + } + + fn flow_control(&self) -> serialport::Result { + Ok(match *self.inner.flow_control.lock().unwrap() { + FlowControl::None => SpFlowControl::None, + FlowControl::RtsCts | FlowControl::DtrDsr => SpFlowControl::Hardware, + FlowControl::XonXoff | FlowControl::XonXoffInline => SpFlowControl::Software, + }) + } + + fn parity(&self) -> serialport::Result { + Ok(match self.inner.line_config.lock().unwrap().parity { + Parity::None => SpParity::None, + Parity::Odd => SpParity::Odd, + Parity::Even => SpParity::Even, + Parity::Mark | Parity::Space => SpParity::None, + }) + } + + fn stop_bits(&self) -> serialport::Result { + Ok(match self.inner.line_config.lock().unwrap().stop_bits { + StopBits::One | StopBits::OnePointFive => SpStopBits::One, + StopBits::Two => SpStopBits::Two, + }) + } + + fn timeout(&self) -> Duration { + self.inner.timeout() + } + + fn set_baud_rate(&mut self, baud_rate: u32) -> serialport::Result<()> { + let mut cfg = self.inner.line_config.lock().unwrap(); + cfg.baud_rate = baud_rate; + self.inner + .handle + .lock() + .unwrap() + .set_line_config(*cfg) + .map_err(sp_err) + } + + fn set_data_bits(&mut self, data_bits: SpDataBits) -> serialport::Result<()> { + let mut cfg = self.inner.line_config.lock().unwrap(); + cfg.data_bits = match data_bits { + SpDataBits::Five => DataBits::Five, + SpDataBits::Six => DataBits::Six, + SpDataBits::Seven => DataBits::Seven, + SpDataBits::Eight => DataBits::Eight, + }; + self.inner + .handle + .lock() + .unwrap() + .set_line_config(*cfg) + .map_err(sp_err) + } + + fn set_flow_control(&mut self, flow_control: SpFlowControl) -> serialport::Result<()> { + let flow = match flow_control { + SpFlowControl::None => FlowControl::None, + SpFlowControl::Hardware => FlowControl::RtsCts, + SpFlowControl::Software => FlowControl::XonXoff, + }; + *self.inner.flow_control.lock().unwrap() = flow; + self.inner + .handle + .lock() + .unwrap() + .set_flow_control(flow) + .map_err(sp_err) + } + + fn set_parity(&mut self, parity: SpParity) -> serialport::Result<()> { + let mut cfg = self.inner.line_config.lock().unwrap(); + cfg.parity = match parity { + SpParity::None => Parity::None, + SpParity::Odd => Parity::Odd, + SpParity::Even => Parity::Even, + }; + self.inner + .handle + .lock() + .unwrap() + .set_line_config(*cfg) + .map_err(sp_err) + } + + fn set_stop_bits(&mut self, stop_bits: SpStopBits) -> serialport::Result<()> { + let mut cfg = self.inner.line_config.lock().unwrap(); + cfg.stop_bits = match stop_bits { + SpStopBits::One => StopBits::One, + SpStopBits::Two => StopBits::Two, + }; + self.inner + .handle + .lock() + .unwrap() + .set_line_config(*cfg) + .map_err(sp_err) + } + + fn set_timeout(&mut self, timeout: Duration) -> serialport::Result<()> { + *self.inner.timeout.lock().unwrap() = timeout; + Ok(()) + } + + fn write_request_to_send(&mut self, level: bool) -> serialport::Result<()> { + self.inner + .handle + .lock() + .unwrap() + .set_rts(level) + .map_err(sp_err) + } + + fn write_data_terminal_ready(&mut self, level: bool) -> serialport::Result<()> { + self.inner + .handle + .lock() + .unwrap() + .set_dtr(level) + .map_err(sp_err) + } + + fn read_clear_to_send(&mut self) -> serialport::Result { + Ok(self + .inner + .handle + .lock() + .unwrap() + .modem_status() + .map_err(sp_err)? + .cts) + } + + fn read_data_set_ready(&mut self) -> serialport::Result { + Ok(self + .inner + .handle + .lock() + .unwrap() + .modem_status() + .map_err(sp_err)? + .dsr) + } + + fn read_ring_indicator(&mut self) -> serialport::Result { + Ok(self + .inner + .handle + .lock() + .unwrap() + .modem_status() + .map_err(sp_err)? + .ri) + } + + fn read_carrier_detect(&mut self) -> serialport::Result { + Ok(self + .inner + .handle + .lock() + .unwrap() + .modem_status() + .map_err(sp_err)? + .cd) + } + + fn bytes_to_read(&self) -> serialport::Result { + Ok(self.inner.ring_len() as u32) + } + + fn bytes_to_write(&self) -> serialport::Result { + Ok(0) + } + + fn clear(&self, buffer_to_clear: ClearBuffer) -> serialport::Result<()> { + if matches!(buffer_to_clear, ClearBuffer::Input | ClearBuffer::All) { + self.inner.clear_ring(); + } + self.inner + .handle + .lock() + .unwrap() + .clear(SerialPortInner::map_purge(buffer_to_clear)) + .map_err(sp_err) + } + + fn try_clone(&self) -> serialport::Result> { + Ok(Box::new(SerialPortAdapter { + inner: self.inner.clone(), + })) + } + + fn set_break(&self) -> serialport::Result<()> { + self.inner + .handle + .lock() + .unwrap() + .set_break(true) + .map_err(sp_err) + } + + fn clear_break(&self) -> serialport::Result<()> { + self.inner + .handle + .lock() + .unwrap() + .set_break(false) + .map_err(sp_err) + } +} + +pub fn line_config_from_serialport( + baud_rate: u32, + data_bits: SpDataBits, + parity: SpParity, + stop_bits: SpStopBits, +) -> LineConfig { + LineConfig { + baud_rate, + data_bits: match data_bits { + SpDataBits::Five => DataBits::Five, + SpDataBits::Six => DataBits::Six, + SpDataBits::Seven => DataBits::Seven, + SpDataBits::Eight => DataBits::Eight, + }, + parity: match parity { + SpParity::None => Parity::None, + SpParity::Odd => Parity::Odd, + SpParity::Even => Parity::Even, + }, + stop_bits: match stop_bits { + SpStopBits::One => StopBits::One, + SpStopBits::Two => StopBits::Two, + }, + } +} + +pub fn flow_from_serialport(flow: SpFlowControl) -> FlowControl { + match flow { + SpFlowControl::None => FlowControl::None, + SpFlowControl::Hardware => FlowControl::RtsCts, + SpFlowControl::Software => FlowControl::XonXoff, + } +} diff --git a/crates/android-usb-serial/src/transport.rs b/crates/android-usb-serial/src/transport.rs new file mode 100644 index 00000000..1ede3f43 --- /dev/null +++ b/crates/android-usb-serial/src/transport.rs @@ -0,0 +1,165 @@ +//! USB transport abstraction (nusb or fake). +//! +//! Drivers talk only through [`Transport`]. Production code uses +//! [`crate::NusbTransport`]; tests use [`crate::FakeTransport`] behind `fake-transport`. + +use crate::error::{ReadOutcome, Result}; +use std::sync::Arc; + +/// USB request direction IN bit. +pub const USB_DIR_IN: u8 = 0x80; +/// USB request direction OUT. +pub const USB_DIR_OUT: u8 = 0x00; +/// bmRequestType type = class. +pub const USB_TYPE_CLASS: u8 = 0x20; +/// bmRequestType recipient = interface. +pub const USB_RECIP_INTERFACE: u8 = 0x01; +/// bmRequestType recipient = device. +pub const USB_RECIP_DEVICE: u8 = 0x00; + +/// USB interface class/subclass/protocol summary used for probing. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct InterfaceInfo { + pub id: u8, + pub class: u8, + pub subclass: u8, + pub protocol: u8, +} + +/// Endpoint descriptor fields needed by drivers. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct EndpointInfo { + pub address: u8, + pub attributes: u8, + pub max_packet_size: u16, + pub interval: u8, +} + +impl EndpointInfo { + /// IN vs OUT from the address bit. + pub fn direction(&self) -> u8 { + self.address & USB_DIR_IN + } + + pub fn is_bulk_in(&self) -> bool { + self.direction() == USB_DIR_IN && (self.attributes & 0x03) == 2 + } + + pub fn is_bulk_out(&self) -> bool { + self.direction() == USB_DIR_OUT && (self.attributes & 0x03) == 2 + } + + pub fn is_interrupt_in(&self) -> bool { + self.direction() == USB_DIR_IN && (self.attributes & 0x03) == 3 + } +} + +/// USB control transfer request. +#[derive(Debug, Clone)] +pub struct ControlRequest { + pub request_type: u8, + pub request: u8, + pub value: u16, + pub index: u16, + pub data: Vec, + pub timeout_ms: u32, +} + +impl ControlRequest { + /// Vendor OUT (host → device), `bmRequestType = 0x40`. + pub fn vendor_out(request: u8, value: u16, index: u16, data: Vec) -> Self { + Self { + request_type: 0x40, + request, + value, + index, + data, + timeout_ms: 5000, + } + } + + /// Vendor IN; `data` length is the wLength buffer size. + pub fn vendor_in(request: u8, value: u16, index: u16, length: usize) -> Self { + Self { + request_type: 0xC0, + request, + value, + index, + data: vec![0; length], + timeout_ms: 5000, + } + } + + /// Class OUT to interface. + pub fn class_out(request: u8, value: u16, index: u16, data: Vec) -> Self { + Self { + request_type: USB_TYPE_CLASS | USB_RECIP_INTERFACE, + request, + value, + index, + data, + timeout_ms: 5000, + } + } + + /// Class IN from interface. + pub fn class_in(request: u8, value: u16, index: u16, length: usize) -> Self { + Self { + request_type: USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, + request, + value, + index, + data: vec![0; length], + timeout_ms: 5000, + } + } +} + +/// Owned bulk (or interrupt) IN pipe. +pub trait BulkIn: Send { + fn read(&mut self, buf: &mut [u8], timeout_ms: u32) -> Result; + fn cancel_all(&mut self); + fn clear_halt(&mut self) -> Result<()>; +} + +/// Owned bulk OUT pipe. +pub trait BulkOut: Send { + fn write(&mut self, data: &[u8], timeout_ms: u32) -> Result; + fn clear_halt(&mut self) -> Result<()>; +} + +/// USB device view used by all chip drivers. +pub trait Transport: Send + Sync { + fn raw_device_descriptor(&self) -> [u8; 18]; + fn raw_descriptors(&self) -> Vec; + fn device_class(&self) -> u8; + fn interfaces(&self) -> Vec; + fn endpoints(&self, interface: u8) -> Vec; + fn claim_interface(&self, interface: u8) -> Result<()>; + fn release_interface(&self, interface: u8) -> Result<()>; + fn control_out(&self, req: &ControlRequest) -> Result; + fn control_in(&self, req: &ControlRequest) -> Result>; + fn open_bulk_in(&self, endpoint: u8, max_packet_size: u16) -> Result>; + fn open_bulk_out(&self, endpoint: u8, max_packet_size: u16) -> Result>; + fn open_interrupt_in(&self, endpoint: u8, max_packet_size: u16) -> Result>; +} + +/// Shared ownership of a [`Transport`] (typically wrapped once per open). +pub type SharedTransport = Arc; + +/// Parse USB control setup fields from `request_type`. +pub fn parse_control_recipient(request_type: u8) -> (u8, bool) { + let direction_in = request_type & 0x80 != 0; + let recipient = request_type & 0x1f; + (recipient, direction_in) +} + +/// Device recipient in `bmRequestType`. +pub fn is_device_recipient(request_type: u8) -> bool { + (request_type & 0x1f) == USB_RECIP_DEVICE +} + +/// Interface recipient in `bmRequestType`. +pub fn is_interface_recipient(request_type: u8) -> bool { + (request_type & 0x1f) == USB_RECIP_INTERFACE +} diff --git a/crates/android-usb-serial/src/xonxoff.rs b/crates/android-usb-serial/src/xonxoff.rs new file mode 100644 index 00000000..ce052824 --- /dev/null +++ b/crates/android-usb-serial/src/xonxoff.rs @@ -0,0 +1,53 @@ +//! Software XON/XOFF filter for RX paths. + +use crate::config::{CHAR_XOFF, CHAR_XON}; + +#[derive(Debug, Clone, Default)] +pub struct XonXoffFilter { + pub enabled: bool, + pub paused: bool, +} + +impl XonXoffFilter { + pub fn new(enabled: bool) -> Self { + Self { + enabled, + paused: false, + } + } + + /// Strip inline XON/XOFF control bytes (matches Java `XonXoffFilter`). + pub fn filter(&mut self, input: &[u8]) -> Vec { + if !self.enabled { + return input.to_vec(); + } + let ctrl_count = input + .iter() + .filter(|&&b| b == CHAR_XON || b == CHAR_XOFF) + .count(); + if ctrl_count == 0 { + return input.to_vec(); + } + let mut out = Vec::with_capacity(input.len().saturating_sub(ctrl_count)); + for &b in input { + match b { + CHAR_XON => self.paused = false, + CHAR_XOFF => self.paused = true, + _ => out.push(b), + } + } + out + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn filters_between_xoff_and_xon() { + let mut f = XonXoffFilter::new(true); + let out = f.filter(&[b'a', CHAR_XOFF, b'b', CHAR_XON, b'c']); + assert_eq!(out, vec![b'a', b'b', b'c']); + } +} diff --git a/crates/android-usb-serial/tests/cdc_acm_test.rs b/crates/android-usb-serial/tests/cdc_acm_test.rs new file mode 100644 index 00000000..53b36d63 --- /dev/null +++ b/crates/android-usb-serial/tests/cdc_acm_test.rs @@ -0,0 +1,121 @@ +#![cfg(feature = "fake-transport")] + +//! CDC ACM driver semantic tests on fake transport. + +use android_usb_serial::config::{DataBits, LineConfig, Parity, StopBits}; +use android_usb_serial::device::open_port; +use android_usb_serial::drivers::line_coding_bytes; +use android_usb_serial::fake::{FakeTransport, RecordedControl}; +use android_usb_serial::transport::{EndpointInfo, InterfaceInfo, Transport}; +use std::sync::Arc; + +fn open_on(fake: &FakeTransport, port_index: usize) -> android_usb_serial::port::SerialPortHandle { + let transport: Arc = Arc::new(fake.clone()); + open_port(transport, port_index).expect("open") +} + +fn has_set_line(controls: &[RecordedControl], index: u16) -> bool { + controls + .iter() + .any(|c| c.request == 0x20 && c.index == index) +} + +#[test] +fn castrated_single_iface_open_windex() { + let fake = FakeTransport::cdc_single_iface(); + fake.set_vendor_product(0x1234, 0x0001); + fake.set_interfaces(vec![InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }]); + fake.configure_endpoints(&[( + 0, + vec![ + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )]); + let mut port = open_on(&fake, 0); + port.set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("line"); + assert_eq!(fake.claimed_interfaces(), vec![0]); + assert!(has_set_line(&fake.recorded_controls(), 0)); +} + +#[test] +fn iad_scan_resolves_comm_data_pair() { + let fake = FakeTransport::cdc_iad(); + let mut port = open_on(&fake, 0); + port.set_line_config(LineConfig::default()).expect("line"); + let claimed = fake.claimed_interfaces(); + assert!(claimed.contains(&0)); + assert!(claimed.contains(&1)); + assert!(has_set_line(&fake.recorded_controls(), 0)); +} + +#[test] +fn comm_data_fallback_multi_port() { + let fake = FakeTransport::cdc_multi(); + let mut port = open_on(&fake, 1); + port.set_line_config(LineConfig { + baud_rate: 9600, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("line"); + let claimed = fake.claimed_interfaces(); + assert!(claimed.contains(&2)); + assert!(claimed.contains(&3)); + assert!(has_set_line(&fake.recorded_controls(), 2)); +} + +#[test] +fn set_line_coding_7e1_bulk_out() { + let fake = FakeTransport::cdc_single_iface(); + let mut port = open_on(&fake, 0); + let cfg = LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Seven, + parity: Parity::Even, + stop_bits: StopBits::One, + }; + port.set_line_config(cfg).expect("line"); + let expected = line_coding_bytes(&cfg); + let set_line = fake + .recorded_controls() + .into_iter() + .find(|c| c.request == 0x20) + .expect("SET_LINE_CODING"); + assert_eq!(set_line.data, expected); + port.write(b"AT\r").expect("write"); + assert_eq!(fake.take_tx(), b"AT\r"); +} + +#[test] +fn unsupported_modem_status_returns_ok_false() { + let fake = FakeTransport::cdc_iad(); + let mut port = open_on(&fake, 0); + let status = port.modem_status().expect("modem"); + assert!(!status.cts); + assert!(!status.dsr); + assert!(!status.ri); + assert!(!status.cd); +} diff --git a/crates/android-usb-serial/tests/ch34x_test.rs b/crates/android-usb-serial/tests/ch34x_test.rs new file mode 100644 index 00000000..48070242 --- /dev/null +++ b/crates/android-usb-serial/tests/ch34x_test.rs @@ -0,0 +1,121 @@ +#![cfg(feature = "fake-transport")] + +//! CH34x driver semantic tests. + +use android_usb_serial::config::{DataBits, LineConfig, Parity, StopBits}; +use android_usb_serial::device::open_port; +use android_usb_serial::fake::FakeTransport; +use android_usb_serial::transport::Transport; +use std::sync::Arc; + +fn script_ch340_init(fake: &FakeTransport) { + for _ in 0..4 { + fake.script_control_in_response(vec![0, 0]); + } + for _ in 0..2 { + fake.script_control_in_response(vec![0, 0]); + } +} + +fn open_ch34x(fake: &FakeTransport) -> android_usb_serial::port::SerialPortHandle { + script_ch340_init(fake); + let transport: Arc = Arc::new(fake.clone()); + open_port(transport, 0).expect("open") +} + +#[test] +fn init_order_check_state_after_each_step() { + let fake = FakeTransport::ch340_dual_iface(); + script_ch340_init(&fake); + let mut port = open_ch34x(&fake); + port.set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("line"); + let controls = fake.recorded_controls(); + let in_requests: Vec = controls + .iter() + .filter(|c| c.request_type & 0x80 != 0) + .map(|c| c.request) + .collect(); + assert!( + in_requests + .windows(2) + .any(|w| w == [0x5F, 0x95] || w == [0x95, 0x95]), + "expected checkState IN sequence during init, got {in_requests:?}" + ); +} + +#[test] +fn baud_921600_div7_factor_f300() { + let fake = FakeTransport::ch340_dual_iface(); + script_ch340_init(&fake); + let mut port = open_ch34x(&fake); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 921_600, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + let baud_out = fake + .recorded_controls() + .into_iter() + .find(|c| c.request == 0x9A && c.value == 0x1312) + .expect("baud divisor"); + assert_eq!(baud_out.index, 0xF387); + let factor = fake + .recorded_controls() + .into_iter() + .find(|c| c.request == 0x9A && c.value == 0x0F2C) + .expect("baud factor"); + assert_eq!(factor.index, 0x0000); +} + +#[test] +fn status_active_low_cts() { + let fake = FakeTransport::ch340_dual_iface(); + script_ch340_init(&fake); + fake.script_control_in_response(vec![0x00, 0x00]); + fake.script_control_in_response(vec![0x01, 0x00]); + let mut port = open_ch34x(&fake); + let status = port.modem_status().expect("modem"); + assert!(status.cts); +} + +#[test] +fn break_rmw_via_0x1805() { + let fake = FakeTransport::ch340_dual_iface(); + script_ch340_init(&fake); + fake.script_control_in_response(vec![0x01, 0x40]); + let mut port = open_ch34x(&fake); + fake.clear_recorded(); + port.set_break(true).expect("break on"); + assert!( + fake.recorded_controls() + .iter() + .any(|c| c.request == 0x95 && c.value == 0x1805), + "break RMW read" + ); + assert!( + fake.recorded_controls() + .iter() + .any(|c| c.request == 0x9A && c.value == 0x1805), + "break RMW write" + ); +} + +#[test] +fn claims_all_interfaces_data_is_last() { + let fake = FakeTransport::ch340_dual_iface(); + script_ch340_init(&fake); + let _port = open_ch34x(&fake); + let claimed = fake.claimed_interfaces(); + assert_eq!(claimed.len(), 2); + assert!(claimed.contains(&0)); + assert!(claimed.contains(&1)); +} diff --git a/crates/android-usb-serial/tests/cp21xx_test.rs b/crates/android-usb-serial/tests/cp21xx_test.rs new file mode 100644 index 00000000..05415077 --- /dev/null +++ b/crates/android-usb-serial/tests/cp21xx_test.rs @@ -0,0 +1,98 @@ +#![cfg(feature = "fake-transport")] + +//! CP21xx driver semantic tests. + +use android_usb_serial::config::{DataBits, FlowControl, LineConfig, Parity, StopBits}; +use android_usb_serial::device::open_port; +use android_usb_serial::fake::FakeTransport; +use android_usb_serial::probe::{DriverType, ProbeTable}; +use android_usb_serial::transport::Transport; +use std::sync::Arc; + +fn cp2105_fake() -> FakeTransport { + FakeTransport::cp2105() +} + +fn open_cp21xx(fake: &FakeTransport, port: usize) -> android_usb_serial::port::SerialPortHandle { + let transport: Arc = Arc::new(fake.clone()); + open_port(transport, port).expect("open") +} + +#[test] +fn ifc_enable_on_open_disable_on_close() { + let fake = FakeTransport::cp2102(); + let mut port = open_cp21xx(&fake, 0); + assert!( + fake.recorded_controls() + .iter() + .any(|c| c.request == 0x00 && c.value == 1), + "IFC_ENABLE on open" + ); + port.close(); + assert!( + fake.recorded_controls() + .iter() + .any(|c| c.request == 0x00 && c.value == 0), + "IFC_DISABLE on close" + ); +} + +#[test] +fn xon_xoff_set_chars_flow_xon_sequence() { + let table = ProbeTable::default_table(); + assert_eq!(table.find(0x10C4, 0xEA60, &[]), DriverType::Cp21xx); + + let fake = FakeTransport::cp2102(); + let mut port = open_cp21xx(&fake, 0); + fake.clear_recorded(); + port.set_flow_control(FlowControl::XonXoff) + .expect("xon/xoff"); + let controls = fake.recorded_controls(); + assert!( + controls.iter().any(|c| c.request == 0x19), + "SET_CHARS expected" + ); + assert!( + controls.iter().any(|c| c.request == 0x13), + "SET_FLOW expected" + ); + assert!( + controls.iter().any(|c| c.request == 0x09), + "SET_XON expected" + ); +} + +#[test] +fn restricted_port1_mark_parity_unsupported() { + let fake = cp2105_fake(); + let mut port = open_cp21xx(&fake, 1); + let err = port.set_line_config(LineConfig { + baud_rate: 9600, + data_bits: DataBits::Eight, + parity: Parity::Mark, + stop_bits: StopBits::One, + }); + assert!(err.is_err()); +} + +#[test] +fn restricted_port1_stop2_unsupported() { + let fake = cp2105_fake(); + let mut port = open_cp21xx(&fake, 1); + let err = port.set_line_config(LineConfig { + baud_rate: 9600, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::Two, + }); + assert!(err.is_err()); +} + +#[test] +fn get_mdmsts_decodes_cts() { + let fake = FakeTransport::cp2102(); + fake.script_control_in_response(vec![0x10]); + let mut port = open_cp21xx(&fake, 0); + let status = port.modem_status().expect("mdmsts"); + assert!(status.cts); +} diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_break_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_break_off.json new file mode 100644 index 00000000..84b93dcf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_break_off.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_break_off", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_break_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_break_on.json new file mode 100644 index 00000000..f817a391 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_break_on.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_break_on", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_close.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_close.json new file mode 100644 index 00000000..c0ec2241 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_close.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_close", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_dtr_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_dtr_off.json new file mode 100644 index 00000000..e9b7a187 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_dtr_off.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_dtr_off", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_dtr_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_dtr_on.json new file mode 100644 index 00000000..36912902 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_dtr_on.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_dtr_on", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_DtrDsr.json new file mode 100644 index 00000000..b330cd85 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_DtrDsr.json @@ -0,0 +1,39 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_flow_DtrDsr", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_None.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_None.json new file mode 100644 index 00000000..0aa5ef67 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_None.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_flow_None", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_RtsCts.json new file mode 100644 index 00000000..0693771e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_flow_RtsCts.json @@ -0,0 +1,39 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_flow_RtsCts", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_open_default.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_open_default.json new file mode 100644 index 00000000..0cc5ec31 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_open_default.json @@ -0,0 +1,52 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_open_default", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_open_line_config.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_open_line_config.json new file mode 100644 index 00000000..d9c921a5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_open_line_config.json @@ -0,0 +1,52 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_open_line_config", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_rts_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_rts_off.json new file mode 100644 index 00000000..a19676f4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_rts_off.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_rts_off", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_rts_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_rts_on.json new file mode 100644 index 00000000..58dd582b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_rts_on.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_rts_on", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1000000.json new file mode 100644 index 00000000..bfa6437c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1000000.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_1000000", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "QEIPAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_115200.json new file mode 100644 index 00000000..c4e41a90 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_115200.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_115200", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1200.json new file mode 100644 index 00000000..0af0bb12 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1200.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_1200", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "sAQAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1500000.json new file mode 100644 index 00000000..a3339ac7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_1500000.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_1500000", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "YOMWAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_19200.json new file mode 100644 index 00000000..a3f52aa3 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_19200.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_19200", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AEsAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_2000000.json new file mode 100644 index 00000000..30e070f4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_2000000.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_2000000", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gIQeAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_230400.json new file mode 100644 index 00000000..2f1c6a1d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_230400.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_230400", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AIQDAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_250000.json new file mode 100644 index 00000000..67c16c7a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_250000.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_250000", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "kNADAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_300.json new file mode 100644 index 00000000..cdf487c9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_300.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_300", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "LAEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_3000000.json new file mode 100644 index 00000000..9222d81b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_3000000.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_3000000", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wMYtAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_38400.json new file mode 100644 index 00000000..9aeb9971 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_38400.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_38400", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AJYAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_460800.json new file mode 100644 index 00000000..0db3dda6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_460800.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_460800", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAgHAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_57600.json new file mode 100644 index 00000000..b45c6263 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_57600.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_57600", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AOEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_921600.json new file mode 100644 index 00000000..378287f3 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_921600.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_921600", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "ABAOAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_9600.json new file mode 100644 index 00000000..86062890 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_baud_9600.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_baud_9600", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gCUAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7E1.json new file mode 100644 index 00000000..7413d893 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7E1.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_line_7E1", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAACBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7M1.json new file mode 100644 index 00000000..6a6795e9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7M1.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_line_7M1", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAADBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7O1.json new file mode 100644 index 00000000..dc8b7503 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7O1.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_line_7O1", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAABBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7S1.json new file mode 100644 index 00000000..4d0f97fa --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_7S1.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_line_7S1", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAEBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N1.json new file mode 100644 index 00000000..7047746b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N1.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_line_8N1", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N1_5.json new file mode 100644 index 00000000..6811b668 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N1_5.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_line_8N1_5", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAEACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N2.json new file mode 100644 index 00000000..009e2283 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_iad_set_line_8N2.json @@ -0,0 +1,38 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_iad_set_line_8N2", + "vendorId": 9025, + "productId": 67, + "portIndex": 0, + "deviceStub": "cdc_iad", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAIACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_close.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_close.json new file mode 100644 index 00000000..5b46bb59 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_close.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_close", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_break_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_break_off.json new file mode 100644 index 00000000..be80139a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_break_off.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_break_off", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_break_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_break_on.json new file mode 100644 index 00000000..b85b8a1d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_break_on.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_break_on", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_dtr_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_dtr_off.json new file mode 100644 index 00000000..a7ba7e1a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_dtr_off.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_dtr_off", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_dtr_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_dtr_on.json new file mode 100644 index 00000000..b706cc26 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_dtr_on.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_dtr_on", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_DtrDsr.json new file mode 100644 index 00000000..c05d8f43 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_DtrDsr.json @@ -0,0 +1,56 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_flow_DtrDsr", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_None.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_None.json new file mode 100644 index 00000000..0500ac55 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_None.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_flow_None", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_RtsCts.json new file mode 100644 index 00000000..84f59873 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_flow_RtsCts.json @@ -0,0 +1,56 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_flow_RtsCts", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_open_default.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_open_default.json new file mode 100644 index 00000000..03769da7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_open_default.json @@ -0,0 +1,69 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_open_default", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_open_line_config.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_open_line_config.json new file mode 100644 index 00000000..d56f6c51 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_open_line_config.json @@ -0,0 +1,69 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_open_line_config", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_rts_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_rts_off.json new file mode 100644 index 00000000..7c8c0b96 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_rts_off.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_rts_off", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_rts_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_rts_on.json new file mode 100644 index 00000000..228e512b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_rts_on.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_rts_on", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1000000.json new file mode 100644 index 00000000..d58bfdcd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1000000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_1000000", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "QEIPAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_115200.json new file mode 100644 index 00000000..8e5fda05 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_115200.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_115200", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1200.json new file mode 100644 index 00000000..bb35811b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1200.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_1200", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "sAQAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1500000.json new file mode 100644 index 00000000..27e2aa83 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_1500000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_1500000", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "YOMWAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_19200.json new file mode 100644 index 00000000..05553fae --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_19200.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_19200", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AEsAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_2000000.json new file mode 100644 index 00000000..871a8563 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_2000000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_2000000", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gIQeAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_230400.json new file mode 100644 index 00000000..494b631a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_230400.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_230400", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AIQDAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_250000.json new file mode 100644 index 00000000..955a46e9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_250000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_250000", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "kNADAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_300.json new file mode 100644 index 00000000..057a63de --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_300.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_300", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "LAEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_3000000.json new file mode 100644 index 00000000..d96adb8f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_3000000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_3000000", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wMYtAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_38400.json new file mode 100644 index 00000000..827c4a11 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_38400.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_38400", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AJYAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_460800.json new file mode 100644 index 00000000..96c794bf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_460800.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_460800", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAgHAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_57600.json new file mode 100644 index 00000000..aab14f04 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_57600.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_57600", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AOEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_921600.json new file mode 100644 index 00000000..b1ebf650 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_921600.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_921600", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "ABAOAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_9600.json new file mode 100644 index 00000000..c224ff86 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_baud_9600.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_baud_9600", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gCUAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7E1.json new file mode 100644 index 00000000..6539d022 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7E1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_line_7E1", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAACBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7M1.json new file mode 100644 index 00000000..3fce3677 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7M1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_line_7M1", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAADBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7O1.json new file mode 100644 index 00000000..16d4bb26 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7O1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_line_7O1", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAABBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7S1.json new file mode 100644 index 00000000..c7abf728 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_7S1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_line_7S1", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAEBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N1.json new file mode 100644 index 00000000..267279b9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_line_8N1", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N1_5.json new file mode 100644 index 00000000..405467cd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N1_5.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_line_8N1_5", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAEACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N2.json new file mode 100644 index 00000000..98a9db93 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port0_set_line_8N2.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port0_set_line_8N2", + "vendorId": 9025, + "productId": 68, + "portIndex": 0, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAIACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_break_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_break_off.json new file mode 100644 index 00000000..8759f124 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_break_off.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_break_off", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_break_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_break_on.json new file mode 100644 index 00000000..8d5e5b3e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_break_on.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_break_on", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_dtr_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_dtr_off.json new file mode 100644 index 00000000..85462aeb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_dtr_off.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_dtr_off", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_dtr_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_dtr_on.json new file mode 100644 index 00000000..f4fec0f4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_dtr_on.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_dtr_on", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_DtrDsr.json new file mode 100644 index 00000000..1370b2cd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_DtrDsr.json @@ -0,0 +1,56 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_flow_DtrDsr", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_None.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_None.json new file mode 100644 index 00000000..5efdbfba --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_None.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_flow_None", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_RtsCts.json new file mode 100644 index 00000000..78751464 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_flow_RtsCts.json @@ -0,0 +1,56 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_flow_RtsCts", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_open_default.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_open_default.json new file mode 100644 index 00000000..a1154e7c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_open_default.json @@ -0,0 +1,69 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_open_default", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 2, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_rts_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_rts_off.json new file mode 100644 index 00000000..5ec3c88d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_rts_off.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_rts_off", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_rts_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_rts_on.json new file mode 100644 index 00000000..8428afbc --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_rts_on.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_rts_on", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1000000.json new file mode 100644 index 00000000..6a334fbe --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1000000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_1000000", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "QEIPAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_115200.json new file mode 100644 index 00000000..d1f7a608 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_115200.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_115200", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1200.json new file mode 100644 index 00000000..c84cf049 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1200.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_1200", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "sAQAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1500000.json new file mode 100644 index 00000000..f2195928 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_1500000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_1500000", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "YOMWAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_19200.json new file mode 100644 index 00000000..27ac443a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_19200.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_19200", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AEsAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_2000000.json new file mode 100644 index 00000000..d0b21ab8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_2000000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_2000000", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "gIQeAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_230400.json new file mode 100644 index 00000000..017409c6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_230400.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_230400", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AIQDAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_250000.json new file mode 100644 index 00000000..18765242 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_250000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_250000", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "kNADAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_300.json new file mode 100644 index 00000000..b64b0e7f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_300.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_300", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "LAEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_3000000.json new file mode 100644 index 00000000..39606a17 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_3000000.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_3000000", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "wMYtAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_38400.json new file mode 100644 index 00000000..e8208ad6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_38400.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_38400", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AJYAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_460800.json new file mode 100644 index 00000000..b25dafd1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_460800.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_460800", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AAgHAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_57600.json new file mode 100644 index 00000000..65ac8c10 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_57600.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_57600", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AOEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_921600.json new file mode 100644 index 00000000..b4470801 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_921600.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_921600", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "ABAOAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_9600.json new file mode 100644 index 00000000..41096f37 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_baud_9600.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_baud_9600", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "gCUAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7E1.json new file mode 100644 index 00000000..6ac02c63 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7E1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_line_7E1", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAACBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7M1.json new file mode 100644 index 00000000..3a62402e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7M1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_line_7M1", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAADBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7O1.json new file mode 100644 index 00000000..854bca50 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7O1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_line_7O1", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAABBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7S1.json new file mode 100644 index 00000000..39f3c91d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_7S1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_line_7S1", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAAEBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N1.json new file mode 100644 index 00000000..6ea1bd51 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N1.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_line_8N1", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N1_5.json new file mode 100644 index 00000000..d010f6fc --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N1_5.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_line_8N1_5", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAEACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N2.json new file mode 100644 index 00000000..87101e33 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_multi_port1_set_line_8N2.json @@ -0,0 +1,55 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_multi_port1_set_line_8N2", + "vendorId": 9025, + "productId": 68, + "portIndex": 1, + "deviceStub": "cdc_multi", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 131, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 2, + "subclass": 2, + "protocol": 0, + "interruptIn": 132, + "maxPacketSize": 64 + }, + { + "id": 3, + "classId": 10, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 2, + "data": "AMIBAAIACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_break_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_break_off.json new file mode 100644 index 00000000..13db9a56 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_break_off.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_break_off", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_break_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_break_on.json new file mode 100644 index 00000000..b87255a3 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_break_on.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_break_on", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_close.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_close.json new file mode 100644 index 00000000..7a0dce82 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_close.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_close", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_dtr_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_dtr_off.json new file mode 100644 index 00000000..776843b3 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_dtr_off.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_dtr_off", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_dtr_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_dtr_on.json new file mode 100644 index 00000000..4dd77492 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_dtr_on.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_dtr_on", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_DtrDsr.json new file mode 100644 index 00000000..6958a607 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_DtrDsr.json @@ -0,0 +1,32 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_flow_DtrDsr", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_None.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_None.json new file mode 100644 index 00000000..3882d2a4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_None.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_flow_None", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_RtsCts.json new file mode 100644 index 00000000..777c8af9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_flow_RtsCts.json @@ -0,0 +1,32 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_flow_RtsCts", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_open_default.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_open_default.json new file mode 100644 index 00000000..0340eb9b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_open_default.json @@ -0,0 +1,45 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_open_default", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_open_line_config.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_open_line_config.json new file mode 100644 index 00000000..452ded1f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_open_line_config.json @@ -0,0 +1,45 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_open_line_config", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_rts_off.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_rts_off.json new file mode 100644 index 00000000..03545866 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_rts_off.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_rts_off", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_rts_on.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_rts_on.json new file mode 100644 index 00000000..be05d4f1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_rts_on.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_rts_on", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1000000.json new file mode 100644 index 00000000..2ca950d6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1000000.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_1000000", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "QEIPAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_115200.json new file mode 100644 index 00000000..8a845fd5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_115200.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_115200", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1200.json new file mode 100644 index 00000000..c4168733 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1200.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_1200", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "sAQAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1500000.json new file mode 100644 index 00000000..80e3c852 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_1500000.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_1500000", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "YOMWAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_19200.json new file mode 100644 index 00000000..25371b52 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_19200.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_19200", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AEsAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_2000000.json new file mode 100644 index 00000000..ff7f2571 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_2000000.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_2000000", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gIQeAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_230400.json new file mode 100644 index 00000000..21e4664b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_230400.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_230400", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AIQDAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_250000.json new file mode 100644 index 00000000..b91e810b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_250000.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_250000", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "kNADAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_300.json new file mode 100644 index 00000000..ac76060f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_300.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_300", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "LAEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_3000000.json new file mode 100644 index 00000000..8eabdad0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_3000000.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_3000000", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wMYtAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_38400.json new file mode 100644 index 00000000..15912564 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_38400.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_38400", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AJYAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_460800.json new file mode 100644 index 00000000..571f1a7b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_460800.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_460800", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAgHAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_57600.json new file mode 100644 index 00000000..c2ae1a39 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_57600.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_57600", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AOEAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_921600.json new file mode 100644 index 00000000..1b663eb0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_921600.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_921600", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "ABAOAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_9600.json new file mode 100644 index 00000000..8af80ce2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_baud_9600.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_baud_9600", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gCUAAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7E1.json new file mode 100644 index 00000000..23274f02 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7E1.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_line_7E1", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAACBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7M1.json new file mode 100644 index 00000000..0a046020 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7M1.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_line_7M1", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAADBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7O1.json new file mode 100644 index 00000000..0c2e8f2f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7O1.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_line_7O1", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAABBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7S1.json new file mode 100644 index 00000000..58d0ad82 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_7S1.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_line_7S1", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAEBw\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N1.json new file mode 100644 index 00000000..323ea25a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N1.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_line_8N1", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N1_5.json new file mode 100644 index 00000000..36ffa9cd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N1_5.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_line_8N1_5", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAEACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N2.json new file mode 100644 index 00000000..c2f6dc03 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cdc_acm/cdc_single_set_line_8N2.json @@ -0,0 +1,31 @@ +{ + "source": "java", + "driver": "cdc_acm", + "scenario": "cdc_single_set_line_8N2", + "vendorId": 4660, + "productId": 1, + "portIndex": 0, + "deviceStub": "cdc_single", + "interfaces": [ + { + "id": 0, + "classId": 2, + "subclass": 2, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "interruptIn": 131, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAIACA\u003d\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/break_off.json b/crates/android-usb-serial/tests/fixtures/ch34x/break_off.json new file mode 100644 index 00000000..f31a0e3d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/break_off.json @@ -0,0 +1,142 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "break_off", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 6149, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 6149, + "index": 16385, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/break_on.json b/crates/android-usb-serial/tests/fixtures/ch34x/break_on.json new file mode 100644 index 00000000..60dc5984 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/break_on.json @@ -0,0 +1,142 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "break_on", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 6149, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 6149, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/close.json b/crates/android-usb-serial/tests/fixtures/ch34x/close.json new file mode 100644 index 00000000..0fe972f5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/close.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "close", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/dtr_off.json b/crates/android-usb-serial/tests/fixtures/ch34x/dtr_off.json new file mode 100644 index 00000000..3034cb20 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/dtr_off.json @@ -0,0 +1,135 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "dtr_off", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/dtr_on.json b/crates/android-usb-serial/tests/fixtures/ch34x/dtr_on.json new file mode 100644 index 00000000..ca55b703 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/dtr_on.json @@ -0,0 +1,135 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "dtr_on", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -33, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/ch34x/flow_DtrDsr.json new file mode 100644 index 00000000..d8199025 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/flow_DtrDsr.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "flow_DtrDsr", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/flow_None.json b/crates/android-usb-serial/tests/fixtures/ch34x/flow_None.json new file mode 100644 index 00000000..f752a069 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/flow_None.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "flow_None", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/ch34x/flow_RtsCts.json new file mode 100644 index 00000000..fd5f0061 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/flow_RtsCts.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "flow_RtsCts", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/modem_status.json b/crates/android-usb-serial/tests/fixtures/ch34x/modem_status.json new file mode 100644 index 00000000..32be3dbe --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/modem_status.json @@ -0,0 +1,177 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "modem_status", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/open_default.json b/crates/android-usb-serial/tests/fixtures/ch34x/open_default.json new file mode 100644 index 00000000..b31d0321 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/open_default.json @@ -0,0 +1,163 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "open_default", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -33, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -97, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/rts_off.json b/crates/android-usb-serial/tests/fixtures/ch34x/rts_off.json new file mode 100644 index 00000000..7fe4c75e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/rts_off.json @@ -0,0 +1,135 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "rts_off", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/rts_on.json b/crates/android-usb-serial/tests/fixtures/ch34x/rts_on.json new file mode 100644 index 00000000..19969320 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/rts_on.json @@ -0,0 +1,135 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "rts_on", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -65, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1000000.json new file mode 100644 index 00000000..6afab548 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1000000.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_1000000", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 64131, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 4, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_115200.json new file mode 100644 index 00000000..6c3f2c4b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_115200.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_115200", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1200.json new file mode 100644 index 00000000..8a5dffcb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1200.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_1200", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45697, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1500000.json new file mode 100644 index 00000000..92a33ec0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_1500000.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_1500000", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 64643, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_19200.json new file mode 100644 index 00000000..6af1653d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_19200.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_19200", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 55682, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 6, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_2000000.json new file mode 100644 index 00000000..9db78cae --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_2000000.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_2000000", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 64899, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_230400.json new file mode 100644 index 00000000..ec16544b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_230400.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_230400", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 59011, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 4, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_250000.json new file mode 100644 index 00000000..1c4b5016 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_250000.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_250000", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 59523, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 14, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_300.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_300.json new file mode 100644 index 00000000..252086e9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_300.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_300", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 55680, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 6, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_3000000.json new file mode 100644 index 00000000..c14ad695 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_3000000.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_3000000", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 65155, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_38400.json new file mode 100644 index 00000000..2b740938 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_38400.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_38400", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 25731, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 24, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_460800.json new file mode 100644 index 00000000..21fec376 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_460800.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_460800", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 62339, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_57600.json new file mode 100644 index 00000000..4459bf24 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_57600.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_57600", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 39043, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 16, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_921600.json new file mode 100644 index 00000000..250fae6a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_921600.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_921600", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 62343, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_9600.json new file mode 100644 index 00000000..669fd747 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_baud_9600.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_baud_9600", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7E1.json new file mode 100644 index 00000000..be8c4829 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7E1.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_line_7E1", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 218, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7M1.json new file mode 100644 index 00000000..fffb59c9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7M1.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_line_7M1", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 234, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7O1.json new file mode 100644 index 00000000..f9499bad --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7O1.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_line_7O1", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 202, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7S1.json new file mode 100644 index 00000000..174763d3 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_7S1.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_line_7S1", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 250, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N1.json new file mode 100644 index 00000000..9036104c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N1.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_line_8N1", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N1_5.json new file mode 100644 index 00000000..0d4a3ff9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N1_5.json @@ -0,0 +1,143 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_line_8N1_5", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N2.json new file mode 100644 index 00000000..87aa7a26 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ch34x/set_line_8N2.json @@ -0,0 +1,149 @@ +{ + "source": "java", + "driver": "ch34x", + "scenario": "set_line_8N2", + "vendorId": 6790, + "productId": 29987, + "portIndex": 0, + "deviceStub": "ch340", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 130, + "bulkOut": 3, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 95, + "value": 0, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 9496, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 195, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 161, + "value": 20511, + "index": 55562, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 164, + "value": -1, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 149, + "value": 1798, + "index": 0, + "data": "AAA\u003d" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 45698, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 12, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 4882, + "index": 52355, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 3884, + "index": 8, + "data": "" + }, + { + "requestType": 64, + "request": 154, + "value": 9496, + "index": 199, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_close.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_close.json new file mode 100644 index 00000000..38e047ba --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_close.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "chrome_ccd_close", + "vendorId": 6353, + "productId": 20500, + "portIndex": 0, + "deviceStub": "chrome_ccd", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port0_open_default.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port0_open_default.json new file mode 100644 index 00000000..74967d75 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port0_open_default.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "chrome_ccd_port0_open_default", + "vendorId": 6353, + "productId": 20500, + "portIndex": 0, + "deviceStub": "chrome_ccd", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port1_open_default.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port1_open_default.json new file mode 100644 index 00000000..c637786a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port1_open_default.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "chrome_ccd_port1_open_default", + "vendorId": 6353, + "productId": 20500, + "portIndex": 1, + "deviceStub": "chrome_ccd", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port2_open_default.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port2_open_default.json new file mode 100644 index 00000000..5a585fb4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/chrome_ccd_port2_open_default.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "chrome_ccd_port2_open_default", + "vendorId": 6353, + "productId": 20500, + "portIndex": 2, + "deviceStub": "chrome_ccd", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_close.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_close.json new file mode 100644 index 00000000..8f15b814 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_close.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "cr50_close", + "vendorId": 6353, + "productId": 20500, + "portIndex": 0, + "deviceStub": "cr50", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port0_open_default.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port0_open_default.json new file mode 100644 index 00000000..ca123b54 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port0_open_default.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "cr50_port0_open_default", + "vendorId": 6353, + "productId": 20500, + "portIndex": 0, + "deviceStub": "cr50", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port1_open_default.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port1_open_default.json new file mode 100644 index 00000000..c4f751c2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port1_open_default.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "cr50_port1_open_default", + "vendorId": 6353, + "productId": 20500, + "portIndex": 1, + "deviceStub": "cr50", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port2_open_default.json b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port2_open_default.json new file mode 100644 index 00000000..e0a7e924 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/chrome_ccd/cr50_port2_open_default.json @@ -0,0 +1,40 @@ +{ + "source": "java", + "driver": "chrome_ccd", + "scenario": "cr50_port2_open_default", + "vendorId": 6353, + "productId": 20500, + "portIndex": 2, + "deviceStub": "cr50", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + }, + { + "id": 2, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 133, + "bulkOut": 6, + "maxPacketSize": 64 + } + ], + "controls": [], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_break_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_break_off.json new file mode 100644 index 00000000..0c9ca5b8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_break_off.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_break_off", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 5, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_break_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_break_on.json new file mode 100644 index 00000000..966859da --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_break_on.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_break_on", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 5, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_close.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_close.json new file mode 100644 index 00000000..44b9c292 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_close.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_close", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_dtr_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_dtr_off.json new file mode 100644 index 00000000..3e668f05 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_dtr_off.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_dtr_off", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 256, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_dtr_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_dtr_on.json new file mode 100644 index 00000000..5208758f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_dtr_on.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_dtr_on", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 257, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_DtrDsr.json new file mode 100644 index 00000000..746ffdf5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_DtrDsr.json @@ -0,0 +1,72 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_flow_DtrDsr", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "EgAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_None.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_None.json new file mode 100644 index 00000000..1b3b99fa --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_None.json @@ -0,0 +1,72 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_flow_None", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_RtsCts.json new file mode 100644 index 00000000..2a01043f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_RtsCts.json @@ -0,0 +1,72 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_flow_RtsCts", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "CAAAAIAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_XonXoff.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_XonXoff.json new file mode 100644 index 00000000..2f2e629c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_flow_XonXoff.json @@ -0,0 +1,86 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_flow_XonXoff", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 25, + "value": 0, + "index": 0, + "data": "AAAAABET" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAMAAICAAAAAgAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 9, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_modem_status.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_modem_status.json new file mode 100644 index 00000000..321adf25 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_modem_status.json @@ -0,0 +1,93 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_modem_status", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_open_default.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_open_default.json new file mode 100644 index 00000000..6b5d8053 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_open_default.json @@ -0,0 +1,79 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_open_default", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 257, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 514, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_both.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_both.json new file mode 100644 index 00000000..fc897a52 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_both.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_purge_both", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 15, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_rx.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_rx.json new file mode 100644 index 00000000..04878514 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_rx.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_purge_rx", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 5, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_tx.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_tx.json new file mode 100644 index 00000000..7d74c6cb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_purge_tx.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_purge_tx", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 10, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_rts_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_rts_off.json new file mode 100644 index 00000000..6ff6f62f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_rts_off.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_rts_off", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 512, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_rts_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_rts_on.json new file mode 100644 index 00000000..4f2948e6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_rts_on.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_rts_on", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 514, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1000000.json new file mode 100644 index 00000000..b1fd79c2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1000000.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_1000000", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "QEIPAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_115200.json new file mode 100644 index 00000000..3bc83228 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_115200.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_115200", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1200.json new file mode 100644 index 00000000..d7e6780e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1200.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_1200", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "sAQAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1500000.json new file mode 100644 index 00000000..2a500d3c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_1500000.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_1500000", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "YOMWAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_19200.json new file mode 100644 index 00000000..dab14055 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_19200.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_19200", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AEsAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_2000000.json new file mode 100644 index 00000000..3af722ad --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_2000000.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_2000000", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "gIQeAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_230400.json new file mode 100644 index 00000000..eed15ae4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_230400.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_230400", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AIQDAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_250000.json new file mode 100644 index 00000000..b676dc5d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_250000.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_250000", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "kNADAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_300.json new file mode 100644 index 00000000..68153b01 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_300.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_300", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "LAEAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_3000000.json new file mode 100644 index 00000000..0ad2da8e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_3000000.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_3000000", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "wMYtAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_38400.json new file mode 100644 index 00000000..75d0c6d4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_38400.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_38400", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AJYAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_460800.json new file mode 100644 index 00000000..9ee9bcd9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_460800.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_460800", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AAgHAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_57600.json new file mode 100644 index 00000000..5e89fabf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_57600.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_57600", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AOEAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_921600.json new file mode 100644 index 00000000..65b41842 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_921600.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_921600", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "ABAOAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_9600.json new file mode 100644 index 00000000..ff619180 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_baud_9600.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_baud_9600", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "gCUAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7E1.json new file mode 100644 index 00000000..d778f236 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7E1.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_line_7E1", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1824, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7M1.json new file mode 100644 index 00000000..35b8e8f0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7M1.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_line_7M1", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1840, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7O1.json new file mode 100644 index 00000000..186f032c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7O1.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_line_7O1", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1808, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7S1.json new file mode 100644 index 00000000..38c83adf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_7S1.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_line_7S1", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1856, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N1.json new file mode 100644 index 00000000..a287bd2e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N1.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_line_8N1", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N1_5.json new file mode 100644 index 00000000..1e038af2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N1_5.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_line_8N1_5", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N2.json new file mode 100644 index 00000000..d3aaca6e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2102_set_line_8N2.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2102_set_line_8N2", + "vendorId": 4292, + "productId": 60000, + "portIndex": 0, + "deviceStub": "cp2102", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2050, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_close.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_close.json new file mode 100644 index 00000000..35dda859 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_close.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_close", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_break_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_break_off.json new file mode 100644 index 00000000..5594c0c0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_break_off.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_break_off", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 5, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_break_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_break_on.json new file mode 100644 index 00000000..eb5c1dd8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_break_on.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_break_on", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 5, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_dtr_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_dtr_off.json new file mode 100644 index 00000000..7369b6c1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_dtr_off.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_dtr_off", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 256, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_dtr_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_dtr_on.json new file mode 100644 index 00000000..ab41b7c6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_dtr_on.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_dtr_on", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 257, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_DtrDsr.json new file mode 100644 index 00000000..883796a9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_DtrDsr.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_flow_DtrDsr", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "EgAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_None.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_None.json new file mode 100644 index 00000000..16731a01 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_None.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_flow_None", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_RtsCts.json new file mode 100644 index 00000000..242d6934 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_RtsCts.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_flow_RtsCts", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "CAAAAIAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_XonXoff.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_XonXoff.json new file mode 100644 index 00000000..b0b32045 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_flow_XonXoff.json @@ -0,0 +1,95 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_flow_XonXoff", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 25, + "value": 0, + "index": 0, + "data": "AAAAABET" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAMAAICAAAAAgAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 9, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_modem_status.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_modem_status.json new file mode 100644 index 00000000..f2056f3b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_modem_status.json @@ -0,0 +1,102 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_modem_status", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_open_default.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_open_default.json new file mode 100644 index 00000000..47c626f0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_open_default.json @@ -0,0 +1,88 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_open_default", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 257, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 514, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_both.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_both.json new file mode 100644 index 00000000..3c575cc5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_both.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_purge_both", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 15, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_rx.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_rx.json new file mode 100644 index 00000000..8c28a051 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_rx.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_purge_rx", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 5, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_tx.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_tx.json new file mode 100644 index 00000000..8d0fe88c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_purge_tx.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_purge_tx", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 10, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_rts_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_rts_off.json new file mode 100644 index 00000000..c190b0b0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_rts_off.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_rts_off", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 512, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_rts_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_rts_on.json new file mode 100644 index 00000000..b11f49eb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_rts_on.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_rts_on", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 514, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1000000.json new file mode 100644 index 00000000..99a976fe --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1000000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_1000000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "QEIPAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_115200.json new file mode 100644 index 00000000..6c0727a0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_115200.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_115200", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1200.json new file mode 100644 index 00000000..da0c5972 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1200.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_1200", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "sAQAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1500000.json new file mode 100644 index 00000000..576fee43 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_1500000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_1500000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "YOMWAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_19200.json new file mode 100644 index 00000000..655cfceb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_19200.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_19200", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AEsAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_2000000.json new file mode 100644 index 00000000..bcec5229 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_2000000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_2000000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "gIQeAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_230400.json new file mode 100644 index 00000000..f4583a8a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_230400.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_230400", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AIQDAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_250000.json new file mode 100644 index 00000000..a13e6abc --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_250000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_250000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "kNADAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_300.json new file mode 100644 index 00000000..e94bc392 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_300.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_300", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "LAEAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_3000000.json new file mode 100644 index 00000000..7404d849 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_3000000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_3000000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "wMYtAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_38400.json new file mode 100644 index 00000000..7fc8c07f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_38400.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_38400", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AJYAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_460800.json new file mode 100644 index 00000000..f68b1193 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_460800.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_460800", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AAgHAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_57600.json new file mode 100644 index 00000000..8369ae98 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_57600.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_57600", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AOEAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_921600.json new file mode 100644 index 00000000..dc5c8167 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_921600.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_921600", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "ABAOAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_9600.json new file mode 100644 index 00000000..d168ba37 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_baud_9600.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_baud_9600", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "gCUAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7E1.json new file mode 100644 index 00000000..c33febcf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7E1.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_line_7E1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1824, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7M1.json new file mode 100644 index 00000000..b85d54f8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7M1.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_line_7M1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1840, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7O1.json new file mode 100644 index 00000000..1803ec19 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7O1.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_line_7O1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1808, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7S1.json new file mode 100644 index 00000000..64144d9e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_7S1.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_line_7S1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 1856, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N1.json new file mode 100644 index 00000000..37e766a2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N1.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_line_8N1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N1_5.json new file mode 100644 index 00000000..2a015780 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N1_5.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_line_8N1_5", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N2.json new file mode 100644 index 00000000..38711579 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port0_set_line_8N2.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port0_set_line_8N2", + "vendorId": 4292, + "productId": 60016, + "portIndex": 0, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 0, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 0, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2050, + "index": 0, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_break_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_break_off.json new file mode 100644 index 00000000..905bbfc2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_break_off.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_break_off", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 5, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_break_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_break_on.json new file mode 100644 index 00000000..8e372693 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_break_on.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_break_on", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 5, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_dtr_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_dtr_off.json new file mode 100644 index 00000000..057ffaef --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_dtr_off.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_dtr_off", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 256, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_dtr_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_dtr_on.json new file mode 100644 index 00000000..c89bbd5a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_dtr_on.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_dtr_on", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 257, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_DtrDsr.json new file mode 100644 index 00000000..4327e0f6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_DtrDsr.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_flow_DtrDsr", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "EgAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_None.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_None.json new file mode 100644 index 00000000..86d10cf6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_None.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_flow_None", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_RtsCts.json new file mode 100644 index 00000000..0b4b90e9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_RtsCts.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_flow_RtsCts", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "CAAAAIAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_XonXoff.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_XonXoff.json new file mode 100644 index 00000000..41b3cc0e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_flow_XonXoff.json @@ -0,0 +1,95 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_flow_XonXoff", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 25, + "value": 0, + "index": 1, + "data": "AAAAABET" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAMAAICAAAAAgAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 9, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_modem_status.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_modem_status.json new file mode 100644 index 00000000..48b82019 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_modem_status.json @@ -0,0 +1,102 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_modem_status", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 1, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 1, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 1, + "data": "AA\u003d\u003d" + }, + { + "requestType": 193, + "request": 8, + "value": 0, + "index": 1, + "data": "AA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_open_default.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_open_default.json new file mode 100644 index 00000000..64aacbb6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_open_default.json @@ -0,0 +1,88 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_open_default", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 257, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 514, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_both.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_both.json new file mode 100644 index 00000000..e0ddecae --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_both.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_purge_both", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 15, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_rx.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_rx.json new file mode 100644 index 00000000..38f1805a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_rx.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_purge_rx", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 5, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_tx.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_tx.json new file mode 100644 index 00000000..2234e50b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_purge_tx.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_purge_tx", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 18, + "value": 10, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_rts_off.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_rts_off.json new file mode 100644 index 00000000..64ee4239 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_rts_off.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_rts_off", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 512, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_rts_on.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_rts_on.json new file mode 100644 index 00000000..bcf6340c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_rts_on.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_rts_on", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 7, + "value": 514, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1000000.json new file mode 100644 index 00000000..2f10f87d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1000000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_1000000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "QEIPAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_115200.json new file mode 100644 index 00000000..6c432d69 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_115200.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_115200", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1200.json new file mode 100644 index 00000000..c2c9f464 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1200.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_1200", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "sAQAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1500000.json new file mode 100644 index 00000000..79402124 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_1500000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_1500000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "YOMWAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_19200.json new file mode 100644 index 00000000..b0ce43fd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_19200.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_19200", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AEsAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_2000000.json new file mode 100644 index 00000000..d36edeb6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_2000000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_2000000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "gIQeAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_230400.json new file mode 100644 index 00000000..242f85ee --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_230400.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_230400", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AIQDAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_250000.json new file mode 100644 index 00000000..ce07d41d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_250000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_250000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "kNADAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_300.json new file mode 100644 index 00000000..fb9a9dbb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_300.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_300", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "LAEAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_3000000.json new file mode 100644 index 00000000..67c2bd39 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_3000000.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_3000000", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "wMYtAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_38400.json new file mode 100644 index 00000000..05bf78fe --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_38400.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_38400", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AJYAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_460800.json new file mode 100644 index 00000000..3fbd2627 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_460800.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_460800", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AAgHAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_57600.json new file mode 100644 index 00000000..35a05880 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_57600.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_57600", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AOEAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_921600.json new file mode 100644 index 00000000..89be1438 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_921600.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_921600", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "ABAOAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_9600.json new file mode 100644 index 00000000..6820473a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_baud_9600.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_baud_9600", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "gCUAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_5N1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_5N1.json new file mode 100644 index 00000000..36acf764 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_5N1.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_5N1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7E1.json new file mode 100644 index 00000000..92d21b4b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7E1.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_7E1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7M1.json new file mode 100644 index 00000000..30024e32 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7M1.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_7M1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7O1.json new file mode 100644 index 00000000..1c45eaaa --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7O1.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_7O1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7S1.json new file mode 100644 index 00000000..e61535c0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_7S1.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_7S1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N1.json new file mode 100644 index 00000000..5e7f0934 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N1.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_8N1", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 3, + "value": 2048, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N1_5.json new file mode 100644 index 00000000..67d7e1b9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N1_5.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_8N1_5", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N2.json new file mode 100644 index 00000000..bf73e775 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/cp21xx/cp2105_port1_set_line_8N2.json @@ -0,0 +1,68 @@ +{ + "source": "java", + "driver": "cp21xx", + "scenario": "cp2105_port1_set_line_8N2", + "vendorId": 4292, + "productId": 60016, + "portIndex": 1, + "deviceStub": "cp2105", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 65, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 7, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 65, + "request": 19, + "value": 0, + "index": 1, + "data": "AAAAAAAAAAAAAAAAAAAAAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 30, + "value": 0, + "index": 1, + "data": "AMIBAA\u003d\u003d" + }, + { + "requestType": 65, + "request": 0, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_close.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_close.json new file mode 100644 index 00000000..b9326858 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_close.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_close", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_break_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_break_off.json new file mode 100644 index 00000000..90a01281 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_break_off.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_break_off", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_break_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_break_on.json new file mode 100644 index 00000000..1d05357d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_break_on.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_break_on", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 16384, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_dtr_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_dtr_off.json new file mode 100644 index 00000000..164d412f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_dtr_off.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_dtr_off", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 256, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_dtr_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_dtr_on.json new file mode 100644 index 00000000..4860e8b1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_dtr_on.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_dtr_on", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 257, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_DtrDsr.json new file mode 100644 index 00000000..02178383 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_DtrDsr.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_flow_DtrDsr", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 513, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_None.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_None.json new file mode 100644 index 00000000..a4c0ec06 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_None.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_flow_None", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_RtsCts.json new file mode 100644 index 00000000..443a50c9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_RtsCts.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_flow_RtsCts", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 257, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_XonXoffInline.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_XonXoffInline.json new file mode 100644 index 00000000..a9d3b19d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_flow_XonXoffInline.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_flow_XonXoffInline", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 4881, + "index": 1025, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_modem_status.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_modem_status.json new file mode 100644 index 00000000..9dcf9109 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_modem_status.json @@ -0,0 +1,95 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_modem_status", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_open_default.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_open_default.json new file mode 100644 index 00000000..8a789f17 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_open_default.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_open_default", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 257, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 514, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_both.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_both.json new file mode 100644 index 00000000..75d6d118 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_both.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_purge_both", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 2, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_rx.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_rx.json new file mode 100644 index 00000000..4d03777a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_rx.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_purge_rx", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 1, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_tx.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_tx.json new file mode 100644 index 00000000..3c3671da --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_purge_tx.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_purge_tx", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 2, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_rts_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_rts_off.json new file mode 100644 index 00000000..aec2a49e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_rts_off.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_rts_off", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 512, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_rts_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_rts_on.json new file mode 100644 index 00000000..0df70643 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_rts_on.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_rts_on", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 514, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1000000.json new file mode 100644 index 00000000..ca40830f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1000000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_1000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 3, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_115200.json new file mode 100644 index 00000000..7cadf094 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_115200.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_115200", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1200.json new file mode 100644 index 00000000..d6f14ab4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1200.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_1200", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 2500, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1500000.json new file mode 100644 index 00000000..10688c6e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_1500000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_1500000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 2, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_19200.json new file mode 100644 index 00000000..2b426379 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_19200.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_19200", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 32924, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_2000000.json new file mode 100644 index 00000000..0a6859ab --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_2000000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_2000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_230400.json new file mode 100644 index 00000000..7812ca3b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_230400.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_230400", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 13, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_250000.json new file mode 100644 index 00000000..9d4dc161 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_250000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_250000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 12, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_300.json new file mode 100644 index 00000000..1ee4ff19 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_300.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_300", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 10000, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_3000000.json new file mode 100644 index 00000000..89eb1887 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_3000000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_3000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_38400.json new file mode 100644 index 00000000..c233f4d0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_38400.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_38400", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 49230, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_460800.json new file mode 100644 index 00000000..ade06afb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_460800.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_460800", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 16390, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_57600.json new file mode 100644 index 00000000..c309ab22 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_57600.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_57600", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 49204, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_921600.json new file mode 100644 index 00000000..dcb10aec --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_921600.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_921600", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 32771, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_9600.json new file mode 100644 index 00000000..8247c948 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_9600.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_9600", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 16696, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_error_4000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_error_4000000.json new file mode 100644 index 00000000..0a573c65 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_baud_error_4000000.json @@ -0,0 +1,54 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_baud_error_4000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7E1.json new file mode 100644 index 00000000..24a62080 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7E1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_line_7E1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 519, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7M1.json new file mode 100644 index 00000000..0edbc001 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7M1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_line_7M1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 775, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7O1.json new file mode 100644 index 00000000..3f6599be --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7O1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_line_7O1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 263, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7S1.json new file mode 100644 index 00000000..d7203a4b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_7S1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_line_7S1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 1031, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N1.json new file mode 100644 index 00000000..20526f18 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_line_8N1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N1_5.json new file mode 100644 index 00000000..12860b87 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N1_5.json @@ -0,0 +1,61 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_line_8N1_5", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N2.json new file mode 100644 index 00000000..f647f98b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port0_set_line_8N2.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port0_set_line_8N2", + "vendorId": 1027, + "productId": 24592, + "portIndex": 0, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 4104, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_break_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_break_off.json new file mode 100644 index 00000000..706487ce --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_break_off.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_break_off", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 0, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_break_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_break_on.json new file mode 100644 index 00000000..10f9cc9d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_break_on.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_break_on", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 16384, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_dtr_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_dtr_off.json new file mode 100644 index 00000000..7780cc78 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_dtr_off.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_dtr_off", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 256, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_dtr_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_dtr_on.json new file mode 100644 index 00000000..caa81c38 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_dtr_on.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_dtr_on", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 257, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_DtrDsr.json new file mode 100644 index 00000000..76175f84 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_DtrDsr.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_flow_DtrDsr", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 514, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_None.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_None.json new file mode 100644 index 00000000..15db9648 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_None.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_flow_None", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_RtsCts.json new file mode 100644 index 00000000..2172d603 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_RtsCts.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_flow_RtsCts", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 258, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_XonXoffInline.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_XonXoffInline.json new file mode 100644 index 00000000..846b3161 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_flow_XonXoffInline.json @@ -0,0 +1,74 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_flow_XonXoffInline", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 4881, + "index": 1026, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_modem_status.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_modem_status.json new file mode 100644 index 00000000..1ed534bb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_modem_status.json @@ -0,0 +1,95 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_modem_status", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 2, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 2, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 2, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 2, + "data": "AAA\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_open_default.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_open_default.json new file mode 100644 index 00000000..983be237 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_open_default.json @@ -0,0 +1,81 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_open_default", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 257, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 514, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_both.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_both.json new file mode 100644 index 00000000..c25de644 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_both.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_purge_both", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 1, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 2, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_rx.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_rx.json new file mode 100644 index 00000000..a1fbcec3 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_rx.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_purge_rx", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 1, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_tx.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_tx.json new file mode 100644 index 00000000..a5ebe997 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_purge_tx.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_purge_tx", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 2, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_rts_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_rts_off.json new file mode 100644 index 00000000..27aaba38 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_rts_off.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_rts_off", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 512, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_rts_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_rts_on.json new file mode 100644 index 00000000..42d8f38e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_rts_on.json @@ -0,0 +1,60 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_rts_on", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 514, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1000000.json new file mode 100644 index 00000000..cab996bf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1000000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_1000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 3, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_115200.json new file mode 100644 index 00000000..96273e0d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_115200.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_115200", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1200.json new file mode 100644 index 00000000..0c16e884 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1200.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_1200", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 2500, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1500000.json new file mode 100644 index 00000000..a90f0b2a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_1500000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_1500000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 2, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_19200.json new file mode 100644 index 00000000..3a1829c1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_19200.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_19200", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 32924, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_2000000.json new file mode 100644 index 00000000..c4e2b799 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_2000000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_2000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 1, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_230400.json new file mode 100644 index 00000000..ff8b7d4d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_230400.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_230400", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 13, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_250000.json new file mode 100644 index 00000000..6fbf9234 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_250000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_250000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 12, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_300.json new file mode 100644 index 00000000..37b36be6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_300.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_300", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 10000, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_3000000.json new file mode 100644 index 00000000..0f9a981f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_3000000.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_3000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_38400.json new file mode 100644 index 00000000..1d8bacd7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_38400.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_38400", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 49230, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_460800.json new file mode 100644 index 00000000..0b871fe8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_460800.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_460800", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 16390, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_57600.json new file mode 100644 index 00000000..a96643b6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_57600.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_57600", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 49204, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_921600.json new file mode 100644 index 00000000..21b44d11 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_921600.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_921600", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 32771, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_9600.json new file mode 100644 index 00000000..23f9fad1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_9600.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_9600", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 16696, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_error_4000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_error_4000000.json new file mode 100644 index 00000000..836d4961 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_baud_error_4000000.json @@ -0,0 +1,54 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_baud_error_4000000", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7E1.json new file mode 100644 index 00000000..4fa11743 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7E1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_line_7E1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 519, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7M1.json new file mode 100644 index 00000000..2082556c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7M1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_line_7M1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 775, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7O1.json new file mode 100644 index 00000000..b574e3b4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7O1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_line_7O1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 263, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7S1.json new file mode 100644 index 00000000..ea12e9c5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_7S1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_line_7S1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 1031, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N1.json new file mode 100644 index 00000000..25cdb336 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N1.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_line_8N1", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N1_5.json new file mode 100644 index 00000000..a38181ff --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N1_5.json @@ -0,0 +1,61 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_line_8N1_5", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N2.json new file mode 100644 index 00000000..2c3ae996 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft2232h_port1_set_line_8N2.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft2232h_port1_set_line_8N2", + "vendorId": 1027, + "productId": 24592, + "portIndex": 1, + "deviceStub": "ftdi_ft2232h", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + }, + { + "id": 1, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 4, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 4104, + "index": 2, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_break_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_break_off.json new file mode 100644 index 00000000..5cd61bca --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_break_off.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_break_off", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_break_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_break_on.json new file mode 100644 index 00000000..47ab89f0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_break_on.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_break_on", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 16384, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_close.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_close.json new file mode 100644 index 00000000..8e68a6aa --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_close.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_close", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_dtr_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_dtr_off.json new file mode 100644 index 00000000..88660f6c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_dtr_off.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_dtr_off", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 256, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_dtr_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_dtr_on.json new file mode 100644 index 00000000..0c7b9280 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_dtr_on.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_dtr_on", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 257, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_DtrDsr.json new file mode 100644 index 00000000..bfafb3c1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_DtrDsr.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_flow_DtrDsr", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 513, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_None.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_None.json new file mode 100644 index 00000000..e1d8baba --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_None.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_flow_None", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_RtsCts.json new file mode 100644 index 00000000..c90dd99b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_RtsCts.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_flow_RtsCts", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 257, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_XonXoffInline.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_XonXoffInline.json new file mode 100644 index 00000000..9257eebb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_flow_XonXoffInline.json @@ -0,0 +1,65 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_flow_XonXoffInline", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 4881, + "index": 1025, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_modem_status.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_modem_status.json new file mode 100644 index 00000000..73706155 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_modem_status.json @@ -0,0 +1,86 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_modem_status", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + }, + { + "requestType": 192, + "request": 5, + "value": 0, + "index": 1, + "data": "AAA\u003d" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_open_default.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_open_default.json new file mode 100644 index 00000000..9b60b5cd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_open_default.json @@ -0,0 +1,72 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_open_default", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 257, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 514, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_both.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_both.json new file mode 100644 index 00000000..d5bf2672 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_both.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_purge_both", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 1, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 2, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_rx.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_rx.json new file mode 100644 index 00000000..bdf92e3c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_rx.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_purge_rx", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 1, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_tx.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_tx.json new file mode 100644 index 00000000..064d9d96 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_purge_tx.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_purge_tx", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 0, + "value": 2, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_rts_off.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_rts_off.json new file mode 100644 index 00000000..2bd0b07e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_rts_off.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_rts_off", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 512, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_rts_on.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_rts_on.json new file mode 100644 index 00000000..0623f0fc --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_rts_on.json @@ -0,0 +1,51 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_rts_on", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 514, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1000000.json new file mode 100644 index 00000000..ae0c5844 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1000000.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_1000000", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 3, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_115200.json new file mode 100644 index 00000000..2bdce997 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_115200.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_115200", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1200.json new file mode 100644 index 00000000..d658e1d4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1200.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_1200", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 2500, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1500000.json new file mode 100644 index 00000000..698e2e19 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_1500000.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_1500000", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 2, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_19200.json new file mode 100644 index 00000000..4d5b0d72 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_19200.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_19200", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 32924, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_2000000.json new file mode 100644 index 00000000..cf464988 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_2000000.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_2000000", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_230400.json new file mode 100644 index 00000000..fb1ed120 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_230400.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_230400", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 13, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_250000.json new file mode 100644 index 00000000..f2eed54f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_250000.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_250000", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 12, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_300.json new file mode 100644 index 00000000..e7383262 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_300.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_300", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 10000, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_3000000.json new file mode 100644 index 00000000..f1691840 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_3000000.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_3000000", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_38400.json new file mode 100644 index 00000000..4667e6d7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_38400.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_38400", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 49230, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_460800.json new file mode 100644 index 00000000..3f8fea9d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_460800.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_460800", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 16390, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_57600.json new file mode 100644 index 00000000..5a721b25 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_57600.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_57600", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 49204, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_921600.json new file mode 100644 index 00000000..56d36af2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_921600.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_921600", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 32771, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_9600.json new file mode 100644 index 00000000..3d92610d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_9600.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_9600", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 16696, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_error_4000000.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_error_4000000.json new file mode 100644 index 00000000..c95d9df1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_baud_error_4000000.json @@ -0,0 +1,45 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_baud_error_4000000", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7E1.json new file mode 100644 index 00000000..9e1ae721 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7E1.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_line_7E1", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 519, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7M1.json new file mode 100644 index 00000000..75f28cfb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7M1.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_line_7M1", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 775, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7O1.json new file mode 100644 index 00000000..fc20e501 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7O1.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_line_7O1", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 263, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7S1.json new file mode 100644 index 00000000..83d1ca72 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_7S1.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_line_7S1", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 1031, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N1.json new file mode 100644 index 00000000..841aeae5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N1.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_line_8N1", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 8, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N1_5.json new file mode 100644 index 00000000..e2aea6e2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N1_5.json @@ -0,0 +1,52 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_line_8N1_5", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N2.json new file mode 100644 index 00000000..b1f867c1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/ftdi/ftdi_ft232r_set_line_8N2.json @@ -0,0 +1,58 @@ +{ + "source": "java", + "driver": "ftdi", + "scenario": "ftdi_ft232r_set_line_8N2", + "vendorId": 1027, + "productId": 24577, + "portIndex": 0, + "deviceStub": "ftdi_ft232r", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 0, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 768, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 2, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 3, + "value": 26, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 4, + "value": 4104, + "index": 1, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/gsm_modem/close.json b/crates/android-usb-serial/tests/fixtures/gsm_modem/close.json new file mode 100644 index 00000000..6f6a6ff4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/gsm_modem/close.json @@ -0,0 +1,30 @@ +{ + "source": "java", + "driver": "gsm_modem", + "scenario": "close", + "vendorId": 6018, + "productId": 19728, + "portIndex": 0, + "deviceStub": "gsm_fibocom", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/gsm_modem/open_default.json b/crates/android-usb-serial/tests/fixtures/gsm_modem/open_default.json new file mode 100644 index 00000000..3e54c0b6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/gsm_modem/open_default.json @@ -0,0 +1,30 @@ +{ + "source": "java", + "driver": "gsm_modem", + "scenario": "open_default", + "vendorId": 6018, + "productId": 19728, + "portIndex": 0, + "deviceStub": "gsm_fibocom", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 129, + "bulkOut": 2, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/probe/probe_table.json b/crates/android-usb-serial/tests/fixtures/probe/probe_table.json new file mode 100644 index 00000000..12f4e4a9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/probe/probe_table.json @@ -0,0 +1,50 @@ +[ + { + "vendorId": 1027, + "productId": 24577, + "driver": "ftdi", + "portCount": 1 + }, + { + "vendorId": 1027, + "productId": 24592, + "driver": "ftdi", + "portCount": 2 + }, + { + "vendorId": 4292, + "productId": 60000, + "driver": "cp21xx", + "portCount": 1 + }, + { + "vendorId": 4292, + "productId": 60016, + "driver": "cp21xx", + "portCount": 2 + }, + { + "vendorId": 1659, + "productId": 8963, + "driver": "prolific", + "portCount": 1 + }, + { + "vendorId": 6790, + "productId": 29987, + "driver": "ch34x", + "portCount": 1 + }, + { + "vendorId": 6353, + "productId": 20500, + "driver": "chrome_ccd", + "portCount": 3 + }, + { + "vendorId": 6018, + "productId": 19728, + "driver": "gsm_modem", + "portCount": 1 + } +] \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_break_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_break_off.json new file mode 100644 index 00000000..8d06a028 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_break_off.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_break_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_break_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_break_on.json new file mode 100644 index 00000000..2505b3c8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_break_on.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_break_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_close.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_close.json new file mode 100644 index 00000000..612ec34f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_close.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_close", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_dtr_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_dtr_off.json new file mode 100644 index 00000000..3f0f4668 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_dtr_off.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_dtr_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_dtr_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_dtr_on.json new file mode 100644 index 00000000..e3f4a8e6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_dtr_on.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_dtr_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_DtrDsr.json new file mode 100644 index 00000000..04ab9527 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_DtrDsr.json @@ -0,0 +1,165 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_flow_DtrDsr", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_None.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_None.json new file mode 100644 index 00000000..e5a89eca --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_None.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_flow_None", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_RtsCts.json new file mode 100644 index 00000000..da8ea842 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_RtsCts.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_flow_RtsCts", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 97, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_XonXoffInline.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_XonXoffInline.json new file mode 100644 index 00000000..7dbf1a0c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_flow_XonXoffInline.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_flow_XonXoffInline", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 193, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_modem_status.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_modem_status.json new file mode 100644 index 00000000..ec092806 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_modem_status.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_modem_status", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 135, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_open_default.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_open_default.json new file mode 100644 index 00000000..95593c01 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_open_default.json @@ -0,0 +1,178 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_open_default", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_both.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_both.json new file mode 100644 index 00000000..0e09ac2a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_both.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_purge_both", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_rx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_rx.json new file mode 100644 index 00000000..5a68a218 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_rx.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_purge_rx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_tx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_tx.json new file mode 100644 index 00000000..672a6042 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_purge_tx.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_purge_tx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_rts_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_rts_off.json new file mode 100644 index 00000000..22b07098 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_rts_off.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_rts_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_rts_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_rts_on.json new file mode 100644 index 00000000..0bf7ab80 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_rts_on.json @@ -0,0 +1,150 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_rts_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1000000.json new file mode 100644 index 00000000..f103a234 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1000000.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_1000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gAEAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_115200.json new file mode 100644 index 00000000..aa64b563 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_115200.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_115200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1200.json new file mode 100644 index 00000000..c59ecd08 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1200.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_1200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "sAQAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1500000.json new file mode 100644 index 00000000..537917c6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_1500000.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_1500000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAEAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_19200.json new file mode 100644 index 00000000..894462b8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_19200.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_19200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AEsAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_2000000.json new file mode 100644 index 00000000..39b4bbda --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_2000000.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_2000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wAAAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_230400.json new file mode 100644 index 00000000..27fd1683 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_230400.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_230400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AIQDAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_250000.json new file mode 100644 index 00000000..b06155ca --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_250000.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_250000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gAMAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_300.json new file mode 100644 index 00000000..220f31d8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_300.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_300", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "LAEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_3000000.json new file mode 100644 index 00000000..3ac5003e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_3000000.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_3000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wMYtAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_38400.json new file mode 100644 index 00000000..aa80b3d6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_38400.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_38400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AJYAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_460800.json new file mode 100644 index 00000000..05c8a8ac --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_460800.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_460800", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAgHAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_57600.json new file mode 100644 index 00000000..d852e7a8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_57600.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_57600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AOEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_921600.json new file mode 100644 index 00000000..b8ce6b9a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_921600.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_921600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "ABAOAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_9600.json new file mode 100644 index 00000000..7747019c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_baud_9600.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_baud_9600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gCUAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7E1.json new file mode 100644 index 00000000..cb78fd3e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7E1.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_line_7E1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAACBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7M1.json new file mode 100644 index 00000000..8d7f4722 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7M1.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_line_7M1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAADBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7O1.json new file mode 100644 index 00000000..34f8630f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7O1.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_line_7O1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAABBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7S1.json new file mode 100644 index 00000000..04ae59a7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_7S1.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_line_7S1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAEBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N1.json new file mode 100644 index 00000000..541ff113 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N1.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_line_8N1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N1_5.json new file mode 100644 index 00000000..754b16b1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N1_5.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_line_8N1_5", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAEACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N2.json new file mode 100644 index 00000000..59a6082e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_01_set_line_8N2.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_01_set_line_8N2", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_01", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 36, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAIACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_break_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_break_off.json new file mode 100644 index 00000000..f8ae2660 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_break_off.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_break_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_break_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_break_on.json new file mode 100644 index 00000000..a6d7f010 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_break_on.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_break_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_close.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_close.json new file mode 100644 index 00000000..dd494e50 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_close.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_close", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_dtr_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_dtr_off.json new file mode 100644 index 00000000..97218803 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_dtr_off.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_dtr_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_dtr_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_dtr_on.json new file mode 100644 index 00000000..5fe43069 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_dtr_on.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_dtr_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_DtrDsr.json new file mode 100644 index 00000000..455595a9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_DtrDsr.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_flow_DtrDsr", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_None.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_None.json new file mode 100644 index 00000000..95f968f6 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_None.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_flow_None", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_RtsCts.json new file mode 100644 index 00000000..d2713411 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_RtsCts.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_flow_RtsCts", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 250, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_XonXoffInline.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_XonXoffInline.json new file mode 100644 index 00000000..c5c72649 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_flow_XonXoffInline.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_flow_XonXoffInline", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 238, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_modem_status.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_modem_status.json new file mode 100644 index 00000000..93d70d50 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_modem_status.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_modem_status", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 192, + "request": 129, + "value": 128, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_open_default.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_open_default.json new file mode 100644 index 00000000..5361255d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_open_default.json @@ -0,0 +1,80 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_open_default", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_both.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_both.json new file mode 100644 index 00000000..0ebb3f1b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_both.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_purge_both", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_rx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_rx.json new file mode 100644 index 00000000..7c7907d5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_rx.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_purge_rx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_tx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_tx.json new file mode 100644 index 00000000..9b93e98d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_purge_tx.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_purge_tx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_rts_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_rts_off.json new file mode 100644 index 00000000..2aa92089 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_rts_off.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_rts_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_rts_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_rts_on.json new file mode 100644 index 00000000..340b9345 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_rts_on.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_rts_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1000000.json new file mode 100644 index 00000000..15ee67b1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1000000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_1000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "QEIPAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_115200.json new file mode 100644 index 00000000..9829ba08 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_115200.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_115200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1200.json new file mode 100644 index 00000000..0162e72c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1200.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_1200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "sAQAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1500000.json new file mode 100644 index 00000000..3c2d2208 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_1500000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_1500000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "YOMWAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_19200.json new file mode 100644 index 00000000..6a01cdeb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_19200.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_19200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AEsAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_2000000.json new file mode 100644 index 00000000..bde62ea1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_2000000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_2000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gIQeAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_230400.json new file mode 100644 index 00000000..4385ed58 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_230400.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_230400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AIQDAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_250000.json new file mode 100644 index 00000000..c4afec2f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_250000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_250000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "kNADAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_300.json new file mode 100644 index 00000000..0f5452b0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_300.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_300", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "LAEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_3000000.json new file mode 100644 index 00000000..9bc7e4d5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_3000000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_3000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wMYtAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_38400.json new file mode 100644 index 00000000..29e74d59 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_38400.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_38400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AJYAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_460800.json new file mode 100644 index 00000000..d1694c0e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_460800.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_460800", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAgHAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_57600.json new file mode 100644 index 00000000..ac8e5942 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_57600.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_57600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AOEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_921600.json new file mode 100644 index 00000000..1b149fab --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_921600.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_921600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "ABAOAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_9600.json new file mode 100644 index 00000000..1d1fca46 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_baud_9600.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_baud_9600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gCUAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7E1.json new file mode 100644 index 00000000..31a513bb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7E1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_line_7E1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAACBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7M1.json new file mode 100644 index 00000000..4f4b47cf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7M1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_line_7M1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAADBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7O1.json new file mode 100644 index 00000000..6ca90dd0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7O1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_line_7O1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAABBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7S1.json new file mode 100644 index 00000000..22948cfe --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_7S1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_line_7S1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAEBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N1.json new file mode 100644 index 00000000..ca26582f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_line_8N1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N1_5.json new file mode 100644 index 00000000..8aefde9c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N1_5.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_line_8N1_5", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAEACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N2.json new file mode 100644 index 00000000..1409e0fa --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hx_set_line_8N2.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hx_set_line_8N2", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hx", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAIACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_break_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_break_off.json new file mode 100644 index 00000000..01e5aacd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_break_off.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_break_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_break_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_break_on.json new file mode 100644 index 00000000..5b04bc09 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_break_on.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_break_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_close.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_close.json new file mode 100644 index 00000000..69b46f56 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_close.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_close", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_dtr_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_dtr_off.json new file mode 100644 index 00000000..518c59e5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_dtr_off.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_dtr_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_dtr_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_dtr_on.json new file mode 100644 index 00000000..aac2534f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_dtr_on.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_dtr_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_DtrDsr.json new file mode 100644 index 00000000..b94399cb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_DtrDsr.json @@ -0,0 +1,67 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_flow_DtrDsr", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_None.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_None.json new file mode 100644 index 00000000..bcf586c1 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_None.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_flow_None", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_RtsCts.json new file mode 100644 index 00000000..f85d0fcb --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_RtsCts.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_flow_RtsCts", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 250, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_XonXoffInline.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_XonXoffInline.json new file mode 100644 index 00000000..fa3accd5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_flow_XonXoffInline.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_flow_XonXoffInline", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 238, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_modem_status.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_modem_status.json new file mode 100644 index 00000000..ac58ea48 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_modem_status.json @@ -0,0 +1,73 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_modem_status", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 192, + "request": 129, + "value": 128, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_open_default.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_open_default.json new file mode 100644 index 00000000..7813cd15 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_open_default.json @@ -0,0 +1,80 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_open_default", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_both.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_both.json new file mode 100644 index 00000000..1390af93 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_both.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_purge_both", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_rx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_rx.json new file mode 100644 index 00000000..7c4d266d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_rx.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_purge_rx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_tx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_tx.json new file mode 100644 index 00000000..e3a82d1a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_purge_tx.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_purge_tx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 2, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_rts_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_rts_off.json new file mode 100644 index 00000000..1244e49d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_rts_off.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_rts_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_rts_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_rts_on.json new file mode 100644 index 00000000..2d08e3cc --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_rts_on.json @@ -0,0 +1,59 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_rts_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1000000.json new file mode 100644 index 00000000..0d9b6f96 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1000000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_1000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "QEIPAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_115200.json new file mode 100644 index 00000000..ebd2fe89 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_115200.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_115200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1200.json new file mode 100644 index 00000000..4fef5d83 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1200.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_1200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "sAQAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1500000.json new file mode 100644 index 00000000..e8f34596 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_1500000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_1500000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "YOMWAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_19200.json new file mode 100644 index 00000000..591bae4b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_19200.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_19200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AEsAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_2000000.json new file mode 100644 index 00000000..b921e63a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_2000000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_2000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gIQeAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_230400.json new file mode 100644 index 00000000..aec8e562 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_230400.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_230400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AIQDAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_250000.json new file mode 100644 index 00000000..acf07aea --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_250000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_250000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "kNADAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_300.json new file mode 100644 index 00000000..0d1bf6de --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_300.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_300", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "LAEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_3000000.json new file mode 100644 index 00000000..fc030aad --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_3000000.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_3000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wMYtAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_38400.json new file mode 100644 index 00000000..5f2e0a43 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_38400.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_38400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AJYAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_460800.json new file mode 100644 index 00000000..88ba2a20 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_460800.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_460800", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAgHAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_57600.json new file mode 100644 index 00000000..af2b2138 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_57600.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_57600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AOEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_921600.json new file mode 100644 index 00000000..5709e8a0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_921600.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_921600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "ABAOAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_9600.json new file mode 100644 index 00000000..fb96ae98 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_baud_9600.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_baud_9600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gCUAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7E1.json new file mode 100644 index 00000000..9f96532f --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7E1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_line_7E1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAACBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7M1.json new file mode 100644 index 00000000..da08478e --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7M1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_line_7M1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAADBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7O1.json new file mode 100644 index 00000000..cfba8854 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7O1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_line_7O1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAABBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7S1.json new file mode 100644 index 00000000..50cbc504 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_7S1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_line_7S1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAEBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N1.json new file mode 100644 index 00000000..844e68fe --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N1.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_line_8N1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N1_5.json new file mode 100644 index 00000000..f0164220 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N1_5.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_line_8N1_5", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAEACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N2.json new file mode 100644 index 00000000..e0f3b2a3 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_hxn_set_line_8N2.json @@ -0,0 +1,66 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_hxn_set_line_8N2", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_hxn", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 10, + "index": 255, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAIACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + }, + { + "requestType": 64, + "request": 128, + "value": 7, + "index": 3, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_break_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_break_off.json new file mode 100644 index 00000000..dddd82a7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_break_off.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_break_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_break_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_break_on.json new file mode 100644 index 00000000..317edd6a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_break_on.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_break_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 35, + "value": 65535, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_close.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_close.json new file mode 100644 index 00000000..b10f2807 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_close.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_close", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_dtr_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_dtr_off.json new file mode 100644 index 00000000..804ba1ae --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_dtr_off.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_dtr_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_dtr_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_dtr_on.json new file mode 100644 index 00000000..7e93a799 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_dtr_on.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_dtr_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_DtrDsr.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_DtrDsr.json new file mode 100644 index 00000000..53a4ecbf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_DtrDsr.json @@ -0,0 +1,172 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_flow_DtrDsr", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [], + "expectError": "UnsupportedOperationException" +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_None.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_None.json new file mode 100644 index 00000000..4d2cb6b2 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_None.json @@ -0,0 +1,178 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_flow_None", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_RtsCts.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_RtsCts.json new file mode 100644 index 00000000..59fd2785 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_RtsCts.json @@ -0,0 +1,178 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_flow_RtsCts", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 97, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_XonXoffInline.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_XonXoffInline.json new file mode 100644 index 00000000..fc6ed0b8 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_flow_XonXoffInline.json @@ -0,0 +1,178 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_flow_XonXoffInline", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 193, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_modem_status.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_modem_status.json new file mode 100644 index 00000000..f672bcbf --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_modem_status.json @@ -0,0 +1,178 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_modem_status", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 135, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_open_default.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_open_default.json new file mode 100644 index 00000000..ac8bc6ea --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_open_default.json @@ -0,0 +1,185 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_open_default", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 3, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_both.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_both.json new file mode 100644 index 00000000..a9efda84 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_both.json @@ -0,0 +1,164 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_purge_both", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_rx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_rx.json new file mode 100644 index 00000000..eb1f526d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_rx.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_purge_rx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_tx.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_tx.json new file mode 100644 index 00000000..210dfc4d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_purge_tx.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_purge_tx", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_rts_off.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_rts_off.json new file mode 100644 index 00000000..22b3e3dd --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_rts_off.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_rts_off", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_rts_on.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_rts_on.json new file mode 100644 index 00000000..c764dda4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_rts_on.json @@ -0,0 +1,157 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_rts_on", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 2, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1000000.json new file mode 100644 index 00000000..ac38ed26 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1000000.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_1000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gAEAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_115200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_115200.json new file mode 100644 index 00000000..68851b6d --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_115200.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_115200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1200.json new file mode 100644 index 00000000..3e6b3752 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1200.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_1200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "sAQAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1500000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1500000.json new file mode 100644 index 00000000..ba7e5e5a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_1500000.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_1500000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAEAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_19200.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_19200.json new file mode 100644 index 00000000..0f6a4466 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_19200.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_19200", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AEsAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_2000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_2000000.json new file mode 100644 index 00000000..1ed1622b --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_2000000.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_2000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wAAAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_230400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_230400.json new file mode 100644 index 00000000..27cb1bc5 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_230400.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_230400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AIQDAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_250000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_250000.json new file mode 100644 index 00000000..8de6c0f0 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_250000.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_250000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAYAgAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_300.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_300.json new file mode 100644 index 00000000..1298e55c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_300.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_300", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "LAEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_3000000.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_3000000.json new file mode 100644 index 00000000..14dd17f7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_3000000.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_3000000", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "wMYtAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_38400.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_38400.json new file mode 100644 index 00000000..56a2000a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_38400.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_38400", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AJYAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_460800.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_460800.json new file mode 100644 index 00000000..d939c02a --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_460800.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_460800", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AAgHAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_57600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_57600.json new file mode 100644 index 00000000..be1c3aa7 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_57600.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_57600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AOEAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_921600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_921600.json new file mode 100644 index 00000000..5117335c --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_921600.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_921600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "ABAOAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_9600.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_9600.json new file mode 100644 index 00000000..20d6a991 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_baud_9600.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_baud_9600", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "gCUAAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7E1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7E1.json new file mode 100644 index 00000000..262ecfec --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7E1.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_line_7E1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAACBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7M1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7M1.json new file mode 100644 index 00000000..a878b795 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7M1.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_line_7M1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAADBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7O1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7O1.json new file mode 100644 index 00000000..526d76de --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7O1.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_line_7O1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAABBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7S1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7S1.json new file mode 100644 index 00000000..960210c9 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_7S1.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_line_7S1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAEBw\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N1.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N1.json new file mode 100644 index 00000000..a6a60952 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N1.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_line_8N1", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAAACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N1_5.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N1_5.json new file mode 100644 index 00000000..739fc912 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N1_5.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_line_8N1_5", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAEACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N2.json b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N2.json new file mode 100644 index 00000000..ac2b9fed --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/prolific/pl2303_ta_set_line_8N2.json @@ -0,0 +1,171 @@ +{ + "source": "java", + "driver": "prolific", + "scenario": "pl2303_ta_set_line_8N2", + "vendorId": 1659, + "productId": 8963, + "portIndex": 0, + "deviceStub": "pl2303_ta", + "interfaces": [ + { + "id": 0, + "classId": 255, + "subclass": 0, + "protocol": 0, + "bulkIn": 131, + "bulkOut": 2, + "interruptIn": 129, + "maxPacketSize": 64 + } + ], + "controls": [ + { + "requestType": 192, + "request": 1, + "value": 32896, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 0, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 1028, + "index": 1, + "data": "" + }, + { + "requestType": 192, + "request": 1, + "value": 33924, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 192, + "request": 1, + "value": 33667, + "index": 0, + "data": "AA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 1, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 1, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 2, + "index": 68, + "data": "" + }, + { + "requestType": 33, + "request": 34, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 0, + "index": 0, + "data": "" + }, + { + "requestType": 33, + "request": 32, + "value": 0, + "index": 0, + "data": "AMIBAAIACA\u003d\u003d" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 8, + "index": 0, + "data": "" + }, + { + "requestType": 64, + "request": 1, + "value": 9, + "index": 0, + "data": "" + } + ], + "bulkOut": [] +} \ No newline at end of file diff --git a/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_mixed_chunk.json b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_mixed_chunk.json new file mode 100644 index 00000000..886c3928 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_mixed_chunk.json @@ -0,0 +1,6 @@ +{ + "source": "rust", + "filter": "ftdi_header", + "input": "00004100000042", + "output": "4100000042" +} diff --git a/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_single_packet.json b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_single_packet.json new file mode 100644 index 00000000..12bd13fe --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_single_packet.json @@ -0,0 +1,6 @@ +{ + "source": "rust", + "filter": "ftdi_header", + "input": "00004869", + "output": "4869" +} diff --git a/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_status_only.json b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_status_only.json new file mode 100644 index 00000000..e242c3a4 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_status_only.json @@ -0,0 +1,6 @@ +{ + "source": "rust", + "filter": "ftdi_header", + "input": "0000", + "output": "" +} diff --git a/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_tail_partial.json b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_tail_partial.json new file mode 100644 index 00000000..ea61b2ff --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/rx_filter/ftdi_tail_partial.json @@ -0,0 +1,6 @@ +{ + "source": "rust", + "filter": "ftdi_header", + "input": "000041", + "output": "41" +} diff --git a/crates/android-usb-serial/tests/fixtures/rx_filter/xon_xoff_strip_17.json b/crates/android-usb-serial/tests/fixtures/rx_filter/xon_xoff_strip_17.json new file mode 100644 index 00000000..57aec308 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/rx_filter/xon_xoff_strip_17.json @@ -0,0 +1,6 @@ +{ + "source": "rust", + "filter": "xon_xoff", + "input": "41421143", + "output": "414243" +} diff --git a/crates/android-usb-serial/tests/fixtures/rx_filter/xon_xoff_strip_19.json b/crates/android-usb-serial/tests/fixtures/rx_filter/xon_xoff_strip_19.json new file mode 100644 index 00000000..adb85944 --- /dev/null +++ b/crates/android-usb-serial/tests/fixtures/rx_filter/xon_xoff_strip_19.json @@ -0,0 +1,6 @@ +{ + "source": "rust", + "filter": "xon_xoff", + "input": "41131143", + "output": "4143" +} diff --git a/crates/android-usb-serial/tests/ftdi_rx_filter_test.rs b/crates/android-usb-serial/tests/ftdi_rx_filter_test.rs new file mode 100644 index 00000000..6520bbef --- /dev/null +++ b/crates/android-usb-serial/tests/ftdi_rx_filter_test.rs @@ -0,0 +1,84 @@ +//! FTDI / XonXoff RX filter integration — all rx_filter fixtures. + +use android_usb_serial::rx_filter::{strip_ftdi_header, RxFilter, XonXoffRxFilter}; +use serde::Deserialize; +use std::fs; +use std::path::PathBuf; + +#[derive(Debug, Deserialize)] +struct RxFilterFixture { + filter: String, + input: String, + output: String, +} + +fn decode_hex(s: &str) -> Vec { + (0..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i + 2], 16).expect("hex")) + .collect() +} + +fn fixture_dir() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/rx_filter") +} + +#[test] +fn all_rx_filter_fixture_pairs() { + let dir = fixture_dir(); + let mut count = 0usize; + for entry in fs::read_dir(&dir).expect("rx_filter dir") { + let path = entry.expect("entry").path(); + if path.extension().and_then(|e| e.to_str()) != Some("json") { + continue; + } + let text = fs::read_to_string(&path).unwrap(); + let fx: RxFilterFixture = serde_json::from_str(&text).unwrap(); + let input = decode_hex(&fx.input); + let want = decode_hex(&fx.output); + let got = match fx.filter.as_str() { + "ftdi_header" => strip_ftdi_header(&input, 64), + "xon_xoff" => { + let mut f = XonXoffRxFilter::new(true); + f.filter(&input) + } + other => panic!("unknown filter {other} in {}", path.display()), + }; + assert_eq!(got, want, "fixture {}", path.display()); + count += 1; + } + assert!(count >= 6, "expected all rx_filter fixtures"); +} + +#[test] +fn strips_two_byte_status_per_packet() { + let packet = vec![0u8, 0u8, b'H', b'i']; + let out = strip_ftdi_header(&packet, 64); + assert_eq!(out, b"Hi"); +} + +#[test] +fn status_only_packet_yields_empty() { + let packet = vec![0u8, 0u8]; + assert!(strip_ftdi_header(&packet, 64).is_empty()); +} + +#[test] +fn ftdi_tail_partial_packet() { + let input = decode_hex("000041"); + assert_eq!(strip_ftdi_header(&input, 64), decode_hex("41")); +} + +#[test] +fn xon_xoff_strip_17_fixture() { + let input = decode_hex("41421143"); + let mut f = XonXoffRxFilter::new(true); + assert_eq!(f.filter(&input), decode_hex("414243")); +} + +#[test] +fn xon_xoff_strip_19_fixture() { + let input = decode_hex("41131143"); + let mut f = XonXoffRxFilter::new(true); + assert_eq!(f.filter(&input), decode_hex("4143")); +} diff --git a/crates/android-usb-serial/tests/ftdi_test.rs b/crates/android-usb-serial/tests/ftdi_test.rs new file mode 100644 index 00000000..88bc1531 --- /dev/null +++ b/crates/android-usb-serial/tests/ftdi_test.rs @@ -0,0 +1,195 @@ +#![cfg(feature = "fake-transport")] + +//! FTDI driver semantic tests on fake transport. + +use android_usb_serial::config::{DataBits, LineConfig, Parity, PurgeKind, StopBits}; +use android_usb_serial::device::open_port; +use android_usb_serial::drivers::ftdi_baud_encoding; +use android_usb_serial::fake::FakeTransport; +use android_usb_serial::reader::SerialReader; +use android_usb_serial::rx_filter::FtdiHeaderFilter; +use android_usb_serial::transport::Transport; +use std::sync::Arc; +use std::time::{Duration, Instant}; + +fn ftdi_baud_control_value(fake: &FakeTransport) -> u16 { + fake.recorded_controls() + .into_iter() + .find(|c| c.request == 3) + .expect("SET_BAUDRATE") + .value +} + +fn open_ftdi(fake: &FakeTransport, port: usize) -> android_usb_serial::port::SerialPortHandle { + let transport: Arc = Arc::new(fake.clone()); + let mut handle = open_port(transport, port).expect("open"); + handle + .set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("line"); + handle +} + +#[test] +fn baud_vector_300_0x2710() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 300, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + assert_eq!(ftdi_baud_control_value(&fake), 0x2710); + let (value, _) = ftdi_baud_encoding(300, false, 0).unwrap(); + assert_eq!(value, 0x2710); +} + +#[test] +fn baud_vector_9600_0x4138() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 9600, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + assert_eq!(ftdi_baud_control_value(&fake), 0x4138); +} + +#[test] +fn baud_vector_115200_0x001a() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + assert_eq!(ftdi_baud_control_value(&fake), 0x001a); +} + +#[test] +fn baud_vector_921600_0x8003() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 921_600, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + assert_eq!(ftdi_baud_control_value(&fake), 0x8003); +} + +#[test] +fn baud_vector_2m_0x0001() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 2_000_000, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + assert_eq!(ftdi_baud_control_value(&fake), 0x0001); +} + +#[test] +fn baud_vector_3m_0x0000() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 3_000_000, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + assert_eq!(ftdi_baud_control_value(&fake), 0x0000); +} + +#[test] +fn baud_over_3_5m_errors() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + let err = port.set_line_config(LineConfig { + baud_rate: 4_000_000, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }); + assert!(err.is_err()); +} + +#[test] +fn ft2232_port1_index_encoding() { + let fake = FakeTransport::ftdi_ft2232(); + let mut port = open_ftdi(&fake, 1); + fake.clear_recorded(); + port.set_line_config(LineConfig { + baud_rate: 9600, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("baud"); + let ctrl = fake + .recorded_controls() + .into_iter() + .find(|c| c.request == 3) + .expect("SET_BAUDRATE"); + assert_eq!(ctrl.index, 2, "port1 wIndex encoding"); + let _ = port; +} + +#[test] +fn purge_rx_clears_write_buffer_naming() { + let fake = FakeTransport::ftdi_ft232r(); + let mut port = open_ftdi(&fake, 0); + fake.clear_recorded(); + port.purge(PurgeKind::Rx).expect("purge rx"); + let purge = fake + .recorded_controls() + .into_iter() + .find(|c| c.request == 0 && c.value == 1) + .expect("PURGE_RX"); + assert_eq!(purge.index, 1); +} + +#[test] +fn read_filter_integration_via_reader() { + let fake = FakeTransport::ftdi_ft232r(); + fake.push_rx(&[0u8, 0u8, b'H', b'i']); + let bulk = fake.open_bulk_in(0x81, 64).expect("bulk in"); + let mut reader = SerialReader::start(bulk, 64, 100, vec![Box::new(FtdiHeaderFilter::new(64))]); + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 4]; + let mut n = 0; + while n == 0 && Instant::now() < deadline { + n = reader.try_read(&mut out).expect("read"); + if n == 0 { + std::thread::sleep(Duration::from_millis(5)); + } + } + reader.stop(); + assert_eq!(n, 2); + assert_eq!(&out[..2], b"Hi"); +} diff --git a/crates/android-usb-serial/tests/golden_parity.rs b/crates/android-usb-serial/tests/golden_parity.rs new file mode 100644 index 00000000..399d6c82 --- /dev/null +++ b/crates/android-usb-serial/tests/golden_parity.rs @@ -0,0 +1,688 @@ +#![cfg(feature = "fake-transport")] + +//! Replay golden fixtures against Rust drivers (Java byte-parity). + +use android_usb_serial::config::{DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits}; +use android_usb_serial::drivers::create_driver; +use android_usb_serial::error::UsbSerialError; +use android_usb_serial::fake::{FakeTransport, RecordedBulkOut, RecordedControl}; +use android_usb_serial::probe::DriverType; +use android_usb_serial::transport::{EndpointInfo, InterfaceInfo, Transport}; +use base64::Engine; +use serde::Deserialize; +use std::fmt::Write as _; +use std::fs; +use std::path::{Path, PathBuf}; +use std::sync::Arc; + +#[derive(Debug, Deserialize)] +struct GoldenFixture { + #[serde(default)] + source: Option, + driver: String, + scenario: String, + #[serde(rename = "vendorId")] + vendor_id: u16, + #[serde(rename = "productId")] + product_id: u16, + #[serde(rename = "portIndex")] + port_index: usize, + #[serde(rename = "deviceStub")] + device_stub: String, + interfaces: Vec, + controls: Vec, + #[serde(rename = "bulkOut", default)] + bulk_out: Vec, + #[serde(rename = "expectError", default)] + expect_error: Option, +} + +#[derive(Debug, Deserialize)] +struct GoldenInterface { + id: u8, + #[serde(rename = "classId")] + class_id: u8, + subclass: u8, + protocol: u8, + #[serde(rename = "bulkIn")] + bulk_in: Option, + #[serde(rename = "bulkOut")] + bulk_out: Option, + #[serde(rename = "interruptIn")] + interrupt_in: Option, + #[serde(rename = "maxPacketSize", default = "default_mps")] + max_packet_size: u16, +} + +fn default_mps() -> u16 { + 64 +} + +fn deserialize_u16_signed<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let v = i32::deserialize(deserializer)?; + Ok(v as u16) +} + +#[derive(Debug, Deserialize)] +struct GoldenControl { + #[serde(rename = "requestType")] + request_type: u8, + request: u8, + #[serde(deserialize_with = "deserialize_u16_signed")] + value: u16, + #[serde(deserialize_with = "deserialize_u16_signed")] + index: u16, + data: String, +} + +#[derive(Debug, Deserialize)] +struct GoldenBulkOut { + endpoint: u8, + data: String, +} + +#[derive(Debug, Deserialize)] +struct RxFilterFixture { + filter: String, + input: String, + output: String, +} + +#[derive(Debug, Deserialize)] +struct ProbeTableEntry { + #[serde(rename = "vendorId")] + vendor_id: u16, + #[serde(rename = "productId")] + product_id: u16, + driver: String, + #[serde(rename = "portCount", default)] + port_count: usize, +} + +fn fixture_dir() -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures") +} + +fn driver_type(name: &str) -> DriverType { + match name { + "cdc_acm" => DriverType::CdcAcm, + "ftdi" => DriverType::Ftdi, + "cp21xx" => DriverType::Cp21xx, + "ch34x" => DriverType::Ch34x, + "prolific" => DriverType::Prolific, + "gsm_modem" => DriverType::GsmModem, + "chrome_ccd" => DriverType::ChromeCcd, + other => panic!("unknown driver {other}"), + } +} + +fn line_115200() -> LineConfig { + LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + } +} + +fn prolific_status_packet() -> Vec { + let mut status = vec![0u8; 10]; + status[0] = 0xA1; + status +} + +fn setup_fake(fixture: &GoldenFixture) -> FakeTransport { + let fake = match fixture.device_stub.as_str() { + "ftdi_ft232r" => FakeTransport::ftdi_ft232r(), + "ftdi_ft2232h" => FakeTransport::ftdi_ft2232(), + "cp2102" => FakeTransport::cp2102(), + "cp2105" => FakeTransport::cp2105(), + "ch340" => { + let t = FakeTransport::ch340_dual_iface(); + for _ in 0..8 { + t.script_control_in_response(vec![0, 0]); + } + t + } + "pl2303_hx" => { + let t = FakeTransport::pl2303_hx(); + t.script_control_in_response(vec![0]); + let status = prolific_status_packet(); + t.push_interrupt_in(&status); + t.push_interrupt_in(&status); + t + } + "pl2303_hxn" => { + let t = FakeTransport::pl2303_hxn(); + let status = prolific_status_packet(); + t.push_interrupt_in(&status); + t.push_interrupt_in(&status); + t + } + "pl2303_01" => { + let t = FakeTransport::pl2303_type01(); + t.script_control_in_response(vec![0]); + let status = prolific_status_packet(); + t.push_interrupt_in(&status); + t.push_interrupt_in(&status); + t + } + "pl2303_ta" => { + let t = FakeTransport::pl2303_ta(); + t.script_control_in_response(vec![0]); + let status = prolific_status_packet(); + t.push_interrupt_in(&status); + t.push_interrupt_in(&status); + t + } + "cdc_single" => FakeTransport::cdc_single_iface(), + "cdc_iad" => FakeTransport::cdc_iad(), + "cdc_multi" => FakeTransport::cdc_multi(), + "gsm_fibocom" => FakeTransport::gsm_modem(), + "chrome_ccd" | "cr50" => FakeTransport::chrome_ccd_3port(), + other => panic!("unknown device stub {other}"), + }; + fake.set_vendor_product(fixture.vendor_id, fixture.product_id); + let ifaces: Vec = fixture + .interfaces + .iter() + .map(|i| InterfaceInfo { + id: i.id, + class: i.class_id, + subclass: i.subclass, + protocol: i.protocol, + }) + .collect(); + fake.set_interfaces(ifaces); + let mut layout: Vec<(u8, Vec)> = Vec::new(); + for i in &fixture.interfaces { + let mut eps = Vec::new(); + if let Some(addr) = i.interrupt_in { + eps.push(EndpointInfo { + address: addr, + attributes: 3, + max_packet_size: i.max_packet_size, + interval: 1, + }); + } + if let Some(addr) = i.bulk_in { + eps.push(EndpointInfo { + address: addr, + attributes: 2, + max_packet_size: i.max_packet_size, + interval: 0, + }); + } + if let Some(addr) = i.bulk_out { + eps.push(EndpointInfo { + address: addr, + attributes: 2, + max_packet_size: i.max_packet_size, + interval: 0, + }); + } + layout.push((i.id, eps)); + } + fake.configure_endpoints(&layout); + fake +} + +fn scenario_suffix(fixture: &GoldenFixture) -> String { + let stub_prefix = format!("{}_", fixture.device_stub); + let rest = fixture + .scenario + .strip_prefix(&stub_prefix) + .unwrap_or(&fixture.scenario); + let port_prefix = format!("port{}_", fixture.port_index); + rest.strip_prefix(&port_prefix).unwrap_or(rest).to_string() +} + +fn parse_line_suffix(name: &str) -> LineConfig { + let (db, rest) = name.split_at(1); + let data_bits = match db { + "5" => DataBits::Five, + "7" => DataBits::Seven, + "8" => DataBits::Eight, + other => panic!("unsupported data bits {other} in set_line_{name}"), + }; + let parity_ch = rest.chars().next().expect("parity"); + let parity = match parity_ch { + 'N' => Parity::None, + 'E' => Parity::Even, + 'O' => Parity::Odd, + 'M' => Parity::Mark, + 'S' => Parity::Space, + other => panic!("unsupported parity {other}"), + }; + let sb_part = &rest[1..]; + let stop_bits = if sb_part == "1" { + StopBits::One + } else if sb_part == "2" { + StopBits::Two + } else if sb_part == "1_5" { + StopBits::OnePointFive + } else { + panic!("unsupported stop bits {sb_part}"); + }; + LineConfig { + baud_rate: 115_200, + data_bits, + parity, + stop_bits, + } +} + +fn is_limited_driver(driver: &str) -> bool { + matches!(driver, "gsm_modem" | "chrome_ccd") +} + +fn replay_scenario( + driver: &mut dyn android_usb_serial::drivers::Driver, + driver_name: &str, + suffix: &str, +) -> Result<(), UsbSerialError> { + match suffix { + "open_default" => { + if !is_limited_driver(driver_name) { + driver.set_line_config(line_115200())?; + let _ = driver.set_dtr(true); + let _ = driver.set_rts(true); + } + Ok(()) + } + "open_line_config" => { + driver.set_line_config(line_115200())?; + let _ = driver.set_dtr(true); + let _ = driver.set_rts(true); + Ok(()) + } + s if s.starts_with("set_baud_") && !s.contains("error") => { + let baud: u32 = s["set_baud_".len()..].parse().expect("baud"); + let mut cfg = line_115200(); + cfg.baud_rate = baud; + driver.set_line_config(cfg) + } + s if s.starts_with("set_baud_error_") => { + let baud: u32 = s["set_baud_error_".len()..].parse().expect("baud"); + let mut cfg = line_115200(); + cfg.baud_rate = baud; + driver.set_line_config(cfg) + } + s if s.starts_with("set_line_") => { + let name = &s["set_line_".len()..]; + driver.set_line_config(parse_line_suffix(name)) + } + "flow_None" => { + driver.set_line_config(line_115200()).ok(); + driver.set_flow_control(FlowControl::None) + } + "flow_RtsCts" => { + driver.set_line_config(line_115200()).ok(); + driver.set_flow_control(FlowControl::RtsCts) + } + "flow_DtrDsr" => { + driver.set_line_config(line_115200()).ok(); + driver.set_flow_control(FlowControl::DtrDsr) + } + "flow_XonXoff" => { + driver.set_line_config(line_115200()).ok(); + driver.set_flow_control(FlowControl::XonXoff) + } + "flow_XonXoffInline" => { + driver.set_line_config(line_115200()).ok(); + driver.set_flow_control(FlowControl::XonXoffInline) + } + "dtr_on" => driver.set_dtr(true), + "dtr_off" => driver.set_dtr(false), + "rts_on" => driver.set_rts(true), + "rts_off" => driver.set_rts(false), + "break_on" => driver.set_break(true), + "break_off" => driver.set_break(false), + "purge_rx" => driver.purge(PurgeKind::Rx), + "purge_tx" => driver.purge(PurgeKind::Tx), + "purge_both" => driver.purge(PurgeKind::Both), + "modem_status" => { + driver.set_line_config(line_115200())?; + for _ in 0..4 { + let _ = driver.modem_status(); + } + Ok(()) + } + "close" => { + if !is_limited_driver(driver_name) { + let _ = driver.set_line_config(line_115200()); + } + Ok(()) + } + other => panic!("unsupported scenario suffix {other}"), + } +} + +fn hex(data: &[u8]) -> String { + data.iter().map(|b| format!("{b:02x}")).collect() +} + +fn decode_b64(s: &str) -> Vec { + base64::engine::general_purpose::STANDARD + .decode(s) + .unwrap_or_default() +} + +fn format_control_diff(path: &Path, got: &[RecordedControl], want: &[GoldenControl]) -> String { + let mut out = format!( + "control mismatch for {}: got {} want {}\n", + path.display(), + got.len(), + want.len() + ); + let n = got.len().max(want.len()); + for i in 0..n { + match (got.get(i), want.get(i)) { + (Some(g), Some(w)) => { + let want_data = decode_b64(&w.data); + if g.request_type != w.request_type + || g.request != w.request + || g.value != w.value + || g.index != w.index + || g.data != want_data + { + let _ = writeln!( + out, + "#{} requestType={}/{} request={}/{} value={:#06x}/{:#06x} index={}/{} data=hex:{} expected=hex:{}", + i, + g.request_type, + w.request_type, + g.request, + w.request, + g.value, + w.value, + g.index, + w.index, + hex(&g.data), + hex(&want_data), + ); + } + } + (Some(g), None) => { + let _ = + writeln!( + out, + "#{} extra got requestType={} request={} value={:#06x} index={} data=hex:{}", + i, g.request_type, g.request, g.value, g.index, hex(&g.data), + ); + } + (None, Some(w)) => { + let want_data = decode_b64(&w.data); + let _ = writeln!( + out, + "#{} missing expected requestType={} request={} value={:#06x} index={} data=hex:{}", + i, w.request_type, w.request, w.value, w.index, hex(&want_data), + ); + } + (None, None) => {} + } + } + out +} + +fn controls_match(got: &[RecordedControl], want: &[GoldenControl]) -> bool { + got.len() == want.len() + && got.iter().zip(want.iter()).all(|(g, w)| { + g.request_type == w.request_type + && g.request == w.request + && g.value == w.value + && g.index == w.index + && g.data == decode_b64(&w.data) + }) +} + +fn assert_controls(path: &Path, got: &[RecordedControl], want: &[GoldenControl]) { + if !controls_match(got, want) { + panic!("{}", format_control_diff(path, got, want)); + } +} + +fn format_bulk_diff(path: &Path, got: &[RecordedBulkOut], want: &[GoldenBulkOut]) -> String { + let mut out = format!( + "bulkOut mismatch for {}: got {} want {}\n", + path.display(), + got.len(), + want.len() + ); + let n = got.len().max(want.len()); + for i in 0..n { + match (got.get(i), want.get(i)) { + (Some(g), Some(w)) => { + let want_data = decode_b64(&w.data); + if g.endpoint != w.endpoint || g.data != want_data { + let _ = writeln!( + out, + "#{} endpoint={}/{} data=hex:{} expected=hex:{}", + i, + g.endpoint, + w.endpoint, + hex(&g.data), + hex(&want_data), + ); + } + } + (Some(g), None) => { + let _ = writeln!( + out, + "#{} extra bulkOut endpoint={} data=hex:{}", + i, + g.endpoint, + hex(&g.data), + ); + } + (None, Some(w)) => { + let want_data = decode_b64(&w.data); + let _ = writeln!( + out, + "#{} missing bulkOut endpoint={} data=hex:{}", + i, + w.endpoint, + hex(&want_data), + ); + } + (None, None) => {} + } + } + out +} + +fn assert_bulk_out(path: &Path, got: &[RecordedBulkOut], want: &[GoldenBulkOut]) { + if got.len() != want.len() + || got + .iter() + .zip(want.iter()) + .any(|(g, w)| g.endpoint != w.endpoint || g.data != decode_b64(&w.data)) + { + panic!("{}", format_bulk_diff(path, got, want)); + } +} + +fn decode_hex(s: &str) -> Vec { + let s = s.trim().trim_start_matches("0x"); + if s.is_empty() { + return Vec::new(); + } + (0..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i + 2], 16).expect("hex")) + .collect() +} + +fn error_class(err: &UsbSerialError) -> &'static str { + match err { + UsbSerialError::Unsupported(_) => "UnsupportedOperationException", + UsbSerialError::ProbeFailed(msg) | UsbSerialError::Io(msg) + if msg.to_lowercase().contains("invalid") => + { + "IllegalArgumentException" + } + UsbSerialError::ProbeFailed(_) | UsbSerialError::Io(_) => "Exception", + _ => "Exception", + } +} + +fn collect_driver_fixtures() -> Vec { + let root = fixture_dir(); + let mut paths = Vec::new(); + for entry in fs::read_dir(&root).expect("read fixtures dir") { + let driver_dir = entry.expect("entry").path(); + if !driver_dir.is_dir() { + continue; + } + let name = driver_dir + .file_name() + .and_then(|n| n.to_str()) + .unwrap_or(""); + if name == "rx_filter" || name == "probe" { + continue; + } + for file in fs::read_dir(&driver_dir).expect("driver dir") { + let p = file.expect("file").path(); + if p.extension().and_then(|e| e.to_str()) != Some("json") { + continue; + } + let text = fs::read_to_string(&p).unwrap_or_default(); + if text.contains("\"source\":\"java\"") || text.contains("\"source\": \"java\"") { + paths.push(p); + } + } + } + paths.sort(); + paths +} + +fn replay_fixture(path: &Path) { + let text = fs::read_to_string(path).unwrap_or_else(|e| panic!("read {}: {e}", path.display())); + let fixture: GoldenFixture = + serde_json::from_str(&text).unwrap_or_else(|e| panic!("parse {}: {e}", path.display())); + assert_eq!( + fixture.source.as_deref(), + Some("java"), + "expected Java fixture {}", + path.display() + ); + let fake = setup_fake(&fixture); + let transport: Arc = Arc::new(fake.clone()); + let mut driver = create_driver(driver_type(&fixture.driver), fixture.port_index); + driver.open(&transport).expect("open"); + let suffix = scenario_suffix(&fixture); + let result = replay_scenario(driver.as_mut(), &fixture.driver, &suffix); + let _ = driver.close(); + if let Some(expected) = &fixture.expect_error { + match result { + Err(e) => assert_eq!( + error_class(&e), + expected.as_str(), + "{}: expected {expected}, got {e:?}", + path.display() + ), + Ok(()) => panic!( + "{}: expected error {expected} but scenario succeeded", + path.display() + ), + } + } else { + result.unwrap_or_else(|e| panic!("{}: scenario {suffix}: {e:?}", path.display())); + } + assert_controls(path, &fake.recorded_controls(), &fixture.controls); + assert_bulk_out(path, &fake.recorded_bulk_out(), &fixture.bulk_out); +} + +#[test] +fn golden_parity_all_java_fixtures() { + let paths = collect_driver_fixtures(); + assert!( + paths.len() >= 250, + "expected >=250 Java fixtures, got {}", + paths.len() + ); + for path in paths { + replay_fixture(&path); + } +} + +#[test] +fn golden_parity_rx_filter_fixtures() { + let dir = fixture_dir().join("rx_filter"); + if !dir.exists() { + eprintln!("skip: no rx_filter fixtures at {}", dir.display()); + return; + } + use android_usb_serial::rx_filter::{strip_ftdi_header, RxFilter, XonXoffRxFilter}; + for entry in fs::read_dir(&dir).expect("rx_filter dir") { + let path = entry.expect("entry").path(); + if path.extension().and_then(|e| e.to_str()) != Some("json") { + continue; + } + let text = fs::read_to_string(&path).unwrap(); + let fx: RxFilterFixture = serde_json::from_str(&text).unwrap(); + let input = decode_hex(&fx.input); + let want = decode_hex(&fx.output); + let got = match fx.filter.as_str() { + "ftdi_header" => strip_ftdi_header(&input, 64), + "xon_xoff" => { + let mut f = XonXoffRxFilter::new(true); + f.filter(&input) + } + other => panic!("unknown rx filter {other}"), + }; + assert_eq!( + got, + want, + "rx_filter {}: input={} want={} got={}", + path.display(), + fx.input, + fx.output, + hex(&got), + ); + } +} + +#[test] +fn golden_parity_probe_table() { + let path = fixture_dir().join("probe/probe_table.json"); + if !path.exists() { + eprintln!("skip: no probe_table at {}", path.display()); + return; + } + use android_usb_serial::probe::{DriverType, ProbeTable}; + let text = fs::read_to_string(&path).unwrap(); + let entries: Vec = serde_json::from_str(&text).unwrap(); + assert!(!entries.is_empty(), "probe_table empty"); + let table = ProbeTable::default_table(); + for entry in entries { + let driver = table.find(entry.vendor_id, entry.product_id, &[]); + let expected = match entry.driver.as_str() { + "cdc_acm" => DriverType::CdcAcm, + "ftdi" => DriverType::Ftdi, + "cp21xx" => DriverType::Cp21xx, + "ch34x" => DriverType::Ch34x, + "prolific" => DriverType::Prolific, + "gsm_modem" => DriverType::GsmModem, + "chrome_ccd" => DriverType::ChromeCcd, + other => panic!("unknown driver {other}"), + }; + assert_eq!( + driver, expected, + "vid={:#06x} pid={:#06x}", + entry.vendor_id, entry.product_id, + ); + if entry.port_count > 0 { + assert_eq!( + table.port_count_product(entry.vendor_id, entry.product_id, driver, &[]), + entry.port_count, + "vid={:#06x} pid={:#06x}", + entry.vendor_id, + entry.product_id, + ); + } + } +} diff --git a/crates/android-usb-serial/tests/gsm_ccd_test.rs b/crates/android-usb-serial/tests/gsm_ccd_test.rs new file mode 100644 index 00000000..e715c00c --- /dev/null +++ b/crates/android-usb-serial/tests/gsm_ccd_test.rs @@ -0,0 +1,68 @@ +#![cfg(feature = "fake-transport")] + +//! GSM modem and Chrome CCD driver tests. + +use android_usb_serial::config::LineConfig; +use android_usb_serial::device::open_port; +use android_usb_serial::fake::FakeTransport; +use android_usb_serial::probe::{DriverType, ProbeTable}; +use android_usb_serial::transport::Transport; +use std::sync::Arc; + +#[test] +fn gsm_init_only_control() { + let table = ProbeTable::default_table(); + assert_eq!(table.find(0x1782, 0x4D10, &[]), DriverType::GsmModem); + + let fake = FakeTransport::gsm_modem(); + let transport: Arc = Arc::new(fake.clone()); + let mut port = open_port(transport, 0).expect("open"); + assert!(port.set_line_config(LineConfig::default()).is_err()); + let init = fake + .recorded_controls() + .iter() + .any(|c| c.request == 0x22 && c.request_type == 0x21); + assert!(init, "GSM init control transfer expected"); +} + +#[test] +fn gsm_line_config_unsupported() { + let fake = FakeTransport::gsm_modem(); + let transport: Arc = Arc::new(fake.clone()); + let mut port = open_port(transport, 0).expect("open"); + assert!(port.set_line_config(LineConfig::default()).is_err()); +} + +#[test] +fn ccd_three_ports_no_cdc_init() { + let table = ProbeTable::default_table(); + assert_eq!(table.find(0x18D1, 0x5014, &[]), DriverType::ChromeCcd); + assert_eq!( + table.port_count_product(0x18D1, 0x5014, DriverType::ChromeCcd, &[]), + 3 + ); + + let fake = FakeTransport::chrome_ccd_3port(); + for port_index in 0..3 { + let t: Arc = Arc::new(fake.clone()); + let mut port = open_port(t, port_index).expect("open"); + assert!(port.set_line_config(LineConfig::default()).is_err()); + } + assert!( + fake.recorded_controls().iter().all(|c| c.request != 0x20), + "no CDC SET_LINE on CCD" + ); +} + +#[test] +fn ccd_port2_bulk_endpoints() { + let fake = FakeTransport::chrome_ccd_3port(); + let transport: Arc = Arc::new(fake.clone()); + let mut port = open_port(transport, 2).expect("open port 2"); + port.write(b"PING").expect("write"); + let bulk = fake.recorded_bulk_out(); + assert!( + bulk.iter().any(|b| b.endpoint == 0x06), + "port2 bulk OUT endpoint 0x06" + ); +} diff --git a/crates/android-usb-serial/tests/nusb_transport_test.rs b/crates/android-usb-serial/tests/nusb_transport_test.rs new file mode 100644 index 00000000..2b618957 --- /dev/null +++ b/crates/android-usb-serial/tests/nusb_transport_test.rs @@ -0,0 +1,45 @@ +#![cfg(feature = "fake-transport")] + +//! Transport parsing and FakeTransport descriptor tests. + +use android_usb_serial::fake::FakeTransport; +use android_usb_serial::serialport_compat::chunk_write_timeout_ms; +use android_usb_serial::transport::{ + is_device_recipient, is_interface_recipient, ControlRequest, Transport, +}; +use std::time::Duration; + +#[test] +fn fake_transport_raw_descriptors_roundtrip() { + let fake = FakeTransport::cdc_single_iface(); + let raw = vec![9, 2, 9, 0, 1, 1, 0, 80, 0]; + fake.set_raw_descriptors(raw.clone()); + assert_eq!(fake.raw_descriptors(), raw); +} + +#[test] +fn vendor_out_uses_device_recipient() { + let req = ControlRequest::vendor_out(0x9a, 0x1312, 0, vec![]); + assert!(is_device_recipient(req.request_type)); +} + +#[test] +fn class_iface_uses_interface_recipient() { + let req = ControlRequest::class_out(0x20, 0, 0, vec![0; 7]); + assert!(is_interface_recipient(req.request_type)); +} + +#[test] +fn chunk_write_timeout_clamps_and_floors_at_2s() { + assert_eq!(chunk_write_timeout_ms(Duration::from_millis(0)), 2000); + assert_eq!(chunk_write_timeout_ms(Duration::from_millis(500)), 2000); + assert_eq!(chunk_write_timeout_ms(Duration::from_secs(5)), 5000); + assert_eq!(chunk_write_timeout_ms(Duration::from_secs(900)), 600_000); +} + +#[test] +fn pipelined_bulk_in_3_transfers() { + // NusbTransport uses 3 in-flight bulk IN transfers (see nusb_transport.rs). + const IN_FLIGHT: usize = 3; + assert_eq!(IN_FLIGHT, 3); +} diff --git a/crates/android-usb-serial/tests/probe_table_test.rs b/crates/android-usb-serial/tests/probe_table_test.rs new file mode 100644 index 00000000..87c14e1d --- /dev/null +++ b/crates/android-usb-serial/tests/probe_table_test.rs @@ -0,0 +1,83 @@ +//! Probe table port-count rules (device_filter + product defaults). + +use android_usb_serial::probe::{DriverType, ProbeTable}; +use android_usb_serial::transport::InterfaceInfo; + +#[test] +fn ftdi_ft2232_port_count_two_without_interfaces() { + let table = ProbeTable::default_table(); + assert_eq!( + table.port_count_product(0x0403, 0x6010, DriverType::Ftdi, &[]), + 2 + ); +} + +#[test] +fn cp2105_port_count_two_without_interfaces() { + let table = ProbeTable::default_table(); + assert_eq!( + table.port_count_product(0x10C4, 0xEA70, DriverType::Cp21xx, &[]), + 2 + ); +} + +#[test] +fn chrome_ccd_port_count_three() { + let table = ProbeTable::default_table(); + assert_eq!( + table.port_count_product(0x18D1, 0x5014, DriverType::ChromeCcd, &[]), + 3 + ); +} + +#[test] +fn cdc_acm_port_count_from_interfaces() { + let table = ProbeTable::default_table(); + let ifaces = vec![ + InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }, + InterfaceInfo { + id: 2, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 3, + class: 10, + subclass: 0, + protocol: 0, + }, + ]; + assert_eq!(table.port_count(DriverType::CdcAcm, &ifaces), 2); +} + +#[test] +fn ftdi_port_count_follows_interface_count() { + let table = ProbeTable::default_table(); + let ifaces = vec![ + InterfaceInfo { + id: 0, + class: 255, + subclass: 0, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 255, + subclass: 0, + protocol: 0, + }, + ]; + assert_eq!(table.port_count(DriverType::Ftdi, &ifaces), 2); +} diff --git a/crates/android-usb-serial/tests/probe_test.rs b/crates/android-usb-serial/tests/probe_test.rs new file mode 100644 index 00000000..4e0d78e6 --- /dev/null +++ b/crates/android-usb-serial/tests/probe_test.rs @@ -0,0 +1,81 @@ +//! Probe table vs Android device_filter.xml. + +use android_usb_serial::probe::{DriverType, ProbeTable}; +use android_usb_serial::transport::InterfaceInfo; +use std::fs; +use std::path::Path; + +fn parse_device_filter_xml(path: &Path) -> Vec<(u16, u16)> { + let text = fs::read_to_string(path).expect("read device_filter.xml"); + let mut out = Vec::new(); + for line in text.lines() { + if let (Some(v), Some(p)) = ( + line.split("vendor-id=\"") + .nth(1) + .and_then(|s| s.split('"').next()), + line.split("product-id=\"") + .nth(1) + .and_then(|s| s.split('"').next()), + ) { + if let (Ok(vid), Ok(pid)) = (v.parse::(), p.parse::()) { + out.push((vid, pid)); + } + } + } + out +} + +#[test] +fn device_filter_explicit_drivers_match_probe_table() { + let root = Path::new(env!("CARGO_MANIFEST_DIR")) + .join("../../android/src/main/res/xml/device_filter.xml"); + let table = ProbeTable::default_table(); + let pairs = parse_device_filter_xml(&root); + assert!(!pairs.is_empty(), "device_filter.xml should list devices"); + + for (vid, pid) in pairs { + let driver = table.find(vid, pid, &[]); + if driver == DriverType::CdcAcm { + continue; + } + assert!( + table + .entries() + .iter() + .any(|e| e.vendor_id == vid && e.product_id == pid), + "explicit driver {vid:04x}:{pid:04x} -> {driver:?} missing from ProbeTable" + ); + } +} + +#[test] +fn cdc_fallback_for_unknown_vid() { + let table = ProbeTable::default_table(); + let ifaces = vec![ + InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }, + ]; + assert_eq!(table.find(0x9999, 0x0001, &ifaces), DriverType::CdcAcm); +} + +#[test] +fn probe_table_matches_device_filter_ftdi() { + let table = ProbeTable::default_table(); + assert_eq!(table.find(0x0403, 0x6001, &[]), DriverType::Ftdi); +} + +#[test] +fn cdc_only_filter_entries_use_fallback() { + let table = ProbeTable::default_table(); + assert_eq!(table.find(0x2341, 0x0043, &[]), DriverType::CdcAcm); +} diff --git a/crates/android-usb-serial/tests/prolific_test.rs b/crates/android-usb-serial/tests/prolific_test.rs new file mode 100644 index 00000000..91303e8b --- /dev/null +++ b/crates/android-usb-serial/tests/prolific_test.rs @@ -0,0 +1,159 @@ +#![cfg(feature = "fake-transport")] + +//! Prolific PL2303 driver semantic tests. + +use android_usb_serial::config::{DataBits, FlowControl, LineConfig, Parity, PurgeKind, StopBits}; +use android_usb_serial::device::open_port; +use android_usb_serial::fake::FakeTransport; +use android_usb_serial::probe::{DriverType, ProbeTable}; +use android_usb_serial::transport::Transport; +use std::sync::Arc; + +const STATUS_NOTIFICATION: u8 = 0xa1; + +fn script_pl2303_open(fake: &FakeTransport) { + fake.script_control_in_response(vec![0]); +} + +fn open_pl2303(fake: &FakeTransport) -> android_usb_serial::port::SerialPortHandle { + script_pl2303_open(fake); + let transport: Arc = Arc::new(fake.clone()); + open_port(transport, 0).expect("open") +} + +fn patch_usb11(fake: &FakeTransport) { + fake.patch_device_descriptor(|d| { + d[2] = 0x10; + d[3] = 0x01; + }); +} + +#[test] +fn type_hx_detection() { + let fake = FakeTransport::pl2303_hx(); + patch_usb11(&fake); + let _port = open_pl2303(&fake); + assert!( + fake.recorded_controls() + .iter() + .any(|c| c.request_type == 0xC0 && c.value == 0x8484), + "HX black magic vendor IN" + ); +} + +#[test] +fn type_hxn_detection() { + let fake = FakeTransport::pl2303_hxn(); + script_pl2303_open(&fake); + let transport: Arc = Arc::new(fake.clone()); + let _port = open_port(transport, 0).expect("open"); + assert!( + !fake.recorded_controls().iter().any(|c| c.value == 0x8484), + "HXN skips black magic reads" + ); +} + +#[test] +fn type_01_detection() { + let fake = FakeTransport::pl2303_type01(); + script_pl2303_open(&fake); + let transport: Arc = Arc::new(fake.clone()); + let _port = open_port(transport, 0).expect("open"); + let controls = fake.recorded_controls(); + assert!( + controls + .iter() + .any(|c| c.request == 0x01 && c.value == 2 && c.index == 0x0024), + "type01 magic write" + ); +} + +#[test] +fn type_ta_detection() { + let fake = FakeTransport::pl2303_ta(); + script_pl2303_open(&fake); + let transport: Arc = Arc::new(fake.clone()); + let _port = open_port(transport, 0).expect("open"); + assert!( + fake.recorded_controls() + .iter() + .any(|c| c.request_type == 0xC0 && c.value == 0x8080), + "TA hx status probe" + ); +} + +#[test] +fn black_magic_order_non_hxn() { + let fake = FakeTransport::pl2303_hx(); + patch_usb11(&fake); + let _port = open_pl2303(&fake); + let values: Vec = fake + .recorded_controls() + .iter() + .filter(|c| c.request_type == 0xC0 || c.request_type == 0x40) + .map(|c| c.value) + .collect(); + assert!(values.contains(&0x8484), "black magic sequence: {values:?}"); +} + +#[test] +fn hxn_skips_black_magic() { + let fake = FakeTransport::pl2303_hxn(); + script_pl2303_open(&fake); + let transport: Arc = Arc::new(fake.clone()); + let _port = open_port(transport, 0).expect("open"); + assert!(!fake.recorded_controls().iter().any(|c| c.value == 0x8383)); +} + +#[test] +fn set_line_skip_if_unchanged_then_purge() { + let fake = FakeTransport::pl2303_hx(); + patch_usb11(&fake); + let mut port = open_pl2303(&fake); + let cfg = LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }; + port.set_line_config(cfg).expect("line"); + let before = fake.recorded_controls().len(); + port.set_line_config(cfg).expect("line again"); + let after = fake.recorded_controls().len(); + assert_eq!(before, after, "unchanged line should skip SET_LINE"); + port.purge(PurgeKind::Rx).expect("purge"); + assert!( + fake.recorded_controls() + .iter() + .any(|c| c.request == 0x01 && c.value == 0x0008), + "purge after skip" + ); +} + +#[test] +fn interrupt_thread_decodes_byte8() { + let fake = FakeTransport::pl2303_hx(); + patch_usb11(&fake); + let mut port = open_pl2303(&fake); + let mut packet = vec![0u8; 10]; + packet[0] = STATUS_NOTIFICATION; + packet[8] = 0x80; + fake.push_interrupt_in(&packet); + std::thread::sleep(std::time::Duration::from_millis(50)); + let status = port.modem_status().expect("modem"); + assert!(status.cts); +} + +#[test] +fn flow_dtr_dsr_unsupported() { + let fake = FakeTransport::pl2303_hx(); + patch_usb11(&fake); + let mut port = open_pl2303(&fake); + assert!(port.set_flow_control(FlowControl::DtrDsr).is_err()); +} + +#[test] +fn prolific_probe_table_entry() { + let table = ProbeTable::default_table(); + assert_eq!(table.find(0x067B, 0x2303, &[]), DriverType::Prolific); +} diff --git a/crates/android-usb-serial/tests/reader_test.rs b/crates/android-usb-serial/tests/reader_test.rs new file mode 100644 index 00000000..fbb13f9a --- /dev/null +++ b/crates/android-usb-serial/tests/reader_test.rs @@ -0,0 +1,205 @@ +#![cfg(feature = "fake-transport")] + +//! Background reader semantic tests. + +use android_usb_serial::config::{DataBits, LineConfig, Parity, StopBits}; +use android_usb_serial::device::open_port; +use android_usb_serial::error::{ReadOutcome, UsbSerialError}; +use android_usb_serial::fake::FakeTransport; +use android_usb_serial::reader::SerialReader; +use android_usb_serial::rx_filter::{FtdiHeaderFilter, XonXoffRxFilter}; +use android_usb_serial::transport::{BulkIn, EndpointInfo, InterfaceInfo, Transport}; +use std::sync::Arc; +use std::sync::Mutex; +use std::time::{Duration, Instant}; + +fn cdc_dual_iface_fake() -> FakeTransport { + let fake = FakeTransport::cdc_single_iface(); + fake.set_interfaces(vec![ + InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }, + ]); + fake.configure_endpoints(&[( + 1, + vec![ + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )]); + fake +} + +#[test] +fn write_after_start_reader_does_not_reopen_bulk_in() { + let fake = cdc_dual_iface_fake(); + let transport: Arc = Arc::new(fake.clone()); + let mut port = open_port(transport, 0).expect("open"); + port.start_reader().expect("start_reader"); + // Regression: write used to call ensure_open() which re-opened bulk IN + // already owned by SerialReader → nusb "endpoint already in use". + assert_eq!(port.write(b"AT\r").expect("write"), 3); + port.close(); +} + +#[test] +fn port_start_reader_without_prior_write() { + let fake = cdc_dual_iface_fake(); + let transport: Arc = Arc::new(fake.clone()); + let mut port = open_port(transport, 0).expect("open"); + port.set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .expect("line"); + port.start_reader().expect("start_reader"); + fake.push_rx(b"ok"); + let mut buf = [0u8; 4]; + let deadline = Instant::now() + Duration::from_secs(2); + let mut n = 0; + while n == 0 && Instant::now() < deadline { + n = port.try_read(&mut buf).expect("read"); + if n == 0 { + std::thread::sleep(Duration::from_millis(5)); + } + } + assert_eq!(n, 2); +} + +#[test] +fn reader_chunk_order_preserved() { + let fake = FakeTransport::cdc_single_iface(); + fake.push_rx(b"AB"); + fake.push_rx(b"C"); + let bulk = fake.open_bulk_in(0x81, 64).expect("bulk in"); + let mut reader = SerialReader::start(bulk, 64, 100, vec![]); + + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 8]; + let mut total = 0usize; + while total < 3 && Instant::now() < deadline { + let n = reader.try_read(&mut out[total..]).expect("read"); + total += n; + if n == 0 { + std::thread::sleep(Duration::from_millis(5)); + } + } + reader.stop(); + assert_eq!(total, 3); + assert_eq!(&out[..3], b"ABC"); +} + +#[test] +fn ftdi_filter_in_reader_path() { + let fake = FakeTransport::ftdi_ft232r(); + fake.push_rx(&[0u8, 0u8, b'X']); + let bulk = fake.open_bulk_in(0x81, 64).expect("bulk in"); + let mut reader = SerialReader::start(bulk, 64, 100, vec![Box::new(FtdiHeaderFilter::new(64))]); + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 4]; + let mut n = 0; + while n == 0 && Instant::now() < deadline { + n = reader.try_read(&mut out).expect("read"); + if n == 0 { + std::thread::sleep(Duration::from_millis(5)); + } + } + reader.stop(); + assert_eq!(n, 1); + assert_eq!(out[0], b'X'); +} + +#[test] +fn xonxoff_filter_in_reader_path() { + let fake = FakeTransport::cdc_single_iface(); + fake.push_rx(&[b'A', 19, b'B']); + let bulk = fake.open_bulk_in(0x81, 64).expect("bulk in"); + let mut reader = SerialReader::start(bulk, 64, 100, vec![Box::new(XonXoffRxFilter::new(true))]); + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 4]; + let mut n = 0; + while n == 0 && Instant::now() < deadline { + n = reader.try_read(&mut out).expect("read"); + if n == 0 { + std::thread::sleep(Duration::from_millis(5)); + } + } + reader.stop(); + assert_eq!(&out[..n], b"AB"); +} + +struct ErrorOnceBulkIn { + calls: Mutex, +} + +impl BulkIn for ErrorOnceBulkIn { + fn read( + &mut self, + _buf: &mut [u8], + _timeout_ms: u32, + ) -> android_usb_serial::Result { + let mut calls = self.calls.lock().unwrap(); + *calls += 1; + Err(UsbSerialError::Io("usb disconnect".into())) + } + + fn cancel_all(&mut self) {} + + fn clear_halt(&mut self) -> android_usb_serial::Result<()> { + Ok(()) + } +} + +#[test] +fn disconnected_emits_single_on_error() { + let bulk = ErrorOnceBulkIn { + calls: Mutex::new(0), + }; + let mut reader = SerialReader::start(Box::new(bulk), 64, 100, vec![]); + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 4]; + let mut err = None; + while Instant::now() < deadline { + match reader.try_read(&mut out) { + Ok(0) => std::thread::sleep(Duration::from_millis(5)), + Ok(_) => break, + Err(e) => { + err = Some(e); + break; + } + } + } + reader.stop(); + assert!(err.is_some()); +} + +#[test] +fn stop_reader_join_under_1s() { + let fake = FakeTransport::cdc_single_iface(); + let bulk = fake.open_bulk_in(0x81, 64).expect("bulk in"); + let mut reader = SerialReader::start(bulk, 64, 100, vec![]); + let start = Instant::now(); + reader.stop(); + assert!(start.elapsed() < Duration::from_secs(1)); +} diff --git a/crates/android-usb-serial/tests/spike_fd.rs b/crates/android-usb-serial/tests/spike_fd.rs new file mode 100644 index 00000000..7dd9e972 --- /dev/null +++ b/crates/android-usb-serial/tests/spike_fd.rs @@ -0,0 +1,108 @@ +//! fd → dup → open path (FakeTransport stand-in until hardware spike). + +#[cfg(feature = "fake-transport")] +#[test] +fn fake_transport_open_write() { + use android_usb_serial::config::{DataBits, LineConfig, Parity, StopBits}; + use android_usb_serial::device::open_port; + use android_usb_serial::fake::FakeTransport; + use android_usb_serial::transport::{EndpointInfo, InterfaceInfo, Transport}; + use std::sync::Arc; + + let fake = FakeTransport::cdc_single_iface(); + fake.set_interfaces(vec![ + InterfaceInfo { + id: 0, + class: 2, + subclass: 2, + protocol: 0, + }, + InterfaceInfo { + id: 1, + class: 10, + subclass: 0, + protocol: 0, + }, + ]); + fake.configure_endpoints(&[( + 1, + vec![ + EndpointInfo { + address: 0x81, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + EndpointInfo { + address: 0x02, + attributes: 2, + max_packet_size: 64, + interval: 0, + }, + ], + )]); + let transport: Arc = Arc::new(fake.clone()); + let mut port = open_port(transport, 0).unwrap(); + port.set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .unwrap(); + assert_eq!(port.write(b"PING").unwrap(), 4); + assert_eq!(fake.take_tx(), b"PING"); +} + +/// Real-device spike: `dup → from_fd → descriptor → claim → echo`. +/// Run on Android hardware: `cargo test -p android-usb-serial spike_fd_hardware -- --ignored` +#[cfg(all(target_os = "android", feature = "fake-transport"))] +#[test] +#[ignore = "requires USB serial device; pass fd via ANDROID_USB_SPIKE_FD"] +fn spike_fd_hardware() { + use android_usb_serial::config::{DataBits, LineConfig, Parity, StopBits}; + use android_usb_serial::device::open_port; + use android_usb_serial::from_raw_fd; + use android_usb_serial::probe::ProbeTable; + use android_usb_serial::transport::Transport; + use android_usb_serial::NusbTransport; + use std::env; + use std::os::fd::RawFd; + use std::sync::Arc; + + let fd: RawFd = env::var("ANDROID_USB_SPIKE_FD") + .expect("set ANDROID_USB_SPIKE_FD to open UsbDeviceConnection fd") + .parse() + .expect("invalid fd"); + let device = from_raw_fd(fd).expect("from_fd"); + let transport = NusbTransport::from_device(device).expect("transport"); + let desc = transport.raw_device_descriptor(); + assert_eq!(desc[0], 18); + assert!(!transport.raw_descriptors().is_empty()); + + let vid = u16::from_le_bytes([desc[8], desc[9]]); + let pid = u16::from_le_bytes([desc[10], desc[11]]); + let table = ProbeTable::default_table(); + let ifaces = transport.interfaces(); + let _driver = table.find(vid, pid, &ifaces); + + let shared: Arc = Arc::new(transport); + let mut port = open_port(shared, 0).expect("open_port"); + if port + .set_line_config(LineConfig { + baud_rate: 115_200, + data_bits: DataBits::Eight, + parity: Parity::None, + stop_bits: StopBits::One, + }) + .is_ok() + { + let _ = port.set_dtr(true); + let _ = port.set_rts(true); + let written = port.write(b"AT\r\n").expect("write"); + assert!(written > 0); + let mut buf = [0u8; 64]; + let _ = port.read(&mut buf); + } + port.close(); +} diff --git a/crates/android-usb-serial/tests/stall_recovery_test.rs b/crates/android-usb-serial/tests/stall_recovery_test.rs new file mode 100644 index 00000000..bc8f39ea --- /dev/null +++ b/crates/android-usb-serial/tests/stall_recovery_test.rs @@ -0,0 +1,85 @@ +#![cfg(feature = "fake-transport")] + +//! Stall recovery in reader loop. + +use android_usb_serial::error::{ReadOutcome, TransferError, UsbSerialError}; +use android_usb_serial::reader::SerialReader; +use android_usb_serial::transport::BulkIn; +use std::sync::Mutex; +use std::time::{Duration, Instant}; + +struct StallOnceBulkIn { + calls: Mutex, +} + +impl BulkIn for StallOnceBulkIn { + fn read( + &mut self, + _buf: &mut [u8], + _timeout_ms: u32, + ) -> android_usb_serial::Result { + let mut calls = self.calls.lock().unwrap(); + *calls += 1; + if *calls == 1 { + return Err(UsbSerialError::from(TransferError::Stall)); + } + Ok(ReadOutcome::Data(vec![b'X'])) + } + + fn cancel_all(&mut self) {} + + fn clear_halt(&mut self) -> android_usb_serial::Result<()> { + Ok(()) + } +} + +#[test] +fn reader_recovers_after_single_stall() { + let bulk = StallOnceBulkIn { + calls: Mutex::new(0), + }; + let mut reader = SerialReader::start(Box::new(bulk), 64, 100, vec![]); + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 4]; + let mut n = 0; + while n == 0 && Instant::now() < deadline { + n = reader.try_read(&mut out).unwrap_or(0); + if n == 0 { + std::thread::sleep(Duration::from_millis(5)); + } + } + reader.stop(); + assert_eq!(n, 1); + assert_eq!(out[0], b'X'); +} + +#[test] +fn reader_double_stall_surfaces_error() { + struct StallTwiceBulkIn; + impl BulkIn for StallTwiceBulkIn { + fn read( + &mut self, + _buf: &mut [u8], + _timeout_ms: u32, + ) -> android_usb_serial::Result { + Err(UsbSerialError::from(TransferError::Stall)) + } + fn cancel_all(&mut self) {} + fn clear_halt(&mut self) -> android_usb_serial::Result<()> { + Ok(()) + } + } + let mut reader = SerialReader::start(Box::new(StallTwiceBulkIn), 64, 100, vec![]); + let deadline = Instant::now() + Duration::from_secs(2); + let mut out = [0u8; 4]; + let mut got_err = false; + while Instant::now() < deadline { + if reader.try_read(&mut out).is_err() { + got_err = true; + break; + } + std::thread::sleep(Duration::from_millis(5)); + } + reader.stop(); + assert!(got_err); +} diff --git a/debug.md b/debug.md deleted file mode 100644 index cea8f134..00000000 --- a/debug.md +++ /dev/null @@ -1,272 +0,0 @@ -# Android Debugging Guide for tauri-plugin-serialplugin - -## Recent Fixes Applied - -Based on the analysis of commits from [niftitech/tauri-plugin-serialplugin](https://github.com/niftitech/tauri-plugin-serialplugin), the following fixes have been applied: - -### 1. Enhanced Enum Support (Commit 7d64208) -- Added `companion object` with `fromValue` methods to all enum classes -- Supports both string and numeric values for all port configuration parameters -- Improved type safety and error handling - -### 2. Improved Error Handling (Commit b9267e1) -- Enhanced logging throughout the plugin -- Better error messages and debugging information -- Fixed response handling in Rust mobile API - -### 3. Type Flexibility -- All port configuration parameters now accept both String and Number types -- Automatic conversion between different value formats -- Backward compatibility maintained - -## Project Structure - -``` -tauri-plugin-serialplugin/ -├── examples/ -│ └── serialport-test/ # Example application -│ └── src-tauri/ -│ └── gen/ # Generated Android project -│ └── android/ # Android project directory -│ ├── app/ # Main application module -│ └── tauri-plugin-serialplugin/ # Plugin module -├── android/ # Plugin source code -│ └── src/ -│ └── main/ -│ ├── kotlin/ -│ │ └── app/ -│ │ └── tauri/ -│ │ └── serialplugin/ -│ │ ├── SerialPlugin.kt -│ │ ├── models/ -│ │ │ └── SerialPortConfig.kt -│ │ └── manager/ -│ │ └── SerialPortManager.kt -│ └── AndroidManifest.xml -└── build.gradle -``` - -## Building and Debugging - -### Building the Project - -1. **From Project Root** - ```bash - # Build the entire project - npm run tauri android build - - # Build with verbose output - npm run tauri android build --verbose - ``` - -2. **From Android Project Directory** - ```bash - # Navigate to the generated Android project - cd examples/serialport-test/src-tauri/gen/android - - # Build the plugin module - ./gradlew :tauri-plugin-serialplugin:compileReleaseKotlin --stacktrace --info - - # Clean build - ./gradlew clean - ``` - -### Debugging Tools - -1. **Logcat for Plugin** - ```bash - # Filter logs for the plugin - adb logcat -v time | grep -E "SerialPort|Tauri|tauri-plugin-serialplugin" - - # More specific filtering - adb logcat -v time | grep -E "SerialPlugin|SerialPortManager" - ``` - -2. **USB Device Debugging** - ```bash - # List connected USB devices - adb shell lsusb - - # Check USB permissions - adb shell dumpsys usb - - # Monitor USB events - adb logcat -v time | grep -i "usb" - ``` - -## Key Improvements Made - -### 1. Enhanced Type Support -All enum classes now support both string and numeric values: - -```kotlin -// DataBits enum -enum class DataBits(val value: Int) { - FIVE(5), SIX(6), SEVEN(7), EIGHT(8); - - companion object { - fun fromValue(value: Int): DataBits { - return values().find { it.value == value } ?: EIGHT - } - } -} -``` - -### 2. Flexible Parameter Handling -Port configuration now accepts multiple value types: - -```kotlin -@InvokeArg -class PortConfigArgs { - lateinit var path: String - var baudRate: Int = 9600 - var dataBits: Any? = null // String or Number - var flowControl: Any? = null // String or Number - var parity: Any? = null // String or Number - var stopBits: Any? = null // String or Number - var timeout: Int = 1000 -} -``` - -### 3. Improved Error Handling -Enhanced logging and error messages: - -```kotlin -Log.d("SerialPlugin", "Opening port: ${args.path}") -Log.d("SerialPortManager", "Setting port parameters: baudRate=${config.baudRate}") -Log.e("SerialPlugin", "Failed to open port: ${e.message}", e) -``` - -### 4. Fixed Response Handling -Rust mobile API now properly handles plugin responses: - -```rust -match self.0.run_mobile_plugin("open", params) { - Ok(Value::Bool(true)) => Ok(()), - Ok(_) => Ok(()), // invoke.resolve() returns Ok(_) - Err(e) => Err(Error::new(format!("Plugin error: {}", e))), -} -``` - -## Common Issues and Solutions - -### 1. DataBits Type Mismatch (FIXED) -- **Issue**: `Type mismatch: inferred type is Any but String was expected` -- **Solution**: Enhanced type handling with `when` expressions -- **Status**: ✅ Resolved - -### 2. USB Device Detection -- **Check**: Verify device appears in `getAvailablePorts()` -- **Debug**: Monitor logs with tag "SerialPortManager" -- **Solution**: Ensure proper USB permissions and device support - -### 3. Port Configuration -- **Default settings**: - ```kotlin - data class SerialPortConfig( - val path: String, - val baudRate: Int = 9600, - val dataBits: DataBits = DataBits.EIGHT, - val flowControl: FlowControl = FlowControl.NONE, - val parity: Parity = Parity.NONE, - val stopBits: StopBits = StopBits.ONE, - val timeout: Int = 1000 - ) - ``` - -## Testing Your Device - -### 1. Check Device Support -```bash -# Get device information -adb shell getprop | grep -i "ro.product" - -# Check USB support -adb shell getprop | grep -i "usb" - -# List USB devices -adb shell lsusb -``` - -### 2. Test USB Connection -```bash -# Monitor USB events -adb logcat -v time | grep -i "usb" - -# Check USB permissions -adb shell dumpsys usb | grep -i "permission" -``` - -### 3. Monitor Plugin Logs -```bash -# Filter plugin logs -adb logcat -v time | grep -E "SerialPlugin|SerialPortManager" - -# Monitor specific operations -adb logcat -v time | grep -E "Opening port|Port opened|Failed to open" -``` - -## Development Workflow - -### 1. Making Changes -- Edit files in `android/src/main/kotlin/app/tauri/serialplugin/` -- Test changes in example app: `examples/serialport-test/` -- Build and verify: `npm run tauri android build` - -### 2. Testing Changes -- Use example app for testing -- Monitor logs with logcat -- Test with different USB devices -- Verify all port configurations - -### 3. Debugging Process -- Enable verbose logging -- Check USB device detection -- Verify port configuration -- Monitor data transmission -- Check error handling - -## Known Working Configurations - -### CP2104 USB-to-UART Bridge -- **Vendor ID**: 4292 (0x10C4) -- **Product ID**: 60000 (0xEA60) -- **Default settings**: 115200 baud, 8 data bits, 1 stop bit, no parity -- **Status**: ✅ Tested and working - -### Common USB-to-Serial Adapters -- **FTDI**: VID 0x0403, PID 0x6001 -- **CP210x**: VID 0x10C4, PID 0xEA60 -- **CH340**: VID 0x1A86, PID 0x7523 -- **PL2303**: VID 0x067B, PID 0x2303 - -## Resources - -### 1. Project Documentation -- [Tauri Android Guide](https://tauri.app/v1/guides/building/android) -- [USB Serial for Android](https://github.com/mik3y/usb-serial-for-android) -- [Android USB Host API](https://developer.android.com/guide/topics/connectivity/usb/host) - -### 2. Project Files -- Main plugin: `android/src/main/kotlin/app/tauri/serialplugin/SerialPlugin.kt` -- Port configuration: `android/src/main/kotlin/app/tauri/serialplugin/models/SerialPortConfig.kt` -- Port management: `android/src/main/kotlin/app/tauri/serialplugin/manager/SerialPortManager.kt` -- Example app: `examples/serialport-test/` - -### 3. Support -- GitHub Issues: [tauri-plugin-serialplugin](https://github.com/s00d/tauri-plugin-serialplugin) -- Fork with Android fixes: [niftitech/tauri-plugin-serialplugin](https://github.com/niftitech/tauri-plugin-serialplugin) -- Tauri Discord: [Tauri Discord Server](https://discord.gg/tauri) - -## Troubleshooting Checklist - -- [ ] USB device properly connected -- [ ] USB permissions granted -- [ ] Device appears in `available_ports()` -- [ ] Correct port path used -- [ ] Valid baud rate and port settings -- [ ] No conflicting applications using the port -- [ ] Device drivers installed (if needed) -- [ ] USB debugging enabled -- [ ] Logs show successful port opening -- [ ] Data transmission working \ No newline at end of file diff --git a/docs/golden-recorder-archive/README.md b/docs/golden-recorder-archive/README.md new file mode 100644 index 00000000..3a6053ef --- /dev/null +++ b/docs/golden-recorder-archive/README.md @@ -0,0 +1,16 @@ +# Golden fixture recorder archive + +The one-time JVM golden recorder lived under `android/src/test/kotlin/.../golden/` and +depended on vendored `android/usbserial/` (usb-serial-for-android). That tree was removed +after Java fixtures were frozen under `crates/android-usb-serial/tests/fixtures/`. + +**Current workflow:** regenerate Rust-only fixtures and verify parity: + +```bash +cargo run -p android-usb-serial --features fake-transport --bin golden_record +cargo test -p android-usb-serial --features fake-transport --test golden_parity +./scripts/verify-android-usb-migration.sh +``` + +To recover the historical Java recorder for a one-shot re-record, check out a git commit +from before usbserial removal, e.g. `git checkout -- android/usbserial android/src/test/kotlin/app/tauri/serialplugin/golden/`. diff --git a/examples/serialport-test/.gitignore b/examples/serialport-test/.gitignore index 1316194d..e30b4f7c 100755 --- a/examples/serialport-test/.gitignore +++ b/examples/serialport-test/.gitignore @@ -11,6 +11,7 @@ node_modules dist dist-ssr *.local +node_modules/.vite # Editor directories and files .vscode/* diff --git a/examples/serialport-test/.vscode/extensions.json b/examples/serialport-test/.vscode/extensions.json index 61343e9b..cf4385bd 100755 --- a/examples/serialport-test/.vscode/extensions.json +++ b/examples/serialport-test/.vscode/extensions.json @@ -1,6 +1,6 @@ { "recommendations": [ - "svelte.svelte-vscode", + "Vue.volar", "tauri-apps.tauri-vscode", "rust-lang.rust-analyzer" ] diff --git a/examples/serialport-test/ANDROID.md b/examples/serialport-test/ANDROID.md new file mode 100644 index 00000000..4a35ce12 --- /dev/null +++ b/examples/serialport-test/ANDROID.md @@ -0,0 +1,69 @@ +# Android (`serialport-test`) + +```bash +cd examples/serialport-test +export JAVA_HOME="$(/usr/libexec/java_home -v 17)" +export ADB_SERIAL=10.0.59.85:37389 # свой из `adb devices` +``` + +## Wireless ADB + +```bash +# npm i -g adb-wifi && adb-wifi +adb pair 10.0.59.85:PAIR_PORT +adb connect 10.0.59.85:DEBUG_PORT +adb devices + +adb kill-server && adb start-server && adb connect 10.0.59.85:DEBUG_PORT +``` + +## Сборка → install → логи + +```bash +pnpm tauri android build --debug + +adb -s "$ADB_SERIAL" install -r \ + /Users/s00d/packeges/tauri-plugin-serialplugin/examples/serialport-test/src-tauri/gen/android/app/build/outputs/apk/universal/debug/app-universal-debug.apk + +adb -s "$ADB_SERIAL" shell am force-stop com.serialport.test +adb -s "$ADB_SERIAL" shell am start -n com.serialport.test/.MainActivity + +adb -s "$ADB_SERIAL" logcat -c +adb -s "$ADB_SERIAL" logcat -v time -s UsbFdBridge SerialPlugin Console +``` + +Все Rust-логи плагина идут в **`SerialPlugin`** (не `RustStdout`). + +| Тег / префикс | Что | +|---|---| +| `SerialPlugin: load` / `logcat sink ready` | старт | +| `UsbFdBridge: enumerateJson … json=` | Kotlin USB list + `interfaces[]` | +| `[SerialEnumerate]` | Rust ProbeTable → `device` или `device#N` | +| `openDeviceFd … (unclaimed for nusb)` | fd без claim | +| `[SerialOpen]` / `start_reader` | claim → line → reader после DTR | +| `[SerialWrite]` | запись после connect | +| `Console: [PortPicker]` | UI snapshot | + +Kotlin **не** claim'ит интерфейсы — это nusb. Write открывает только bulk OUT (IN у reader). + +## CH340 / отвал после Connect (EPROTO) + +Симптом: `URB ep 82 status=-71` → `Device disconnected` → `enumerateJson: 0`. + +**Изоляция железо vs софт** — тот же адаптер через [`examples/usb-driver-tester`](../usb-driver-tester/): + +```bash +cd examples/usb-driver-tester +./gradlew installDebug +# Test на устройстве → смотри лог в UI (Share) +``` + +| Результат | Вывод | +|---|---| +| tester **тоже** падает на open/read | питание OTG, кабель, хаб с питанием | +| tester **стабилен**, serialport-test отваливается | gap в плагине (reader/timing) — смотри `[SerialOpen]` | +| оба живут после хаба с питанием | слабый USB-порт телефона | + +Плагин: reader стартует **после** line/DTR; bulk IN in-flight = 2 (не 3). Перед повторным тестом: `am force-stop com.serialport.test`. + +Package: `com.serialport.test`. diff --git a/examples/serialport-test/README.md b/examples/serialport-test/README.md index 5288f115..f7689c4a 100755 --- a/examples/serialport-test/README.md +++ b/examples/serialport-test/README.md @@ -1,7 +1,41 @@ -# Tauri + Svelte + Typescript +# serialport-test (v3) -This template should help get you started developing with Tauri, Svelte and TypeScript in Vite. +Demo for **tauri-plugin-serialplugin** v3: terminal UI, `watch()` / `watchAvailablePorts()`, AT queue, signals, config. -## Recommended IDE Setup +## Layout -[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). +- **Status bar** — capabilities, log level, Rust `get_ports_programmatically` (desktop) +- **Port picker** — live hotplug (`watchAvailablePorts`), manual path, managed ports +- **Terminal** — scrollable RX/TX/URC/sys log; **input dock at the bottom** (Text / AT / Hex, line endings) +- **Tools panel** — Signals (RTS/DTR/CTS…), AT script queue, port config + +## Terminal + +1. Select a port → **Connect** +2. Type at the bottom → Enter or **Send** +3. Modes: **Text** (raw write), **AT** (`sendAt()`), **Hex** (`48 65 6c 6c 6f`) +4. Toolbar: clear, poll read, demo binary, flush buffers + +## Mobile + +- Port list opens as a slide-over drawer (☰ / **Ports**) +- Terminal input respects safe-area inset; font 16px to avoid iOS zoom +- **Tools** collapses above the input dock + +## Dev + +```bash +pnpm install +pnpm tauri dev +``` + +In dev, Vite resolves `tauri-plugin-serialplugin-api` to **`guest-js/`**. Clear cache after major API changes: + +```bash +pnpm run clean:vite +pnpm tauri dev +``` + +## Android + +→ [`ANDROID.md`](ANDROID.md) — wireless ADB, build/install, logcat. \ No newline at end of file diff --git a/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/JniChainFixture.kt b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/JniChainFixture.kt new file mode 100644 index 00000000..3afbaeb8 --- /dev/null +++ b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/JniChainFixture.kt @@ -0,0 +1,50 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import app.tauri.serialplugin.UsbNative +import app.tauri.serialplugin.manager.UsbFdBridge + +/** Sets up FakeTransport CDC + production fd bridge + Rust test harness for one port. */ +object JniChainFixture { + const val DEVICE_NAME: String = "/dev/bus/usb/001/099" + + lateinit var bridge: UsbFdBridge + private set + lateinit var sessionPath: String + private set + + private var libraryLoaded = false + + fun setUp() { + loadNativeLibrary() + MobileBridge.testHarnessReset() + bridge = UsbFdBridge.forIntegrationTest() + UsbNative.bind(bridge) + sessionPath = MobileBridge.testOpenFakePort(DEVICE_NAME) + check(!sessionPath.startsWith("ERR:")) { "testOpenFakePort: $sessionPath" } + } + + fun tearDown() { + if (::bridge.isInitialized) { + runCatching { bridge.closeDeviceFd(DEVICE_NAME) } + } + MobileBridge.testHarnessReset() + MobileBridge.onAppDestroy() + } + + private fun loadNativeLibrary() { + if (libraryLoaded) return + System.loadLibrary("tauri_app_lib") + libraryLoaded = true + } + + fun waitForHubBytes(minLen: Long = 1, timeoutMs: Long = 10000): Long { + val deadline = System.currentTimeMillis() + timeoutMs + while (System.currentTimeMillis() < deadline) { + val len = MobileBridge.testHubBufferedLen(sessionPath) + if (len >= minLen) return len + Thread.sleep(10) + } + return MobileBridge.testHubBufferedLen(sessionPath) + } +} diff --git a/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/RxChainTest.kt b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/RxChainTest.kt new file mode 100644 index 00000000..b4fe477b --- /dev/null +++ b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/RxChainTest.kt @@ -0,0 +1,44 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import org.junit.After +import org.junit.Assert.assertArrayEquals +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import androidx.test.ext.junit.runners.AndroidJUnit4 + +@RunWith(AndroidJUnit4::class) +class RxChainTest { + + @Before + fun setUp() = JniChainFixture.setUp() + + @After + fun tearDown() = JniChainFixture.tearDown() + + @Test + fun reader_full_chain_reaches_hub() { + MobileBridge.testFakeInjectRx( + JniChainFixture.DEVICE_NAME, + "AT\r\r\nOK\r\n".toByteArray(), + ) + val len = JniChainFixture.waitForHubBytes(minLen = 2) + assertTrue("expected bytes in Rust hub, got len=$len", len >= 2) + val idle = MobileBridge.testHubTakeIdle(JniChainFixture.sessionPath) + val text = String(idle, Charsets.US_ASCII) + assertTrue("expected OK in hub idle buffer: $text", text.contains("OK")) + } + + @Test + fun batched_rx_reaches_hub() { + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "A".toByteArray()) + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "B".toByteArray()) + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "C".toByteArray()) + val len = JniChainFixture.waitForHubBytes(minLen = 3) + assertTrue(len >= 3) + val idle = MobileBridge.testHubTakeIdle(JniChainFixture.sessionPath) + assertArrayEquals("ABC".toByteArray(), idle) + } +} diff --git a/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/TxChainTest.kt b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/TxChainTest.kt new file mode 100644 index 00000000..25f224b2 --- /dev/null +++ b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/TxChainTest.kt @@ -0,0 +1,42 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import org.junit.After +import org.junit.Assert.assertArrayEquals +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import androidx.test.ext.junit.runners.AndroidJUnit4 + +@RunWith(AndroidJUnit4::class) +class TxChainTest { + + @Before + fun setUp() = JniChainFixture.setUp() + + @After + fun tearDown() = JniChainFixture.tearDown() + + @Test + fun rust_write_hits_fake_transport() { + val payload = "AT\r".toByteArray() + val n = MobileBridge.testInvokeWrite(JniChainFixture.sessionPath, payload) + assertEquals(payload.size.toLong(), n) + assertArrayEquals(payload, MobileBridge.testFakeTakeTx(JniChainFixture.DEVICE_NAME)) + } + + @Test + fun roundtrip_write_then_inject_rx_reaches_hub() { + val payload = "AT\r".toByteArray() + val n = MobileBridge.testInvokeWrite(JniChainFixture.sessionPath, payload) + assertEquals(payload.size.toLong(), n) + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "OK\r\n".toByteArray()) + val len = JniChainFixture.waitForHubBytes(minLen = 2, timeoutMs = 5000) + assertTrue("expected OK in hub, len=$len", len >= 2) + val idle = MobileBridge.testHubTakeIdle(JniChainFixture.sessionPath) + val text = String(idle, Charsets.US_ASCII) + assertTrue("expected OK from injected RX: $text", text.contains("OK")) + } +} diff --git a/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/UsbDetachChainTest.kt b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/UsbDetachChainTest.kt new file mode 100644 index 00000000..40b2ed17 --- /dev/null +++ b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/UsbDetachChainTest.kt @@ -0,0 +1,30 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import org.junit.After +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import androidx.test.ext.junit.runners.AndroidJUnit4 + +@RunWith(AndroidJUnit4::class) +class UsbDetachChainTest { + + @Before + fun setUp() = JniChainFixture.setUp() + + @After + fun tearDown() = JniChainFixture.tearDown() + + @Test + fun detach_clears_registry() { + assertTrue(MobileBridge.testRegistryHasPort(JniChainFixture.sessionPath)) + MobileBridge.onDeviceDetached(JniChainFixture.DEVICE_NAME) + assertFalse( + "registry should drop port after USB detach", + MobileBridge.testRegistryHasPort(JniChainFixture.sessionPath), + ) + } +} diff --git a/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/UsbErrorChainTest.kt b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/UsbErrorChainTest.kt new file mode 100644 index 00000000..09777bd5 --- /dev/null +++ b/examples/serialport-test/android-integration/src/androidTest/kotlin/com/serialport/test/jni/UsbErrorChainTest.kt @@ -0,0 +1,31 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import org.junit.After +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import androidx.test.ext.junit.runners.AndroidJUnit4 + +@RunWith(AndroidJUnit4::class) +class UsbErrorChainTest { + + @Before + fun setUp() = JniChainFixture.setUp() + + @After + fun tearDown() = JniChainFixture.tearDown() + + @Test + fun fake_read_error_clears_registry() { + assertTrue(MobileBridge.testRegistryHasPort(JniChainFixture.sessionPath)) + MobileBridge.testFakeInjectError(JniChainFixture.DEVICE_NAME, "device exploded") + Thread.sleep(1500) + assertFalse( + "registry should drop port after reader error → onUsbError", + MobileBridge.testRegistryHasPort(JniChainFixture.sessionPath), + ) + } +} diff --git a/examples/serialport-test/index.html b/examples/serialport-test/index.html index 6e53357d..dbd2e0ef 100755 --- a/examples/serialport-test/index.html +++ b/examples/serialport-test/index.html @@ -3,8 +3,8 @@ - - Tauri + Svelte + TS + + Serial Port Test — Tauri + Vue diff --git a/examples/serialport-test/package-lock.json b/examples/serialport-test/package-lock.json deleted file mode 100644 index a68429d7..00000000 --- a/examples/serialport-test/package-lock.json +++ /dev/null @@ -1,1747 +0,0 @@ -{ - "name": "serialport-test", - "version": "0.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "serialport-test", - "version": "0.0.0", - "dependencies": { - "@tauri-apps/api": "^2.5.0", - "tauri-plugin-serialplugin": "file:../../" - }, - "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^5.0.3", - "@tauri-apps/cli": "^2.5.0", - "@tsconfig/svelte": "^5.0.4", - "@types/node": "^20.17.6", - "svelte": "^5.25.6", - "svelte-check": "^4.1.5", - "svelte-preprocess": "^6.0.3", - "tslib": "^2.8.1", - "typescript": "^5.6.3", - "vite": "^6.2.5" - } - }, - "../..": { - "version": "2.11.0", - "license": "MIT or APACHE-2.0", - "dependencies": { - "@tauri-apps/api": "^2.5.0" - }, - "devDependencies": { - "@rollup/plugin-node-resolve": "15.3.1", - "@rollup/plugin-terser": "0.4.4", - "@rollup/plugin-typescript": "11.1.6", - "rollup": "4.34.9", - "standard-version": "^9.5.0", - "tslib": "^2.8.1", - "typescript": "5.6.3" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", - "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.0.tgz", - "integrity": "sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.0.tgz", - "integrity": "sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.0.tgz", - "integrity": "sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.0.tgz", - "integrity": "sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.0.tgz", - "integrity": "sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.0.tgz", - "integrity": "sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.0.tgz", - "integrity": "sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.0.tgz", - "integrity": "sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.0.tgz", - "integrity": "sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.0.tgz", - "integrity": "sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.0.tgz", - "integrity": "sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.0.tgz", - "integrity": "sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.0.tgz", - "integrity": "sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.0.tgz", - "integrity": "sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.0.tgz", - "integrity": "sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.0.tgz", - "integrity": "sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.0.tgz", - "integrity": "sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.0.tgz", - "integrity": "sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.0.tgz", - "integrity": "sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.0.tgz", - "integrity": "sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.0.tgz", - "integrity": "sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.0.tgz", - "integrity": "sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.0.tgz", - "integrity": "sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.0.tgz", - "integrity": "sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.0.tgz", - "integrity": "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.41.1.tgz", - "integrity": "sha512-NELNvyEWZ6R9QMkiytB4/L4zSEaBC03KIXEghptLGLZWJ6VPrL63ooZQCOnlx36aQPGhzuOMwDerC1Eb2VmrLw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.41.1.tgz", - "integrity": "sha512-DXdQe1BJ6TK47ukAoZLehRHhfKnKg9BjnQYUu9gzhI8Mwa1d2fzxA1aw2JixHVl403bwp1+/o/NhhHtxWJBgEA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.41.1.tgz", - "integrity": "sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.41.1.tgz", - "integrity": "sha512-egpJACny8QOdHNNMZKf8xY0Is6gIMz+tuqXlusxquWu3F833DcMwmGM7WlvCO9sB3OsPjdC4U0wHw5FabzCGZg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.41.1.tgz", - "integrity": "sha512-DBVMZH5vbjgRk3r0OzgjS38z+atlupJ7xfKIDJdZZL6sM6wjfDNo64aowcLPKIx7LMQi8vybB56uh1Ftck/Atg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.41.1.tgz", - "integrity": "sha512-3FkydeohozEskBxNWEIbPfOE0aqQgB6ttTkJ159uWOFn42VLyfAiyD9UK5mhu+ItWzft60DycIN1Xdgiy8o/SA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.41.1.tgz", - "integrity": "sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.41.1.tgz", - "integrity": "sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.41.1.tgz", - "integrity": "sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.41.1.tgz", - "integrity": "sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.41.1.tgz", - "integrity": "sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.41.1.tgz", - "integrity": "sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.41.1.tgz", - "integrity": "sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.41.1.tgz", - "integrity": "sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.41.1.tgz", - "integrity": "sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.41.1.tgz", - "integrity": "sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.41.1.tgz", - "integrity": "sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.41.1.tgz", - "integrity": "sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.41.1.tgz", - "integrity": "sha512-+psFT9+pIh2iuGsxFYYa/LhS5MFKmuivRsx9iPJWNSGbh2XVEjk90fmpUEjCnILPEPJnikAU6SFDiEUyOv90Pg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.1.tgz", - "integrity": "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@sveltejs/acorn-typescript": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.5.tgz", - "integrity": "sha512-IwQk4yfwLdibDlrXVE04jTZYlLnwsTT2PIOQQGNLWfjavGifnk1JD1LcZjZaBTRcxZu2FfPfNLOE04DSu9lqtQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^8.9.0" - } - }, - "node_modules/@sveltejs/vite-plugin-svelte": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-5.0.3.tgz", - "integrity": "sha512-MCFS6CrQDu1yGwspm4qtli0e63vaPCehf6V7pIMP15AsWgMKrqDGCPFF/0kn4SP0ii4aySu4Pa62+fIRGFMjgw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@sveltejs/vite-plugin-svelte-inspector": "^4.0.1", - "debug": "^4.4.0", - "deepmerge": "^4.3.1", - "kleur": "^4.1.5", - "magic-string": "^0.30.15", - "vitefu": "^1.0.4" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22" - }, - "peerDependencies": { - "svelte": "^5.0.0", - "vite": "^6.0.0" - } - }, - "node_modules/@sveltejs/vite-plugin-svelte-inspector": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-4.0.1.tgz", - "integrity": "sha512-J/Nmb2Q2y7mck2hyCX4ckVHcR5tu2J+MtBEQqpDrrgELZ2uvraQcK/ioCV61AqkdXFgriksOKIceDcQmqnGhVw==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.3.7" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22" - }, - "peerDependencies": { - "@sveltejs/vite-plugin-svelte": "^5.0.0", - "svelte": "^5.0.0", - "vite": "^6.0.0" - } - }, - "node_modules/@tauri-apps/api": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.5.0.tgz", - "integrity": "sha512-Ldux4ip+HGAcPUmuLT8EIkk6yafl5vK0P0c0byzAKzxJh7vxelVtdPONjfgTm96PbN24yjZNESY8CKo8qniluA==", - "license": "Apache-2.0 OR MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/tauri" - } - }, - "node_modules/@tauri-apps/cli": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.5.0.tgz", - "integrity": "sha512-rAtHqG0Gh/IWLjN2zTf3nZqYqbo81oMbqop56rGTjrlWk9pTTAjkqOjSL9XQLIMZ3RbeVjveCqqCA0s8RnLdMg==", - "dev": true, - "license": "Apache-2.0 OR MIT", - "bin": { - "tauri": "tauri.js" - }, - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/tauri" - }, - "optionalDependencies": { - "@tauri-apps/cli-darwin-arm64": "2.5.0", - "@tauri-apps/cli-darwin-x64": "2.5.0", - "@tauri-apps/cli-linux-arm-gnueabihf": "2.5.0", - "@tauri-apps/cli-linux-arm64-gnu": "2.5.0", - "@tauri-apps/cli-linux-arm64-musl": "2.5.0", - "@tauri-apps/cli-linux-riscv64-gnu": "2.5.0", - "@tauri-apps/cli-linux-x64-gnu": "2.5.0", - "@tauri-apps/cli-linux-x64-musl": "2.5.0", - "@tauri-apps/cli-win32-arm64-msvc": "2.5.0", - "@tauri-apps/cli-win32-ia32-msvc": "2.5.0", - "@tauri-apps/cli-win32-x64-msvc": "2.5.0" - } - }, - "node_modules/@tauri-apps/cli-darwin-arm64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.5.0.tgz", - "integrity": "sha512-VuVAeTFq86dfpoBDNYAdtQVLbP0+2EKCHIIhkaxjeoPARR0sLpFHz2zs0PcFU76e+KAaxtEtAJAXGNUc8E1PzQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-darwin-x64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.5.0.tgz", - "integrity": "sha512-hUF01sC06cZVa8+I0/VtsHOk9BbO75rd+YdtHJ48xTdcYaQ5QIwL4yZz9OR1AKBTaUYhBam8UX9Pvd5V2/4Dpw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-linux-arm-gnueabihf": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.5.0.tgz", - "integrity": "sha512-LQKqttsK252LlqYyX8R02MinUsfFcy3+NZiJwHFgi5Y3+ZUIAED9cSxJkyNtuY5KMnR4RlpgWyLv4P6akN1xhg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-linux-arm64-gnu": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.5.0.tgz", - "integrity": "sha512-mTQufsPcpdHg5RW0zypazMo4L55EfeE5snTzrPqbLX4yCK2qalN7+rnP8O8GT06xhp6ElSP/Ku1M2MR297SByQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-linux-arm64-musl": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.5.0.tgz", - "integrity": "sha512-rQO1HhRUQqyEaal5dUVOQruTRda/TD36s9kv1hTxZiFuSq3558lsTjAcUEnMAtBcBkps20sbyTJNMT0AwYIk8Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-linux-riscv64-gnu": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.5.0.tgz", - "integrity": "sha512-7oS18FN46yDxyw1zX/AxhLAd7T3GrLj3Ai6s8hZKd9qFVzrAn36ESL7d3G05s8wEtsJf26qjXnVF4qleS3dYsA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-linux-x64-gnu": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.5.0.tgz", - "integrity": "sha512-SG5sFNL7VMmDBdIg3nO3EzNRT306HsiEQ0N90ILe3ZABYAVoPDO/ttpCO37ApLInTzrq/DLN+gOlC/mgZvLw1w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-linux-x64-musl": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.5.0.tgz", - "integrity": "sha512-QXDM8zp/6v05PNWju5ELsVwF0VH1n6b5pk2E6W/jFbbiwz80Vs1lACl9pv5kEHkrxBj+aWU/03JzGuIj2g3SkQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-win32-arm64-msvc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.5.0.tgz", - "integrity": "sha512-pFSHFK6b+o9y4Un8w0gGLwVyFTZaC3P0kQ7umRt/BLDkzD5RnQ4vBM7CF8BCU5nkwmEBUCZd7Wt3TWZxe41o6Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-win32-ia32-msvc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.5.0.tgz", - "integrity": "sha512-EArv1IaRlogdLAQyGlKmEqZqm5RfHCUMhJoedWu7GtdbOMUfSAz6FMX2boE1PtEmNO4An+g188flLeVErrxEKg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tauri-apps/cli-win32-x64-msvc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.5.0.tgz", - "integrity": "sha512-lj43EFYbnAta8pd9JnUq87o+xRUR0odz+4rixBtTUwUgdRdwQ2V9CzFtsMu6FQKpFQ6mujRK6P1IEwhL6ADRsQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0 OR MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tsconfig/svelte": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-5.0.4.tgz", - "integrity": "sha512-BV9NplVgLmSi4mwKzD8BD/NQ8erOY/nUE/GpgWe2ckx+wIQF5RyRirn/QsSSCPeulVpc3RA/iJt6DpfTIZps0Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/estree": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", - "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "20.17.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.16.tgz", - "integrity": "sha512-vOTpLduLkZXePLxHiHsBLp98mHGnl8RptV4YAO3HfKO5UHjDvySGbxKtpYfy8Sx5+WKcgc45qNreJJRVM3L6mw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.19.2" - } - }, - "node_modules/acorn": { - "version": "8.14.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", - "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/aria-query": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz", - "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/axobject-query": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", - "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "dev": true, - "license": "MIT", - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/esbuild": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", - "integrity": "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.0", - "@esbuild/android-arm": "0.25.0", - "@esbuild/android-arm64": "0.25.0", - "@esbuild/android-x64": "0.25.0", - "@esbuild/darwin-arm64": "0.25.0", - "@esbuild/darwin-x64": "0.25.0", - "@esbuild/freebsd-arm64": "0.25.0", - "@esbuild/freebsd-x64": "0.25.0", - "@esbuild/linux-arm": "0.25.0", - "@esbuild/linux-arm64": "0.25.0", - "@esbuild/linux-ia32": "0.25.0", - "@esbuild/linux-loong64": "0.25.0", - "@esbuild/linux-mips64el": "0.25.0", - "@esbuild/linux-ppc64": "0.25.0", - "@esbuild/linux-riscv64": "0.25.0", - "@esbuild/linux-s390x": "0.25.0", - "@esbuild/linux-x64": "0.25.0", - "@esbuild/netbsd-arm64": "0.25.0", - "@esbuild/netbsd-x64": "0.25.0", - "@esbuild/openbsd-arm64": "0.25.0", - "@esbuild/openbsd-x64": "0.25.0", - "@esbuild/sunos-x64": "0.25.0", - "@esbuild/win32-arm64": "0.25.0", - "@esbuild/win32-ia32": "0.25.0", - "@esbuild/win32-x64": "0.25.0" - } - }, - "node_modules/esm-env": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz", - "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/esrap": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/esrap/-/esrap-1.4.6.tgz", - "integrity": "sha512-F/D2mADJ9SHY3IwksD4DAXjTt7qt7GWUf3/8RhCNWmC/67tyb55dpimHmy7EplakFaflV0R/PC+fdSPqrRHAQw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" - } - }, - "node_modules/fdir": { - "version": "6.4.4", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", - "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/is-reference": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", - "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.6" - } - }, - "node_modules/kleur": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", - "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/locate-character": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", - "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", - "dev": true, - "license": "MIT" - }, - "node_modules/magic-string": { - "version": "0.30.17", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", - "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" - } - }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", - "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/postcss": { - "version": "8.5.3", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", - "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.8", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/readdirp": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.1.tgz", - "integrity": "sha512-h80JrZu/MHUZCyHu5ciuoI0+WxsCxzxJTILn6Fs8rxSnFPh+UVHYfeIxK1nVGugMqkfC4vJcBOYbkfkwYK0+gw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/rollup": { - "version": "4.41.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.41.1.tgz", - "integrity": "sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.7" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.41.1", - "@rollup/rollup-android-arm64": "4.41.1", - "@rollup/rollup-darwin-arm64": "4.41.1", - "@rollup/rollup-darwin-x64": "4.41.1", - "@rollup/rollup-freebsd-arm64": "4.41.1", - "@rollup/rollup-freebsd-x64": "4.41.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.41.1", - "@rollup/rollup-linux-arm-musleabihf": "4.41.1", - "@rollup/rollup-linux-arm64-gnu": "4.41.1", - "@rollup/rollup-linux-arm64-musl": "4.41.1", - "@rollup/rollup-linux-loongarch64-gnu": "4.41.1", - "@rollup/rollup-linux-powerpc64le-gnu": "4.41.1", - "@rollup/rollup-linux-riscv64-gnu": "4.41.1", - "@rollup/rollup-linux-riscv64-musl": "4.41.1", - "@rollup/rollup-linux-s390x-gnu": "4.41.1", - "@rollup/rollup-linux-x64-gnu": "4.41.1", - "@rollup/rollup-linux-x64-musl": "4.41.1", - "@rollup/rollup-win32-arm64-msvc": "4.41.1", - "@rollup/rollup-win32-ia32-msvc": "4.41.1", - "@rollup/rollup-win32-x64-msvc": "4.41.1", - "fsevents": "~2.3.2" - } - }, - "node_modules/sade": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", - "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", - "dev": true, - "license": "MIT", - "dependencies": { - "mri": "^1.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/svelte": { - "version": "5.33.2", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.33.2.tgz", - "integrity": "sha512-uiyusx2rUa9NmVMaIcShnZyDhOfFXxgkn5eXOcgjDBL3RYQGR1+7TctPcI6AWNbu4gHWF5xZ/TlFM7nnw5H+JQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@ampproject/remapping": "^2.3.0", - "@jridgewell/sourcemap-codec": "^1.5.0", - "@sveltejs/acorn-typescript": "^1.0.5", - "@types/estree": "^1.0.5", - "acorn": "^8.12.1", - "aria-query": "^5.3.1", - "axobject-query": "^4.1.0", - "clsx": "^2.1.1", - "esm-env": "^1.2.1", - "esrap": "^1.4.6", - "is-reference": "^3.0.3", - "locate-character": "^3.0.0", - "magic-string": "^0.30.11", - "zimmerframe": "^1.1.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/svelte-check": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.1.5.tgz", - "integrity": "sha512-Gb0T2IqBNe1tLB9EB1Qh+LOe+JB8wt2/rNBDGvkxQVvk8vNeAoG+vZgFB/3P5+zC7RWlyBlzm9dVjZFph/maIg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.25", - "chokidar": "^4.0.1", - "fdir": "^6.2.0", - "picocolors": "^1.0.0", - "sade": "^1.7.4" - }, - "bin": { - "svelte-check": "bin/svelte-check" - }, - "engines": { - "node": ">= 18.0.0" - }, - "peerDependencies": { - "svelte": "^4.0.0 || ^5.0.0-next.0", - "typescript": ">=5.0.0" - } - }, - "node_modules/svelte-preprocess": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-6.0.3.tgz", - "integrity": "sha512-PLG2k05qHdhmRG7zR/dyo5qKvakhm8IJ+hD2eFRQmMLHp7X3eJnjeupUtvuRpbNiF31RjVw45W+abDwHEmP5OA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "engines": { - "node": ">= 18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.10.2", - "coffeescript": "^2.5.1", - "less": "^3.11.3 || ^4.0.0", - "postcss": "^7 || ^8", - "postcss-load-config": ">=3", - "pug": "^3.0.0", - "sass": "^1.26.8", - "stylus": ">=0.55", - "sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0", - "svelte": "^4.0.0 || ^5.0.0-next.100 || ^5.0.0", - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "coffeescript": { - "optional": true - }, - "less": { - "optional": true - }, - "postcss": { - "optional": true - }, - "postcss-load-config": { - "optional": true - }, - "pug": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/tauri-plugin-serialplugin": { - "resolved": "../..", - "link": true - }, - "node_modules/tinyglobby": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", - "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.4.4", - "picomatch": "^4.0.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, - "license": "0BSD" - }, - "node_modules/typescript": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", - "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" - }, - "node_modules/vite": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", - "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "jiti": ">=1.21.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/vitefu": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.5.tgz", - "integrity": "sha512-h4Vflt9gxODPFNGPwp4zAMZRpZR7eslzwH2c5hn5kNZ5rhnKyRJ50U+yGCdc2IRaBs8O4haIgLNGrV5CrpMsCA==", - "dev": true, - "license": "MIT", - "workspaces": [ - "tests/deps/*", - "tests/projects/*" - ], - "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" - }, - "peerDependenciesMeta": { - "vite": { - "optional": true - } - } - }, - "node_modules/zimmerframe": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.2.tgz", - "integrity": "sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==", - "dev": true, - "license": "MIT" - } - } -} diff --git a/examples/serialport-test/package.json b/examples/serialport-test/package.json index c40d6150..a90e45c2 100755 --- a/examples/serialport-test/package.json +++ b/examples/serialport-test/package.json @@ -5,25 +5,24 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "pnpm --dir ../.. run build && pnpm --dir ../.. install && vue-tsc --noEmit && vite build", "preview": "vite preview", - "check": "svelte-check --tsconfig ./tsconfig.json", - "tauri": "tauri" + "check": "vue-tsc --noEmit", + "clean:vite": "rm -rf node_modules/.vite", + "tauri": "tauri", + "android:integration-test": "pnpm tauri android build --debug --features android-test-harness && cd src-tauri && cargo ndk -t arm64-v8a -o gen/android/app/src/main/jniLibs build --package serialport-test --features android-test-harness --lib && cd .. && ../../scripts/sync-android-integration-tests.sh && cd src-tauri/gen/android && JAVA_HOME=\"${JAVA_HOME:-$(/usr/libexec/java_home -v 17)}\" ./gradlew connectedArm64DebugAndroidTest -x rustBuildArm64Debug -x rustBuildUniversalDebug -x rustBuildArmDebug -x rustBuildX86Debug -x rustBuildX86_64Debug" }, "dependencies": { - "@tauri-apps/api": "^2.5.0", - "tauri-plugin-serialplugin-api": "file:../../" + "tauri-plugin-serialplugin-api": "file:../../", + "vue": "^3.5.13" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^5.0.3", - "@tauri-apps/cli": "^2.5.0", - "@tsconfig/svelte": "^5.0.4", + "@tauri-apps/api": "^2.6.0", + "@tauri-apps/cli": "^2.11.4", "@types/node": "^20.17.6", - "svelte": "^5.25.6", - "svelte-check": "^4.1.5", - "svelte-preprocess": "^6.0.3", - "tslib": "^2.8.1", + "@vitejs/plugin-vue": "^5.2.1", "typescript": "^5.6.3", - "vite": "^6.2.5" + "vite": "^6.2.5", + "vue-tsc": "^2.2.8" } } diff --git a/examples/serialport-test/src-tauri/.gitignore b/examples/serialport-test/src-tauri/.gitignore index f4dfb82b..fbd3f332 100755 --- a/examples/serialport-test/src-tauri/.gitignore +++ b/examples/serialport-test/src-tauri/.gitignore @@ -2,3 +2,5 @@ # will have compiled files and executables /target/ +# Local Gradle cache (android build from src-tauri) +.gradle/ diff --git a/examples/serialport-test/src-tauri/Cargo.lock b/examples/serialport-test/src-tauri/Cargo.lock index b5a5dfca..cee2b241 100644 --- a/examples/serialport-test/src-tauri/Cargo.lock +++ b/examples/serialport-test/src-tauri/Cargo.lock @@ -47,6 +47,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +[[package]] +name = "android-usb-serial" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "libc", + "log", + "nusb", + "serde", + "serde_json", + "serialport", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -426,7 +439,7 @@ dependencies = [ "bitflags 2.6.0", "block", "cocoa-foundation", - "core-foundation 0.10.0", + "core-foundation 0.10.1", "core-graphics 0.24.0", "foreign-types", "libc", @@ -441,7 +454,7 @@ checksum = "e14045fb83be07b5acf1c0884b2180461635b433455fa35d1cd6f17f1450679d" dependencies = [ "bitflags 2.6.0", "block", - "core-foundation 0.10.0", + "core-foundation 0.10.1", "core-graphics-types 0.2.0", "libc", "objc", @@ -495,9 +508,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", "libc", @@ -529,7 +542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" dependencies = [ "bitflags 2.6.0", - "core-foundation 0.10.0", + "core-foundation 0.10.1", "core-graphics-types 0.2.0", "foreign-types", "libc", @@ -553,7 +566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ "bitflags 2.6.0", - "core-foundation 0.10.0", + "core-foundation 0.10.1", "libc", ] @@ -875,6 +888,16 @@ dependencies = [ "typeid", ] +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "fdeflate" version = "0.3.4" @@ -1654,7 +1677,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" dependencies = [ "core-foundation-sys", - "mach2", + "mach2 0.4.2", +] + +[[package]] +name = "io-kit-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d3a048d09fbb6597dbf7c69f40d14df4a49487db1487191618c893fc3b1c26" +dependencies = [ + "core-foundation-sys", + "mach2 0.5.0", ] [[package]] @@ -1809,9 +1842,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.169" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "libloading" @@ -1853,6 +1886,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + [[package]] name = "local-ip-address" version = "0.5.7" @@ -1896,6 +1935,15 @@ dependencies = [ "libc", ] +[[package]] +name = "mach2" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea" +dependencies = [ + "libc", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -2139,6 +2187,24 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "nusb" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "215a49c10e8cff30a0da93b258b21846c4e9242f7683748cfa8474fdc2e4d22b" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "futures-core", + "io-kit-sys 0.5.0", + "linux-raw-sys", + "log", + "once_cell", + "rustix", + "slab", + "windows-sys 0.61.2", +] + [[package]] name = "objc" version = "0.2.7" @@ -3034,6 +3100,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.18" @@ -3261,11 +3340,11 @@ checksum = "a4d91116f97173694f1642263b2ff837f80d933aa837e2314969f6728f661df3" dependencies = [ "bitflags 2.6.0", "cfg-if", - "core-foundation 0.10.0", + "core-foundation 0.10.1", "core-foundation-sys", - "io-kit-sys", + "io-kit-sys 0.4.1", "libudev", - "mach2", + "mach2 0.4.2", "nix", "scopeguard", "unescaper", @@ -3504,7 +3583,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49c380ca75a231b87b6c9dd86948f035012e7171d1a7c40a9c2890489a7ffd8a" dependencies = [ "bitflags 2.6.0", - "core-foundation 0.10.0", + "core-foundation 0.10.1", "core-graphics 0.24.0", "crossbeam-channel", "dispatch", @@ -3713,14 +3792,16 @@ dependencies = [ [[package]] name = "tauri-plugin-serialplugin" -version = "2.23.0" +version = "3.0.0" dependencies = [ + "android-usb-serial", + "jni", + "log", "serde", "serde_json", "serialport", "tauri", "tauri-plugin", - "thiserror 2.0.12", ] [[package]] @@ -4676,7 +4757,7 @@ dependencies = [ "windows-collections", "windows-core 0.61.2", "windows-future", - "windows-link", + "windows-link 0.1.1", "windows-numerics", ] @@ -4706,7 +4787,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.1", "windows-result", "windows-strings", ] @@ -4718,7 +4799,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core 0.61.2", - "windows-link", + "windows-link 0.1.1", "windows-threading", ] @@ -4750,6 +4831,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -4757,7 +4844,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core 0.61.2", - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -4766,7 +4853,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -4775,7 +4862,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -4814,6 +4901,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -4866,7 +4962,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] diff --git a/examples/serialport-test/src-tauri/Cargo.toml b/examples/serialport-test/src-tauri/Cargo.toml index 18860dd1..e95d4f3d 100755 --- a/examples/serialport-test/src-tauri/Cargo.toml +++ b/examples/serialport-test/src-tauri/Cargo.toml @@ -27,3 +27,4 @@ tauri-plugin-devtools = "2.0.0" # this feature is used for production builds or when `devPath` points to the filesystem # DO NOT REMOVE!! custom-protocol = ["tauri/custom-protocol"] +android-test-harness = ["tauri-plugin-serialplugin/android-test-harness"] diff --git a/examples/serialport-test/src-tauri/build.gradle.kts b/examples/serialport-test/src-tauri/build.gradle.kts index 9fa801cd..b6b59572 100644 --- a/examples/serialport-test/src-tauri/build.gradle.kts +++ b/examples/serialport-test/src-tauri/build.gradle.kts @@ -2,7 +2,6 @@ buildscript { repositories { google() mavenCentral() - maven { url = uri("https://jitpack.io") } } dependencies { classpath("com.android.tools.build:gradle:8.5.1") @@ -14,11 +13,9 @@ allprojects { repositories { google() mavenCentral() - maven { url = uri("https://jitpack.io") } } } tasks.register("clean").configure { delete("build") } - diff --git a/examples/serialport-test/src-tauri/gen/android/app/build.gradle.kts b/examples/serialport-test/src-tauri/gen/android/app/build.gradle.kts index 86376d88..2e629537 100644 --- a/examples/serialport-test/src-tauri/gen/android/app/build.gradle.kts +++ b/examples/serialport-test/src-tauri/gen/android/app/build.gradle.kts @@ -23,6 +23,7 @@ android { targetSdk = 34 versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt() versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0") + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { getByName("debug") { diff --git a/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/JniChainFixture.kt b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/JniChainFixture.kt new file mode 100644 index 00000000..3afbaeb8 --- /dev/null +++ b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/JniChainFixture.kt @@ -0,0 +1,50 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import app.tauri.serialplugin.UsbNative +import app.tauri.serialplugin.manager.UsbFdBridge + +/** Sets up FakeTransport CDC + production fd bridge + Rust test harness for one port. */ +object JniChainFixture { + const val DEVICE_NAME: String = "/dev/bus/usb/001/099" + + lateinit var bridge: UsbFdBridge + private set + lateinit var sessionPath: String + private set + + private var libraryLoaded = false + + fun setUp() { + loadNativeLibrary() + MobileBridge.testHarnessReset() + bridge = UsbFdBridge.forIntegrationTest() + UsbNative.bind(bridge) + sessionPath = MobileBridge.testOpenFakePort(DEVICE_NAME) + check(!sessionPath.startsWith("ERR:")) { "testOpenFakePort: $sessionPath" } + } + + fun tearDown() { + if (::bridge.isInitialized) { + runCatching { bridge.closeDeviceFd(DEVICE_NAME) } + } + MobileBridge.testHarnessReset() + MobileBridge.onAppDestroy() + } + + private fun loadNativeLibrary() { + if (libraryLoaded) return + System.loadLibrary("tauri_app_lib") + libraryLoaded = true + } + + fun waitForHubBytes(minLen: Long = 1, timeoutMs: Long = 10000): Long { + val deadline = System.currentTimeMillis() + timeoutMs + while (System.currentTimeMillis() < deadline) { + val len = MobileBridge.testHubBufferedLen(sessionPath) + if (len >= minLen) return len + Thread.sleep(10) + } + return MobileBridge.testHubBufferedLen(sessionPath) + } +} diff --git a/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/RxChainTest.kt b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/RxChainTest.kt new file mode 100644 index 00000000..b4fe477b --- /dev/null +++ b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/RxChainTest.kt @@ -0,0 +1,44 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import org.junit.After +import org.junit.Assert.assertArrayEquals +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import androidx.test.ext.junit.runners.AndroidJUnit4 + +@RunWith(AndroidJUnit4::class) +class RxChainTest { + + @Before + fun setUp() = JniChainFixture.setUp() + + @After + fun tearDown() = JniChainFixture.tearDown() + + @Test + fun reader_full_chain_reaches_hub() { + MobileBridge.testFakeInjectRx( + JniChainFixture.DEVICE_NAME, + "AT\r\r\nOK\r\n".toByteArray(), + ) + val len = JniChainFixture.waitForHubBytes(minLen = 2) + assertTrue("expected bytes in Rust hub, got len=$len", len >= 2) + val idle = MobileBridge.testHubTakeIdle(JniChainFixture.sessionPath) + val text = String(idle, Charsets.US_ASCII) + assertTrue("expected OK in hub idle buffer: $text", text.contains("OK")) + } + + @Test + fun batched_rx_reaches_hub() { + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "A".toByteArray()) + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "B".toByteArray()) + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "C".toByteArray()) + val len = JniChainFixture.waitForHubBytes(minLen = 3) + assertTrue(len >= 3) + val idle = MobileBridge.testHubTakeIdle(JniChainFixture.sessionPath) + assertArrayEquals("ABC".toByteArray(), idle) + } +} diff --git a/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/TxChainTest.kt b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/TxChainTest.kt new file mode 100644 index 00000000..25f224b2 --- /dev/null +++ b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/TxChainTest.kt @@ -0,0 +1,42 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import org.junit.After +import org.junit.Assert.assertArrayEquals +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import androidx.test.ext.junit.runners.AndroidJUnit4 + +@RunWith(AndroidJUnit4::class) +class TxChainTest { + + @Before + fun setUp() = JniChainFixture.setUp() + + @After + fun tearDown() = JniChainFixture.tearDown() + + @Test + fun rust_write_hits_fake_transport() { + val payload = "AT\r".toByteArray() + val n = MobileBridge.testInvokeWrite(JniChainFixture.sessionPath, payload) + assertEquals(payload.size.toLong(), n) + assertArrayEquals(payload, MobileBridge.testFakeTakeTx(JniChainFixture.DEVICE_NAME)) + } + + @Test + fun roundtrip_write_then_inject_rx_reaches_hub() { + val payload = "AT\r".toByteArray() + val n = MobileBridge.testInvokeWrite(JniChainFixture.sessionPath, payload) + assertEquals(payload.size.toLong(), n) + MobileBridge.testFakeInjectRx(JniChainFixture.DEVICE_NAME, "OK\r\n".toByteArray()) + val len = JniChainFixture.waitForHubBytes(minLen = 2, timeoutMs = 5000) + assertTrue("expected OK in hub, len=$len", len >= 2) + val idle = MobileBridge.testHubTakeIdle(JniChainFixture.sessionPath) + val text = String(idle, Charsets.US_ASCII) + assertTrue("expected OK from injected RX: $text", text.contains("OK")) + } +} diff --git a/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/UsbErrorChainTest.kt b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/UsbErrorChainTest.kt new file mode 100644 index 00000000..09777bd5 --- /dev/null +++ b/examples/serialport-test/src-tauri/gen/android/app/src/androidTest/kotlin/com/serialport/test/jni/UsbErrorChainTest.kt @@ -0,0 +1,31 @@ +package com.serialport.test.jni + +import app.tauri.serialplugin.MobileBridge +import org.junit.After +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import androidx.test.ext.junit.runners.AndroidJUnit4 + +@RunWith(AndroidJUnit4::class) +class UsbErrorChainTest { + + @Before + fun setUp() = JniChainFixture.setUp() + + @After + fun tearDown() = JniChainFixture.tearDown() + + @Test + fun fake_read_error_clears_registry() { + assertTrue(MobileBridge.testRegistryHasPort(JniChainFixture.sessionPath)) + MobileBridge.testFakeInjectError(JniChainFixture.DEVICE_NAME, "device exploded") + Thread.sleep(1500) + assertFalse( + "registry should drop port after reader error → onUsbError", + MobileBridge.testRegistryHasPort(JniChainFixture.sessionPath), + ) + } +} diff --git a/examples/serialport-test/src-tauri/gen/android/build.gradle.kts b/examples/serialport-test/src-tauri/gen/android/build.gradle.kts index 9fa801cd..b6b59572 100644 --- a/examples/serialport-test/src-tauri/gen/android/build.gradle.kts +++ b/examples/serialport-test/src-tauri/gen/android/build.gradle.kts @@ -2,7 +2,6 @@ buildscript { repositories { google() mavenCentral() - maven { url = uri("https://jitpack.io") } } dependencies { classpath("com.android.tools.build:gradle:8.5.1") @@ -14,11 +13,9 @@ allprojects { repositories { google() mavenCentral() - maven { url = uri("https://jitpack.io") } } } tasks.register("clean").configure { delete("build") } - diff --git a/examples/serialport-test/src-tauri/gen/schemas/acl-manifests.json b/examples/serialport-test/src-tauri/gen/schemas/acl-manifests.json index b612917b..7153bd20 100644 --- a/examples/serialport-test/src-tauri/gen/schemas/acl-manifests.json +++ b/examples/serialport-test/src-tauri/gen/schemas/acl-manifests.json @@ -1 +1 @@ -{"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-set-app-theme":{"identifier":"allow-set-app-theme","description":"Enables the set_app_theme command without any pre-configured scope.","commands":{"allow":["set_app_theme"],"deny":[]}},"allow-set-dock-visibility":{"identifier":"allow-set-dock-visibility","description":"Enables the set_dock_visibility command without any pre-configured scope.","commands":{"allow":["set_dock_visibility"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-fetch-data-store-identifiers":{"identifier":"deny-fetch-data-store-identifiers","description":"Denies the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":[],"deny":["fetch_data_store_identifiers"]}},"deny-identifier":{"identifier":"deny-identifier","description":"Denies the identifier command without any pre-configured scope.","commands":{"allow":[],"deny":["identifier"]}},"deny-name":{"identifier":"deny-name","description":"Denies the name command without any pre-configured scope.","commands":{"allow":[],"deny":["name"]}},"deny-remove-data-store":{"identifier":"deny-remove-data-store","description":"Denies the remove_data_store command without any pre-configured scope.","commands":{"allow":[],"deny":["remove_data_store"]}},"deny-set-app-theme":{"identifier":"deny-set-app-theme","description":"Denies the set_app_theme command without any pre-configured scope.","commands":{"allow":[],"deny":["set_app_theme"]}},"deny-set-dock-visibility":{"identifier":"deny-set-dock-visibility","description":"Denies the set_dock_visibility command without any pre-configured scope.","commands":{"allow":[],"deny":["set_dock_visibility"]}},"deny-tauri-version":{"identifier":"deny-tauri-version","description":"Denies the tauri_version command without any pre-configured scope.","commands":{"allow":[],"deny":["tauri_version"]}},"deny-version":{"identifier":"deny-version","description":"Denies the version command without any pre-configured scope.","commands":{"allow":[],"deny":["version"]}}},"permission_sets":{},"global_scope_schema":null},"core:event":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-listen","allow-unlisten","allow-emit","allow-emit-to"]},"permissions":{"allow-emit":{"identifier":"allow-emit","description":"Enables the emit command without any pre-configured scope.","commands":{"allow":["emit"],"deny":[]}},"allow-emit-to":{"identifier":"allow-emit-to","description":"Enables the emit_to command without any pre-configured scope.","commands":{"allow":["emit_to"],"deny":[]}},"allow-listen":{"identifier":"allow-listen","description":"Enables the listen command without any pre-configured scope.","commands":{"allow":["listen"],"deny":[]}},"allow-unlisten":{"identifier":"allow-unlisten","description":"Enables the unlisten command without any pre-configured scope.","commands":{"allow":["unlisten"],"deny":[]}},"deny-emit":{"identifier":"deny-emit","description":"Denies the emit command without any pre-configured scope.","commands":{"allow":[],"deny":["emit"]}},"deny-emit-to":{"identifier":"deny-emit-to","description":"Denies the emit_to command without any pre-configured scope.","commands":{"allow":[],"deny":["emit_to"]}},"deny-listen":{"identifier":"deny-listen","description":"Denies the listen command without any pre-configured scope.","commands":{"allow":[],"deny":["listen"]}},"deny-unlisten":{"identifier":"deny-unlisten","description":"Denies the unlisten command without any pre-configured scope.","commands":{"allow":[],"deny":["unlisten"]}}},"permission_sets":{},"global_scope_schema":null},"core:image":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-new","allow-from-bytes","allow-from-path","allow-rgba","allow-size"]},"permissions":{"allow-from-bytes":{"identifier":"allow-from-bytes","description":"Enables the from_bytes command without any pre-configured scope.","commands":{"allow":["from_bytes"],"deny":[]}},"allow-from-path":{"identifier":"allow-from-path","description":"Enables the from_path command without any pre-configured scope.","commands":{"allow":["from_path"],"deny":[]}},"allow-new":{"identifier":"allow-new","description":"Enables the new command without any pre-configured scope.","commands":{"allow":["new"],"deny":[]}},"allow-rgba":{"identifier":"allow-rgba","description":"Enables the rgba command without any pre-configured scope.","commands":{"allow":["rgba"],"deny":[]}},"allow-size":{"identifier":"allow-size","description":"Enables the size command without any pre-configured scope.","commands":{"allow":["size"],"deny":[]}},"deny-from-bytes":{"identifier":"deny-from-bytes","description":"Denies the from_bytes command without any pre-configured scope.","commands":{"allow":[],"deny":["from_bytes"]}},"deny-from-path":{"identifier":"deny-from-path","description":"Denies the from_path command without any pre-configured scope.","commands":{"allow":[],"deny":["from_path"]}},"deny-new":{"identifier":"deny-new","description":"Denies the new command without any pre-configured scope.","commands":{"allow":[],"deny":["new"]}},"deny-rgba":{"identifier":"deny-rgba","description":"Denies the rgba command without any pre-configured scope.","commands":{"allow":[],"deny":["rgba"]}},"deny-size":{"identifier":"deny-size","description":"Denies the size command without any pre-configured scope.","commands":{"allow":[],"deny":["size"]}}},"permission_sets":{},"global_scope_schema":null},"core:menu":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-new","allow-append","allow-prepend","allow-insert","allow-remove","allow-remove-at","allow-items","allow-get","allow-popup","allow-create-default","allow-set-as-app-menu","allow-set-as-window-menu","allow-text","allow-set-text","allow-is-enabled","allow-set-enabled","allow-set-accelerator","allow-set-as-windows-menu-for-nsapp","allow-set-as-help-menu-for-nsapp","allow-is-checked","allow-set-checked","allow-set-icon"]},"permissions":{"allow-append":{"identifier":"allow-append","description":"Enables the append command without any pre-configured scope.","commands":{"allow":["append"],"deny":[]}},"allow-create-default":{"identifier":"allow-create-default","description":"Enables the create_default command without any pre-configured scope.","commands":{"allow":["create_default"],"deny":[]}},"allow-get":{"identifier":"allow-get","description":"Enables the get command without any pre-configured scope.","commands":{"allow":["get"],"deny":[]}},"allow-insert":{"identifier":"allow-insert","description":"Enables the insert command without any pre-configured scope.","commands":{"allow":["insert"],"deny":[]}},"allow-is-checked":{"identifier":"allow-is-checked","description":"Enables the is_checked command without any pre-configured scope.","commands":{"allow":["is_checked"],"deny":[]}},"allow-is-enabled":{"identifier":"allow-is-enabled","description":"Enables the is_enabled command without any pre-configured scope.","commands":{"allow":["is_enabled"],"deny":[]}},"allow-items":{"identifier":"allow-items","description":"Enables the items command without any pre-configured scope.","commands":{"allow":["items"],"deny":[]}},"allow-new":{"identifier":"allow-new","description":"Enables the new command without any pre-configured scope.","commands":{"allow":["new"],"deny":[]}},"allow-popup":{"identifier":"allow-popup","description":"Enables the popup command without any pre-configured scope.","commands":{"allow":["popup"],"deny":[]}},"allow-prepend":{"identifier":"allow-prepend","description":"Enables the prepend command without any pre-configured scope.","commands":{"allow":["prepend"],"deny":[]}},"allow-remove":{"identifier":"allow-remove","description":"Enables the remove command without any pre-configured scope.","commands":{"allow":["remove"],"deny":[]}},"allow-remove-at":{"identifier":"allow-remove-at","description":"Enables the remove_at command without any pre-configured scope.","commands":{"allow":["remove_at"],"deny":[]}},"allow-set-accelerator":{"identifier":"allow-set-accelerator","description":"Enables the set_accelerator command without any pre-configured scope.","commands":{"allow":["set_accelerator"],"deny":[]}},"allow-set-as-app-menu":{"identifier":"allow-set-as-app-menu","description":"Enables the set_as_app_menu command without any pre-configured scope.","commands":{"allow":["set_as_app_menu"],"deny":[]}},"allow-set-as-help-menu-for-nsapp":{"identifier":"allow-set-as-help-menu-for-nsapp","description":"Enables the set_as_help_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":["set_as_help_menu_for_nsapp"],"deny":[]}},"allow-set-as-window-menu":{"identifier":"allow-set-as-window-menu","description":"Enables the set_as_window_menu command without any pre-configured scope.","commands":{"allow":["set_as_window_menu"],"deny":[]}},"allow-set-as-windows-menu-for-nsapp":{"identifier":"allow-set-as-windows-menu-for-nsapp","description":"Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":["set_as_windows_menu_for_nsapp"],"deny":[]}},"allow-set-checked":{"identifier":"allow-set-checked","description":"Enables the set_checked command without any pre-configured scope.","commands":{"allow":["set_checked"],"deny":[]}},"allow-set-enabled":{"identifier":"allow-set-enabled","description":"Enables the set_enabled command without any pre-configured scope.","commands":{"allow":["set_enabled"],"deny":[]}},"allow-set-icon":{"identifier":"allow-set-icon","description":"Enables the set_icon command without any pre-configured scope.","commands":{"allow":["set_icon"],"deny":[]}},"allow-set-text":{"identifier":"allow-set-text","description":"Enables the set_text command without any pre-configured scope.","commands":{"allow":["set_text"],"deny":[]}},"allow-text":{"identifier":"allow-text","description":"Enables the text command without any pre-configured scope.","commands":{"allow":["text"],"deny":[]}},"deny-append":{"identifier":"deny-append","description":"Denies the append command without any pre-configured scope.","commands":{"allow":[],"deny":["append"]}},"deny-create-default":{"identifier":"deny-create-default","description":"Denies the create_default command without any pre-configured scope.","commands":{"allow":[],"deny":["create_default"]}},"deny-get":{"identifier":"deny-get","description":"Denies the get command without any pre-configured scope.","commands":{"allow":[],"deny":["get"]}},"deny-insert":{"identifier":"deny-insert","description":"Denies the insert command without any pre-configured scope.","commands":{"allow":[],"deny":["insert"]}},"deny-is-checked":{"identifier":"deny-is-checked","description":"Denies the is_checked command without any pre-configured scope.","commands":{"allow":[],"deny":["is_checked"]}},"deny-is-enabled":{"identifier":"deny-is-enabled","description":"Denies the is_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["is_enabled"]}},"deny-items":{"identifier":"deny-items","description":"Denies the items command without any pre-configured scope.","commands":{"allow":[],"deny":["items"]}},"deny-new":{"identifier":"deny-new","description":"Denies the new command without any pre-configured scope.","commands":{"allow":[],"deny":["new"]}},"deny-popup":{"identifier":"deny-popup","description":"Denies the popup command without any pre-configured scope.","commands":{"allow":[],"deny":["popup"]}},"deny-prepend":{"identifier":"deny-prepend","description":"Denies the prepend command without any pre-configured scope.","commands":{"allow":[],"deny":["prepend"]}},"deny-remove":{"identifier":"deny-remove","description":"Denies the remove command without any pre-configured scope.","commands":{"allow":[],"deny":["remove"]}},"deny-remove-at":{"identifier":"deny-remove-at","description":"Denies the remove_at command without any pre-configured scope.","commands":{"allow":[],"deny":["remove_at"]}},"deny-set-accelerator":{"identifier":"deny-set-accelerator","description":"Denies the set_accelerator command without any pre-configured scope.","commands":{"allow":[],"deny":["set_accelerator"]}},"deny-set-as-app-menu":{"identifier":"deny-set-as-app-menu","description":"Denies the set_as_app_menu command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_app_menu"]}},"deny-set-as-help-menu-for-nsapp":{"identifier":"deny-set-as-help-menu-for-nsapp","description":"Denies the set_as_help_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_help_menu_for_nsapp"]}},"deny-set-as-window-menu":{"identifier":"deny-set-as-window-menu","description":"Denies the set_as_window_menu command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_window_menu"]}},"deny-set-as-windows-menu-for-nsapp":{"identifier":"deny-set-as-windows-menu-for-nsapp","description":"Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_windows_menu_for_nsapp"]}},"deny-set-checked":{"identifier":"deny-set-checked","description":"Denies the set_checked command without any pre-configured scope.","commands":{"allow":[],"deny":["set_checked"]}},"deny-set-enabled":{"identifier":"deny-set-enabled","description":"Denies the set_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["set_enabled"]}},"deny-set-icon":{"identifier":"deny-set-icon","description":"Denies the set_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon"]}},"deny-set-text":{"identifier":"deny-set-text","description":"Denies the set_text command without any pre-configured scope.","commands":{"allow":[],"deny":["set_text"]}},"deny-text":{"identifier":"deny-text","description":"Denies the text command without any pre-configured scope.","commands":{"allow":[],"deny":["text"]}}},"permission_sets":{},"global_scope_schema":null},"core:path":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-resolve-directory","allow-resolve","allow-normalize","allow-join","allow-dirname","allow-extname","allow-basename","allow-is-absolute"]},"permissions":{"allow-basename":{"identifier":"allow-basename","description":"Enables the basename command without any pre-configured scope.","commands":{"allow":["basename"],"deny":[]}},"allow-dirname":{"identifier":"allow-dirname","description":"Enables the dirname command without any pre-configured scope.","commands":{"allow":["dirname"],"deny":[]}},"allow-extname":{"identifier":"allow-extname","description":"Enables the extname command without any pre-configured scope.","commands":{"allow":["extname"],"deny":[]}},"allow-is-absolute":{"identifier":"allow-is-absolute","description":"Enables the is_absolute command without any pre-configured scope.","commands":{"allow":["is_absolute"],"deny":[]}},"allow-join":{"identifier":"allow-join","description":"Enables the join command without any pre-configured scope.","commands":{"allow":["join"],"deny":[]}},"allow-normalize":{"identifier":"allow-normalize","description":"Enables the normalize command without any pre-configured scope.","commands":{"allow":["normalize"],"deny":[]}},"allow-resolve":{"identifier":"allow-resolve","description":"Enables the resolve command without any pre-configured scope.","commands":{"allow":["resolve"],"deny":[]}},"allow-resolve-directory":{"identifier":"allow-resolve-directory","description":"Enables the resolve_directory command without any pre-configured scope.","commands":{"allow":["resolve_directory"],"deny":[]}},"deny-basename":{"identifier":"deny-basename","description":"Denies the basename command without any pre-configured scope.","commands":{"allow":[],"deny":["basename"]}},"deny-dirname":{"identifier":"deny-dirname","description":"Denies the dirname command without any pre-configured scope.","commands":{"allow":[],"deny":["dirname"]}},"deny-extname":{"identifier":"deny-extname","description":"Denies the extname command without any pre-configured scope.","commands":{"allow":[],"deny":["extname"]}},"deny-is-absolute":{"identifier":"deny-is-absolute","description":"Denies the is_absolute command without any pre-configured scope.","commands":{"allow":[],"deny":["is_absolute"]}},"deny-join":{"identifier":"deny-join","description":"Denies the join command without any pre-configured scope.","commands":{"allow":[],"deny":["join"]}},"deny-normalize":{"identifier":"deny-normalize","description":"Denies the normalize command without any pre-configured scope.","commands":{"allow":[],"deny":["normalize"]}},"deny-resolve":{"identifier":"deny-resolve","description":"Denies the resolve command without any pre-configured scope.","commands":{"allow":[],"deny":["resolve"]}},"deny-resolve-directory":{"identifier":"deny-resolve-directory","description":"Denies the resolve_directory command without any pre-configured scope.","commands":{"allow":[],"deny":["resolve_directory"]}}},"permission_sets":{},"global_scope_schema":null},"core:resources":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-close"]},"permissions":{"allow-close":{"identifier":"allow-close","description":"Enables the close command without any pre-configured scope.","commands":{"allow":["close"],"deny":[]}},"deny-close":{"identifier":"deny-close","description":"Denies the close command without any pre-configured scope.","commands":{"allow":[],"deny":["close"]}}},"permission_sets":{},"global_scope_schema":null},"core:tray":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-new","allow-get-by-id","allow-remove-by-id","allow-set-icon","allow-set-menu","allow-set-tooltip","allow-set-title","allow-set-visible","allow-set-temp-dir-path","allow-set-icon-as-template","allow-set-show-menu-on-left-click"]},"permissions":{"allow-get-by-id":{"identifier":"allow-get-by-id","description":"Enables the get_by_id command without any pre-configured scope.","commands":{"allow":["get_by_id"],"deny":[]}},"allow-new":{"identifier":"allow-new","description":"Enables the new command without any pre-configured scope.","commands":{"allow":["new"],"deny":[]}},"allow-remove-by-id":{"identifier":"allow-remove-by-id","description":"Enables the remove_by_id command without any pre-configured scope.","commands":{"allow":["remove_by_id"],"deny":[]}},"allow-set-icon":{"identifier":"allow-set-icon","description":"Enables the set_icon command without any pre-configured scope.","commands":{"allow":["set_icon"],"deny":[]}},"allow-set-icon-as-template":{"identifier":"allow-set-icon-as-template","description":"Enables the set_icon_as_template command without any pre-configured scope.","commands":{"allow":["set_icon_as_template"],"deny":[]}},"allow-set-menu":{"identifier":"allow-set-menu","description":"Enables the set_menu command without any pre-configured scope.","commands":{"allow":["set_menu"],"deny":[]}},"allow-set-show-menu-on-left-click":{"identifier":"allow-set-show-menu-on-left-click","description":"Enables the set_show_menu_on_left_click command without any pre-configured scope.","commands":{"allow":["set_show_menu_on_left_click"],"deny":[]}},"allow-set-temp-dir-path":{"identifier":"allow-set-temp-dir-path","description":"Enables the set_temp_dir_path command without any pre-configured scope.","commands":{"allow":["set_temp_dir_path"],"deny":[]}},"allow-set-title":{"identifier":"allow-set-title","description":"Enables the set_title command without any pre-configured scope.","commands":{"allow":["set_title"],"deny":[]}},"allow-set-tooltip":{"identifier":"allow-set-tooltip","description":"Enables the set_tooltip command without any pre-configured scope.","commands":{"allow":["set_tooltip"],"deny":[]}},"allow-set-visible":{"identifier":"allow-set-visible","description":"Enables the set_visible command without any pre-configured scope.","commands":{"allow":["set_visible"],"deny":[]}},"deny-get-by-id":{"identifier":"deny-get-by-id","description":"Denies the get_by_id command without any pre-configured scope.","commands":{"allow":[],"deny":["get_by_id"]}},"deny-new":{"identifier":"deny-new","description":"Denies the new command without any pre-configured scope.","commands":{"allow":[],"deny":["new"]}},"deny-remove-by-id":{"identifier":"deny-remove-by-id","description":"Denies the remove_by_id command without any pre-configured scope.","commands":{"allow":[],"deny":["remove_by_id"]}},"deny-set-icon":{"identifier":"deny-set-icon","description":"Denies the set_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon"]}},"deny-set-icon-as-template":{"identifier":"deny-set-icon-as-template","description":"Denies the set_icon_as_template command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon_as_template"]}},"deny-set-menu":{"identifier":"deny-set-menu","description":"Denies the set_menu command without any pre-configured scope.","commands":{"allow":[],"deny":["set_menu"]}},"deny-set-show-menu-on-left-click":{"identifier":"deny-set-show-menu-on-left-click","description":"Denies the set_show_menu_on_left_click command without any pre-configured scope.","commands":{"allow":[],"deny":["set_show_menu_on_left_click"]}},"deny-set-temp-dir-path":{"identifier":"deny-set-temp-dir-path","description":"Denies the set_temp_dir_path command without any pre-configured scope.","commands":{"allow":[],"deny":["set_temp_dir_path"]}},"deny-set-title":{"identifier":"deny-set-title","description":"Denies the set_title command without any pre-configured scope.","commands":{"allow":[],"deny":["set_title"]}},"deny-set-tooltip":{"identifier":"deny-set-tooltip","description":"Denies the set_tooltip command without any pre-configured scope.","commands":{"allow":[],"deny":["set_tooltip"]}},"deny-set-visible":{"identifier":"deny-set-visible","description":"Denies the set_visible command without any pre-configured scope.","commands":{"allow":[],"deny":["set_visible"]}}},"permission_sets":{},"global_scope_schema":null},"core:webview":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-get-all-webviews","allow-webview-position","allow-webview-size","allow-internal-toggle-devtools"]},"permissions":{"allow-clear-all-browsing-data":{"identifier":"allow-clear-all-browsing-data","description":"Enables the clear_all_browsing_data command without any pre-configured scope.","commands":{"allow":["clear_all_browsing_data"],"deny":[]}},"allow-create-webview":{"identifier":"allow-create-webview","description":"Enables the create_webview command without any pre-configured scope.","commands":{"allow":["create_webview"],"deny":[]}},"allow-create-webview-window":{"identifier":"allow-create-webview-window","description":"Enables the create_webview_window command without any pre-configured scope.","commands":{"allow":["create_webview_window"],"deny":[]}},"allow-get-all-webviews":{"identifier":"allow-get-all-webviews","description":"Enables the get_all_webviews command without any pre-configured scope.","commands":{"allow":["get_all_webviews"],"deny":[]}},"allow-internal-toggle-devtools":{"identifier":"allow-internal-toggle-devtools","description":"Enables the internal_toggle_devtools command without any pre-configured scope.","commands":{"allow":["internal_toggle_devtools"],"deny":[]}},"allow-print":{"identifier":"allow-print","description":"Enables the print command without any pre-configured scope.","commands":{"allow":["print"],"deny":[]}},"allow-reparent":{"identifier":"allow-reparent","description":"Enables the reparent command without any pre-configured scope.","commands":{"allow":["reparent"],"deny":[]}},"allow-set-webview-auto-resize":{"identifier":"allow-set-webview-auto-resize","description":"Enables the set_webview_auto_resize command without any pre-configured scope.","commands":{"allow":["set_webview_auto_resize"],"deny":[]}},"allow-set-webview-background-color":{"identifier":"allow-set-webview-background-color","description":"Enables the set_webview_background_color command without any pre-configured scope.","commands":{"allow":["set_webview_background_color"],"deny":[]}},"allow-set-webview-focus":{"identifier":"allow-set-webview-focus","description":"Enables the set_webview_focus command without any pre-configured scope.","commands":{"allow":["set_webview_focus"],"deny":[]}},"allow-set-webview-position":{"identifier":"allow-set-webview-position","description":"Enables the set_webview_position command without any pre-configured scope.","commands":{"allow":["set_webview_position"],"deny":[]}},"allow-set-webview-size":{"identifier":"allow-set-webview-size","description":"Enables the set_webview_size command without any pre-configured scope.","commands":{"allow":["set_webview_size"],"deny":[]}},"allow-set-webview-zoom":{"identifier":"allow-set-webview-zoom","description":"Enables the set_webview_zoom command without any pre-configured scope.","commands":{"allow":["set_webview_zoom"],"deny":[]}},"allow-webview-close":{"identifier":"allow-webview-close","description":"Enables the webview_close command without any pre-configured scope.","commands":{"allow":["webview_close"],"deny":[]}},"allow-webview-hide":{"identifier":"allow-webview-hide","description":"Enables the webview_hide command without any pre-configured scope.","commands":{"allow":["webview_hide"],"deny":[]}},"allow-webview-position":{"identifier":"allow-webview-position","description":"Enables the webview_position command without any pre-configured scope.","commands":{"allow":["webview_position"],"deny":[]}},"allow-webview-show":{"identifier":"allow-webview-show","description":"Enables the webview_show command without any pre-configured scope.","commands":{"allow":["webview_show"],"deny":[]}},"allow-webview-size":{"identifier":"allow-webview-size","description":"Enables the webview_size command without any pre-configured scope.","commands":{"allow":["webview_size"],"deny":[]}},"deny-clear-all-browsing-data":{"identifier":"deny-clear-all-browsing-data","description":"Denies the clear_all_browsing_data command without any pre-configured scope.","commands":{"allow":[],"deny":["clear_all_browsing_data"]}},"deny-create-webview":{"identifier":"deny-create-webview","description":"Denies the create_webview command without any pre-configured scope.","commands":{"allow":[],"deny":["create_webview"]}},"deny-create-webview-window":{"identifier":"deny-create-webview-window","description":"Denies the create_webview_window command without any pre-configured scope.","commands":{"allow":[],"deny":["create_webview_window"]}},"deny-get-all-webviews":{"identifier":"deny-get-all-webviews","description":"Denies the get_all_webviews command without any pre-configured scope.","commands":{"allow":[],"deny":["get_all_webviews"]}},"deny-internal-toggle-devtools":{"identifier":"deny-internal-toggle-devtools","description":"Denies the internal_toggle_devtools command without any pre-configured scope.","commands":{"allow":[],"deny":["internal_toggle_devtools"]}},"deny-print":{"identifier":"deny-print","description":"Denies the print command without any pre-configured scope.","commands":{"allow":[],"deny":["print"]}},"deny-reparent":{"identifier":"deny-reparent","description":"Denies the reparent command without any pre-configured scope.","commands":{"allow":[],"deny":["reparent"]}},"deny-set-webview-auto-resize":{"identifier":"deny-set-webview-auto-resize","description":"Denies the set_webview_auto_resize command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_auto_resize"]}},"deny-set-webview-background-color":{"identifier":"deny-set-webview-background-color","description":"Denies the set_webview_background_color command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_background_color"]}},"deny-set-webview-focus":{"identifier":"deny-set-webview-focus","description":"Denies the set_webview_focus command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_focus"]}},"deny-set-webview-position":{"identifier":"deny-set-webview-position","description":"Denies the set_webview_position command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_position"]}},"deny-set-webview-size":{"identifier":"deny-set-webview-size","description":"Denies the set_webview_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_size"]}},"deny-set-webview-zoom":{"identifier":"deny-set-webview-zoom","description":"Denies the set_webview_zoom command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_zoom"]}},"deny-webview-close":{"identifier":"deny-webview-close","description":"Denies the webview_close command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_close"]}},"deny-webview-hide":{"identifier":"deny-webview-hide","description":"Denies the webview_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_hide"]}},"deny-webview-position":{"identifier":"deny-webview-position","description":"Denies the webview_position command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_position"]}},"deny-webview-show":{"identifier":"deny-webview-show","description":"Denies the webview_show command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_show"]}},"deny-webview-size":{"identifier":"deny-webview-size","description":"Denies the webview_size command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_size"]}}},"permission_sets":{},"global_scope_schema":null},"core:window":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-get-all-windows","allow-scale-factor","allow-inner-position","allow-outer-position","allow-inner-size","allow-outer-size","allow-is-fullscreen","allow-is-minimized","allow-is-maximized","allow-is-focused","allow-is-decorated","allow-is-resizable","allow-is-maximizable","allow-is-minimizable","allow-is-closable","allow-is-visible","allow-is-enabled","allow-title","allow-current-monitor","allow-primary-monitor","allow-monitor-from-point","allow-available-monitors","allow-cursor-position","allow-theme","allow-is-always-on-top","allow-internal-toggle-maximize"]},"permissions":{"allow-available-monitors":{"identifier":"allow-available-monitors","description":"Enables the available_monitors command without any pre-configured scope.","commands":{"allow":["available_monitors"],"deny":[]}},"allow-center":{"identifier":"allow-center","description":"Enables the center command without any pre-configured scope.","commands":{"allow":["center"],"deny":[]}},"allow-close":{"identifier":"allow-close","description":"Enables the close command without any pre-configured scope.","commands":{"allow":["close"],"deny":[]}},"allow-create":{"identifier":"allow-create","description":"Enables the create command without any pre-configured scope.","commands":{"allow":["create"],"deny":[]}},"allow-current-monitor":{"identifier":"allow-current-monitor","description":"Enables the current_monitor command without any pre-configured scope.","commands":{"allow":["current_monitor"],"deny":[]}},"allow-cursor-position":{"identifier":"allow-cursor-position","description":"Enables the cursor_position command without any pre-configured scope.","commands":{"allow":["cursor_position"],"deny":[]}},"allow-destroy":{"identifier":"allow-destroy","description":"Enables the destroy command without any pre-configured scope.","commands":{"allow":["destroy"],"deny":[]}},"allow-get-all-windows":{"identifier":"allow-get-all-windows","description":"Enables the get_all_windows command without any pre-configured scope.","commands":{"allow":["get_all_windows"],"deny":[]}},"allow-hide":{"identifier":"allow-hide","description":"Enables the hide command without any pre-configured scope.","commands":{"allow":["hide"],"deny":[]}},"allow-inner-position":{"identifier":"allow-inner-position","description":"Enables the inner_position command without any pre-configured scope.","commands":{"allow":["inner_position"],"deny":[]}},"allow-inner-size":{"identifier":"allow-inner-size","description":"Enables the inner_size command without any pre-configured scope.","commands":{"allow":["inner_size"],"deny":[]}},"allow-internal-toggle-maximize":{"identifier":"allow-internal-toggle-maximize","description":"Enables the internal_toggle_maximize command without any pre-configured scope.","commands":{"allow":["internal_toggle_maximize"],"deny":[]}},"allow-is-always-on-top":{"identifier":"allow-is-always-on-top","description":"Enables the is_always_on_top command without any pre-configured scope.","commands":{"allow":["is_always_on_top"],"deny":[]}},"allow-is-closable":{"identifier":"allow-is-closable","description":"Enables the is_closable command without any pre-configured scope.","commands":{"allow":["is_closable"],"deny":[]}},"allow-is-decorated":{"identifier":"allow-is-decorated","description":"Enables the is_decorated command without any pre-configured scope.","commands":{"allow":["is_decorated"],"deny":[]}},"allow-is-enabled":{"identifier":"allow-is-enabled","description":"Enables the is_enabled command without any pre-configured scope.","commands":{"allow":["is_enabled"],"deny":[]}},"allow-is-focused":{"identifier":"allow-is-focused","description":"Enables the is_focused command without any pre-configured scope.","commands":{"allow":["is_focused"],"deny":[]}},"allow-is-fullscreen":{"identifier":"allow-is-fullscreen","description":"Enables the is_fullscreen command without any pre-configured scope.","commands":{"allow":["is_fullscreen"],"deny":[]}},"allow-is-maximizable":{"identifier":"allow-is-maximizable","description":"Enables the is_maximizable command without any pre-configured scope.","commands":{"allow":["is_maximizable"],"deny":[]}},"allow-is-maximized":{"identifier":"allow-is-maximized","description":"Enables the is_maximized command without any pre-configured scope.","commands":{"allow":["is_maximized"],"deny":[]}},"allow-is-minimizable":{"identifier":"allow-is-minimizable","description":"Enables the is_minimizable command without any pre-configured scope.","commands":{"allow":["is_minimizable"],"deny":[]}},"allow-is-minimized":{"identifier":"allow-is-minimized","description":"Enables the is_minimized command without any pre-configured scope.","commands":{"allow":["is_minimized"],"deny":[]}},"allow-is-resizable":{"identifier":"allow-is-resizable","description":"Enables the is_resizable command without any pre-configured scope.","commands":{"allow":["is_resizable"],"deny":[]}},"allow-is-visible":{"identifier":"allow-is-visible","description":"Enables the is_visible command without any pre-configured scope.","commands":{"allow":["is_visible"],"deny":[]}},"allow-maximize":{"identifier":"allow-maximize","description":"Enables the maximize command without any pre-configured scope.","commands":{"allow":["maximize"],"deny":[]}},"allow-minimize":{"identifier":"allow-minimize","description":"Enables the minimize command without any pre-configured scope.","commands":{"allow":["minimize"],"deny":[]}},"allow-monitor-from-point":{"identifier":"allow-monitor-from-point","description":"Enables the monitor_from_point command without any pre-configured scope.","commands":{"allow":["monitor_from_point"],"deny":[]}},"allow-outer-position":{"identifier":"allow-outer-position","description":"Enables the outer_position command without any pre-configured scope.","commands":{"allow":["outer_position"],"deny":[]}},"allow-outer-size":{"identifier":"allow-outer-size","description":"Enables the outer_size command without any pre-configured scope.","commands":{"allow":["outer_size"],"deny":[]}},"allow-primary-monitor":{"identifier":"allow-primary-monitor","description":"Enables the primary_monitor command without any pre-configured scope.","commands":{"allow":["primary_monitor"],"deny":[]}},"allow-request-user-attention":{"identifier":"allow-request-user-attention","description":"Enables the request_user_attention command without any pre-configured scope.","commands":{"allow":["request_user_attention"],"deny":[]}},"allow-scale-factor":{"identifier":"allow-scale-factor","description":"Enables the scale_factor command without any pre-configured scope.","commands":{"allow":["scale_factor"],"deny":[]}},"allow-set-always-on-bottom":{"identifier":"allow-set-always-on-bottom","description":"Enables the set_always_on_bottom command without any pre-configured scope.","commands":{"allow":["set_always_on_bottom"],"deny":[]}},"allow-set-always-on-top":{"identifier":"allow-set-always-on-top","description":"Enables the set_always_on_top command without any pre-configured scope.","commands":{"allow":["set_always_on_top"],"deny":[]}},"allow-set-background-color":{"identifier":"allow-set-background-color","description":"Enables the set_background_color command without any pre-configured scope.","commands":{"allow":["set_background_color"],"deny":[]}},"allow-set-badge-count":{"identifier":"allow-set-badge-count","description":"Enables the set_badge_count command without any pre-configured scope.","commands":{"allow":["set_badge_count"],"deny":[]}},"allow-set-badge-label":{"identifier":"allow-set-badge-label","description":"Enables the set_badge_label command without any pre-configured scope.","commands":{"allow":["set_badge_label"],"deny":[]}},"allow-set-closable":{"identifier":"allow-set-closable","description":"Enables the set_closable command without any pre-configured scope.","commands":{"allow":["set_closable"],"deny":[]}},"allow-set-content-protected":{"identifier":"allow-set-content-protected","description":"Enables the set_content_protected command without any pre-configured scope.","commands":{"allow":["set_content_protected"],"deny":[]}},"allow-set-cursor-grab":{"identifier":"allow-set-cursor-grab","description":"Enables the set_cursor_grab command without any pre-configured scope.","commands":{"allow":["set_cursor_grab"],"deny":[]}},"allow-set-cursor-icon":{"identifier":"allow-set-cursor-icon","description":"Enables the set_cursor_icon command without any pre-configured scope.","commands":{"allow":["set_cursor_icon"],"deny":[]}},"allow-set-cursor-position":{"identifier":"allow-set-cursor-position","description":"Enables the set_cursor_position command without any pre-configured scope.","commands":{"allow":["set_cursor_position"],"deny":[]}},"allow-set-cursor-visible":{"identifier":"allow-set-cursor-visible","description":"Enables the set_cursor_visible command without any pre-configured scope.","commands":{"allow":["set_cursor_visible"],"deny":[]}},"allow-set-decorations":{"identifier":"allow-set-decorations","description":"Enables the set_decorations command without any pre-configured scope.","commands":{"allow":["set_decorations"],"deny":[]}},"allow-set-effects":{"identifier":"allow-set-effects","description":"Enables the set_effects command without any pre-configured scope.","commands":{"allow":["set_effects"],"deny":[]}},"allow-set-enabled":{"identifier":"allow-set-enabled","description":"Enables the set_enabled command without any pre-configured scope.","commands":{"allow":["set_enabled"],"deny":[]}},"allow-set-focus":{"identifier":"allow-set-focus","description":"Enables the set_focus command without any pre-configured scope.","commands":{"allow":["set_focus"],"deny":[]}},"allow-set-fullscreen":{"identifier":"allow-set-fullscreen","description":"Enables the set_fullscreen command without any pre-configured scope.","commands":{"allow":["set_fullscreen"],"deny":[]}},"allow-set-icon":{"identifier":"allow-set-icon","description":"Enables the set_icon command without any pre-configured scope.","commands":{"allow":["set_icon"],"deny":[]}},"allow-set-ignore-cursor-events":{"identifier":"allow-set-ignore-cursor-events","description":"Enables the set_ignore_cursor_events command without any pre-configured scope.","commands":{"allow":["set_ignore_cursor_events"],"deny":[]}},"allow-set-max-size":{"identifier":"allow-set-max-size","description":"Enables the set_max_size command without any pre-configured scope.","commands":{"allow":["set_max_size"],"deny":[]}},"allow-set-maximizable":{"identifier":"allow-set-maximizable","description":"Enables the set_maximizable command without any pre-configured scope.","commands":{"allow":["set_maximizable"],"deny":[]}},"allow-set-min-size":{"identifier":"allow-set-min-size","description":"Enables the set_min_size command without any pre-configured scope.","commands":{"allow":["set_min_size"],"deny":[]}},"allow-set-minimizable":{"identifier":"allow-set-minimizable","description":"Enables the set_minimizable command without any pre-configured scope.","commands":{"allow":["set_minimizable"],"deny":[]}},"allow-set-overlay-icon":{"identifier":"allow-set-overlay-icon","description":"Enables the set_overlay_icon command without any pre-configured scope.","commands":{"allow":["set_overlay_icon"],"deny":[]}},"allow-set-position":{"identifier":"allow-set-position","description":"Enables the set_position command without any pre-configured scope.","commands":{"allow":["set_position"],"deny":[]}},"allow-set-progress-bar":{"identifier":"allow-set-progress-bar","description":"Enables the set_progress_bar command without any pre-configured scope.","commands":{"allow":["set_progress_bar"],"deny":[]}},"allow-set-resizable":{"identifier":"allow-set-resizable","description":"Enables the set_resizable command without any pre-configured scope.","commands":{"allow":["set_resizable"],"deny":[]}},"allow-set-shadow":{"identifier":"allow-set-shadow","description":"Enables the set_shadow command without any pre-configured scope.","commands":{"allow":["set_shadow"],"deny":[]}},"allow-set-size":{"identifier":"allow-set-size","description":"Enables the set_size command without any pre-configured scope.","commands":{"allow":["set_size"],"deny":[]}},"allow-set-size-constraints":{"identifier":"allow-set-size-constraints","description":"Enables the set_size_constraints command without any pre-configured scope.","commands":{"allow":["set_size_constraints"],"deny":[]}},"allow-set-skip-taskbar":{"identifier":"allow-set-skip-taskbar","description":"Enables the set_skip_taskbar command without any pre-configured scope.","commands":{"allow":["set_skip_taskbar"],"deny":[]}},"allow-set-theme":{"identifier":"allow-set-theme","description":"Enables the set_theme command without any pre-configured scope.","commands":{"allow":["set_theme"],"deny":[]}},"allow-set-title":{"identifier":"allow-set-title","description":"Enables the set_title command without any pre-configured scope.","commands":{"allow":["set_title"],"deny":[]}},"allow-set-title-bar-style":{"identifier":"allow-set-title-bar-style","description":"Enables the set_title_bar_style command without any pre-configured scope.","commands":{"allow":["set_title_bar_style"],"deny":[]}},"allow-set-visible-on-all-workspaces":{"identifier":"allow-set-visible-on-all-workspaces","description":"Enables the set_visible_on_all_workspaces command without any pre-configured scope.","commands":{"allow":["set_visible_on_all_workspaces"],"deny":[]}},"allow-show":{"identifier":"allow-show","description":"Enables the show command without any pre-configured scope.","commands":{"allow":["show"],"deny":[]}},"allow-start-dragging":{"identifier":"allow-start-dragging","description":"Enables the start_dragging command without any pre-configured scope.","commands":{"allow":["start_dragging"],"deny":[]}},"allow-start-resize-dragging":{"identifier":"allow-start-resize-dragging","description":"Enables the start_resize_dragging command without any pre-configured scope.","commands":{"allow":["start_resize_dragging"],"deny":[]}},"allow-theme":{"identifier":"allow-theme","description":"Enables the theme command without any pre-configured scope.","commands":{"allow":["theme"],"deny":[]}},"allow-title":{"identifier":"allow-title","description":"Enables the title command without any pre-configured scope.","commands":{"allow":["title"],"deny":[]}},"allow-toggle-maximize":{"identifier":"allow-toggle-maximize","description":"Enables the toggle_maximize command without any pre-configured scope.","commands":{"allow":["toggle_maximize"],"deny":[]}},"allow-unmaximize":{"identifier":"allow-unmaximize","description":"Enables the unmaximize command without any pre-configured scope.","commands":{"allow":["unmaximize"],"deny":[]}},"allow-unminimize":{"identifier":"allow-unminimize","description":"Enables the unminimize command without any pre-configured scope.","commands":{"allow":["unminimize"],"deny":[]}},"deny-available-monitors":{"identifier":"deny-available-monitors","description":"Denies the available_monitors command without any pre-configured scope.","commands":{"allow":[],"deny":["available_monitors"]}},"deny-center":{"identifier":"deny-center","description":"Denies the center command without any pre-configured scope.","commands":{"allow":[],"deny":["center"]}},"deny-close":{"identifier":"deny-close","description":"Denies the close command without any pre-configured scope.","commands":{"allow":[],"deny":["close"]}},"deny-create":{"identifier":"deny-create","description":"Denies the create command without any pre-configured scope.","commands":{"allow":[],"deny":["create"]}},"deny-current-monitor":{"identifier":"deny-current-monitor","description":"Denies the current_monitor command without any pre-configured scope.","commands":{"allow":[],"deny":["current_monitor"]}},"deny-cursor-position":{"identifier":"deny-cursor-position","description":"Denies the cursor_position command without any pre-configured scope.","commands":{"allow":[],"deny":["cursor_position"]}},"deny-destroy":{"identifier":"deny-destroy","description":"Denies the destroy command without any pre-configured scope.","commands":{"allow":[],"deny":["destroy"]}},"deny-get-all-windows":{"identifier":"deny-get-all-windows","description":"Denies the get_all_windows command without any pre-configured scope.","commands":{"allow":[],"deny":["get_all_windows"]}},"deny-hide":{"identifier":"deny-hide","description":"Denies the hide command without any pre-configured scope.","commands":{"allow":[],"deny":["hide"]}},"deny-inner-position":{"identifier":"deny-inner-position","description":"Denies the inner_position command without any pre-configured scope.","commands":{"allow":[],"deny":["inner_position"]}},"deny-inner-size":{"identifier":"deny-inner-size","description":"Denies the inner_size command without any pre-configured scope.","commands":{"allow":[],"deny":["inner_size"]}},"deny-internal-toggle-maximize":{"identifier":"deny-internal-toggle-maximize","description":"Denies the internal_toggle_maximize command without any pre-configured scope.","commands":{"allow":[],"deny":["internal_toggle_maximize"]}},"deny-is-always-on-top":{"identifier":"deny-is-always-on-top","description":"Denies the is_always_on_top command without any pre-configured scope.","commands":{"allow":[],"deny":["is_always_on_top"]}},"deny-is-closable":{"identifier":"deny-is-closable","description":"Denies the is_closable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_closable"]}},"deny-is-decorated":{"identifier":"deny-is-decorated","description":"Denies the is_decorated command without any pre-configured scope.","commands":{"allow":[],"deny":["is_decorated"]}},"deny-is-enabled":{"identifier":"deny-is-enabled","description":"Denies the is_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["is_enabled"]}},"deny-is-focused":{"identifier":"deny-is-focused","description":"Denies the is_focused command without any pre-configured scope.","commands":{"allow":[],"deny":["is_focused"]}},"deny-is-fullscreen":{"identifier":"deny-is-fullscreen","description":"Denies the is_fullscreen command without any pre-configured scope.","commands":{"allow":[],"deny":["is_fullscreen"]}},"deny-is-maximizable":{"identifier":"deny-is-maximizable","description":"Denies the is_maximizable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_maximizable"]}},"deny-is-maximized":{"identifier":"deny-is-maximized","description":"Denies the is_maximized command without any pre-configured scope.","commands":{"allow":[],"deny":["is_maximized"]}},"deny-is-minimizable":{"identifier":"deny-is-minimizable","description":"Denies the is_minimizable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_minimizable"]}},"deny-is-minimized":{"identifier":"deny-is-minimized","description":"Denies the is_minimized command without any pre-configured scope.","commands":{"allow":[],"deny":["is_minimized"]}},"deny-is-resizable":{"identifier":"deny-is-resizable","description":"Denies the is_resizable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_resizable"]}},"deny-is-visible":{"identifier":"deny-is-visible","description":"Denies the is_visible command without any pre-configured scope.","commands":{"allow":[],"deny":["is_visible"]}},"deny-maximize":{"identifier":"deny-maximize","description":"Denies the maximize command without any pre-configured scope.","commands":{"allow":[],"deny":["maximize"]}},"deny-minimize":{"identifier":"deny-minimize","description":"Denies the minimize command without any pre-configured scope.","commands":{"allow":[],"deny":["minimize"]}},"deny-monitor-from-point":{"identifier":"deny-monitor-from-point","description":"Denies the monitor_from_point command without any pre-configured scope.","commands":{"allow":[],"deny":["monitor_from_point"]}},"deny-outer-position":{"identifier":"deny-outer-position","description":"Denies the outer_position command without any pre-configured scope.","commands":{"allow":[],"deny":["outer_position"]}},"deny-outer-size":{"identifier":"deny-outer-size","description":"Denies the outer_size command without any pre-configured scope.","commands":{"allow":[],"deny":["outer_size"]}},"deny-primary-monitor":{"identifier":"deny-primary-monitor","description":"Denies the primary_monitor command without any pre-configured scope.","commands":{"allow":[],"deny":["primary_monitor"]}},"deny-request-user-attention":{"identifier":"deny-request-user-attention","description":"Denies the request_user_attention command without any pre-configured scope.","commands":{"allow":[],"deny":["request_user_attention"]}},"deny-scale-factor":{"identifier":"deny-scale-factor","description":"Denies the scale_factor command without any pre-configured scope.","commands":{"allow":[],"deny":["scale_factor"]}},"deny-set-always-on-bottom":{"identifier":"deny-set-always-on-bottom","description":"Denies the set_always_on_bottom command without any pre-configured scope.","commands":{"allow":[],"deny":["set_always_on_bottom"]}},"deny-set-always-on-top":{"identifier":"deny-set-always-on-top","description":"Denies the set_always_on_top command without any pre-configured scope.","commands":{"allow":[],"deny":["set_always_on_top"]}},"deny-set-background-color":{"identifier":"deny-set-background-color","description":"Denies the set_background_color command without any pre-configured scope.","commands":{"allow":[],"deny":["set_background_color"]}},"deny-set-badge-count":{"identifier":"deny-set-badge-count","description":"Denies the set_badge_count command without any pre-configured scope.","commands":{"allow":[],"deny":["set_badge_count"]}},"deny-set-badge-label":{"identifier":"deny-set-badge-label","description":"Denies the set_badge_label command without any pre-configured scope.","commands":{"allow":[],"deny":["set_badge_label"]}},"deny-set-closable":{"identifier":"deny-set-closable","description":"Denies the set_closable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_closable"]}},"deny-set-content-protected":{"identifier":"deny-set-content-protected","description":"Denies the set_content_protected command without any pre-configured scope.","commands":{"allow":[],"deny":["set_content_protected"]}},"deny-set-cursor-grab":{"identifier":"deny-set-cursor-grab","description":"Denies the set_cursor_grab command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_grab"]}},"deny-set-cursor-icon":{"identifier":"deny-set-cursor-icon","description":"Denies the set_cursor_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_icon"]}},"deny-set-cursor-position":{"identifier":"deny-set-cursor-position","description":"Denies the set_cursor_position command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_position"]}},"deny-set-cursor-visible":{"identifier":"deny-set-cursor-visible","description":"Denies the set_cursor_visible command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_visible"]}},"deny-set-decorations":{"identifier":"deny-set-decorations","description":"Denies the set_decorations command without any pre-configured scope.","commands":{"allow":[],"deny":["set_decorations"]}},"deny-set-effects":{"identifier":"deny-set-effects","description":"Denies the set_effects command without any pre-configured scope.","commands":{"allow":[],"deny":["set_effects"]}},"deny-set-enabled":{"identifier":"deny-set-enabled","description":"Denies the set_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["set_enabled"]}},"deny-set-focus":{"identifier":"deny-set-focus","description":"Denies the set_focus command without any pre-configured scope.","commands":{"allow":[],"deny":["set_focus"]}},"deny-set-fullscreen":{"identifier":"deny-set-fullscreen","description":"Denies the set_fullscreen command without any pre-configured scope.","commands":{"allow":[],"deny":["set_fullscreen"]}},"deny-set-icon":{"identifier":"deny-set-icon","description":"Denies the set_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon"]}},"deny-set-ignore-cursor-events":{"identifier":"deny-set-ignore-cursor-events","description":"Denies the set_ignore_cursor_events command without any pre-configured scope.","commands":{"allow":[],"deny":["set_ignore_cursor_events"]}},"deny-set-max-size":{"identifier":"deny-set-max-size","description":"Denies the set_max_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_max_size"]}},"deny-set-maximizable":{"identifier":"deny-set-maximizable","description":"Denies the set_maximizable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_maximizable"]}},"deny-set-min-size":{"identifier":"deny-set-min-size","description":"Denies the set_min_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_min_size"]}},"deny-set-minimizable":{"identifier":"deny-set-minimizable","description":"Denies the set_minimizable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_minimizable"]}},"deny-set-overlay-icon":{"identifier":"deny-set-overlay-icon","description":"Denies the set_overlay_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_overlay_icon"]}},"deny-set-position":{"identifier":"deny-set-position","description":"Denies the set_position command without any pre-configured scope.","commands":{"allow":[],"deny":["set_position"]}},"deny-set-progress-bar":{"identifier":"deny-set-progress-bar","description":"Denies the set_progress_bar command without any pre-configured scope.","commands":{"allow":[],"deny":["set_progress_bar"]}},"deny-set-resizable":{"identifier":"deny-set-resizable","description":"Denies the set_resizable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_resizable"]}},"deny-set-shadow":{"identifier":"deny-set-shadow","description":"Denies the set_shadow command without any pre-configured scope.","commands":{"allow":[],"deny":["set_shadow"]}},"deny-set-size":{"identifier":"deny-set-size","description":"Denies the set_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_size"]}},"deny-set-size-constraints":{"identifier":"deny-set-size-constraints","description":"Denies the set_size_constraints command without any pre-configured scope.","commands":{"allow":[],"deny":["set_size_constraints"]}},"deny-set-skip-taskbar":{"identifier":"deny-set-skip-taskbar","description":"Denies the set_skip_taskbar command without any pre-configured scope.","commands":{"allow":[],"deny":["set_skip_taskbar"]}},"deny-set-theme":{"identifier":"deny-set-theme","description":"Denies the set_theme command without any pre-configured scope.","commands":{"allow":[],"deny":["set_theme"]}},"deny-set-title":{"identifier":"deny-set-title","description":"Denies the set_title command without any pre-configured scope.","commands":{"allow":[],"deny":["set_title"]}},"deny-set-title-bar-style":{"identifier":"deny-set-title-bar-style","description":"Denies the set_title_bar_style command without any pre-configured scope.","commands":{"allow":[],"deny":["set_title_bar_style"]}},"deny-set-visible-on-all-workspaces":{"identifier":"deny-set-visible-on-all-workspaces","description":"Denies the set_visible_on_all_workspaces command without any pre-configured scope.","commands":{"allow":[],"deny":["set_visible_on_all_workspaces"]}},"deny-show":{"identifier":"deny-show","description":"Denies the show command without any pre-configured scope.","commands":{"allow":[],"deny":["show"]}},"deny-start-dragging":{"identifier":"deny-start-dragging","description":"Denies the start_dragging command without any pre-configured scope.","commands":{"allow":[],"deny":["start_dragging"]}},"deny-start-resize-dragging":{"identifier":"deny-start-resize-dragging","description":"Denies the start_resize_dragging command without any pre-configured scope.","commands":{"allow":[],"deny":["start_resize_dragging"]}},"deny-theme":{"identifier":"deny-theme","description":"Denies the theme command without any pre-configured scope.","commands":{"allow":[],"deny":["theme"]}},"deny-title":{"identifier":"deny-title","description":"Denies the title command without any pre-configured scope.","commands":{"allow":[],"deny":["title"]}},"deny-toggle-maximize":{"identifier":"deny-toggle-maximize","description":"Denies the toggle_maximize command without any pre-configured scope.","commands":{"allow":[],"deny":["toggle_maximize"]}},"deny-unmaximize":{"identifier":"deny-unmaximize","description":"Denies the unmaximize command without any pre-configured scope.","commands":{"allow":[],"deny":["unmaximize"]}},"deny-unminimize":{"identifier":"deny-unminimize","description":"Denies the unminimize command without any pre-configured scope.","commands":{"allow":[],"deny":["unminimize"]}}},"permission_sets":{},"global_scope_schema":null},"devtools":{"default_permission":null,"permissions":{},"permission_sets":{},"global_scope_schema":null},"serialplugin":{"default_permission":{"identifier":"default","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","permissions":["allow-managed-ports","allow-available-ports","allow-available-ports-direct","allow-cancel-read","allow-close","allow-close-all","allow-force-close","allow-open","allow-read","allow-write","allow-write-binary","allow-start-listening","allow-stop-listening","allow-available-ports","allow-available-ports-direct","allow-bytes-to-read","allow-bytes-to-write","allow-cancel-read","allow-clear-break","allow-clear-buffer","allow-close","allow-close-all","allow-force-close","allow-managed-ports","allow-open","allow-read","allow-read-binary","allow-read-carrier-detect","allow-read-cd","allow-read-clear-to-send","allow-read-cts","allow-read-data-set-ready","allow-read-dsr","allow-read-dtr","allow-read-ri","allow-read-ring-indicator","allow-set-baud-rate","allow-set-break","allow-set-data-bits","allow-set-flow-control","allow-set-parity","allow-set-stop-bits","allow-set-timeout","allow-start-listening","allow-stop-listening","allow-write","allow-write-binary","allow-write-data-terminal-ready","allow-write-dtr","allow-write-request-to-send","allow-write-rts","allow-set-log-level","allow-get-log-level"]},"permissions":{"allow-available-ports":{"identifier":"allow-available-ports","description":"Enables the available_ports command without any pre-configured scope.","commands":{"allow":["available_ports"],"deny":[]}},"allow-available-ports-direct":{"identifier":"allow-available-ports-direct","description":"Enables the available_ports_direct command without any pre-configured scope.","commands":{"allow":["available_ports_direct"],"deny":[]}},"allow-bytes-to-read":{"identifier":"allow-bytes-to-read","description":"Enables the bytes_to_read command without any pre-configured scope.","commands":{"allow":["bytes_to_read"],"deny":[]}},"allow-bytes-to-write":{"identifier":"allow-bytes-to-write","description":"Enables the bytes_to_write command without any pre-configured scope.","commands":{"allow":["bytes_to_write"],"deny":[]}},"allow-cancel-read":{"identifier":"allow-cancel-read","description":"Enables the cancel_read command without any pre-configured scope.","commands":{"allow":["cancel_read"],"deny":[]}},"allow-clear-break":{"identifier":"allow-clear-break","description":"Enables the clear_break command without any pre-configured scope.","commands":{"allow":["clear_break"],"deny":[]}},"allow-clear-buffer":{"identifier":"allow-clear-buffer","description":"Enables the clear_buffer command without any pre-configured scope.","commands":{"allow":["clear_buffer"],"deny":[]}},"allow-close":{"identifier":"allow-close","description":"Enables the close command without any pre-configured scope.","commands":{"allow":["close"],"deny":[]}},"allow-close-all":{"identifier":"allow-close-all","description":"Enables the close_all command without any pre-configured scope.","commands":{"allow":["close_all"],"deny":[]}},"allow-force-close":{"identifier":"allow-force-close","description":"Enables the force_close command without any pre-configured scope.","commands":{"allow":["force_close"],"deny":[]}},"allow-get-log-level":{"identifier":"allow-get-log-level","description":"Enables the get_log_level command without any pre-configured scope.","commands":{"allow":["get_log_level"],"deny":[]}},"allow-managed-ports":{"identifier":"allow-managed-ports","description":"Enables the managed_ports command without any pre-configured scope.","commands":{"allow":["managed_ports"],"deny":[]}},"allow-open":{"identifier":"allow-open","description":"Enables the open command without any pre-configured scope.","commands":{"allow":["open"],"deny":[]}},"allow-read":{"identifier":"allow-read","description":"Enables the read command without any pre-configured scope.","commands":{"allow":["read"],"deny":[]}},"allow-read-binary":{"identifier":"allow-read-binary","description":"Enables the read_binary command without any pre-configured scope.","commands":{"allow":["read_binary"],"deny":[]}},"allow-read-carrier-detect":{"identifier":"allow-read-carrier-detect","description":"Enables the read_carrier_detect command without any pre-configured scope.","commands":{"allow":["read_carrier_detect"],"deny":[]}},"allow-read-cd":{"identifier":"allow-read-cd","description":"Enables the read_cd command without any pre-configured scope.","commands":{"allow":["read_cd"],"deny":[]}},"allow-read-clear-to-send":{"identifier":"allow-read-clear-to-send","description":"Enables the read_clear_to_send command without any pre-configured scope.","commands":{"allow":["read_clear_to_send"],"deny":[]}},"allow-read-cts":{"identifier":"allow-read-cts","description":"Enables the read_cts command without any pre-configured scope.","commands":{"allow":["read_cts"],"deny":[]}},"allow-read-data-set-ready":{"identifier":"allow-read-data-set-ready","description":"Enables the read_data_set_ready command without any pre-configured scope.","commands":{"allow":["read_data_set_ready"],"deny":[]}},"allow-read-dsr":{"identifier":"allow-read-dsr","description":"Enables the read_dsr command without any pre-configured scope.","commands":{"allow":["read_dsr"],"deny":[]}},"allow-read-dtr":{"identifier":"allow-read-dtr","description":"Enables the read_dtr command without any pre-configured scope.","commands":{"allow":["read_dtr"],"deny":[]}},"allow-read-ri":{"identifier":"allow-read-ri","description":"Enables the read_ri command without any pre-configured scope.","commands":{"allow":["read_ri"],"deny":[]}},"allow-read-ring-indicator":{"identifier":"allow-read-ring-indicator","description":"Enables the read_ring_indicator command without any pre-configured scope.","commands":{"allow":["read_ring_indicator"],"deny":[]}},"allow-set-baud-rate":{"identifier":"allow-set-baud-rate","description":"Enables the set_baud_rate command without any pre-configured scope.","commands":{"allow":["set_baud_rate"],"deny":[]}},"allow-set-break":{"identifier":"allow-set-break","description":"Enables the set_break command without any pre-configured scope.","commands":{"allow":["set_break"],"deny":[]}},"allow-set-data-bits":{"identifier":"allow-set-data-bits","description":"Enables the set_data_bits command without any pre-configured scope.","commands":{"allow":["set_data_bits"],"deny":[]}},"allow-set-flow-control":{"identifier":"allow-set-flow-control","description":"Enables the set_flow_control command without any pre-configured scope.","commands":{"allow":["set_flow_control"],"deny":[]}},"allow-set-log-level":{"identifier":"allow-set-log-level","description":"Enables the set_log_level command without any pre-configured scope.","commands":{"allow":["set_log_level"],"deny":[]}},"allow-set-parity":{"identifier":"allow-set-parity","description":"Enables the set_parity command without any pre-configured scope.","commands":{"allow":["set_parity"],"deny":[]}},"allow-set-stop-bits":{"identifier":"allow-set-stop-bits","description":"Enables the set_stop_bits command without any pre-configured scope.","commands":{"allow":["set_stop_bits"],"deny":[]}},"allow-set-timeout":{"identifier":"allow-set-timeout","description":"Enables the set_timeout command without any pre-configured scope.","commands":{"allow":["set_timeout"],"deny":[]}},"allow-start-listening":{"identifier":"allow-start-listening","description":"Enables the start_listening command without any pre-configured scope.","commands":{"allow":["start_listening"],"deny":[]}},"allow-stop-listening":{"identifier":"allow-stop-listening","description":"Enables the stop_listening command without any pre-configured scope.","commands":{"allow":["stop_listening"],"deny":[]}},"allow-write":{"identifier":"allow-write","description":"Enables the write command without any pre-configured scope.","commands":{"allow":["write"],"deny":[]}},"allow-write-binary":{"identifier":"allow-write-binary","description":"Enables the write_binary command without any pre-configured scope.","commands":{"allow":["write_binary"],"deny":[]}},"allow-write-data-terminal-ready":{"identifier":"allow-write-data-terminal-ready","description":"Enables the write_data_terminal_ready command without any pre-configured scope.","commands":{"allow":["write_data_terminal_ready"],"deny":[]}},"allow-write-dtr":{"identifier":"allow-write-dtr","description":"Enables the write_dtr command without any pre-configured scope.","commands":{"allow":["write_dtr"],"deny":[]}},"allow-write-request-to-send":{"identifier":"allow-write-request-to-send","description":"Enables the write_request_to_send command without any pre-configured scope.","commands":{"allow":["write_request_to_send"],"deny":[]}},"allow-write-rts":{"identifier":"allow-write-rts","description":"Enables the write_rts command without any pre-configured scope.","commands":{"allow":["write_rts"],"deny":[]}},"deny-available-ports":{"identifier":"deny-available-ports","description":"Denies the available_ports command without any pre-configured scope.","commands":{"allow":[],"deny":["available_ports"]}},"deny-available-ports-direct":{"identifier":"deny-available-ports-direct","description":"Denies the available_ports_direct command without any pre-configured scope.","commands":{"allow":[],"deny":["available_ports_direct"]}},"deny-bytes-to-read":{"identifier":"deny-bytes-to-read","description":"Denies the bytes_to_read command without any pre-configured scope.","commands":{"allow":[],"deny":["bytes_to_read"]}},"deny-bytes-to-write":{"identifier":"deny-bytes-to-write","description":"Denies the bytes_to_write command without any pre-configured scope.","commands":{"allow":[],"deny":["bytes_to_write"]}},"deny-cancel-read":{"identifier":"deny-cancel-read","description":"Denies the cancel_read command without any pre-configured scope.","commands":{"allow":[],"deny":["cancel_read"]}},"deny-clear-break":{"identifier":"deny-clear-break","description":"Denies the clear_break command without any pre-configured scope.","commands":{"allow":[],"deny":["clear_break"]}},"deny-clear-buffer":{"identifier":"deny-clear-buffer","description":"Denies the clear_buffer command without any pre-configured scope.","commands":{"allow":[],"deny":["clear_buffer"]}},"deny-close":{"identifier":"deny-close","description":"Denies the close command without any pre-configured scope.","commands":{"allow":[],"deny":["close"]}},"deny-close-all":{"identifier":"deny-close-all","description":"Denies the close_all command without any pre-configured scope.","commands":{"allow":[],"deny":["close_all"]}},"deny-force-close":{"identifier":"deny-force-close","description":"Denies the force_close command without any pre-configured scope.","commands":{"allow":[],"deny":["force_close"]}},"deny-get-log-level":{"identifier":"deny-get-log-level","description":"Denies the get_log_level command without any pre-configured scope.","commands":{"allow":[],"deny":["get_log_level"]}},"deny-managed-ports":{"identifier":"deny-managed-ports","description":"Denies the managed_ports command without any pre-configured scope.","commands":{"allow":[],"deny":["managed_ports"]}},"deny-open":{"identifier":"deny-open","description":"Denies the open command without any pre-configured scope.","commands":{"allow":[],"deny":["open"]}},"deny-read":{"identifier":"deny-read","description":"Denies the read command without any pre-configured scope.","commands":{"allow":[],"deny":["read"]}},"deny-read-binary":{"identifier":"deny-read-binary","description":"Denies the read_binary command without any pre-configured scope.","commands":{"allow":[],"deny":["read_binary"]}},"deny-read-carrier-detect":{"identifier":"deny-read-carrier-detect","description":"Denies the read_carrier_detect command without any pre-configured scope.","commands":{"allow":[],"deny":["read_carrier_detect"]}},"deny-read-cd":{"identifier":"deny-read-cd","description":"Denies the read_cd command without any pre-configured scope.","commands":{"allow":[],"deny":["read_cd"]}},"deny-read-clear-to-send":{"identifier":"deny-read-clear-to-send","description":"Denies the read_clear_to_send command without any pre-configured scope.","commands":{"allow":[],"deny":["read_clear_to_send"]}},"deny-read-cts":{"identifier":"deny-read-cts","description":"Denies the read_cts command without any pre-configured scope.","commands":{"allow":[],"deny":["read_cts"]}},"deny-read-data-set-ready":{"identifier":"deny-read-data-set-ready","description":"Denies the read_data_set_ready command without any pre-configured scope.","commands":{"allow":[],"deny":["read_data_set_ready"]}},"deny-read-dsr":{"identifier":"deny-read-dsr","description":"Denies the read_dsr command without any pre-configured scope.","commands":{"allow":[],"deny":["read_dsr"]}},"deny-read-dtr":{"identifier":"deny-read-dtr","description":"Denies the read_dtr command without any pre-configured scope.","commands":{"allow":[],"deny":["read_dtr"]}},"deny-read-ri":{"identifier":"deny-read-ri","description":"Denies the read_ri command without any pre-configured scope.","commands":{"allow":[],"deny":["read_ri"]}},"deny-read-ring-indicator":{"identifier":"deny-read-ring-indicator","description":"Denies the read_ring_indicator command without any pre-configured scope.","commands":{"allow":[],"deny":["read_ring_indicator"]}},"deny-set-baud-rate":{"identifier":"deny-set-baud-rate","description":"Denies the set_baud_rate command without any pre-configured scope.","commands":{"allow":[],"deny":["set_baud_rate"]}},"deny-set-break":{"identifier":"deny-set-break","description":"Denies the set_break command without any pre-configured scope.","commands":{"allow":[],"deny":["set_break"]}},"deny-set-data-bits":{"identifier":"deny-set-data-bits","description":"Denies the set_data_bits command without any pre-configured scope.","commands":{"allow":[],"deny":["set_data_bits"]}},"deny-set-flow-control":{"identifier":"deny-set-flow-control","description":"Denies the set_flow_control command without any pre-configured scope.","commands":{"allow":[],"deny":["set_flow_control"]}},"deny-set-log-level":{"identifier":"deny-set-log-level","description":"Denies the set_log_level command without any pre-configured scope.","commands":{"allow":[],"deny":["set_log_level"]}},"deny-set-parity":{"identifier":"deny-set-parity","description":"Denies the set_parity command without any pre-configured scope.","commands":{"allow":[],"deny":["set_parity"]}},"deny-set-stop-bits":{"identifier":"deny-set-stop-bits","description":"Denies the set_stop_bits command without any pre-configured scope.","commands":{"allow":[],"deny":["set_stop_bits"]}},"deny-set-timeout":{"identifier":"deny-set-timeout","description":"Denies the set_timeout command without any pre-configured scope.","commands":{"allow":[],"deny":["set_timeout"]}},"deny-start-listening":{"identifier":"deny-start-listening","description":"Denies the start_listening command without any pre-configured scope.","commands":{"allow":[],"deny":["start_listening"]}},"deny-stop-listening":{"identifier":"deny-stop-listening","description":"Denies the stop_listening command without any pre-configured scope.","commands":{"allow":[],"deny":["stop_listening"]}},"deny-write":{"identifier":"deny-write","description":"Denies the write command without any pre-configured scope.","commands":{"allow":[],"deny":["write"]}},"deny-write-binary":{"identifier":"deny-write-binary","description":"Denies the write_binary command without any pre-configured scope.","commands":{"allow":[],"deny":["write_binary"]}},"deny-write-data-terminal-ready":{"identifier":"deny-write-data-terminal-ready","description":"Denies the write_data_terminal_ready command without any pre-configured scope.","commands":{"allow":[],"deny":["write_data_terminal_ready"]}},"deny-write-dtr":{"identifier":"deny-write-dtr","description":"Denies the write_dtr command without any pre-configured scope.","commands":{"allow":[],"deny":["write_dtr"]}},"deny-write-request-to-send":{"identifier":"deny-write-request-to-send","description":"Denies the write_request_to_send command without any pre-configured scope.","commands":{"allow":[],"deny":["write_request_to_send"]}},"deny-write-rts":{"identifier":"deny-write-rts","description":"Denies the write_rts command without any pre-configured scope.","commands":{"allow":[],"deny":["write_rts"]}}},"permission_sets":{},"global_scope_schema":null}} \ No newline at end of file +{"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-set-app-theme":{"identifier":"allow-set-app-theme","description":"Enables the set_app_theme command without any pre-configured scope.","commands":{"allow":["set_app_theme"],"deny":[]}},"allow-set-dock-visibility":{"identifier":"allow-set-dock-visibility","description":"Enables the set_dock_visibility command without any pre-configured scope.","commands":{"allow":["set_dock_visibility"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-fetch-data-store-identifiers":{"identifier":"deny-fetch-data-store-identifiers","description":"Denies the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":[],"deny":["fetch_data_store_identifiers"]}},"deny-identifier":{"identifier":"deny-identifier","description":"Denies the identifier command without any pre-configured scope.","commands":{"allow":[],"deny":["identifier"]}},"deny-name":{"identifier":"deny-name","description":"Denies the name command without any pre-configured scope.","commands":{"allow":[],"deny":["name"]}},"deny-remove-data-store":{"identifier":"deny-remove-data-store","description":"Denies the remove_data_store command without any pre-configured scope.","commands":{"allow":[],"deny":["remove_data_store"]}},"deny-set-app-theme":{"identifier":"deny-set-app-theme","description":"Denies the set_app_theme command without any pre-configured scope.","commands":{"allow":[],"deny":["set_app_theme"]}},"deny-set-dock-visibility":{"identifier":"deny-set-dock-visibility","description":"Denies the set_dock_visibility command without any pre-configured scope.","commands":{"allow":[],"deny":["set_dock_visibility"]}},"deny-tauri-version":{"identifier":"deny-tauri-version","description":"Denies the tauri_version command without any pre-configured scope.","commands":{"allow":[],"deny":["tauri_version"]}},"deny-version":{"identifier":"deny-version","description":"Denies the version command without any pre-configured scope.","commands":{"allow":[],"deny":["version"]}}},"permission_sets":{},"global_scope_schema":null},"core:event":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-listen","allow-unlisten","allow-emit","allow-emit-to"]},"permissions":{"allow-emit":{"identifier":"allow-emit","description":"Enables the emit command without any pre-configured scope.","commands":{"allow":["emit"],"deny":[]}},"allow-emit-to":{"identifier":"allow-emit-to","description":"Enables the emit_to command without any pre-configured scope.","commands":{"allow":["emit_to"],"deny":[]}},"allow-listen":{"identifier":"allow-listen","description":"Enables the listen command without any pre-configured scope.","commands":{"allow":["listen"],"deny":[]}},"allow-unlisten":{"identifier":"allow-unlisten","description":"Enables the unlisten command without any pre-configured scope.","commands":{"allow":["unlisten"],"deny":[]}},"deny-emit":{"identifier":"deny-emit","description":"Denies the emit command without any pre-configured scope.","commands":{"allow":[],"deny":["emit"]}},"deny-emit-to":{"identifier":"deny-emit-to","description":"Denies the emit_to command without any pre-configured scope.","commands":{"allow":[],"deny":["emit_to"]}},"deny-listen":{"identifier":"deny-listen","description":"Denies the listen command without any pre-configured scope.","commands":{"allow":[],"deny":["listen"]}},"deny-unlisten":{"identifier":"deny-unlisten","description":"Denies the unlisten command without any pre-configured scope.","commands":{"allow":[],"deny":["unlisten"]}}},"permission_sets":{},"global_scope_schema":null},"core:image":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-new","allow-from-bytes","allow-from-path","allow-rgba","allow-size"]},"permissions":{"allow-from-bytes":{"identifier":"allow-from-bytes","description":"Enables the from_bytes command without any pre-configured scope.","commands":{"allow":["from_bytes"],"deny":[]}},"allow-from-path":{"identifier":"allow-from-path","description":"Enables the from_path command without any pre-configured scope.","commands":{"allow":["from_path"],"deny":[]}},"allow-new":{"identifier":"allow-new","description":"Enables the new command without any pre-configured scope.","commands":{"allow":["new"],"deny":[]}},"allow-rgba":{"identifier":"allow-rgba","description":"Enables the rgba command without any pre-configured scope.","commands":{"allow":["rgba"],"deny":[]}},"allow-size":{"identifier":"allow-size","description":"Enables the size command without any pre-configured scope.","commands":{"allow":["size"],"deny":[]}},"deny-from-bytes":{"identifier":"deny-from-bytes","description":"Denies the from_bytes command without any pre-configured scope.","commands":{"allow":[],"deny":["from_bytes"]}},"deny-from-path":{"identifier":"deny-from-path","description":"Denies the from_path command without any pre-configured scope.","commands":{"allow":[],"deny":["from_path"]}},"deny-new":{"identifier":"deny-new","description":"Denies the new command without any pre-configured scope.","commands":{"allow":[],"deny":["new"]}},"deny-rgba":{"identifier":"deny-rgba","description":"Denies the rgba command without any pre-configured scope.","commands":{"allow":[],"deny":["rgba"]}},"deny-size":{"identifier":"deny-size","description":"Denies the size command without any pre-configured scope.","commands":{"allow":[],"deny":["size"]}}},"permission_sets":{},"global_scope_schema":null},"core:menu":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-new","allow-append","allow-prepend","allow-insert","allow-remove","allow-remove-at","allow-items","allow-get","allow-popup","allow-create-default","allow-set-as-app-menu","allow-set-as-window-menu","allow-text","allow-set-text","allow-is-enabled","allow-set-enabled","allow-set-accelerator","allow-set-as-windows-menu-for-nsapp","allow-set-as-help-menu-for-nsapp","allow-is-checked","allow-set-checked","allow-set-icon"]},"permissions":{"allow-append":{"identifier":"allow-append","description":"Enables the append command without any pre-configured scope.","commands":{"allow":["append"],"deny":[]}},"allow-create-default":{"identifier":"allow-create-default","description":"Enables the create_default command without any pre-configured scope.","commands":{"allow":["create_default"],"deny":[]}},"allow-get":{"identifier":"allow-get","description":"Enables the get command without any pre-configured scope.","commands":{"allow":["get"],"deny":[]}},"allow-insert":{"identifier":"allow-insert","description":"Enables the insert command without any pre-configured scope.","commands":{"allow":["insert"],"deny":[]}},"allow-is-checked":{"identifier":"allow-is-checked","description":"Enables the is_checked command without any pre-configured scope.","commands":{"allow":["is_checked"],"deny":[]}},"allow-is-enabled":{"identifier":"allow-is-enabled","description":"Enables the is_enabled command without any pre-configured scope.","commands":{"allow":["is_enabled"],"deny":[]}},"allow-items":{"identifier":"allow-items","description":"Enables the items command without any pre-configured scope.","commands":{"allow":["items"],"deny":[]}},"allow-new":{"identifier":"allow-new","description":"Enables the new command without any pre-configured scope.","commands":{"allow":["new"],"deny":[]}},"allow-popup":{"identifier":"allow-popup","description":"Enables the popup command without any pre-configured scope.","commands":{"allow":["popup"],"deny":[]}},"allow-prepend":{"identifier":"allow-prepend","description":"Enables the prepend command without any pre-configured scope.","commands":{"allow":["prepend"],"deny":[]}},"allow-remove":{"identifier":"allow-remove","description":"Enables the remove command without any pre-configured scope.","commands":{"allow":["remove"],"deny":[]}},"allow-remove-at":{"identifier":"allow-remove-at","description":"Enables the remove_at command without any pre-configured scope.","commands":{"allow":["remove_at"],"deny":[]}},"allow-set-accelerator":{"identifier":"allow-set-accelerator","description":"Enables the set_accelerator command without any pre-configured scope.","commands":{"allow":["set_accelerator"],"deny":[]}},"allow-set-as-app-menu":{"identifier":"allow-set-as-app-menu","description":"Enables the set_as_app_menu command without any pre-configured scope.","commands":{"allow":["set_as_app_menu"],"deny":[]}},"allow-set-as-help-menu-for-nsapp":{"identifier":"allow-set-as-help-menu-for-nsapp","description":"Enables the set_as_help_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":["set_as_help_menu_for_nsapp"],"deny":[]}},"allow-set-as-window-menu":{"identifier":"allow-set-as-window-menu","description":"Enables the set_as_window_menu command without any pre-configured scope.","commands":{"allow":["set_as_window_menu"],"deny":[]}},"allow-set-as-windows-menu-for-nsapp":{"identifier":"allow-set-as-windows-menu-for-nsapp","description":"Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":["set_as_windows_menu_for_nsapp"],"deny":[]}},"allow-set-checked":{"identifier":"allow-set-checked","description":"Enables the set_checked command without any pre-configured scope.","commands":{"allow":["set_checked"],"deny":[]}},"allow-set-enabled":{"identifier":"allow-set-enabled","description":"Enables the set_enabled command without any pre-configured scope.","commands":{"allow":["set_enabled"],"deny":[]}},"allow-set-icon":{"identifier":"allow-set-icon","description":"Enables the set_icon command without any pre-configured scope.","commands":{"allow":["set_icon"],"deny":[]}},"allow-set-text":{"identifier":"allow-set-text","description":"Enables the set_text command without any pre-configured scope.","commands":{"allow":["set_text"],"deny":[]}},"allow-text":{"identifier":"allow-text","description":"Enables the text command without any pre-configured scope.","commands":{"allow":["text"],"deny":[]}},"deny-append":{"identifier":"deny-append","description":"Denies the append command without any pre-configured scope.","commands":{"allow":[],"deny":["append"]}},"deny-create-default":{"identifier":"deny-create-default","description":"Denies the create_default command without any pre-configured scope.","commands":{"allow":[],"deny":["create_default"]}},"deny-get":{"identifier":"deny-get","description":"Denies the get command without any pre-configured scope.","commands":{"allow":[],"deny":["get"]}},"deny-insert":{"identifier":"deny-insert","description":"Denies the insert command without any pre-configured scope.","commands":{"allow":[],"deny":["insert"]}},"deny-is-checked":{"identifier":"deny-is-checked","description":"Denies the is_checked command without any pre-configured scope.","commands":{"allow":[],"deny":["is_checked"]}},"deny-is-enabled":{"identifier":"deny-is-enabled","description":"Denies the is_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["is_enabled"]}},"deny-items":{"identifier":"deny-items","description":"Denies the items command without any pre-configured scope.","commands":{"allow":[],"deny":["items"]}},"deny-new":{"identifier":"deny-new","description":"Denies the new command without any pre-configured scope.","commands":{"allow":[],"deny":["new"]}},"deny-popup":{"identifier":"deny-popup","description":"Denies the popup command without any pre-configured scope.","commands":{"allow":[],"deny":["popup"]}},"deny-prepend":{"identifier":"deny-prepend","description":"Denies the prepend command without any pre-configured scope.","commands":{"allow":[],"deny":["prepend"]}},"deny-remove":{"identifier":"deny-remove","description":"Denies the remove command without any pre-configured scope.","commands":{"allow":[],"deny":["remove"]}},"deny-remove-at":{"identifier":"deny-remove-at","description":"Denies the remove_at command without any pre-configured scope.","commands":{"allow":[],"deny":["remove_at"]}},"deny-set-accelerator":{"identifier":"deny-set-accelerator","description":"Denies the set_accelerator command without any pre-configured scope.","commands":{"allow":[],"deny":["set_accelerator"]}},"deny-set-as-app-menu":{"identifier":"deny-set-as-app-menu","description":"Denies the set_as_app_menu command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_app_menu"]}},"deny-set-as-help-menu-for-nsapp":{"identifier":"deny-set-as-help-menu-for-nsapp","description":"Denies the set_as_help_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_help_menu_for_nsapp"]}},"deny-set-as-window-menu":{"identifier":"deny-set-as-window-menu","description":"Denies the set_as_window_menu command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_window_menu"]}},"deny-set-as-windows-menu-for-nsapp":{"identifier":"deny-set-as-windows-menu-for-nsapp","description":"Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope.","commands":{"allow":[],"deny":["set_as_windows_menu_for_nsapp"]}},"deny-set-checked":{"identifier":"deny-set-checked","description":"Denies the set_checked command without any pre-configured scope.","commands":{"allow":[],"deny":["set_checked"]}},"deny-set-enabled":{"identifier":"deny-set-enabled","description":"Denies the set_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["set_enabled"]}},"deny-set-icon":{"identifier":"deny-set-icon","description":"Denies the set_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon"]}},"deny-set-text":{"identifier":"deny-set-text","description":"Denies the set_text command without any pre-configured scope.","commands":{"allow":[],"deny":["set_text"]}},"deny-text":{"identifier":"deny-text","description":"Denies the text command without any pre-configured scope.","commands":{"allow":[],"deny":["text"]}}},"permission_sets":{},"global_scope_schema":null},"core:path":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-resolve-directory","allow-resolve","allow-normalize","allow-join","allow-dirname","allow-extname","allow-basename","allow-is-absolute"]},"permissions":{"allow-basename":{"identifier":"allow-basename","description":"Enables the basename command without any pre-configured scope.","commands":{"allow":["basename"],"deny":[]}},"allow-dirname":{"identifier":"allow-dirname","description":"Enables the dirname command without any pre-configured scope.","commands":{"allow":["dirname"],"deny":[]}},"allow-extname":{"identifier":"allow-extname","description":"Enables the extname command without any pre-configured scope.","commands":{"allow":["extname"],"deny":[]}},"allow-is-absolute":{"identifier":"allow-is-absolute","description":"Enables the is_absolute command without any pre-configured scope.","commands":{"allow":["is_absolute"],"deny":[]}},"allow-join":{"identifier":"allow-join","description":"Enables the join command without any pre-configured scope.","commands":{"allow":["join"],"deny":[]}},"allow-normalize":{"identifier":"allow-normalize","description":"Enables the normalize command without any pre-configured scope.","commands":{"allow":["normalize"],"deny":[]}},"allow-resolve":{"identifier":"allow-resolve","description":"Enables the resolve command without any pre-configured scope.","commands":{"allow":["resolve"],"deny":[]}},"allow-resolve-directory":{"identifier":"allow-resolve-directory","description":"Enables the resolve_directory command without any pre-configured scope.","commands":{"allow":["resolve_directory"],"deny":[]}},"deny-basename":{"identifier":"deny-basename","description":"Denies the basename command without any pre-configured scope.","commands":{"allow":[],"deny":["basename"]}},"deny-dirname":{"identifier":"deny-dirname","description":"Denies the dirname command without any pre-configured scope.","commands":{"allow":[],"deny":["dirname"]}},"deny-extname":{"identifier":"deny-extname","description":"Denies the extname command without any pre-configured scope.","commands":{"allow":[],"deny":["extname"]}},"deny-is-absolute":{"identifier":"deny-is-absolute","description":"Denies the is_absolute command without any pre-configured scope.","commands":{"allow":[],"deny":["is_absolute"]}},"deny-join":{"identifier":"deny-join","description":"Denies the join command without any pre-configured scope.","commands":{"allow":[],"deny":["join"]}},"deny-normalize":{"identifier":"deny-normalize","description":"Denies the normalize command without any pre-configured scope.","commands":{"allow":[],"deny":["normalize"]}},"deny-resolve":{"identifier":"deny-resolve","description":"Denies the resolve command without any pre-configured scope.","commands":{"allow":[],"deny":["resolve"]}},"deny-resolve-directory":{"identifier":"deny-resolve-directory","description":"Denies the resolve_directory command without any pre-configured scope.","commands":{"allow":[],"deny":["resolve_directory"]}}},"permission_sets":{},"global_scope_schema":null},"core:resources":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-close"]},"permissions":{"allow-close":{"identifier":"allow-close","description":"Enables the close command without any pre-configured scope.","commands":{"allow":["close"],"deny":[]}},"deny-close":{"identifier":"deny-close","description":"Denies the close command without any pre-configured scope.","commands":{"allow":[],"deny":["close"]}}},"permission_sets":{},"global_scope_schema":null},"core:tray":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin, which enables all commands.","permissions":["allow-new","allow-get-by-id","allow-remove-by-id","allow-set-icon","allow-set-menu","allow-set-tooltip","allow-set-title","allow-set-visible","allow-set-temp-dir-path","allow-set-icon-as-template","allow-set-show-menu-on-left-click"]},"permissions":{"allow-get-by-id":{"identifier":"allow-get-by-id","description":"Enables the get_by_id command without any pre-configured scope.","commands":{"allow":["get_by_id"],"deny":[]}},"allow-new":{"identifier":"allow-new","description":"Enables the new command without any pre-configured scope.","commands":{"allow":["new"],"deny":[]}},"allow-remove-by-id":{"identifier":"allow-remove-by-id","description":"Enables the remove_by_id command without any pre-configured scope.","commands":{"allow":["remove_by_id"],"deny":[]}},"allow-set-icon":{"identifier":"allow-set-icon","description":"Enables the set_icon command without any pre-configured scope.","commands":{"allow":["set_icon"],"deny":[]}},"allow-set-icon-as-template":{"identifier":"allow-set-icon-as-template","description":"Enables the set_icon_as_template command without any pre-configured scope.","commands":{"allow":["set_icon_as_template"],"deny":[]}},"allow-set-menu":{"identifier":"allow-set-menu","description":"Enables the set_menu command without any pre-configured scope.","commands":{"allow":["set_menu"],"deny":[]}},"allow-set-show-menu-on-left-click":{"identifier":"allow-set-show-menu-on-left-click","description":"Enables the set_show_menu_on_left_click command without any pre-configured scope.","commands":{"allow":["set_show_menu_on_left_click"],"deny":[]}},"allow-set-temp-dir-path":{"identifier":"allow-set-temp-dir-path","description":"Enables the set_temp_dir_path command without any pre-configured scope.","commands":{"allow":["set_temp_dir_path"],"deny":[]}},"allow-set-title":{"identifier":"allow-set-title","description":"Enables the set_title command without any pre-configured scope.","commands":{"allow":["set_title"],"deny":[]}},"allow-set-tooltip":{"identifier":"allow-set-tooltip","description":"Enables the set_tooltip command without any pre-configured scope.","commands":{"allow":["set_tooltip"],"deny":[]}},"allow-set-visible":{"identifier":"allow-set-visible","description":"Enables the set_visible command without any pre-configured scope.","commands":{"allow":["set_visible"],"deny":[]}},"deny-get-by-id":{"identifier":"deny-get-by-id","description":"Denies the get_by_id command without any pre-configured scope.","commands":{"allow":[],"deny":["get_by_id"]}},"deny-new":{"identifier":"deny-new","description":"Denies the new command without any pre-configured scope.","commands":{"allow":[],"deny":["new"]}},"deny-remove-by-id":{"identifier":"deny-remove-by-id","description":"Denies the remove_by_id command without any pre-configured scope.","commands":{"allow":[],"deny":["remove_by_id"]}},"deny-set-icon":{"identifier":"deny-set-icon","description":"Denies the set_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon"]}},"deny-set-icon-as-template":{"identifier":"deny-set-icon-as-template","description":"Denies the set_icon_as_template command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon_as_template"]}},"deny-set-menu":{"identifier":"deny-set-menu","description":"Denies the set_menu command without any pre-configured scope.","commands":{"allow":[],"deny":["set_menu"]}},"deny-set-show-menu-on-left-click":{"identifier":"deny-set-show-menu-on-left-click","description":"Denies the set_show_menu_on_left_click command without any pre-configured scope.","commands":{"allow":[],"deny":["set_show_menu_on_left_click"]}},"deny-set-temp-dir-path":{"identifier":"deny-set-temp-dir-path","description":"Denies the set_temp_dir_path command without any pre-configured scope.","commands":{"allow":[],"deny":["set_temp_dir_path"]}},"deny-set-title":{"identifier":"deny-set-title","description":"Denies the set_title command without any pre-configured scope.","commands":{"allow":[],"deny":["set_title"]}},"deny-set-tooltip":{"identifier":"deny-set-tooltip","description":"Denies the set_tooltip command without any pre-configured scope.","commands":{"allow":[],"deny":["set_tooltip"]}},"deny-set-visible":{"identifier":"deny-set-visible","description":"Denies the set_visible command without any pre-configured scope.","commands":{"allow":[],"deny":["set_visible"]}}},"permission_sets":{},"global_scope_schema":null},"core:webview":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-get-all-webviews","allow-webview-position","allow-webview-size","allow-internal-toggle-devtools"]},"permissions":{"allow-clear-all-browsing-data":{"identifier":"allow-clear-all-browsing-data","description":"Enables the clear_all_browsing_data command without any pre-configured scope.","commands":{"allow":["clear_all_browsing_data"],"deny":[]}},"allow-create-webview":{"identifier":"allow-create-webview","description":"Enables the create_webview command without any pre-configured scope.","commands":{"allow":["create_webview"],"deny":[]}},"allow-create-webview-window":{"identifier":"allow-create-webview-window","description":"Enables the create_webview_window command without any pre-configured scope.","commands":{"allow":["create_webview_window"],"deny":[]}},"allow-get-all-webviews":{"identifier":"allow-get-all-webviews","description":"Enables the get_all_webviews command without any pre-configured scope.","commands":{"allow":["get_all_webviews"],"deny":[]}},"allow-internal-toggle-devtools":{"identifier":"allow-internal-toggle-devtools","description":"Enables the internal_toggle_devtools command without any pre-configured scope.","commands":{"allow":["internal_toggle_devtools"],"deny":[]}},"allow-print":{"identifier":"allow-print","description":"Enables the print command without any pre-configured scope.","commands":{"allow":["print"],"deny":[]}},"allow-reparent":{"identifier":"allow-reparent","description":"Enables the reparent command without any pre-configured scope.","commands":{"allow":["reparent"],"deny":[]}},"allow-set-webview-auto-resize":{"identifier":"allow-set-webview-auto-resize","description":"Enables the set_webview_auto_resize command without any pre-configured scope.","commands":{"allow":["set_webview_auto_resize"],"deny":[]}},"allow-set-webview-background-color":{"identifier":"allow-set-webview-background-color","description":"Enables the set_webview_background_color command without any pre-configured scope.","commands":{"allow":["set_webview_background_color"],"deny":[]}},"allow-set-webview-focus":{"identifier":"allow-set-webview-focus","description":"Enables the set_webview_focus command without any pre-configured scope.","commands":{"allow":["set_webview_focus"],"deny":[]}},"allow-set-webview-position":{"identifier":"allow-set-webview-position","description":"Enables the set_webview_position command without any pre-configured scope.","commands":{"allow":["set_webview_position"],"deny":[]}},"allow-set-webview-size":{"identifier":"allow-set-webview-size","description":"Enables the set_webview_size command without any pre-configured scope.","commands":{"allow":["set_webview_size"],"deny":[]}},"allow-set-webview-zoom":{"identifier":"allow-set-webview-zoom","description":"Enables the set_webview_zoom command without any pre-configured scope.","commands":{"allow":["set_webview_zoom"],"deny":[]}},"allow-webview-close":{"identifier":"allow-webview-close","description":"Enables the webview_close command without any pre-configured scope.","commands":{"allow":["webview_close"],"deny":[]}},"allow-webview-hide":{"identifier":"allow-webview-hide","description":"Enables the webview_hide command without any pre-configured scope.","commands":{"allow":["webview_hide"],"deny":[]}},"allow-webview-position":{"identifier":"allow-webview-position","description":"Enables the webview_position command without any pre-configured scope.","commands":{"allow":["webview_position"],"deny":[]}},"allow-webview-show":{"identifier":"allow-webview-show","description":"Enables the webview_show command without any pre-configured scope.","commands":{"allow":["webview_show"],"deny":[]}},"allow-webview-size":{"identifier":"allow-webview-size","description":"Enables the webview_size command without any pre-configured scope.","commands":{"allow":["webview_size"],"deny":[]}},"deny-clear-all-browsing-data":{"identifier":"deny-clear-all-browsing-data","description":"Denies the clear_all_browsing_data command without any pre-configured scope.","commands":{"allow":[],"deny":["clear_all_browsing_data"]}},"deny-create-webview":{"identifier":"deny-create-webview","description":"Denies the create_webview command without any pre-configured scope.","commands":{"allow":[],"deny":["create_webview"]}},"deny-create-webview-window":{"identifier":"deny-create-webview-window","description":"Denies the create_webview_window command without any pre-configured scope.","commands":{"allow":[],"deny":["create_webview_window"]}},"deny-get-all-webviews":{"identifier":"deny-get-all-webviews","description":"Denies the get_all_webviews command without any pre-configured scope.","commands":{"allow":[],"deny":["get_all_webviews"]}},"deny-internal-toggle-devtools":{"identifier":"deny-internal-toggle-devtools","description":"Denies the internal_toggle_devtools command without any pre-configured scope.","commands":{"allow":[],"deny":["internal_toggle_devtools"]}},"deny-print":{"identifier":"deny-print","description":"Denies the print command without any pre-configured scope.","commands":{"allow":[],"deny":["print"]}},"deny-reparent":{"identifier":"deny-reparent","description":"Denies the reparent command without any pre-configured scope.","commands":{"allow":[],"deny":["reparent"]}},"deny-set-webview-auto-resize":{"identifier":"deny-set-webview-auto-resize","description":"Denies the set_webview_auto_resize command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_auto_resize"]}},"deny-set-webview-background-color":{"identifier":"deny-set-webview-background-color","description":"Denies the set_webview_background_color command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_background_color"]}},"deny-set-webview-focus":{"identifier":"deny-set-webview-focus","description":"Denies the set_webview_focus command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_focus"]}},"deny-set-webview-position":{"identifier":"deny-set-webview-position","description":"Denies the set_webview_position command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_position"]}},"deny-set-webview-size":{"identifier":"deny-set-webview-size","description":"Denies the set_webview_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_size"]}},"deny-set-webview-zoom":{"identifier":"deny-set-webview-zoom","description":"Denies the set_webview_zoom command without any pre-configured scope.","commands":{"allow":[],"deny":["set_webview_zoom"]}},"deny-webview-close":{"identifier":"deny-webview-close","description":"Denies the webview_close command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_close"]}},"deny-webview-hide":{"identifier":"deny-webview-hide","description":"Denies the webview_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_hide"]}},"deny-webview-position":{"identifier":"deny-webview-position","description":"Denies the webview_position command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_position"]}},"deny-webview-show":{"identifier":"deny-webview-show","description":"Denies the webview_show command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_show"]}},"deny-webview-size":{"identifier":"deny-webview-size","description":"Denies the webview_size command without any pre-configured scope.","commands":{"allow":[],"deny":["webview_size"]}}},"permission_sets":{},"global_scope_schema":null},"core:window":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-get-all-windows","allow-scale-factor","allow-inner-position","allow-outer-position","allow-inner-size","allow-outer-size","allow-is-fullscreen","allow-is-minimized","allow-is-maximized","allow-is-focused","allow-is-decorated","allow-is-resizable","allow-is-maximizable","allow-is-minimizable","allow-is-closable","allow-is-visible","allow-is-enabled","allow-title","allow-current-monitor","allow-primary-monitor","allow-monitor-from-point","allow-available-monitors","allow-cursor-position","allow-theme","allow-is-always-on-top","allow-internal-toggle-maximize"]},"permissions":{"allow-available-monitors":{"identifier":"allow-available-monitors","description":"Enables the available_monitors command without any pre-configured scope.","commands":{"allow":["available_monitors"],"deny":[]}},"allow-center":{"identifier":"allow-center","description":"Enables the center command without any pre-configured scope.","commands":{"allow":["center"],"deny":[]}},"allow-close":{"identifier":"allow-close","description":"Enables the close command without any pre-configured scope.","commands":{"allow":["close"],"deny":[]}},"allow-create":{"identifier":"allow-create","description":"Enables the create command without any pre-configured scope.","commands":{"allow":["create"],"deny":[]}},"allow-current-monitor":{"identifier":"allow-current-monitor","description":"Enables the current_monitor command without any pre-configured scope.","commands":{"allow":["current_monitor"],"deny":[]}},"allow-cursor-position":{"identifier":"allow-cursor-position","description":"Enables the cursor_position command without any pre-configured scope.","commands":{"allow":["cursor_position"],"deny":[]}},"allow-destroy":{"identifier":"allow-destroy","description":"Enables the destroy command without any pre-configured scope.","commands":{"allow":["destroy"],"deny":[]}},"allow-get-all-windows":{"identifier":"allow-get-all-windows","description":"Enables the get_all_windows command without any pre-configured scope.","commands":{"allow":["get_all_windows"],"deny":[]}},"allow-hide":{"identifier":"allow-hide","description":"Enables the hide command without any pre-configured scope.","commands":{"allow":["hide"],"deny":[]}},"allow-inner-position":{"identifier":"allow-inner-position","description":"Enables the inner_position command without any pre-configured scope.","commands":{"allow":["inner_position"],"deny":[]}},"allow-inner-size":{"identifier":"allow-inner-size","description":"Enables the inner_size command without any pre-configured scope.","commands":{"allow":["inner_size"],"deny":[]}},"allow-internal-toggle-maximize":{"identifier":"allow-internal-toggle-maximize","description":"Enables the internal_toggle_maximize command without any pre-configured scope.","commands":{"allow":["internal_toggle_maximize"],"deny":[]}},"allow-is-always-on-top":{"identifier":"allow-is-always-on-top","description":"Enables the is_always_on_top command without any pre-configured scope.","commands":{"allow":["is_always_on_top"],"deny":[]}},"allow-is-closable":{"identifier":"allow-is-closable","description":"Enables the is_closable command without any pre-configured scope.","commands":{"allow":["is_closable"],"deny":[]}},"allow-is-decorated":{"identifier":"allow-is-decorated","description":"Enables the is_decorated command without any pre-configured scope.","commands":{"allow":["is_decorated"],"deny":[]}},"allow-is-enabled":{"identifier":"allow-is-enabled","description":"Enables the is_enabled command without any pre-configured scope.","commands":{"allow":["is_enabled"],"deny":[]}},"allow-is-focused":{"identifier":"allow-is-focused","description":"Enables the is_focused command without any pre-configured scope.","commands":{"allow":["is_focused"],"deny":[]}},"allow-is-fullscreen":{"identifier":"allow-is-fullscreen","description":"Enables the is_fullscreen command without any pre-configured scope.","commands":{"allow":["is_fullscreen"],"deny":[]}},"allow-is-maximizable":{"identifier":"allow-is-maximizable","description":"Enables the is_maximizable command without any pre-configured scope.","commands":{"allow":["is_maximizable"],"deny":[]}},"allow-is-maximized":{"identifier":"allow-is-maximized","description":"Enables the is_maximized command without any pre-configured scope.","commands":{"allow":["is_maximized"],"deny":[]}},"allow-is-minimizable":{"identifier":"allow-is-minimizable","description":"Enables the is_minimizable command without any pre-configured scope.","commands":{"allow":["is_minimizable"],"deny":[]}},"allow-is-minimized":{"identifier":"allow-is-minimized","description":"Enables the is_minimized command without any pre-configured scope.","commands":{"allow":["is_minimized"],"deny":[]}},"allow-is-resizable":{"identifier":"allow-is-resizable","description":"Enables the is_resizable command without any pre-configured scope.","commands":{"allow":["is_resizable"],"deny":[]}},"allow-is-visible":{"identifier":"allow-is-visible","description":"Enables the is_visible command without any pre-configured scope.","commands":{"allow":["is_visible"],"deny":[]}},"allow-maximize":{"identifier":"allow-maximize","description":"Enables the maximize command without any pre-configured scope.","commands":{"allow":["maximize"],"deny":[]}},"allow-minimize":{"identifier":"allow-minimize","description":"Enables the minimize command without any pre-configured scope.","commands":{"allow":["minimize"],"deny":[]}},"allow-monitor-from-point":{"identifier":"allow-monitor-from-point","description":"Enables the monitor_from_point command without any pre-configured scope.","commands":{"allow":["monitor_from_point"],"deny":[]}},"allow-outer-position":{"identifier":"allow-outer-position","description":"Enables the outer_position command without any pre-configured scope.","commands":{"allow":["outer_position"],"deny":[]}},"allow-outer-size":{"identifier":"allow-outer-size","description":"Enables the outer_size command without any pre-configured scope.","commands":{"allow":["outer_size"],"deny":[]}},"allow-primary-monitor":{"identifier":"allow-primary-monitor","description":"Enables the primary_monitor command without any pre-configured scope.","commands":{"allow":["primary_monitor"],"deny":[]}},"allow-request-user-attention":{"identifier":"allow-request-user-attention","description":"Enables the request_user_attention command without any pre-configured scope.","commands":{"allow":["request_user_attention"],"deny":[]}},"allow-scale-factor":{"identifier":"allow-scale-factor","description":"Enables the scale_factor command without any pre-configured scope.","commands":{"allow":["scale_factor"],"deny":[]}},"allow-set-always-on-bottom":{"identifier":"allow-set-always-on-bottom","description":"Enables the set_always_on_bottom command without any pre-configured scope.","commands":{"allow":["set_always_on_bottom"],"deny":[]}},"allow-set-always-on-top":{"identifier":"allow-set-always-on-top","description":"Enables the set_always_on_top command without any pre-configured scope.","commands":{"allow":["set_always_on_top"],"deny":[]}},"allow-set-background-color":{"identifier":"allow-set-background-color","description":"Enables the set_background_color command without any pre-configured scope.","commands":{"allow":["set_background_color"],"deny":[]}},"allow-set-badge-count":{"identifier":"allow-set-badge-count","description":"Enables the set_badge_count command without any pre-configured scope.","commands":{"allow":["set_badge_count"],"deny":[]}},"allow-set-badge-label":{"identifier":"allow-set-badge-label","description":"Enables the set_badge_label command without any pre-configured scope.","commands":{"allow":["set_badge_label"],"deny":[]}},"allow-set-closable":{"identifier":"allow-set-closable","description":"Enables the set_closable command without any pre-configured scope.","commands":{"allow":["set_closable"],"deny":[]}},"allow-set-content-protected":{"identifier":"allow-set-content-protected","description":"Enables the set_content_protected command without any pre-configured scope.","commands":{"allow":["set_content_protected"],"deny":[]}},"allow-set-cursor-grab":{"identifier":"allow-set-cursor-grab","description":"Enables the set_cursor_grab command without any pre-configured scope.","commands":{"allow":["set_cursor_grab"],"deny":[]}},"allow-set-cursor-icon":{"identifier":"allow-set-cursor-icon","description":"Enables the set_cursor_icon command without any pre-configured scope.","commands":{"allow":["set_cursor_icon"],"deny":[]}},"allow-set-cursor-position":{"identifier":"allow-set-cursor-position","description":"Enables the set_cursor_position command without any pre-configured scope.","commands":{"allow":["set_cursor_position"],"deny":[]}},"allow-set-cursor-visible":{"identifier":"allow-set-cursor-visible","description":"Enables the set_cursor_visible command without any pre-configured scope.","commands":{"allow":["set_cursor_visible"],"deny":[]}},"allow-set-decorations":{"identifier":"allow-set-decorations","description":"Enables the set_decorations command without any pre-configured scope.","commands":{"allow":["set_decorations"],"deny":[]}},"allow-set-effects":{"identifier":"allow-set-effects","description":"Enables the set_effects command without any pre-configured scope.","commands":{"allow":["set_effects"],"deny":[]}},"allow-set-enabled":{"identifier":"allow-set-enabled","description":"Enables the set_enabled command without any pre-configured scope.","commands":{"allow":["set_enabled"],"deny":[]}},"allow-set-focus":{"identifier":"allow-set-focus","description":"Enables the set_focus command without any pre-configured scope.","commands":{"allow":["set_focus"],"deny":[]}},"allow-set-fullscreen":{"identifier":"allow-set-fullscreen","description":"Enables the set_fullscreen command without any pre-configured scope.","commands":{"allow":["set_fullscreen"],"deny":[]}},"allow-set-icon":{"identifier":"allow-set-icon","description":"Enables the set_icon command without any pre-configured scope.","commands":{"allow":["set_icon"],"deny":[]}},"allow-set-ignore-cursor-events":{"identifier":"allow-set-ignore-cursor-events","description":"Enables the set_ignore_cursor_events command without any pre-configured scope.","commands":{"allow":["set_ignore_cursor_events"],"deny":[]}},"allow-set-max-size":{"identifier":"allow-set-max-size","description":"Enables the set_max_size command without any pre-configured scope.","commands":{"allow":["set_max_size"],"deny":[]}},"allow-set-maximizable":{"identifier":"allow-set-maximizable","description":"Enables the set_maximizable command without any pre-configured scope.","commands":{"allow":["set_maximizable"],"deny":[]}},"allow-set-min-size":{"identifier":"allow-set-min-size","description":"Enables the set_min_size command without any pre-configured scope.","commands":{"allow":["set_min_size"],"deny":[]}},"allow-set-minimizable":{"identifier":"allow-set-minimizable","description":"Enables the set_minimizable command without any pre-configured scope.","commands":{"allow":["set_minimizable"],"deny":[]}},"allow-set-overlay-icon":{"identifier":"allow-set-overlay-icon","description":"Enables the set_overlay_icon command without any pre-configured scope.","commands":{"allow":["set_overlay_icon"],"deny":[]}},"allow-set-position":{"identifier":"allow-set-position","description":"Enables the set_position command without any pre-configured scope.","commands":{"allow":["set_position"],"deny":[]}},"allow-set-progress-bar":{"identifier":"allow-set-progress-bar","description":"Enables the set_progress_bar command without any pre-configured scope.","commands":{"allow":["set_progress_bar"],"deny":[]}},"allow-set-resizable":{"identifier":"allow-set-resizable","description":"Enables the set_resizable command without any pre-configured scope.","commands":{"allow":["set_resizable"],"deny":[]}},"allow-set-shadow":{"identifier":"allow-set-shadow","description":"Enables the set_shadow command without any pre-configured scope.","commands":{"allow":["set_shadow"],"deny":[]}},"allow-set-size":{"identifier":"allow-set-size","description":"Enables the set_size command without any pre-configured scope.","commands":{"allow":["set_size"],"deny":[]}},"allow-set-size-constraints":{"identifier":"allow-set-size-constraints","description":"Enables the set_size_constraints command without any pre-configured scope.","commands":{"allow":["set_size_constraints"],"deny":[]}},"allow-set-skip-taskbar":{"identifier":"allow-set-skip-taskbar","description":"Enables the set_skip_taskbar command without any pre-configured scope.","commands":{"allow":["set_skip_taskbar"],"deny":[]}},"allow-set-theme":{"identifier":"allow-set-theme","description":"Enables the set_theme command without any pre-configured scope.","commands":{"allow":["set_theme"],"deny":[]}},"allow-set-title":{"identifier":"allow-set-title","description":"Enables the set_title command without any pre-configured scope.","commands":{"allow":["set_title"],"deny":[]}},"allow-set-title-bar-style":{"identifier":"allow-set-title-bar-style","description":"Enables the set_title_bar_style command without any pre-configured scope.","commands":{"allow":["set_title_bar_style"],"deny":[]}},"allow-set-visible-on-all-workspaces":{"identifier":"allow-set-visible-on-all-workspaces","description":"Enables the set_visible_on_all_workspaces command without any pre-configured scope.","commands":{"allow":["set_visible_on_all_workspaces"],"deny":[]}},"allow-show":{"identifier":"allow-show","description":"Enables the show command without any pre-configured scope.","commands":{"allow":["show"],"deny":[]}},"allow-start-dragging":{"identifier":"allow-start-dragging","description":"Enables the start_dragging command without any pre-configured scope.","commands":{"allow":["start_dragging"],"deny":[]}},"allow-start-resize-dragging":{"identifier":"allow-start-resize-dragging","description":"Enables the start_resize_dragging command without any pre-configured scope.","commands":{"allow":["start_resize_dragging"],"deny":[]}},"allow-theme":{"identifier":"allow-theme","description":"Enables the theme command without any pre-configured scope.","commands":{"allow":["theme"],"deny":[]}},"allow-title":{"identifier":"allow-title","description":"Enables the title command without any pre-configured scope.","commands":{"allow":["title"],"deny":[]}},"allow-toggle-maximize":{"identifier":"allow-toggle-maximize","description":"Enables the toggle_maximize command without any pre-configured scope.","commands":{"allow":["toggle_maximize"],"deny":[]}},"allow-unmaximize":{"identifier":"allow-unmaximize","description":"Enables the unmaximize command without any pre-configured scope.","commands":{"allow":["unmaximize"],"deny":[]}},"allow-unminimize":{"identifier":"allow-unminimize","description":"Enables the unminimize command without any pre-configured scope.","commands":{"allow":["unminimize"],"deny":[]}},"deny-available-monitors":{"identifier":"deny-available-monitors","description":"Denies the available_monitors command without any pre-configured scope.","commands":{"allow":[],"deny":["available_monitors"]}},"deny-center":{"identifier":"deny-center","description":"Denies the center command without any pre-configured scope.","commands":{"allow":[],"deny":["center"]}},"deny-close":{"identifier":"deny-close","description":"Denies the close command without any pre-configured scope.","commands":{"allow":[],"deny":["close"]}},"deny-create":{"identifier":"deny-create","description":"Denies the create command without any pre-configured scope.","commands":{"allow":[],"deny":["create"]}},"deny-current-monitor":{"identifier":"deny-current-monitor","description":"Denies the current_monitor command without any pre-configured scope.","commands":{"allow":[],"deny":["current_monitor"]}},"deny-cursor-position":{"identifier":"deny-cursor-position","description":"Denies the cursor_position command without any pre-configured scope.","commands":{"allow":[],"deny":["cursor_position"]}},"deny-destroy":{"identifier":"deny-destroy","description":"Denies the destroy command without any pre-configured scope.","commands":{"allow":[],"deny":["destroy"]}},"deny-get-all-windows":{"identifier":"deny-get-all-windows","description":"Denies the get_all_windows command without any pre-configured scope.","commands":{"allow":[],"deny":["get_all_windows"]}},"deny-hide":{"identifier":"deny-hide","description":"Denies the hide command without any pre-configured scope.","commands":{"allow":[],"deny":["hide"]}},"deny-inner-position":{"identifier":"deny-inner-position","description":"Denies the inner_position command without any pre-configured scope.","commands":{"allow":[],"deny":["inner_position"]}},"deny-inner-size":{"identifier":"deny-inner-size","description":"Denies the inner_size command without any pre-configured scope.","commands":{"allow":[],"deny":["inner_size"]}},"deny-internal-toggle-maximize":{"identifier":"deny-internal-toggle-maximize","description":"Denies the internal_toggle_maximize command without any pre-configured scope.","commands":{"allow":[],"deny":["internal_toggle_maximize"]}},"deny-is-always-on-top":{"identifier":"deny-is-always-on-top","description":"Denies the is_always_on_top command without any pre-configured scope.","commands":{"allow":[],"deny":["is_always_on_top"]}},"deny-is-closable":{"identifier":"deny-is-closable","description":"Denies the is_closable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_closable"]}},"deny-is-decorated":{"identifier":"deny-is-decorated","description":"Denies the is_decorated command without any pre-configured scope.","commands":{"allow":[],"deny":["is_decorated"]}},"deny-is-enabled":{"identifier":"deny-is-enabled","description":"Denies the is_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["is_enabled"]}},"deny-is-focused":{"identifier":"deny-is-focused","description":"Denies the is_focused command without any pre-configured scope.","commands":{"allow":[],"deny":["is_focused"]}},"deny-is-fullscreen":{"identifier":"deny-is-fullscreen","description":"Denies the is_fullscreen command without any pre-configured scope.","commands":{"allow":[],"deny":["is_fullscreen"]}},"deny-is-maximizable":{"identifier":"deny-is-maximizable","description":"Denies the is_maximizable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_maximizable"]}},"deny-is-maximized":{"identifier":"deny-is-maximized","description":"Denies the is_maximized command without any pre-configured scope.","commands":{"allow":[],"deny":["is_maximized"]}},"deny-is-minimizable":{"identifier":"deny-is-minimizable","description":"Denies the is_minimizable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_minimizable"]}},"deny-is-minimized":{"identifier":"deny-is-minimized","description":"Denies the is_minimized command without any pre-configured scope.","commands":{"allow":[],"deny":["is_minimized"]}},"deny-is-resizable":{"identifier":"deny-is-resizable","description":"Denies the is_resizable command without any pre-configured scope.","commands":{"allow":[],"deny":["is_resizable"]}},"deny-is-visible":{"identifier":"deny-is-visible","description":"Denies the is_visible command without any pre-configured scope.","commands":{"allow":[],"deny":["is_visible"]}},"deny-maximize":{"identifier":"deny-maximize","description":"Denies the maximize command without any pre-configured scope.","commands":{"allow":[],"deny":["maximize"]}},"deny-minimize":{"identifier":"deny-minimize","description":"Denies the minimize command without any pre-configured scope.","commands":{"allow":[],"deny":["minimize"]}},"deny-monitor-from-point":{"identifier":"deny-monitor-from-point","description":"Denies the monitor_from_point command without any pre-configured scope.","commands":{"allow":[],"deny":["monitor_from_point"]}},"deny-outer-position":{"identifier":"deny-outer-position","description":"Denies the outer_position command without any pre-configured scope.","commands":{"allow":[],"deny":["outer_position"]}},"deny-outer-size":{"identifier":"deny-outer-size","description":"Denies the outer_size command without any pre-configured scope.","commands":{"allow":[],"deny":["outer_size"]}},"deny-primary-monitor":{"identifier":"deny-primary-monitor","description":"Denies the primary_monitor command without any pre-configured scope.","commands":{"allow":[],"deny":["primary_monitor"]}},"deny-request-user-attention":{"identifier":"deny-request-user-attention","description":"Denies the request_user_attention command without any pre-configured scope.","commands":{"allow":[],"deny":["request_user_attention"]}},"deny-scale-factor":{"identifier":"deny-scale-factor","description":"Denies the scale_factor command without any pre-configured scope.","commands":{"allow":[],"deny":["scale_factor"]}},"deny-set-always-on-bottom":{"identifier":"deny-set-always-on-bottom","description":"Denies the set_always_on_bottom command without any pre-configured scope.","commands":{"allow":[],"deny":["set_always_on_bottom"]}},"deny-set-always-on-top":{"identifier":"deny-set-always-on-top","description":"Denies the set_always_on_top command without any pre-configured scope.","commands":{"allow":[],"deny":["set_always_on_top"]}},"deny-set-background-color":{"identifier":"deny-set-background-color","description":"Denies the set_background_color command without any pre-configured scope.","commands":{"allow":[],"deny":["set_background_color"]}},"deny-set-badge-count":{"identifier":"deny-set-badge-count","description":"Denies the set_badge_count command without any pre-configured scope.","commands":{"allow":[],"deny":["set_badge_count"]}},"deny-set-badge-label":{"identifier":"deny-set-badge-label","description":"Denies the set_badge_label command without any pre-configured scope.","commands":{"allow":[],"deny":["set_badge_label"]}},"deny-set-closable":{"identifier":"deny-set-closable","description":"Denies the set_closable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_closable"]}},"deny-set-content-protected":{"identifier":"deny-set-content-protected","description":"Denies the set_content_protected command without any pre-configured scope.","commands":{"allow":[],"deny":["set_content_protected"]}},"deny-set-cursor-grab":{"identifier":"deny-set-cursor-grab","description":"Denies the set_cursor_grab command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_grab"]}},"deny-set-cursor-icon":{"identifier":"deny-set-cursor-icon","description":"Denies the set_cursor_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_icon"]}},"deny-set-cursor-position":{"identifier":"deny-set-cursor-position","description":"Denies the set_cursor_position command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_position"]}},"deny-set-cursor-visible":{"identifier":"deny-set-cursor-visible","description":"Denies the set_cursor_visible command without any pre-configured scope.","commands":{"allow":[],"deny":["set_cursor_visible"]}},"deny-set-decorations":{"identifier":"deny-set-decorations","description":"Denies the set_decorations command without any pre-configured scope.","commands":{"allow":[],"deny":["set_decorations"]}},"deny-set-effects":{"identifier":"deny-set-effects","description":"Denies the set_effects command without any pre-configured scope.","commands":{"allow":[],"deny":["set_effects"]}},"deny-set-enabled":{"identifier":"deny-set-enabled","description":"Denies the set_enabled command without any pre-configured scope.","commands":{"allow":[],"deny":["set_enabled"]}},"deny-set-focus":{"identifier":"deny-set-focus","description":"Denies the set_focus command without any pre-configured scope.","commands":{"allow":[],"deny":["set_focus"]}},"deny-set-fullscreen":{"identifier":"deny-set-fullscreen","description":"Denies the set_fullscreen command without any pre-configured scope.","commands":{"allow":[],"deny":["set_fullscreen"]}},"deny-set-icon":{"identifier":"deny-set-icon","description":"Denies the set_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_icon"]}},"deny-set-ignore-cursor-events":{"identifier":"deny-set-ignore-cursor-events","description":"Denies the set_ignore_cursor_events command without any pre-configured scope.","commands":{"allow":[],"deny":["set_ignore_cursor_events"]}},"deny-set-max-size":{"identifier":"deny-set-max-size","description":"Denies the set_max_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_max_size"]}},"deny-set-maximizable":{"identifier":"deny-set-maximizable","description":"Denies the set_maximizable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_maximizable"]}},"deny-set-min-size":{"identifier":"deny-set-min-size","description":"Denies the set_min_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_min_size"]}},"deny-set-minimizable":{"identifier":"deny-set-minimizable","description":"Denies the set_minimizable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_minimizable"]}},"deny-set-overlay-icon":{"identifier":"deny-set-overlay-icon","description":"Denies the set_overlay_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["set_overlay_icon"]}},"deny-set-position":{"identifier":"deny-set-position","description":"Denies the set_position command without any pre-configured scope.","commands":{"allow":[],"deny":["set_position"]}},"deny-set-progress-bar":{"identifier":"deny-set-progress-bar","description":"Denies the set_progress_bar command without any pre-configured scope.","commands":{"allow":[],"deny":["set_progress_bar"]}},"deny-set-resizable":{"identifier":"deny-set-resizable","description":"Denies the set_resizable command without any pre-configured scope.","commands":{"allow":[],"deny":["set_resizable"]}},"deny-set-shadow":{"identifier":"deny-set-shadow","description":"Denies the set_shadow command without any pre-configured scope.","commands":{"allow":[],"deny":["set_shadow"]}},"deny-set-size":{"identifier":"deny-set-size","description":"Denies the set_size command without any pre-configured scope.","commands":{"allow":[],"deny":["set_size"]}},"deny-set-size-constraints":{"identifier":"deny-set-size-constraints","description":"Denies the set_size_constraints command without any pre-configured scope.","commands":{"allow":[],"deny":["set_size_constraints"]}},"deny-set-skip-taskbar":{"identifier":"deny-set-skip-taskbar","description":"Denies the set_skip_taskbar command without any pre-configured scope.","commands":{"allow":[],"deny":["set_skip_taskbar"]}},"deny-set-theme":{"identifier":"deny-set-theme","description":"Denies the set_theme command without any pre-configured scope.","commands":{"allow":[],"deny":["set_theme"]}},"deny-set-title":{"identifier":"deny-set-title","description":"Denies the set_title command without any pre-configured scope.","commands":{"allow":[],"deny":["set_title"]}},"deny-set-title-bar-style":{"identifier":"deny-set-title-bar-style","description":"Denies the set_title_bar_style command without any pre-configured scope.","commands":{"allow":[],"deny":["set_title_bar_style"]}},"deny-set-visible-on-all-workspaces":{"identifier":"deny-set-visible-on-all-workspaces","description":"Denies the set_visible_on_all_workspaces command without any pre-configured scope.","commands":{"allow":[],"deny":["set_visible_on_all_workspaces"]}},"deny-show":{"identifier":"deny-show","description":"Denies the show command without any pre-configured scope.","commands":{"allow":[],"deny":["show"]}},"deny-start-dragging":{"identifier":"deny-start-dragging","description":"Denies the start_dragging command without any pre-configured scope.","commands":{"allow":[],"deny":["start_dragging"]}},"deny-start-resize-dragging":{"identifier":"deny-start-resize-dragging","description":"Denies the start_resize_dragging command without any pre-configured scope.","commands":{"allow":[],"deny":["start_resize_dragging"]}},"deny-theme":{"identifier":"deny-theme","description":"Denies the theme command without any pre-configured scope.","commands":{"allow":[],"deny":["theme"]}},"deny-title":{"identifier":"deny-title","description":"Denies the title command without any pre-configured scope.","commands":{"allow":[],"deny":["title"]}},"deny-toggle-maximize":{"identifier":"deny-toggle-maximize","description":"Denies the toggle_maximize command without any pre-configured scope.","commands":{"allow":[],"deny":["toggle_maximize"]}},"deny-unmaximize":{"identifier":"deny-unmaximize","description":"Denies the unmaximize command without any pre-configured scope.","commands":{"allow":[],"deny":["unmaximize"]}},"deny-unminimize":{"identifier":"deny-unminimize","description":"Denies the unminimize command without any pre-configured scope.","commands":{"allow":[],"deny":["unminimize"]}}},"permission_sets":{},"global_scope_schema":null},"devtools":{"default_permission":null,"permissions":{},"permission_sets":{},"global_scope_schema":null},"serialplugin":{"default_permission":{"identifier":"default","description":"Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n","permissions":["allow-managed-ports","allow-available-ports","allow-watch-ports","allow-unwatch-ports","allow-cancel-read","allow-close","allow-close-all","allow-force-close","allow-open","allow-read","allow-read-binary","allow-write","allow-write-binary","allow-capabilities","allow-watch","allow-unwatch","allow-bytes-to-read","allow-bytes-to-write","allow-clear-break","allow-clear-buffer","allow-read-carrier-detect","allow-read-clear-to-send","allow-read-data-set-ready","allow-read-ring-indicator","allow-set-baud-rate","allow-set-break","allow-set-data-bits","allow-set-flow-control","allow-set-parity","allow-set-stop-bits","allow-set-timeout","allow-write-data-terminal-ready","allow-write-request-to-send","allow-set-log-level","allow-get-log-level","allow-exchange","allow-exchange-binary","allow-cancel-exchange","allow-at","allow-at-phases","allow-send-sms-pdu","allow-configure-at-session","allow-enable-mux","allow-open-mux-channel","allow-disable-mux"]},"permissions":{"allow-at":{"identifier":"allow-at","description":"Enables the at command without any pre-configured scope.","commands":{"allow":["at"],"deny":[]}},"allow-at-phases":{"identifier":"allow-at-phases","description":"Enables the at_phases command without any pre-configured scope.","commands":{"allow":["at_phases"],"deny":[]}},"allow-available-ports":{"identifier":"allow-available-ports","description":"Enables the available_ports command without any pre-configured scope.","commands":{"allow":["available_ports"],"deny":[]}},"allow-bytes-to-read":{"identifier":"allow-bytes-to-read","description":"Enables the bytes_to_read command without any pre-configured scope.","commands":{"allow":["bytes_to_read"],"deny":[]}},"allow-bytes-to-write":{"identifier":"allow-bytes-to-write","description":"Enables the bytes_to_write command without any pre-configured scope.","commands":{"allow":["bytes_to_write"],"deny":[]}},"allow-cancel-exchange":{"identifier":"allow-cancel-exchange","description":"Enables the cancel_exchange command without any pre-configured scope.","commands":{"allow":["cancel_exchange"],"deny":[]}},"allow-cancel-read":{"identifier":"allow-cancel-read","description":"Enables the cancel_read command without any pre-configured scope.","commands":{"allow":["cancel_read"],"deny":[]}},"allow-capabilities":{"identifier":"allow-capabilities","description":"Enables the capabilities command without any pre-configured scope.","commands":{"allow":["capabilities"],"deny":[]}},"allow-clear-break":{"identifier":"allow-clear-break","description":"Enables the clear_break command without any pre-configured scope.","commands":{"allow":["clear_break"],"deny":[]}},"allow-clear-buffer":{"identifier":"allow-clear-buffer","description":"Enables the clear_buffer command without any pre-configured scope.","commands":{"allow":["clear_buffer"],"deny":[]}},"allow-close":{"identifier":"allow-close","description":"Enables the close command without any pre-configured scope.","commands":{"allow":["close"],"deny":[]}},"allow-close-all":{"identifier":"allow-close-all","description":"Enables the close_all command without any pre-configured scope.","commands":{"allow":["close_all"],"deny":[]}},"allow-configure-at-session":{"identifier":"allow-configure-at-session","description":"Enables the configure_at_session command without any pre-configured scope.","commands":{"allow":["configure_at_session"],"deny":[]}},"allow-disable-mux":{"identifier":"allow-disable-mux","description":"Enables the disable_mux command without any pre-configured scope.","commands":{"allow":["disable_mux"],"deny":[]}},"allow-enable-mux":{"identifier":"allow-enable-mux","description":"Enables the enable_mux command without any pre-configured scope.","commands":{"allow":["enable_mux"],"deny":[]}},"allow-exchange":{"identifier":"allow-exchange","description":"Enables the exchange command without any pre-configured scope.","commands":{"allow":["exchange"],"deny":[]}},"allow-exchange-binary":{"identifier":"allow-exchange-binary","description":"Enables the exchange_binary command without any pre-configured scope.","commands":{"allow":["exchange_binary"],"deny":[]}},"allow-force-close":{"identifier":"allow-force-close","description":"Enables the force_close command without any pre-configured scope.","commands":{"allow":["force_close"],"deny":[]}},"allow-get-log-level":{"identifier":"allow-get-log-level","description":"Enables the get_log_level command without any pre-configured scope.","commands":{"allow":["get_log_level"],"deny":[]}},"allow-managed-ports":{"identifier":"allow-managed-ports","description":"Enables the managed_ports command without any pre-configured scope.","commands":{"allow":["managed_ports"],"deny":[]}},"allow-open":{"identifier":"allow-open","description":"Enables the open command without any pre-configured scope.","commands":{"allow":["open"],"deny":[]}},"allow-open-mux-channel":{"identifier":"allow-open-mux-channel","description":"Enables the open_mux_channel command without any pre-configured scope.","commands":{"allow":["open_mux_channel"],"deny":[]}},"allow-read":{"identifier":"allow-read","description":"Enables the read command without any pre-configured scope.","commands":{"allow":["read"],"deny":[]}},"allow-read-binary":{"identifier":"allow-read-binary","description":"Enables the read_binary command without any pre-configured scope.","commands":{"allow":["read_binary"],"deny":[]}},"allow-read-carrier-detect":{"identifier":"allow-read-carrier-detect","description":"Enables the read_carrier_detect command without any pre-configured scope.","commands":{"allow":["read_carrier_detect"],"deny":[]}},"allow-read-clear-to-send":{"identifier":"allow-read-clear-to-send","description":"Enables the read_clear_to_send command without any pre-configured scope.","commands":{"allow":["read_clear_to_send"],"deny":[]}},"allow-read-data-set-ready":{"identifier":"allow-read-data-set-ready","description":"Enables the read_data_set_ready command without any pre-configured scope.","commands":{"allow":["read_data_set_ready"],"deny":[]}},"allow-read-ring-indicator":{"identifier":"allow-read-ring-indicator","description":"Enables the read_ring_indicator command without any pre-configured scope.","commands":{"allow":["read_ring_indicator"],"deny":[]}},"allow-send-sms-pdu":{"identifier":"allow-send-sms-pdu","description":"Enables the send_sms_pdu command without any pre-configured scope.","commands":{"allow":["send_sms_pdu"],"deny":[]}},"allow-set-baud-rate":{"identifier":"allow-set-baud-rate","description":"Enables the set_baud_rate command without any pre-configured scope.","commands":{"allow":["set_baud_rate"],"deny":[]}},"allow-set-break":{"identifier":"allow-set-break","description":"Enables the set_break command without any pre-configured scope.","commands":{"allow":["set_break"],"deny":[]}},"allow-set-data-bits":{"identifier":"allow-set-data-bits","description":"Enables the set_data_bits command without any pre-configured scope.","commands":{"allow":["set_data_bits"],"deny":[]}},"allow-set-flow-control":{"identifier":"allow-set-flow-control","description":"Enables the set_flow_control command without any pre-configured scope.","commands":{"allow":["set_flow_control"],"deny":[]}},"allow-set-log-level":{"identifier":"allow-set-log-level","description":"Enables the set_log_level command without any pre-configured scope.","commands":{"allow":["set_log_level"],"deny":[]}},"allow-set-parity":{"identifier":"allow-set-parity","description":"Enables the set_parity command without any pre-configured scope.","commands":{"allow":["set_parity"],"deny":[]}},"allow-set-stop-bits":{"identifier":"allow-set-stop-bits","description":"Enables the set_stop_bits command without any pre-configured scope.","commands":{"allow":["set_stop_bits"],"deny":[]}},"allow-set-timeout":{"identifier":"allow-set-timeout","description":"Enables the set_timeout command without any pre-configured scope.","commands":{"allow":["set_timeout"],"deny":[]}},"allow-unwatch":{"identifier":"allow-unwatch","description":"Enables the unwatch command without any pre-configured scope.","commands":{"allow":["unwatch"],"deny":[]}},"allow-unwatch-ports":{"identifier":"allow-unwatch-ports","description":"Enables the unwatch_ports command without any pre-configured scope.","commands":{"allow":["unwatch_ports"],"deny":[]}},"allow-watch":{"identifier":"allow-watch","description":"Enables the watch command without any pre-configured scope.","commands":{"allow":["watch"],"deny":[]}},"allow-watch-ports":{"identifier":"allow-watch-ports","description":"Enables the watch_ports command without any pre-configured scope.","commands":{"allow":["watch_ports"],"deny":[]}},"allow-write":{"identifier":"allow-write","description":"Enables the write command without any pre-configured scope.","commands":{"allow":["write"],"deny":[]}},"allow-write-binary":{"identifier":"allow-write-binary","description":"Enables the write_binary command without any pre-configured scope.","commands":{"allow":["write_binary"],"deny":[]}},"allow-write-data-terminal-ready":{"identifier":"allow-write-data-terminal-ready","description":"Enables the write_data_terminal_ready command without any pre-configured scope.","commands":{"allow":["write_data_terminal_ready"],"deny":[]}},"allow-write-request-to-send":{"identifier":"allow-write-request-to-send","description":"Enables the write_request_to_send command without any pre-configured scope.","commands":{"allow":["write_request_to_send"],"deny":[]}},"deny-at":{"identifier":"deny-at","description":"Denies the at command without any pre-configured scope.","commands":{"allow":[],"deny":["at"]}},"deny-at-phases":{"identifier":"deny-at-phases","description":"Denies the at_phases command without any pre-configured scope.","commands":{"allow":[],"deny":["at_phases"]}},"deny-available-ports":{"identifier":"deny-available-ports","description":"Denies the available_ports command without any pre-configured scope.","commands":{"allow":[],"deny":["available_ports"]}},"deny-bytes-to-read":{"identifier":"deny-bytes-to-read","description":"Denies the bytes_to_read command without any pre-configured scope.","commands":{"allow":[],"deny":["bytes_to_read"]}},"deny-bytes-to-write":{"identifier":"deny-bytes-to-write","description":"Denies the bytes_to_write command without any pre-configured scope.","commands":{"allow":[],"deny":["bytes_to_write"]}},"deny-cancel-exchange":{"identifier":"deny-cancel-exchange","description":"Denies the cancel_exchange command without any pre-configured scope.","commands":{"allow":[],"deny":["cancel_exchange"]}},"deny-cancel-read":{"identifier":"deny-cancel-read","description":"Denies the cancel_read command without any pre-configured scope.","commands":{"allow":[],"deny":["cancel_read"]}},"deny-capabilities":{"identifier":"deny-capabilities","description":"Denies the capabilities command without any pre-configured scope.","commands":{"allow":[],"deny":["capabilities"]}},"deny-clear-break":{"identifier":"deny-clear-break","description":"Denies the clear_break command without any pre-configured scope.","commands":{"allow":[],"deny":["clear_break"]}},"deny-clear-buffer":{"identifier":"deny-clear-buffer","description":"Denies the clear_buffer command without any pre-configured scope.","commands":{"allow":[],"deny":["clear_buffer"]}},"deny-close":{"identifier":"deny-close","description":"Denies the close command without any pre-configured scope.","commands":{"allow":[],"deny":["close"]}},"deny-close-all":{"identifier":"deny-close-all","description":"Denies the close_all command without any pre-configured scope.","commands":{"allow":[],"deny":["close_all"]}},"deny-configure-at-session":{"identifier":"deny-configure-at-session","description":"Denies the configure_at_session command without any pre-configured scope.","commands":{"allow":[],"deny":["configure_at_session"]}},"deny-disable-mux":{"identifier":"deny-disable-mux","description":"Denies the disable_mux command without any pre-configured scope.","commands":{"allow":[],"deny":["disable_mux"]}},"deny-enable-mux":{"identifier":"deny-enable-mux","description":"Denies the enable_mux command without any pre-configured scope.","commands":{"allow":[],"deny":["enable_mux"]}},"deny-exchange":{"identifier":"deny-exchange","description":"Denies the exchange command without any pre-configured scope.","commands":{"allow":[],"deny":["exchange"]}},"deny-exchange-binary":{"identifier":"deny-exchange-binary","description":"Denies the exchange_binary command without any pre-configured scope.","commands":{"allow":[],"deny":["exchange_binary"]}},"deny-force-close":{"identifier":"deny-force-close","description":"Denies the force_close command without any pre-configured scope.","commands":{"allow":[],"deny":["force_close"]}},"deny-get-log-level":{"identifier":"deny-get-log-level","description":"Denies the get_log_level command without any pre-configured scope.","commands":{"allow":[],"deny":["get_log_level"]}},"deny-managed-ports":{"identifier":"deny-managed-ports","description":"Denies the managed_ports command without any pre-configured scope.","commands":{"allow":[],"deny":["managed_ports"]}},"deny-open":{"identifier":"deny-open","description":"Denies the open command without any pre-configured scope.","commands":{"allow":[],"deny":["open"]}},"deny-open-mux-channel":{"identifier":"deny-open-mux-channel","description":"Denies the open_mux_channel command without any pre-configured scope.","commands":{"allow":[],"deny":["open_mux_channel"]}},"deny-read":{"identifier":"deny-read","description":"Denies the read command without any pre-configured scope.","commands":{"allow":[],"deny":["read"]}},"deny-read-binary":{"identifier":"deny-read-binary","description":"Denies the read_binary command without any pre-configured scope.","commands":{"allow":[],"deny":["read_binary"]}},"deny-read-carrier-detect":{"identifier":"deny-read-carrier-detect","description":"Denies the read_carrier_detect command without any pre-configured scope.","commands":{"allow":[],"deny":["read_carrier_detect"]}},"deny-read-clear-to-send":{"identifier":"deny-read-clear-to-send","description":"Denies the read_clear_to_send command without any pre-configured scope.","commands":{"allow":[],"deny":["read_clear_to_send"]}},"deny-read-data-set-ready":{"identifier":"deny-read-data-set-ready","description":"Denies the read_data_set_ready command without any pre-configured scope.","commands":{"allow":[],"deny":["read_data_set_ready"]}},"deny-read-ring-indicator":{"identifier":"deny-read-ring-indicator","description":"Denies the read_ring_indicator command without any pre-configured scope.","commands":{"allow":[],"deny":["read_ring_indicator"]}},"deny-send-sms-pdu":{"identifier":"deny-send-sms-pdu","description":"Denies the send_sms_pdu command without any pre-configured scope.","commands":{"allow":[],"deny":["send_sms_pdu"]}},"deny-set-baud-rate":{"identifier":"deny-set-baud-rate","description":"Denies the set_baud_rate command without any pre-configured scope.","commands":{"allow":[],"deny":["set_baud_rate"]}},"deny-set-break":{"identifier":"deny-set-break","description":"Denies the set_break command without any pre-configured scope.","commands":{"allow":[],"deny":["set_break"]}},"deny-set-data-bits":{"identifier":"deny-set-data-bits","description":"Denies the set_data_bits command without any pre-configured scope.","commands":{"allow":[],"deny":["set_data_bits"]}},"deny-set-flow-control":{"identifier":"deny-set-flow-control","description":"Denies the set_flow_control command without any pre-configured scope.","commands":{"allow":[],"deny":["set_flow_control"]}},"deny-set-log-level":{"identifier":"deny-set-log-level","description":"Denies the set_log_level command without any pre-configured scope.","commands":{"allow":[],"deny":["set_log_level"]}},"deny-set-parity":{"identifier":"deny-set-parity","description":"Denies the set_parity command without any pre-configured scope.","commands":{"allow":[],"deny":["set_parity"]}},"deny-set-stop-bits":{"identifier":"deny-set-stop-bits","description":"Denies the set_stop_bits command without any pre-configured scope.","commands":{"allow":[],"deny":["set_stop_bits"]}},"deny-set-timeout":{"identifier":"deny-set-timeout","description":"Denies the set_timeout command without any pre-configured scope.","commands":{"allow":[],"deny":["set_timeout"]}},"deny-unwatch":{"identifier":"deny-unwatch","description":"Denies the unwatch command without any pre-configured scope.","commands":{"allow":[],"deny":["unwatch"]}},"deny-unwatch-ports":{"identifier":"deny-unwatch-ports","description":"Denies the unwatch_ports command without any pre-configured scope.","commands":{"allow":[],"deny":["unwatch_ports"]}},"deny-watch":{"identifier":"deny-watch","description":"Denies the watch command without any pre-configured scope.","commands":{"allow":[],"deny":["watch"]}},"deny-watch-ports":{"identifier":"deny-watch-ports","description":"Denies the watch_ports command without any pre-configured scope.","commands":{"allow":[],"deny":["watch_ports"]}},"deny-write":{"identifier":"deny-write","description":"Denies the write command without any pre-configured scope.","commands":{"allow":[],"deny":["write"]}},"deny-write-binary":{"identifier":"deny-write-binary","description":"Denies the write_binary command without any pre-configured scope.","commands":{"allow":[],"deny":["write_binary"]}},"deny-write-data-terminal-ready":{"identifier":"deny-write-data-terminal-ready","description":"Denies the write_data_terminal_ready command without any pre-configured scope.","commands":{"allow":[],"deny":["write_data_terminal_ready"]}},"deny-write-request-to-send":{"identifier":"deny-write-request-to-send","description":"Denies the write_request_to_send command without any pre-configured scope.","commands":{"allow":[],"deny":["write_request_to_send"]}}},"permission_sets":{},"global_scope_schema":null}} \ No newline at end of file diff --git a/examples/serialport-test/src-tauri/gen/schemas/android-schema.json b/examples/serialport-test/src-tauri/gen/schemas/android-schema.json index 521f154f..b55dfdda 100644 --- a/examples/serialport-test/src-tauri/gen/schemas/android-schema.json +++ b/examples/serialport-test/src-tauri/gen/schemas/android-schema.json @@ -2085,22 +2085,28 @@ "markdownDescription": "Denies the unminimize command without any pre-configured scope." }, { - "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`", + "description": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`", "type": "string", "const": "serialplugin:default", - "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`" + "markdownDescription": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`" }, { - "description": "Enables the available_ports command without any pre-configured scope.", + "description": "Enables the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports", - "markdownDescription": "Enables the available_ports command without any pre-configured scope." + "const": "serialplugin:allow-at", + "markdownDescription": "Enables the at command without any pre-configured scope." }, { - "description": "Enables the available_ports_direct command without any pre-configured scope.", + "description": "Enables the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports-direct", - "markdownDescription": "Enables the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:allow-at-phases", + "markdownDescription": "Enables the at_phases command without any pre-configured scope." + }, + { + "description": "Enables the available_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-available-ports", + "markdownDescription": "Enables the available_ports command without any pre-configured scope." }, { "description": "Enables the bytes_to_read command without any pre-configured scope.", @@ -2114,12 +2120,24 @@ "const": "serialplugin:allow-bytes-to-write", "markdownDescription": "Enables the bytes_to_write command without any pre-configured scope." }, + { + "description": "Enables the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-cancel-exchange", + "markdownDescription": "Enables the cancel_exchange command without any pre-configured scope." + }, { "description": "Enables the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-cancel-read", "markdownDescription": "Enables the cancel_read command without any pre-configured scope." }, + { + "description": "Enables the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-capabilities", + "markdownDescription": "Enables the capabilities command without any pre-configured scope." + }, { "description": "Enables the clear_break command without any pre-configured scope.", "type": "string", @@ -2144,6 +2162,36 @@ "const": "serialplugin:allow-close-all", "markdownDescription": "Enables the close_all command without any pre-configured scope." }, + { + "description": "Enables the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-configure-at-session", + "markdownDescription": "Enables the configure_at_session command without any pre-configured scope." + }, + { + "description": "Enables the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-disable-mux", + "markdownDescription": "Enables the disable_mux command without any pre-configured scope." + }, + { + "description": "Enables the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-enable-mux", + "markdownDescription": "Enables the enable_mux command without any pre-configured scope." + }, + { + "description": "Enables the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange", + "markdownDescription": "Enables the exchange command without any pre-configured scope." + }, + { + "description": "Enables the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange-binary", + "markdownDescription": "Enables the exchange_binary command without any pre-configured scope." + }, { "description": "Enables the force_close command without any pre-configured scope.", "type": "string", @@ -2168,6 +2216,12 @@ "const": "serialplugin:allow-open", "markdownDescription": "Enables the open command without any pre-configured scope." }, + { + "description": "Enables the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-open-mux-channel", + "markdownDescription": "Enables the open_mux_channel command without any pre-configured scope." + }, { "description": "Enables the read command without any pre-configured scope.", "type": "string", @@ -2186,54 +2240,30 @@ "const": "serialplugin:allow-read-carrier-detect", "markdownDescription": "Enables the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Enables the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cd", - "markdownDescription": "Enables the read_cd command without any pre-configured scope." - }, { "description": "Enables the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-clear-to-send", "markdownDescription": "Enables the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Enables the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cts", - "markdownDescription": "Enables the read_cts command without any pre-configured scope." - }, { "description": "Enables the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-data-set-ready", "markdownDescription": "Enables the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Enables the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dsr", - "markdownDescription": "Enables the read_dsr command without any pre-configured scope." - }, - { - "description": "Enables the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dtr", - "markdownDescription": "Enables the read_dtr command without any pre-configured scope." - }, - { - "description": "Enables the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-ri", - "markdownDescription": "Enables the read_ri command without any pre-configured scope." - }, { "description": "Enables the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-ring-indicator", "markdownDescription": "Enables the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Enables the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-send-sms-pdu", + "markdownDescription": "Enables the send_sms_pdu command without any pre-configured scope." + }, { "description": "Enables the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2283,16 +2313,28 @@ "markdownDescription": "Enables the set_timeout command without any pre-configured scope." }, { - "description": "Enables the start_listening command without any pre-configured scope.", + "description": "Enables the unwatch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-start-listening", - "markdownDescription": "Enables the start_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch", + "markdownDescription": "Enables the unwatch command without any pre-configured scope." }, { - "description": "Enables the stop_listening command without any pre-configured scope.", + "description": "Enables the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-stop-listening", - "markdownDescription": "Enables the stop_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch-ports", + "markdownDescription": "Enables the unwatch_ports command without any pre-configured scope." + }, + { + "description": "Enables the watch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch", + "markdownDescription": "Enables the watch command without any pre-configured scope." + }, + { + "description": "Enables the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch-ports", + "markdownDescription": "Enables the watch_ports command without any pre-configured scope." }, { "description": "Enables the write command without any pre-configured scope.", @@ -2312,12 +2354,6 @@ "const": "serialplugin:allow-write-data-terminal-ready", "markdownDescription": "Enables the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Enables the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-write-dtr", - "markdownDescription": "Enables the write_dtr command without any pre-configured scope." - }, { "description": "Enables the write_request_to_send command without any pre-configured scope.", "type": "string", @@ -2325,22 +2361,22 @@ "markdownDescription": "Enables the write_request_to_send command without any pre-configured scope." }, { - "description": "Enables the write_rts command without any pre-configured scope.", + "description": "Denies the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-write-rts", - "markdownDescription": "Enables the write_rts command without any pre-configured scope." + "const": "serialplugin:deny-at", + "markdownDescription": "Denies the at command without any pre-configured scope." }, { - "description": "Denies the available_ports command without any pre-configured scope.", + "description": "Denies the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports", - "markdownDescription": "Denies the available_ports command without any pre-configured scope." + "const": "serialplugin:deny-at-phases", + "markdownDescription": "Denies the at_phases command without any pre-configured scope." }, { - "description": "Denies the available_ports_direct command without any pre-configured scope.", + "description": "Denies the available_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports-direct", - "markdownDescription": "Denies the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:deny-available-ports", + "markdownDescription": "Denies the available_ports command without any pre-configured scope." }, { "description": "Denies the bytes_to_read command without any pre-configured scope.", @@ -2354,12 +2390,24 @@ "const": "serialplugin:deny-bytes-to-write", "markdownDescription": "Denies the bytes_to_write command without any pre-configured scope." }, + { + "description": "Denies the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-cancel-exchange", + "markdownDescription": "Denies the cancel_exchange command without any pre-configured scope." + }, { "description": "Denies the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-cancel-read", "markdownDescription": "Denies the cancel_read command without any pre-configured scope." }, + { + "description": "Denies the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-capabilities", + "markdownDescription": "Denies the capabilities command without any pre-configured scope." + }, { "description": "Denies the clear_break command without any pre-configured scope.", "type": "string", @@ -2384,6 +2432,36 @@ "const": "serialplugin:deny-close-all", "markdownDescription": "Denies the close_all command without any pre-configured scope." }, + { + "description": "Denies the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-configure-at-session", + "markdownDescription": "Denies the configure_at_session command without any pre-configured scope." + }, + { + "description": "Denies the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-disable-mux", + "markdownDescription": "Denies the disable_mux command without any pre-configured scope." + }, + { + "description": "Denies the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-enable-mux", + "markdownDescription": "Denies the enable_mux command without any pre-configured scope." + }, + { + "description": "Denies the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange", + "markdownDescription": "Denies the exchange command without any pre-configured scope." + }, + { + "description": "Denies the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange-binary", + "markdownDescription": "Denies the exchange_binary command without any pre-configured scope." + }, { "description": "Denies the force_close command without any pre-configured scope.", "type": "string", @@ -2408,6 +2486,12 @@ "const": "serialplugin:deny-open", "markdownDescription": "Denies the open command without any pre-configured scope." }, + { + "description": "Denies the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-open-mux-channel", + "markdownDescription": "Denies the open_mux_channel command without any pre-configured scope." + }, { "description": "Denies the read command without any pre-configured scope.", "type": "string", @@ -2426,54 +2510,30 @@ "const": "serialplugin:deny-read-carrier-detect", "markdownDescription": "Denies the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Denies the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cd", - "markdownDescription": "Denies the read_cd command without any pre-configured scope." - }, { "description": "Denies the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-clear-to-send", "markdownDescription": "Denies the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Denies the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cts", - "markdownDescription": "Denies the read_cts command without any pre-configured scope." - }, { "description": "Denies the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-data-set-ready", "markdownDescription": "Denies the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Denies the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dsr", - "markdownDescription": "Denies the read_dsr command without any pre-configured scope." - }, - { - "description": "Denies the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dtr", - "markdownDescription": "Denies the read_dtr command without any pre-configured scope." - }, - { - "description": "Denies the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-ri", - "markdownDescription": "Denies the read_ri command without any pre-configured scope." - }, { "description": "Denies the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-ring-indicator", "markdownDescription": "Denies the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Denies the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-send-sms-pdu", + "markdownDescription": "Denies the send_sms_pdu command without any pre-configured scope." + }, { "description": "Denies the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2523,16 +2583,28 @@ "markdownDescription": "Denies the set_timeout command without any pre-configured scope." }, { - "description": "Denies the start_listening command without any pre-configured scope.", + "description": "Denies the unwatch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-unwatch", + "markdownDescription": "Denies the unwatch command without any pre-configured scope." + }, + { + "description": "Denies the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-start-listening", - "markdownDescription": "Denies the start_listening command without any pre-configured scope." + "const": "serialplugin:deny-unwatch-ports", + "markdownDescription": "Denies the unwatch_ports command without any pre-configured scope." }, { - "description": "Denies the stop_listening command without any pre-configured scope.", + "description": "Denies the watch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-stop-listening", - "markdownDescription": "Denies the stop_listening command without any pre-configured scope." + "const": "serialplugin:deny-watch", + "markdownDescription": "Denies the watch command without any pre-configured scope." + }, + { + "description": "Denies the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-watch-ports", + "markdownDescription": "Denies the watch_ports command without any pre-configured scope." }, { "description": "Denies the write command without any pre-configured scope.", @@ -2552,23 +2624,11 @@ "const": "serialplugin:deny-write-data-terminal-ready", "markdownDescription": "Denies the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Denies the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-dtr", - "markdownDescription": "Denies the write_dtr command without any pre-configured scope." - }, { "description": "Denies the write_request_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-write-request-to-send", "markdownDescription": "Denies the write_request_to_send command without any pre-configured scope." - }, - { - "description": "Denies the write_rts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-rts", - "markdownDescription": "Denies the write_rts command without any pre-configured scope." } ] }, diff --git a/examples/serialport-test/src-tauri/gen/schemas/desktop-schema.json b/examples/serialport-test/src-tauri/gen/schemas/desktop-schema.json index 521f154f..b55dfdda 100644 --- a/examples/serialport-test/src-tauri/gen/schemas/desktop-schema.json +++ b/examples/serialport-test/src-tauri/gen/schemas/desktop-schema.json @@ -2085,22 +2085,28 @@ "markdownDescription": "Denies the unminimize command without any pre-configured scope." }, { - "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`", + "description": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`", "type": "string", "const": "serialplugin:default", - "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`" + "markdownDescription": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`" }, { - "description": "Enables the available_ports command without any pre-configured scope.", + "description": "Enables the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports", - "markdownDescription": "Enables the available_ports command without any pre-configured scope." + "const": "serialplugin:allow-at", + "markdownDescription": "Enables the at command without any pre-configured scope." }, { - "description": "Enables the available_ports_direct command without any pre-configured scope.", + "description": "Enables the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports-direct", - "markdownDescription": "Enables the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:allow-at-phases", + "markdownDescription": "Enables the at_phases command without any pre-configured scope." + }, + { + "description": "Enables the available_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-available-ports", + "markdownDescription": "Enables the available_ports command without any pre-configured scope." }, { "description": "Enables the bytes_to_read command without any pre-configured scope.", @@ -2114,12 +2120,24 @@ "const": "serialplugin:allow-bytes-to-write", "markdownDescription": "Enables the bytes_to_write command without any pre-configured scope." }, + { + "description": "Enables the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-cancel-exchange", + "markdownDescription": "Enables the cancel_exchange command without any pre-configured scope." + }, { "description": "Enables the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-cancel-read", "markdownDescription": "Enables the cancel_read command without any pre-configured scope." }, + { + "description": "Enables the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-capabilities", + "markdownDescription": "Enables the capabilities command without any pre-configured scope." + }, { "description": "Enables the clear_break command without any pre-configured scope.", "type": "string", @@ -2144,6 +2162,36 @@ "const": "serialplugin:allow-close-all", "markdownDescription": "Enables the close_all command without any pre-configured scope." }, + { + "description": "Enables the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-configure-at-session", + "markdownDescription": "Enables the configure_at_session command without any pre-configured scope." + }, + { + "description": "Enables the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-disable-mux", + "markdownDescription": "Enables the disable_mux command without any pre-configured scope." + }, + { + "description": "Enables the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-enable-mux", + "markdownDescription": "Enables the enable_mux command without any pre-configured scope." + }, + { + "description": "Enables the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange", + "markdownDescription": "Enables the exchange command without any pre-configured scope." + }, + { + "description": "Enables the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange-binary", + "markdownDescription": "Enables the exchange_binary command without any pre-configured scope." + }, { "description": "Enables the force_close command without any pre-configured scope.", "type": "string", @@ -2168,6 +2216,12 @@ "const": "serialplugin:allow-open", "markdownDescription": "Enables the open command without any pre-configured scope." }, + { + "description": "Enables the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-open-mux-channel", + "markdownDescription": "Enables the open_mux_channel command without any pre-configured scope." + }, { "description": "Enables the read command without any pre-configured scope.", "type": "string", @@ -2186,54 +2240,30 @@ "const": "serialplugin:allow-read-carrier-detect", "markdownDescription": "Enables the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Enables the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cd", - "markdownDescription": "Enables the read_cd command without any pre-configured scope." - }, { "description": "Enables the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-clear-to-send", "markdownDescription": "Enables the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Enables the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cts", - "markdownDescription": "Enables the read_cts command without any pre-configured scope." - }, { "description": "Enables the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-data-set-ready", "markdownDescription": "Enables the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Enables the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dsr", - "markdownDescription": "Enables the read_dsr command without any pre-configured scope." - }, - { - "description": "Enables the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dtr", - "markdownDescription": "Enables the read_dtr command without any pre-configured scope." - }, - { - "description": "Enables the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-ri", - "markdownDescription": "Enables the read_ri command without any pre-configured scope." - }, { "description": "Enables the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-ring-indicator", "markdownDescription": "Enables the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Enables the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-send-sms-pdu", + "markdownDescription": "Enables the send_sms_pdu command without any pre-configured scope." + }, { "description": "Enables the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2283,16 +2313,28 @@ "markdownDescription": "Enables the set_timeout command without any pre-configured scope." }, { - "description": "Enables the start_listening command without any pre-configured scope.", + "description": "Enables the unwatch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-start-listening", - "markdownDescription": "Enables the start_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch", + "markdownDescription": "Enables the unwatch command without any pre-configured scope." }, { - "description": "Enables the stop_listening command without any pre-configured scope.", + "description": "Enables the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-stop-listening", - "markdownDescription": "Enables the stop_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch-ports", + "markdownDescription": "Enables the unwatch_ports command without any pre-configured scope." + }, + { + "description": "Enables the watch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch", + "markdownDescription": "Enables the watch command without any pre-configured scope." + }, + { + "description": "Enables the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch-ports", + "markdownDescription": "Enables the watch_ports command without any pre-configured scope." }, { "description": "Enables the write command without any pre-configured scope.", @@ -2312,12 +2354,6 @@ "const": "serialplugin:allow-write-data-terminal-ready", "markdownDescription": "Enables the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Enables the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-write-dtr", - "markdownDescription": "Enables the write_dtr command without any pre-configured scope." - }, { "description": "Enables the write_request_to_send command without any pre-configured scope.", "type": "string", @@ -2325,22 +2361,22 @@ "markdownDescription": "Enables the write_request_to_send command without any pre-configured scope." }, { - "description": "Enables the write_rts command without any pre-configured scope.", + "description": "Denies the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-write-rts", - "markdownDescription": "Enables the write_rts command without any pre-configured scope." + "const": "serialplugin:deny-at", + "markdownDescription": "Denies the at command without any pre-configured scope." }, { - "description": "Denies the available_ports command without any pre-configured scope.", + "description": "Denies the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports", - "markdownDescription": "Denies the available_ports command without any pre-configured scope." + "const": "serialplugin:deny-at-phases", + "markdownDescription": "Denies the at_phases command without any pre-configured scope." }, { - "description": "Denies the available_ports_direct command without any pre-configured scope.", + "description": "Denies the available_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports-direct", - "markdownDescription": "Denies the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:deny-available-ports", + "markdownDescription": "Denies the available_ports command without any pre-configured scope." }, { "description": "Denies the bytes_to_read command without any pre-configured scope.", @@ -2354,12 +2390,24 @@ "const": "serialplugin:deny-bytes-to-write", "markdownDescription": "Denies the bytes_to_write command without any pre-configured scope." }, + { + "description": "Denies the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-cancel-exchange", + "markdownDescription": "Denies the cancel_exchange command without any pre-configured scope." + }, { "description": "Denies the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-cancel-read", "markdownDescription": "Denies the cancel_read command without any pre-configured scope." }, + { + "description": "Denies the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-capabilities", + "markdownDescription": "Denies the capabilities command without any pre-configured scope." + }, { "description": "Denies the clear_break command without any pre-configured scope.", "type": "string", @@ -2384,6 +2432,36 @@ "const": "serialplugin:deny-close-all", "markdownDescription": "Denies the close_all command without any pre-configured scope." }, + { + "description": "Denies the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-configure-at-session", + "markdownDescription": "Denies the configure_at_session command without any pre-configured scope." + }, + { + "description": "Denies the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-disable-mux", + "markdownDescription": "Denies the disable_mux command without any pre-configured scope." + }, + { + "description": "Denies the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-enable-mux", + "markdownDescription": "Denies the enable_mux command without any pre-configured scope." + }, + { + "description": "Denies the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange", + "markdownDescription": "Denies the exchange command without any pre-configured scope." + }, + { + "description": "Denies the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange-binary", + "markdownDescription": "Denies the exchange_binary command without any pre-configured scope." + }, { "description": "Denies the force_close command without any pre-configured scope.", "type": "string", @@ -2408,6 +2486,12 @@ "const": "serialplugin:deny-open", "markdownDescription": "Denies the open command without any pre-configured scope." }, + { + "description": "Denies the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-open-mux-channel", + "markdownDescription": "Denies the open_mux_channel command without any pre-configured scope." + }, { "description": "Denies the read command without any pre-configured scope.", "type": "string", @@ -2426,54 +2510,30 @@ "const": "serialplugin:deny-read-carrier-detect", "markdownDescription": "Denies the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Denies the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cd", - "markdownDescription": "Denies the read_cd command without any pre-configured scope." - }, { "description": "Denies the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-clear-to-send", "markdownDescription": "Denies the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Denies the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cts", - "markdownDescription": "Denies the read_cts command without any pre-configured scope." - }, { "description": "Denies the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-data-set-ready", "markdownDescription": "Denies the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Denies the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dsr", - "markdownDescription": "Denies the read_dsr command without any pre-configured scope." - }, - { - "description": "Denies the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dtr", - "markdownDescription": "Denies the read_dtr command without any pre-configured scope." - }, - { - "description": "Denies the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-ri", - "markdownDescription": "Denies the read_ri command without any pre-configured scope." - }, { "description": "Denies the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-ring-indicator", "markdownDescription": "Denies the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Denies the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-send-sms-pdu", + "markdownDescription": "Denies the send_sms_pdu command without any pre-configured scope." + }, { "description": "Denies the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2523,16 +2583,28 @@ "markdownDescription": "Denies the set_timeout command without any pre-configured scope." }, { - "description": "Denies the start_listening command without any pre-configured scope.", + "description": "Denies the unwatch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-unwatch", + "markdownDescription": "Denies the unwatch command without any pre-configured scope." + }, + { + "description": "Denies the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-start-listening", - "markdownDescription": "Denies the start_listening command without any pre-configured scope." + "const": "serialplugin:deny-unwatch-ports", + "markdownDescription": "Denies the unwatch_ports command without any pre-configured scope." }, { - "description": "Denies the stop_listening command without any pre-configured scope.", + "description": "Denies the watch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-stop-listening", - "markdownDescription": "Denies the stop_listening command without any pre-configured scope." + "const": "serialplugin:deny-watch", + "markdownDescription": "Denies the watch command without any pre-configured scope." + }, + { + "description": "Denies the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-watch-ports", + "markdownDescription": "Denies the watch_ports command without any pre-configured scope." }, { "description": "Denies the write command without any pre-configured scope.", @@ -2552,23 +2624,11 @@ "const": "serialplugin:deny-write-data-terminal-ready", "markdownDescription": "Denies the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Denies the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-dtr", - "markdownDescription": "Denies the write_dtr command without any pre-configured scope." - }, { "description": "Denies the write_request_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-write-request-to-send", "markdownDescription": "Denies the write_request_to_send command without any pre-configured scope." - }, - { - "description": "Denies the write_rts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-rts", - "markdownDescription": "Denies the write_rts command without any pre-configured scope." } ] }, diff --git a/examples/serialport-test/src-tauri/gen/schemas/macOS-schema.json b/examples/serialport-test/src-tauri/gen/schemas/macOS-schema.json index 521f154f..b55dfdda 100644 --- a/examples/serialport-test/src-tauri/gen/schemas/macOS-schema.json +++ b/examples/serialport-test/src-tauri/gen/schemas/macOS-schema.json @@ -2085,22 +2085,28 @@ "markdownDescription": "Denies the unminimize command without any pre-configured scope." }, { - "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`", + "description": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`", "type": "string", "const": "serialplugin:default", - "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`" + "markdownDescription": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`" }, { - "description": "Enables the available_ports command without any pre-configured scope.", + "description": "Enables the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports", - "markdownDescription": "Enables the available_ports command without any pre-configured scope." + "const": "serialplugin:allow-at", + "markdownDescription": "Enables the at command without any pre-configured scope." }, { - "description": "Enables the available_ports_direct command without any pre-configured scope.", + "description": "Enables the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports-direct", - "markdownDescription": "Enables the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:allow-at-phases", + "markdownDescription": "Enables the at_phases command without any pre-configured scope." + }, + { + "description": "Enables the available_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-available-ports", + "markdownDescription": "Enables the available_ports command without any pre-configured scope." }, { "description": "Enables the bytes_to_read command without any pre-configured scope.", @@ -2114,12 +2120,24 @@ "const": "serialplugin:allow-bytes-to-write", "markdownDescription": "Enables the bytes_to_write command without any pre-configured scope." }, + { + "description": "Enables the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-cancel-exchange", + "markdownDescription": "Enables the cancel_exchange command without any pre-configured scope." + }, { "description": "Enables the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-cancel-read", "markdownDescription": "Enables the cancel_read command without any pre-configured scope." }, + { + "description": "Enables the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-capabilities", + "markdownDescription": "Enables the capabilities command without any pre-configured scope." + }, { "description": "Enables the clear_break command without any pre-configured scope.", "type": "string", @@ -2144,6 +2162,36 @@ "const": "serialplugin:allow-close-all", "markdownDescription": "Enables the close_all command without any pre-configured scope." }, + { + "description": "Enables the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-configure-at-session", + "markdownDescription": "Enables the configure_at_session command without any pre-configured scope." + }, + { + "description": "Enables the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-disable-mux", + "markdownDescription": "Enables the disable_mux command without any pre-configured scope." + }, + { + "description": "Enables the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-enable-mux", + "markdownDescription": "Enables the enable_mux command without any pre-configured scope." + }, + { + "description": "Enables the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange", + "markdownDescription": "Enables the exchange command without any pre-configured scope." + }, + { + "description": "Enables the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange-binary", + "markdownDescription": "Enables the exchange_binary command without any pre-configured scope." + }, { "description": "Enables the force_close command without any pre-configured scope.", "type": "string", @@ -2168,6 +2216,12 @@ "const": "serialplugin:allow-open", "markdownDescription": "Enables the open command without any pre-configured scope." }, + { + "description": "Enables the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-open-mux-channel", + "markdownDescription": "Enables the open_mux_channel command without any pre-configured scope." + }, { "description": "Enables the read command without any pre-configured scope.", "type": "string", @@ -2186,54 +2240,30 @@ "const": "serialplugin:allow-read-carrier-detect", "markdownDescription": "Enables the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Enables the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cd", - "markdownDescription": "Enables the read_cd command without any pre-configured scope." - }, { "description": "Enables the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-clear-to-send", "markdownDescription": "Enables the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Enables the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cts", - "markdownDescription": "Enables the read_cts command without any pre-configured scope." - }, { "description": "Enables the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-data-set-ready", "markdownDescription": "Enables the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Enables the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dsr", - "markdownDescription": "Enables the read_dsr command without any pre-configured scope." - }, - { - "description": "Enables the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dtr", - "markdownDescription": "Enables the read_dtr command without any pre-configured scope." - }, - { - "description": "Enables the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-ri", - "markdownDescription": "Enables the read_ri command without any pre-configured scope." - }, { "description": "Enables the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-ring-indicator", "markdownDescription": "Enables the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Enables the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-send-sms-pdu", + "markdownDescription": "Enables the send_sms_pdu command without any pre-configured scope." + }, { "description": "Enables the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2283,16 +2313,28 @@ "markdownDescription": "Enables the set_timeout command without any pre-configured scope." }, { - "description": "Enables the start_listening command without any pre-configured scope.", + "description": "Enables the unwatch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-start-listening", - "markdownDescription": "Enables the start_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch", + "markdownDescription": "Enables the unwatch command without any pre-configured scope." }, { - "description": "Enables the stop_listening command without any pre-configured scope.", + "description": "Enables the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-stop-listening", - "markdownDescription": "Enables the stop_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch-ports", + "markdownDescription": "Enables the unwatch_ports command without any pre-configured scope." + }, + { + "description": "Enables the watch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch", + "markdownDescription": "Enables the watch command without any pre-configured scope." + }, + { + "description": "Enables the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch-ports", + "markdownDescription": "Enables the watch_ports command without any pre-configured scope." }, { "description": "Enables the write command without any pre-configured scope.", @@ -2312,12 +2354,6 @@ "const": "serialplugin:allow-write-data-terminal-ready", "markdownDescription": "Enables the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Enables the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-write-dtr", - "markdownDescription": "Enables the write_dtr command without any pre-configured scope." - }, { "description": "Enables the write_request_to_send command without any pre-configured scope.", "type": "string", @@ -2325,22 +2361,22 @@ "markdownDescription": "Enables the write_request_to_send command without any pre-configured scope." }, { - "description": "Enables the write_rts command without any pre-configured scope.", + "description": "Denies the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-write-rts", - "markdownDescription": "Enables the write_rts command without any pre-configured scope." + "const": "serialplugin:deny-at", + "markdownDescription": "Denies the at command without any pre-configured scope." }, { - "description": "Denies the available_ports command without any pre-configured scope.", + "description": "Denies the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports", - "markdownDescription": "Denies the available_ports command without any pre-configured scope." + "const": "serialplugin:deny-at-phases", + "markdownDescription": "Denies the at_phases command without any pre-configured scope." }, { - "description": "Denies the available_ports_direct command without any pre-configured scope.", + "description": "Denies the available_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports-direct", - "markdownDescription": "Denies the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:deny-available-ports", + "markdownDescription": "Denies the available_ports command without any pre-configured scope." }, { "description": "Denies the bytes_to_read command without any pre-configured scope.", @@ -2354,12 +2390,24 @@ "const": "serialplugin:deny-bytes-to-write", "markdownDescription": "Denies the bytes_to_write command without any pre-configured scope." }, + { + "description": "Denies the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-cancel-exchange", + "markdownDescription": "Denies the cancel_exchange command without any pre-configured scope." + }, { "description": "Denies the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-cancel-read", "markdownDescription": "Denies the cancel_read command without any pre-configured scope." }, + { + "description": "Denies the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-capabilities", + "markdownDescription": "Denies the capabilities command without any pre-configured scope." + }, { "description": "Denies the clear_break command without any pre-configured scope.", "type": "string", @@ -2384,6 +2432,36 @@ "const": "serialplugin:deny-close-all", "markdownDescription": "Denies the close_all command without any pre-configured scope." }, + { + "description": "Denies the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-configure-at-session", + "markdownDescription": "Denies the configure_at_session command without any pre-configured scope." + }, + { + "description": "Denies the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-disable-mux", + "markdownDescription": "Denies the disable_mux command without any pre-configured scope." + }, + { + "description": "Denies the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-enable-mux", + "markdownDescription": "Denies the enable_mux command without any pre-configured scope." + }, + { + "description": "Denies the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange", + "markdownDescription": "Denies the exchange command without any pre-configured scope." + }, + { + "description": "Denies the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange-binary", + "markdownDescription": "Denies the exchange_binary command without any pre-configured scope." + }, { "description": "Denies the force_close command without any pre-configured scope.", "type": "string", @@ -2408,6 +2486,12 @@ "const": "serialplugin:deny-open", "markdownDescription": "Denies the open command without any pre-configured scope." }, + { + "description": "Denies the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-open-mux-channel", + "markdownDescription": "Denies the open_mux_channel command without any pre-configured scope." + }, { "description": "Denies the read command without any pre-configured scope.", "type": "string", @@ -2426,54 +2510,30 @@ "const": "serialplugin:deny-read-carrier-detect", "markdownDescription": "Denies the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Denies the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cd", - "markdownDescription": "Denies the read_cd command without any pre-configured scope." - }, { "description": "Denies the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-clear-to-send", "markdownDescription": "Denies the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Denies the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cts", - "markdownDescription": "Denies the read_cts command without any pre-configured scope." - }, { "description": "Denies the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-data-set-ready", "markdownDescription": "Denies the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Denies the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dsr", - "markdownDescription": "Denies the read_dsr command without any pre-configured scope." - }, - { - "description": "Denies the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dtr", - "markdownDescription": "Denies the read_dtr command without any pre-configured scope." - }, - { - "description": "Denies the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-ri", - "markdownDescription": "Denies the read_ri command without any pre-configured scope." - }, { "description": "Denies the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-ring-indicator", "markdownDescription": "Denies the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Denies the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-send-sms-pdu", + "markdownDescription": "Denies the send_sms_pdu command without any pre-configured scope." + }, { "description": "Denies the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2523,16 +2583,28 @@ "markdownDescription": "Denies the set_timeout command without any pre-configured scope." }, { - "description": "Denies the start_listening command without any pre-configured scope.", + "description": "Denies the unwatch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-unwatch", + "markdownDescription": "Denies the unwatch command without any pre-configured scope." + }, + { + "description": "Denies the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-start-listening", - "markdownDescription": "Denies the start_listening command without any pre-configured scope." + "const": "serialplugin:deny-unwatch-ports", + "markdownDescription": "Denies the unwatch_ports command without any pre-configured scope." }, { - "description": "Denies the stop_listening command without any pre-configured scope.", + "description": "Denies the watch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-stop-listening", - "markdownDescription": "Denies the stop_listening command without any pre-configured scope." + "const": "serialplugin:deny-watch", + "markdownDescription": "Denies the watch command without any pre-configured scope." + }, + { + "description": "Denies the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-watch-ports", + "markdownDescription": "Denies the watch_ports command without any pre-configured scope." }, { "description": "Denies the write command without any pre-configured scope.", @@ -2552,23 +2624,11 @@ "const": "serialplugin:deny-write-data-terminal-ready", "markdownDescription": "Denies the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Denies the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-dtr", - "markdownDescription": "Denies the write_dtr command without any pre-configured scope." - }, { "description": "Denies the write_request_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-write-request-to-send", "markdownDescription": "Denies the write_request_to_send command without any pre-configured scope." - }, - { - "description": "Denies the write_rts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-rts", - "markdownDescription": "Denies the write_rts command without any pre-configured scope." } ] }, diff --git a/examples/serialport-test/src-tauri/gen/schemas/mobile-schema.json b/examples/serialport-test/src-tauri/gen/schemas/mobile-schema.json index 521f154f..b55dfdda 100644 --- a/examples/serialport-test/src-tauri/gen/schemas/mobile-schema.json +++ b/examples/serialport-test/src-tauri/gen/schemas/mobile-schema.json @@ -2085,22 +2085,28 @@ "markdownDescription": "Denies the unminimize command without any pre-configured scope." }, { - "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`", + "description": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`", "type": "string", "const": "serialplugin:default", - "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`" + "markdownDescription": "Default permissions for the serialplugin: enumerate, open, read/write, watch/unwatch,\nport hotplug, AT session, exchange, and configure serial ports on desktop and Android.\n\n#### This default permission set includes:\n\n- `allow-managed-ports`\n- `allow-available-ports`\n- `allow-watch-ports`\n- `allow-unwatch-ports`\n- `allow-cancel-read`\n- `allow-close`\n- `allow-close-all`\n- `allow-force-close`\n- `allow-open`\n- `allow-read`\n- `allow-read-binary`\n- `allow-write`\n- `allow-write-binary`\n- `allow-capabilities`\n- `allow-watch`\n- `allow-unwatch`\n- `allow-bytes-to-read`\n- `allow-bytes-to-write`\n- `allow-clear-break`\n- `allow-clear-buffer`\n- `allow-read-carrier-detect`\n- `allow-read-clear-to-send`\n- `allow-read-data-set-ready`\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-write-data-terminal-ready`\n- `allow-write-request-to-send`\n- `allow-set-log-level`\n- `allow-get-log-level`\n- `allow-exchange`\n- `allow-exchange-binary`\n- `allow-cancel-exchange`\n- `allow-at`\n- `allow-at-phases`\n- `allow-send-sms-pdu`\n- `allow-configure-at-session`\n- `allow-enable-mux`\n- `allow-open-mux-channel`\n- `allow-disable-mux`" }, { - "description": "Enables the available_ports command without any pre-configured scope.", + "description": "Enables the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports", - "markdownDescription": "Enables the available_ports command without any pre-configured scope." + "const": "serialplugin:allow-at", + "markdownDescription": "Enables the at command without any pre-configured scope." }, { - "description": "Enables the available_ports_direct command without any pre-configured scope.", + "description": "Enables the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-available-ports-direct", - "markdownDescription": "Enables the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:allow-at-phases", + "markdownDescription": "Enables the at_phases command without any pre-configured scope." + }, + { + "description": "Enables the available_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-available-ports", + "markdownDescription": "Enables the available_ports command without any pre-configured scope." }, { "description": "Enables the bytes_to_read command without any pre-configured scope.", @@ -2114,12 +2120,24 @@ "const": "serialplugin:allow-bytes-to-write", "markdownDescription": "Enables the bytes_to_write command without any pre-configured scope." }, + { + "description": "Enables the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-cancel-exchange", + "markdownDescription": "Enables the cancel_exchange command without any pre-configured scope." + }, { "description": "Enables the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-cancel-read", "markdownDescription": "Enables the cancel_read command without any pre-configured scope." }, + { + "description": "Enables the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-capabilities", + "markdownDescription": "Enables the capabilities command without any pre-configured scope." + }, { "description": "Enables the clear_break command without any pre-configured scope.", "type": "string", @@ -2144,6 +2162,36 @@ "const": "serialplugin:allow-close-all", "markdownDescription": "Enables the close_all command without any pre-configured scope." }, + { + "description": "Enables the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-configure-at-session", + "markdownDescription": "Enables the configure_at_session command without any pre-configured scope." + }, + { + "description": "Enables the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-disable-mux", + "markdownDescription": "Enables the disable_mux command without any pre-configured scope." + }, + { + "description": "Enables the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-enable-mux", + "markdownDescription": "Enables the enable_mux command without any pre-configured scope." + }, + { + "description": "Enables the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange", + "markdownDescription": "Enables the exchange command without any pre-configured scope." + }, + { + "description": "Enables the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-exchange-binary", + "markdownDescription": "Enables the exchange_binary command without any pre-configured scope." + }, { "description": "Enables the force_close command without any pre-configured scope.", "type": "string", @@ -2168,6 +2216,12 @@ "const": "serialplugin:allow-open", "markdownDescription": "Enables the open command without any pre-configured scope." }, + { + "description": "Enables the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-open-mux-channel", + "markdownDescription": "Enables the open_mux_channel command without any pre-configured scope." + }, { "description": "Enables the read command without any pre-configured scope.", "type": "string", @@ -2186,54 +2240,30 @@ "const": "serialplugin:allow-read-carrier-detect", "markdownDescription": "Enables the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Enables the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cd", - "markdownDescription": "Enables the read_cd command without any pre-configured scope." - }, { "description": "Enables the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-clear-to-send", "markdownDescription": "Enables the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Enables the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-cts", - "markdownDescription": "Enables the read_cts command without any pre-configured scope." - }, { "description": "Enables the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-data-set-ready", "markdownDescription": "Enables the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Enables the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dsr", - "markdownDescription": "Enables the read_dsr command without any pre-configured scope." - }, - { - "description": "Enables the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-dtr", - "markdownDescription": "Enables the read_dtr command without any pre-configured scope." - }, - { - "description": "Enables the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-read-ri", - "markdownDescription": "Enables the read_ri command without any pre-configured scope." - }, { "description": "Enables the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:allow-read-ring-indicator", "markdownDescription": "Enables the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Enables the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-send-sms-pdu", + "markdownDescription": "Enables the send_sms_pdu command without any pre-configured scope." + }, { "description": "Enables the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2283,16 +2313,28 @@ "markdownDescription": "Enables the set_timeout command without any pre-configured scope." }, { - "description": "Enables the start_listening command without any pre-configured scope.", + "description": "Enables the unwatch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-start-listening", - "markdownDescription": "Enables the start_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch", + "markdownDescription": "Enables the unwatch command without any pre-configured scope." }, { - "description": "Enables the stop_listening command without any pre-configured scope.", + "description": "Enables the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-stop-listening", - "markdownDescription": "Enables the stop_listening command without any pre-configured scope." + "const": "serialplugin:allow-unwatch-ports", + "markdownDescription": "Enables the unwatch_ports command without any pre-configured scope." + }, + { + "description": "Enables the watch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch", + "markdownDescription": "Enables the watch command without any pre-configured scope." + }, + { + "description": "Enables the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:allow-watch-ports", + "markdownDescription": "Enables the watch_ports command without any pre-configured scope." }, { "description": "Enables the write command without any pre-configured scope.", @@ -2312,12 +2354,6 @@ "const": "serialplugin:allow-write-data-terminal-ready", "markdownDescription": "Enables the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Enables the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:allow-write-dtr", - "markdownDescription": "Enables the write_dtr command without any pre-configured scope." - }, { "description": "Enables the write_request_to_send command without any pre-configured scope.", "type": "string", @@ -2325,22 +2361,22 @@ "markdownDescription": "Enables the write_request_to_send command without any pre-configured scope." }, { - "description": "Enables the write_rts command without any pre-configured scope.", + "description": "Denies the at command without any pre-configured scope.", "type": "string", - "const": "serialplugin:allow-write-rts", - "markdownDescription": "Enables the write_rts command without any pre-configured scope." + "const": "serialplugin:deny-at", + "markdownDescription": "Denies the at command without any pre-configured scope." }, { - "description": "Denies the available_ports command without any pre-configured scope.", + "description": "Denies the at_phases command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports", - "markdownDescription": "Denies the available_ports command without any pre-configured scope." + "const": "serialplugin:deny-at-phases", + "markdownDescription": "Denies the at_phases command without any pre-configured scope." }, { - "description": "Denies the available_ports_direct command without any pre-configured scope.", + "description": "Denies the available_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-available-ports-direct", - "markdownDescription": "Denies the available_ports_direct command without any pre-configured scope." + "const": "serialplugin:deny-available-ports", + "markdownDescription": "Denies the available_ports command without any pre-configured scope." }, { "description": "Denies the bytes_to_read command without any pre-configured scope.", @@ -2354,12 +2390,24 @@ "const": "serialplugin:deny-bytes-to-write", "markdownDescription": "Denies the bytes_to_write command without any pre-configured scope." }, + { + "description": "Denies the cancel_exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-cancel-exchange", + "markdownDescription": "Denies the cancel_exchange command without any pre-configured scope." + }, { "description": "Denies the cancel_read command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-cancel-read", "markdownDescription": "Denies the cancel_read command without any pre-configured scope." }, + { + "description": "Denies the capabilities command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-capabilities", + "markdownDescription": "Denies the capabilities command without any pre-configured scope." + }, { "description": "Denies the clear_break command without any pre-configured scope.", "type": "string", @@ -2384,6 +2432,36 @@ "const": "serialplugin:deny-close-all", "markdownDescription": "Denies the close_all command without any pre-configured scope." }, + { + "description": "Denies the configure_at_session command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-configure-at-session", + "markdownDescription": "Denies the configure_at_session command without any pre-configured scope." + }, + { + "description": "Denies the disable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-disable-mux", + "markdownDescription": "Denies the disable_mux command without any pre-configured scope." + }, + { + "description": "Denies the enable_mux command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-enable-mux", + "markdownDescription": "Denies the enable_mux command without any pre-configured scope." + }, + { + "description": "Denies the exchange command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange", + "markdownDescription": "Denies the exchange command without any pre-configured scope." + }, + { + "description": "Denies the exchange_binary command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-exchange-binary", + "markdownDescription": "Denies the exchange_binary command without any pre-configured scope." + }, { "description": "Denies the force_close command without any pre-configured scope.", "type": "string", @@ -2408,6 +2486,12 @@ "const": "serialplugin:deny-open", "markdownDescription": "Denies the open command without any pre-configured scope." }, + { + "description": "Denies the open_mux_channel command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-open-mux-channel", + "markdownDescription": "Denies the open_mux_channel command without any pre-configured scope." + }, { "description": "Denies the read command without any pre-configured scope.", "type": "string", @@ -2426,54 +2510,30 @@ "const": "serialplugin:deny-read-carrier-detect", "markdownDescription": "Denies the read_carrier_detect command without any pre-configured scope." }, - { - "description": "Denies the read_cd command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cd", - "markdownDescription": "Denies the read_cd command without any pre-configured scope." - }, { "description": "Denies the read_clear_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-clear-to-send", "markdownDescription": "Denies the read_clear_to_send command without any pre-configured scope." }, - { - "description": "Denies the read_cts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-cts", - "markdownDescription": "Denies the read_cts command without any pre-configured scope." - }, { "description": "Denies the read_data_set_ready command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-data-set-ready", "markdownDescription": "Denies the read_data_set_ready command without any pre-configured scope." }, - { - "description": "Denies the read_dsr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dsr", - "markdownDescription": "Denies the read_dsr command without any pre-configured scope." - }, - { - "description": "Denies the read_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-dtr", - "markdownDescription": "Denies the read_dtr command without any pre-configured scope." - }, - { - "description": "Denies the read_ri command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-read-ri", - "markdownDescription": "Denies the read_ri command without any pre-configured scope." - }, { "description": "Denies the read_ring_indicator command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-read-ring-indicator", "markdownDescription": "Denies the read_ring_indicator command without any pre-configured scope." }, + { + "description": "Denies the send_sms_pdu command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-send-sms-pdu", + "markdownDescription": "Denies the send_sms_pdu command without any pre-configured scope." + }, { "description": "Denies the set_baud_rate command without any pre-configured scope.", "type": "string", @@ -2523,16 +2583,28 @@ "markdownDescription": "Denies the set_timeout command without any pre-configured scope." }, { - "description": "Denies the start_listening command without any pre-configured scope.", + "description": "Denies the unwatch command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-unwatch", + "markdownDescription": "Denies the unwatch command without any pre-configured scope." + }, + { + "description": "Denies the unwatch_ports command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-start-listening", - "markdownDescription": "Denies the start_listening command without any pre-configured scope." + "const": "serialplugin:deny-unwatch-ports", + "markdownDescription": "Denies the unwatch_ports command without any pre-configured scope." }, { - "description": "Denies the stop_listening command without any pre-configured scope.", + "description": "Denies the watch command without any pre-configured scope.", "type": "string", - "const": "serialplugin:deny-stop-listening", - "markdownDescription": "Denies the stop_listening command without any pre-configured scope." + "const": "serialplugin:deny-watch", + "markdownDescription": "Denies the watch command without any pre-configured scope." + }, + { + "description": "Denies the watch_ports command without any pre-configured scope.", + "type": "string", + "const": "serialplugin:deny-watch-ports", + "markdownDescription": "Denies the watch_ports command without any pre-configured scope." }, { "description": "Denies the write command without any pre-configured scope.", @@ -2552,23 +2624,11 @@ "const": "serialplugin:deny-write-data-terminal-ready", "markdownDescription": "Denies the write_data_terminal_ready command without any pre-configured scope." }, - { - "description": "Denies the write_dtr command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-dtr", - "markdownDescription": "Denies the write_dtr command without any pre-configured scope." - }, { "description": "Denies the write_request_to_send command without any pre-configured scope.", "type": "string", "const": "serialplugin:deny-write-request-to-send", "markdownDescription": "Denies the write_request_to_send command without any pre-configured scope." - }, - { - "description": "Denies the write_rts command without any pre-configured scope.", - "type": "string", - "const": "serialplugin:deny-write-rts", - "markdownDescription": "Denies the write_rts command without any pre-configured scope." } ] }, diff --git a/examples/serialport-test/src-tauri/src/lib.rs b/examples/serialport-test/src-tauri/src/lib.rs index 7b8078ab..602297fa 100644 --- a/examples/serialport-test/src-tauri/src/lib.rs +++ b/examples/serialport-test/src-tauri/src/lib.rs @@ -4,61 +4,56 @@ fn greet(name: &str) -> String { format!("Hello, {}! You've been greeted from Rust!", name) } +#[cfg(desktop)] #[tauri::command] async fn get_ports_programmatically( app: tauri::AppHandle, - serial: tauri::State<'_, tauri_plugin_serialplugin::desktop_api::SerialPort> + serial: tauri::State<'_, tauri_plugin_serialplugin::api::desktop::SerialPort>, ) -> Result { - - // Get list of available ports - let available_ports = tauri_plugin_serialplugin::commands::available_ports(app.clone(), serial.clone()) + let available_ports = tauri_plugin_serialplugin::commands::available_ports(app.clone(), serial.clone(), None) .map_err(|e| format!("Failed to get available ports: {}", e))?; - - // Get list of ports via direct commands - let direct_ports = tauri_plugin_serialplugin::commands::available_ports_direct(app.clone(), serial.clone()) - .map_err(|e| format!("Failed to get direct ports: {}", e))?; - - // Get list of managed ports + let managed_ports = tauri_plugin_serialplugin::commands::managed_ports(app.clone(), serial.clone()) .map_err(|e| format!("Failed to get managed ports: {}", e))?; - - // Format the result - let result = format!( + + Ok(format!( "=== Programmatic Port List Retrieval ===\n\ Available ports count: {}\n\ - Direct ports count: {}\n\ Managed ports count: {}\n\ \n\ Available ports: {:?}\n\ - Direct ports: {:?}\n\ Managed ports: {:?}\n\ \n\ === Programmatic retrieval completed ===", available_ports.len(), - direct_ports.len(), managed_ports.len(), available_ports, - direct_ports, managed_ports - ); - - Ok(result) + )) } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .setup(|_app| { - #[cfg(debug_assertions)] // only include this code on debug builds + #[cfg(all(debug_assertions, desktop))] { - // Note: DevTools are not available on mobile use tauri::Manager; let window = _app.get_webview_window("main").unwrap(); window.open_devtools(); } Ok(()) }) - .invoke_handler(tauri::generate_handler![greet, get_ports_programmatically]) + .invoke_handler({ + #[cfg(desktop)] + { + tauri::generate_handler![greet, get_ports_programmatically] + } + #[cfg(mobile)] + { + tauri::generate_handler![greet] + } + }) .plugin(tauri_plugin_serialplugin::init()) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/examples/serialport-test/src-tauri/tauri.conf.json b/examples/serialport-test/src-tauri/tauri.conf.json index a86f6c4a..fb0f36ff 100755 --- a/examples/serialport-test/src-tauri/tauri.conf.json +++ b/examples/serialport-test/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "build": { - "beforeDevCommand": "npm run dev", - "beforeBuildCommand": "npm run build", + "beforeDevCommand": "pnpm run dev", + "beforeBuildCommand": "pnpm run build", "frontendDist": "../dist", "devUrl": "http://localhost:1420" }, @@ -14,8 +14,7 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" - ], - "createUpdaterArtifacts": "v1Compatible" + ] }, "productName": "serialport-test", "version": "0.0.1", diff --git a/examples/serialport-test/src/App.svelte b/examples/serialport-test/src/App.svelte deleted file mode 100755 index e36d9dda..00000000 --- a/examples/serialport-test/src/App.svelte +++ /dev/null @@ -1,558 +0,0 @@ - - -
-
-

Serial Port Manager

-

Multi-port serial communication demo

-
- - -
-
-

🔧 Rust Commands

-

Test backend functionality

-
- -

Result will be displayed in browser console

-
- - -
-
-

🔗 Manual Connection

-

Connect to a specific port

-
-
- - -
-
- - -
-
-

📡 Port Discovery

-

Available serial ports on your system

-
-
- -
-
-

🔍 Available Ports

- -
- {#if Object.keys(availablePorts).length > 0} -
    - {#each Object.entries(availablePorts).sort( (a, b) => a[0].localeCompare(b[0]), ) as [portName, info]} -
  • -
    - {portName} - {info.type} -
    - -
  • - {/each} -
- {:else} -

No ports found

- {/if} -
- - -
-
-

🎯 Direct Ports

- -
- {#if Object.keys(directPorts).length > 0} -
    - {#each Object.entries(directPorts).sort( (a, b) => a[0].localeCompare(b[0]), ) as [portName, info]} -
  • -
    - {portName} - {info.type} -
    - -
  • - {/each} -
- {:else} -

No direct ports found

- {/if} -
- - -
-
-

⚙️ Managed Ports

- -
- {#if managedPorts.length > 0} -
    - {#each managedPorts as portName} -
  • -
    - {portName} - Managed -
    - -
  • - {/each} -
- {:else} -

No managed ports found

- {/if} -
-
-
- - -
-
-

🔌 Active Connections

-

Currently connected serial ports

-
- {#if activePorts.length > 0} -
- {#each activePorts as portName} -
- -
- {/each} -
- {:else} -
-
🔌
-

No active connections

-

Add a port from the lists above to get started

-
- {/if} -
-
- - diff --git a/examples/serialport-test/src/App.vue b/examples/serialport-test/src/App.vue new file mode 100644 index 00000000..a86e464d --- /dev/null +++ b/examples/serialport-test/src/App.vue @@ -0,0 +1,168 @@ + + + + + diff --git a/examples/serialport-test/src/components/PortAtConsole.vue b/examples/serialport-test/src/components/PortAtConsole.vue new file mode 100644 index 00000000..aa7a9384 --- /dev/null +++ b/examples/serialport-test/src/components/PortAtConsole.vue @@ -0,0 +1,196 @@ + + +