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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
Make sure that the message is useful and doesn't just print a hex number
like "1f050100".
"Unexpected buffer count for method 31: 1f050100 (in: 5 vs 2, out: 1 vs 1)"
is a much more descriptive and helpful error.
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
This is good to print for completeness, and can be useful when extending
fopen to not just allow read operations.
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
It is possible (albeit unusual) to boot a big-endian system on a
smartphone, and it's generally good to have portable code.
le32toh and htole32 are a glibc extension that is also implemented by
musl-libc, uclibc-ng, and bionic.
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
The tests don't require access to Hexagon hardware, they currently pass,
and running them will provide a better assurance against regressions.
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
This shouldn't be a requirement to compile anything else. Stop requiring
it for building anything, and assume the user just wants to compile the
main project.
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
No breaking changes
New features:
- man page for hexagonrpcd
- support for FASTRPC_IOCTL_INIT_CREATE with fastrpc_shell_X
- apps_mem interface (mostly allocating memory for now)
- logic for hexagonfs root directory
- sscregistrygen tool to generate sensor registry
- Github CI (successful compilation only)
Fixes:
- Disabled verbose logging by default
- Documented the paths relative to the root directory
- Made apps_std_stat relative to ADSP libs directory
- Fixed unsigned/signed comparison in reverse tunnel
- Declared minimum meson version for meson.options
- Added soversion to the library build
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Without this building fails with:
../git/hexagonrpcd/rpcd.c: In function 'start_reverse_tunnel':
../git/hexagonrpcd/rpcd.c:275:21: error: too many arguments to function 'fastrpc_apps_mem_init'; expected 0, have 1
275 | ifaces[2] = fastrpc_apps_mem_init(fd);
| ^~~~~~~~~~~~~~~~~~~~~ ~~
In file included from ../git/hexagonrpcd/rpcd.c:38:
../git/hexagonrpcd/apps_mem.h:27:27: note: declared here
27 | struct fastrpc_interface *fastrpc_apps_mem_init();
| ^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
The project uses meson.options rather than meson_options.txt. Document
the minimum meson version that can be used to build the project.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Fix warning / error reported by gcc:
../git/hexagonrpcd/listener.c:115:25: warning: comparison of integer expressions of different signedness: 'uint32_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
if (inbufs[0].s != 4 * (def->in_nums
^~
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
When loading a new skel file, the DSP may access a testsig.so file. This
calls apps_std_fopen_with_env which is relative to a specified
directory, but also apps_std_stat. Since the same "testsig.so"
path is accessed relative to ADSP_LIBRARY_PATH and to the current
working directory, infer that the current working directory should be
ADSP_LIBRARY_PATH.
The files shouldn't be installed right in /usr/share/qcom except for
testing. Rather, they should be installed in some device-specific
directory to make packaging easier on some distros. Document the paths
relative to the root directory for served files.
The absolute paths shouldn't be installed right in /usr/share/qcom
except for testing. Document the modifiable directory where served files
are retrieved from and the convention of where this directory should be
located.
Link: https://gitlab.com/flamingradian/sensh/-/issues/1
Verbose logging can be useful when something goes wrong, but HexagonRPCD
already works well on some devices. Disable verbose logging by default.
Reported by Adrian on the SDM845 Mainline Matrix channel.
Fixes: 30fa49eb20 ("build: add hexagonrpcd_verbose option")
2024-05-16 16:00:13 -04:00
65 changed files with 3475 additions and 918 deletions
Loaded 20 of 65 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.