230 Commits
Author SHA1 Message Date
Guido Günther da7a3742ab rpcd: Map -h to help
This allows to get usage information without a non-zero exit status.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2026-09-15 10:21:41 +02:00
Richard Acayan 598b591ae9 tests: add unit test for hexagonrpc function
The hexagonrpc function is getting very complex and deserves its own
unit test. Add a unit test for the hexagonrpc function.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan ab26a830a6 libhexagonrpc: remove legacy APIs
There is now no user of the interp2 APIs in the source tree.
Remove them.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 605b90ac7e hexagonrpcd: iobuffer: depend on new hexagonrpc header
The iobuffer decoder depends on REMOTE_SCALARS_INBUFS to know the number
of encoded input buffers without knowing the exact length of the encoded
input. Depend on the new hexagonrpc header which is being switched to.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 5218213f66 tests: depend on stdlib and new libhexagonrpc header file
Both the hexagonfs and iobuffer tests need malloc and free. The iobuffer
test also needs REMOTE_SCALARS_MAKE. Include stdlib directly and include
the new libhexagonrpc header file.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 4210f6d851 hexagonrpcd: listener: remove interp2 support
With the remote method definitions converted to interp4, the interp2
definitions are no longer needed. Replace the interp2 definitions with
the interp4 definitions recently added.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 9da2b5ec0c hexagonrpcd: interface: switch adsp_default_listener to interp4
The new interp4 definitions add support for more remote methods with
sequences of multi-byte data, sequences of sequences, plain integers
interleaved with sequences, and constant-size data other than 32-bit
integers. The new definitions are complex and can't fit in a simple
macro. Switch the chre_slpi interface to interp4, split it into a header
and source file, and update the users.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 0b2b5d245e hexagonrpcd: interface: switch adsp_listener to interp4
The new interp4 definitions add support for more remote methods with
sequences of multi-byte data, sequences of sequences, plain integers
interleaved with sequences, and constant-size data other than 32-bit
integers. The new definitions are complex and can't fit in a simple
macro. Switch the adsp_listener interface to interp4, split it into a
header and source file, and update the users.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 0390727bca hexagonrpcd: interface: switch apps_mem interface to interp4
The new interp4 definitions add support for more remote methods with
sequences of multi-byte data, sequences of sequences, plain integers
interleaved with sequences, and constant-size data other than 32-bit
integers. The new definitions are complex and can't fit in a simple
macro. Switch the apps_mem interface to interp4, split it into a header
and source file, and add the new definitions to the implementation.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 2469c21ca7 hexagonrpcd: interface: switch apps_std interface to interp4
The new interp4 definitions add support for more remote methods with
sequences of multi-byte data, sequences of sequences, plain integers
interleaved with sequences, and constant-size data other than 32-bit
integers. The new definitions are complex and can't fit in a simple
macro. Switch the chre_slpi interface to interp4, split it into a header
and source file, and add the new definitions to the implementation.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan e53998a12e chrecd: interface: switch chre_slpi interface to interp4
The new interp4 definitions add support for more remote methods with
sequences of multi-byte data, sequences of sequences, plain integers
interleaved with sequences, and constant-size data other than 32-bit
integers. The new definitions are complex and can't fit in a simple
macro. Switch the chre_slpi interface to interp4, split it into a header
and source file, and update the users.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 1dacea0470 libhexagonrpc: interface: switch remotectl interface to interp4
The new interp4 definitions add support for more remote methods with
sequences of multi-byte data, sequences of sequences, plain integers
interleaved with sequences, and constant-size data other than 32-bit
integers. The new definitions are complex and can't fit in a simple
macro. Switch the remotectl interface to interp4, split it into a header
and source file, and update the users.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 8cbdeb5ebf hexagonrpcd: listener: decode interp4 method definitions
To use interp4 method definitions for everything, the reverse tunnel
needs to be updated to understand them. Add support for the new method
definitions, preferring them if present.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 7d71de1ebc hexagonrpcd: iobuffer: use size_t for buffer sizes
The FastRPC peer can encode a 32-bit size for a variable-length
sequence. The members of the sequence can have a size more than 1,
potentially using more than 32 bits. Expand the buffer size to a size_t.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 85d96d4df6 chrecd: use hexagonrpc handle API
The handle API is a high-level interface that puts all error messages in
the same buffer. Use the handle API to open and close the chre_slpi
remote interface for code deduplication.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 034d35a6ed hexagonrpcd: use hexagonrpc handle API for default listener
The handle API is a high-level interface that puts all error messages in
the same buffer. Use the handle API to open and close the
adsp_default_listener remote interface.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 4fd9efcde2 libhexagonrpc: add remote interface open and close API
The code for opening and closing a remote interface with an error is
duplicated in hexagonrpcd and chrecd. Like the remotectl interface
itself, the error handling is useful for most FastRPC applications. Add
a new API for opening and closing remote interfaces with error checking.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan ea3e58d9e6 libhexagonrpc: add version 4 of method definition format
The current method definition format has a few issues. There is no way
to represent `apps_std_mkdir(in string dir, in long long mode)` because
it has a sequence before a fixed-length argument. The fixed-length
arguments are passed in 4-byte units, making large fixed-length arrays
awkward. Sequences of sequences cannot be represented.

Add a new version of the remote method definition to support more
methods, with sequences of sequences, mixed input and output arguments,
and fixed-length data structures greater than 32 bits.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 78e2a94251 fastrpc: hexagonrpcd: listener: support more than 31 methods
When there are more than 31 methods in a remote interface, an extended
method ID is added to the primary input buffer when the ID is greater
than 30. Select the method from the primary input buffer when the ID is
greater than 30 in the reverse tunnel.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan daab6ff190 fastrpc: libhexagonrpc: add error API
When the kernel side of FastRPC fails, the return value is -1 and errno
is set. When the remote side of FastRPC fails, the return value is an
AEE error code. It is not specialized for the reverse tunnel. Add an
error API that can convert the return value to a string-based error.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2026-08-24 17:40:17 -04:00
Richard Acayan 435ed1cd68 meson.build: bump to version 0.5.0
No breaking changes

New features:
- systemd unit files
- Android service files and Soong build files
- print access mode in apps_std_fopen_with_env
- run tests in CI and add .editorconfig
- print more detailed error when amount of I/O buffers don't match
  definition

Fixes:
- convert to little endian for I/O buffer coding
v0.5.0
2026-08-13 10:48:55 -04:00
Yumi Yukimura dd9ac70c02 data: Add Android service definitions
Signed-off-by: Yumi Yukimura <me.cafebabe@gmail.com>
2026-03-31 15:05:18 +08:00
Yumi Yukimura ffd300c27e hexagonrpcd: Include endian.h where needed
hardware/mainline/qcom/hexagonrpc/hexagonrpcd/iobuffer.c:43:15: error: use of undeclared identifier 'le32toh'
   43 |                 ctx->size = le32toh(ctx->size);
      |                             ^
hardware/mainline/qcom/hexagonrpc/hexagonrpcd/iobuffer.c:218:23: error: use of undeclared identifier 'htole32'
  218 |                 *(uint32_t *) ptr = htole32(outbufs[i].s);
      |                                     ^
2 errors generated.

Signed-off-by: Yumi Yukimura <me.cafebabe@gmail.com>
2026-03-31 15:05:18 +08:00
Yumi Yukimura 5c4e11360d Add Android.bp build rules
Signed-off-by: Yumi Yukimura <me.cafebabe@gmail.com>
2026-03-31 15:05:18 +08:00
Luca Weiss eec389f322 Add .editorconfig
EditorConfig is a file format and collection of text editor plugins for
maintaining consistent coding styles between different editors and IDEs.

Add a config for hexagonrpc with the preferred indentation style, and
some other settings.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
2026-03-29 17:03:32 +02:00