10 Commits
Author SHA1 Message Date
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
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
Luca Weiss 196c72e80f listener: Print more info with "Unexpected buffer count" errors
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>
2026-03-29 17:03:32 +02:00
Luca Weiss cfc745ce09 hexagonrpcd: apps_std: Print rw_mode in openat verbose log
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>
2026-03-20 17:11:46 +01:00
J. Neuschäfer 93f3467dcf iobuffer: Fix encoding/decoding on big-endian
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>
2025-12-31 16:06:35 +01:00
Achill Gilgenast c4109b4502 data: Add systemd system services
Signed-off-by: Achill Gilgenast <achill@achill.org>
2025-11-20 15:13:10 +01:00
J. Neuschäfer 5d3cef4e5b CI: Run tests
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>
2025-09-22 13:03:46 +02:00
19 changed files with 187 additions and 7 deletions

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: GPL-3.0-or-later
root = true
[*.{c,h}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 8
+5 -1
View File
@@ -1,4 +1,4 @@
name: Buildtest
name: Build+test
on:
pull_request:
@@ -27,3 +27,7 @@ jobs:
run: |
meson setup build
ninja -C build
- name: run tests
run: |
ninja -C build test
+10
View File
@@ -0,0 +1,10 @@
cc_defaults {
name: "hexagonrpc_defaults",
cflags: [
"-Wno-unused-parameter",
],
header_libs: [
"device_kernel_headers",
"hexagonrpc_headers",
],
}
+12
View File
@@ -0,0 +1,12 @@
cc_binary {
name: "chrecd",
defaults: ["hexagonrpc_defaults"],
srcs: [
"interfaces.c",
"main.c",
],
shared_libs: [
"libhexagonrpc",
],
vendor: true,
}
+20
View File
@@ -0,0 +1,20 @@
prebuilt_etc {
name: "hexagonrpcd-adsp-rootpd.rc",
src: "hexagonrpcd-adsp-rootpd.rc",
sub_dir: "init",
vendor: true,
}
prebuilt_etc {
name: "hexagonrpcd-adsp-sensorspd.rc",
src: "hexagonrpcd-adsp-sensorspd.rc",
sub_dir: "init",
vendor: true,
}
prebuilt_etc {
name: "hexagonrpcd-sdsp.rc",
src: "hexagonrpcd-sdsp.rc",
sub_dir: "init",
vendor: true,
}
+5
View File
@@ -0,0 +1,5 @@
service vendor.hexagonrpcd-adsp-rootpd /vendor/bin/hexagonrpcd -f /dev/fastrpc-adsp -d adsp -R /vendor/etc/hexagonrpcd-root
class core
user system
group system
stdio_to_kmsg
+18
View File
@@ -0,0 +1,18 @@
[Unit]
Description=Server for FastRPC remote procedure calls from Qualcomm ADSP - RootPD
Conflicts=suspend.target
Before=suspend.target
# FIXME: Remove this once hexagonrpcd can serve rootpd on the ADSP
# of the SDM845 devices
ConditionPathExists=!/dev/fastrpc-sdsp
ConditionPathExists=/dev/fastrpc-adsp
[Service]
ExecStart=@bindir@/hexagonrpcd -f /dev/fastrpc-adsp -d adsp
Restart=always
RestartSec=3
User=fastrpc
Group=fastrpc
[Install]
WantedBy=multi-user.target
+4
View File
@@ -0,0 +1,4 @@
service vendor.hexagonrpcd-adsp-sensorspd /vendor/bin/hexagonrpcd -f /dev/fastrpc-adsp -d adsp -s -R /vendor/etc/hexagonrpcd-root
class core
user system
group system
@@ -0,0 +1,17 @@
[Unit]
Description=Server for FastRPC remote procedure calls from Qualcomm ADSP - sensorspd
Conflicts=suspend.target
Before=suspend.target
# This service shouldn't be run on devices with an SDSP
ConditionPathExists=!/dev/fastrpc-sdsp
ConditionPathExists=/dev/fastrpc-adsp
[Service]
ExecStart=@bindir@/hexagonrpcd -f /dev/fastrpc-adsp -d adsp -s
Restart=always
RestartSec=3
User=fastrpc
Group=fastrpc
[Install]
WantedBy=multi-user.target
+4
View File
@@ -0,0 +1,4 @@
service vendor.hexagonrpcd-sdsp /vendor/bin/hexagonrpcd -f /dev/fastrpc-sdsp -d sdsp -s -R /vendor/etc/hexagonrpcd-root
class core
user system
group system
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Server for FastRPC remote procedure calls from Qualcomm SDSP
ConditionPathExists=/dev/fastrpc-sdsp
[Service]
ExecStart=@bindir@/hexagonrpcd -f /dev/fastrpc-sdsp -d sdsp -s
Restart=always
RestartSec=3
User=fastrpc
Group=fastrpc
[Install]
WantedBy=multi-user.target
+15
View File
@@ -0,0 +1,15 @@
systemd_units = [
'hexagonrpcd-adsp-rootpd.service',
'hexagonrpcd-adsp-sensorspd.service',
'hexagonrpcd-sdsp.service',
]
foreach unit : systemd_units
configure_file(
input: unit + '.in',
output: unit,
configuration: { 'bindir': get_option('prefix') / get_option('bindir') },
install: true,
install_dir: get_option('libdir') / 'systemd/system',
)
endforeach
+23
View File
@@ -0,0 +1,23 @@
cc_binary {
name: "hexagonrpcd",
defaults: ["hexagonrpc_defaults"],
srcs: [
"aee_error.c",
"apps_mem.c",
"apps_std.c",
"hexagonfs.c",
"hexagonfs_mapped.c",
"hexagonfs_plat_subtype_name.c",
"hexagonfs_virt_dir.c",
"interfaces.c",
"iobuffer.c",
"listener.c",
"localctl.c",
"rpcd.c",
"rpcd_builder.c",
],
shared_libs: [
"libhexagonrpc",
],
vendor: true,
}
+4 -3
View File
@@ -197,9 +197,10 @@ static uint32_t apps_std_fopen_with_env(void *data,
}
#ifdef HEXAGONRPC_VERBOSE
printf("openat($%s, %s) -> %d\n", (const char *) inbufs[1].p,
(const char *) inbufs[3].p,
fd);
printf("openat($%s, %s, %c) -> %d\n", (const char *) inbufs[1].p,
(const char *) inbufs[3].p,
rw_mode,
fd);
#endif
*out = fd;
+5 -1
View File
@@ -19,6 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <endian.h>
#include <libhexagonrpc/fastrpc.h>
#include <stdint.h>
#include <stdio.h>
@@ -39,6 +40,9 @@ static size_t consume_size(struct fastrpc_decoder_context *ctx,
ctx->size_off = (ctx->size_off + segment) % 4;
ctx->align = (ctx->align + segment) & 0x7;
if (ctx->size_off == 0)
ctx->size = le32toh(ctx->size);
return segment;
}
@@ -212,7 +216,7 @@ void outbufs_encode(size_t n_outbufs, const struct fastrpc_io_buffer *outbufs,
size_t i;
for (i = 0; i < n_outbufs; i++) {
*(uint32_t *) ptr = outbufs[i].s;
*(uint32_t *) ptr = htole32(outbufs[i].s);
ptr = &ptr[4];
align = (align + 4) & 0x7;
+4 -1
View File
@@ -254,7 +254,10 @@ static int invoke_requested_procedure(size_t n_ifaces,
if (REMOTE_SCALARS_INBUFS(sc) != in_count
|| REMOTE_SCALARS_OUTBUFS(sc) != out_count) {
fprintf(stderr, "Unexpected buffer count: %08x\n", sc);
fprintf(stderr, "Unexpected buffer count for method %u: %08x (in: %d vs %d, out: %d vs %d)\n",
method, sc,
REMOTE_SCALARS_INBUFS(sc), in_count,
REMOTE_SCALARS_OUTBUFS(sc), out_count);
*result = AEE_EBADPARM;
return 1;
}
+5
View File
@@ -0,0 +1,5 @@
cc_library_headers {
name: "hexagonrpc_headers",
export_include_dirs: ["."],
vendor: true,
}
+11
View File
@@ -0,0 +1,11 @@
cc_library_shared {
name: "libhexagonrpc",
defaults: ["hexagonrpc_defaults"],
srcs: [
"context.c",
"fastrpc.c",
"interfaces.c",
"session.c",
],
vendor: true,
}
+2 -1
View File
@@ -1,4 +1,4 @@
project('fastrpc', 'c', version: '0.4.0', meson_version: '>=1.1')
project('fastrpc', 'c', version: '0.5.0', meson_version: '>=1.1')
version_array = meson.project_version().split('.')
api_version = version_array[0] + '.' + version_array[1]
@@ -16,6 +16,7 @@ subdir('libhexagonrpc')
subdir('hexagonrpcd')
subdir('chrecd')
subdir('data')
subdir('tools')
subdir('tests')