Skip to content

Custom firmware v1.6.2: authentication with M5Stack services and StackChan World #134

Open

Description

@berusnet

Hi M5Stack team,

I’m developing a local AI integration for an original StackChan equipped with the M140 LLM module.

I built firmware v1.6.2 from the public source, adding a separate M140 local-agent app while retaining the existing AI.AGENT and AVATAR apps. The firmware builds and boots successfully.

I would like to clarify the supported authentication path for custom firmware builds.

Observed behavior

  • Wi-Fi connects successfully.
  • AI Agent work as the original.
  • Test Service reaches the M5Stack Device API, which returns HTTP 200 with application error code 53.
  • In AVATAR mode, the firmware reports repeated WebSocket handshake failures.
  • With AVATAR open on StackChan and Motion controls open in StackChan World, manual left/right commands produce no movement.

During a 55-second serial capture covering those manual commands, the firmware logged:

  • No incoming ControlMotion packets.
  • Repeated WebSocket handshake failed messages.
  • The LAN channel waiting for the app to announce its endpoint.

Source-code findings

In firmware/main/hal/utils/secret_logic/secret_logic.cpp, the weak implementations of generate_auth_token() and generate_handshake_token() return the fixed string hi-stack-chan.

I verified that these placeholder implementations are linked into my build.

###Question
PR #128 distinguishes hardware validation using the release firmware from build validation with the public authentication placeholder. Could you clarify what additional components or configuration are required for custom firmware to authenticate with M5Stack services?

Thank you!

6025848685935136322

Activity

  1. Forairaaaaa commented on Nov 12, 2026

    @Forairaaaaa
    Contributor

    Hi, your findings are correct. The public source includes placeholder authentication functions; the production implementation used by the official firmware is not included in this repository. There is no additional SDKCONFIG setting that enables it for a custom build.

    These functions are used by the M5Stack service connection and StackChan World handshake. AI.Agent uses a separate Xiaozhi connection, so it can still work independently.

    This is a limitation of the public build, and your observations are consistent with it. We currently don’t have a published authentication component or setup procedure to provide for custom firmware that needs to retain those official integrations.

  2. berusnet commented on Nov 12, 2026

    @berusnet
    Author

    Hi, your findings are correct. The public source includes placeholder authentication functions; the production implementation used by the official firmware is not included in this repository. There is no additional SDKCONFIG setting that enables it for a custom build.

    These functions are used by the M5Stack service connection and StackChan World handshake. AI.Agent uses a separate Xiaozhi connection, so it can still work independently.

    This is a limitation of the public build, and your observations are consistent with it. We currently don’t have a published authentication component or setup procedure to provide for custom firmware that needs to retain those official integrations.

    Thank you for the clarification!

    Are there any plans to release an authentication component, SDK, or provisioning procedure for custom firmware in the near future?

    It would be very useful for developers who want to extend StackChan with custom applications while preserving compatibility with official M5Stack services.

    Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions