Skip to content

Android: Failed to open port: No enum constant app.tauri.serialplugin.models.DataBits.8 #19

@FalsePsyche

Description

@FalsePsyche

When attempting to connect to a serial port on Android using the latest main branch of tauri-plugin-serialplugin, the connection fails with the error Plugin error: Failed to open port: No enum constant app.tauri.serialplugin.models.DataBits.8. This occurs when specifying 8 data bits, which is a standard configuration.

Environment:

  • Plugin Version: main branch (commit around early June 2025, e.g., 81730a5 or latest)
  • Tauri Version: tauri-cli 2.5.0
  • Operating System: Android Go 15
  • Device: Lenovo M8 Android Tablet with CP2104 USB-to-UART bridge
  • Rust Version: rustc 1.86.0 (05f9846f8 2025-03-31)

Steps to Reproduce:

  1. Configure tauri-plugin-serialplugin in Cargo.toml to use the main branch:
    tauri-plugin-serialplugin = { git = "https://github.com/s00d/tauri-plugin-serialplugin.git", branch = "main" }
  2. Attempt to open a serial port connection from the Tauri frontend on an Android device with the following parameters (or similar standard parameters):
    • path: (e.g., /dev/bus/usb/001/011)
    • baudRate: (e.g., 115200 or any other valid rate)
    • dataBits: 8
    • stopBits: 1
    • parity: none
    • flowControl: none (or hardware if applicable, the error seems to occur before flow control is deeply engaged)
  3. Observe the error.

Expected Behavior:
The serial port should connect successfully, allowing for data transmission.

Actual Behavior:
The connection fails, and the following error is logged in the Tauri console:

Error connecting to port: Plugin error: Failed to open port: No enum constant app.tauri.serialplugin.models.DataBits.8

(Referenced from frontend log: File: http://tauri.localhost/src/components/SerialPort/SerialPort2.tsx - Line 164 - Msg: Error connecting to port: Plugin error: Failed to open port: No enum constant app.tauri.serialplugin.models.DataBits.8)

Additional Context:

  • The issue seems specific to the Android implementation of the plugin.
  • The USB device being connected to is a CP2104 USB to UART Bridge Controller.

Log Snippet (from Tauri console on Android):

06-05 15:27:05.680 13526 13526 I Tauri/Console: File: http://tauri.localhost/src/components/SerialPort/SerialPort2.tsx - Line 91 - Msg: Raw response from available_ports: {"/dev/bus/usb/001/011":{"vid":"4292","pid":"60000","product":"CP2104 USB to UART Bridge Controller","serial_number":"02L2L7MG","type":"USB","manufacturer":"Silicon Labs"}}
06-05 15:27:05.681 13526 13526 I Tauri/Console: File: http://tauri.localhost/src/components/SerialPort/SerialPort2.tsx - Line 78 - Msg: [3:27:05 PM] INFO: Found 1 ports using standard method.
06-05 15:27:05.682 13526 13526 I Tauri/Console: File: http://tauri.localhost/src/components/SerialPort/SerialPort2.tsx - Line 100 - Msg: Port path: /dev/bus/usb/001/011
06-05 15:27:05.683 13526 13526 I Tauri/Console: File: http://tauri.localhost/src/components/SerialPort/SerialPort2.tsx - Line 101 - Msg: Port info: {"vid":"4292","pid":"60000","product":"CP2104 USB to UART Bridge Controller","serial_number":"02L2L7MG","type":"USB","manufacturer":"Silicon Labs","path":"/dev/bus/usb/001/011"}
06-05 15:27:08.504 13526 13526 I Tauri/Console: File: http://tauri.localhost/src/components/SerialPort/SerialPort2.tsx - Line 78 - Msg: [3:27:08 PM] INFO: Connecting to /dev/bus/usb/001/011...
06-05 15:27:08.657 13526 13526 E Tauri/Console: File: http://tauri.localhost/src/components/SerialPort/SerialPort2.tsx - Line 164 - Msg: Error connecting to port: Plugin error: Failed to open port: No enum constant app.tauri.serialplugin.models.DataBits.8

I'm wondering if Android will be properly supported in the future? When I pulled down the repo and manually modified it to get past this No enum constant error, I started having trouble with enabling hardware flow control. These issue lead me to assume that the android implementation is incomplete.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions