mirror of
https://github.com/linux-msm/hexagonrpc.git
synced 2026-10-07 15:29:50 -07:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92237debf1 | ||
|
|
64bff607fe | ||
|
|
b15e721660 | ||
|
|
eee667b6cc | ||
|
|
13c14c1611 | ||
|
|
916db473b4 | ||
|
|
09add3eecc |
No files matched your search
@@ -1,10 +0,0 @@
|
||||
# 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
|
||||
@@ -1,33 +0,0 @@
|
||||
name: Build+test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- runner: ubuntu-24.04
|
||||
# 22.04 has old meson
|
||||
# - runner: ubuntu-22.04
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y meson ninja-build libjson-c-dev
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
meson setup build
|
||||
ninja -C build
|
||||
|
||||
- name: run tests
|
||||
run: |
|
||||
ninja -C build test
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
cc_defaults {
|
||||
name: "hexagonrpc_defaults",
|
||||
cflags: [
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
header_libs: [
|
||||
"device_kernel_headers",
|
||||
"hexagonrpc_headers",
|
||||
],
|
||||
}
|
||||
@@ -125,26 +125,19 @@ Interfaces are initialized in the `start_reverse_tunnel` function, in hexagonrpc
|
||||
## HexagonFS
|
||||
|
||||
The reverse tunnel's `apps_std` interface serves files to the remote processor.
|
||||
These files are searched for in a directory tree, starting at the location
|
||||
defined by the `-R` option, or in `/usr/share/qcom` by default:
|
||||
These files are searched for in:
|
||||
|
||||
HexagonRPCD file/dir Android file/dir
|
||||
acdb /vendor/etc/acdbdata
|
||||
dsp /vendor/dsp
|
||||
sensors/config /vendor/etc/sensors/config
|
||||
sensors/registry /mnt/vendor/persist/sensors/registry/registry
|
||||
sensors/sns_reg.conf /vendor/etc/sensors/sns_reg_config
|
||||
socinfo /sys/devices/soc0
|
||||
Physical file/dir Android file/dir
|
||||
/usr/share/qcom/acdb /vendor/etc/acdbdata
|
||||
/usr/share/qcom/dsp /vendor/dsp
|
||||
/usr/share/qcom/sensors/config /vendor/etc/sensors/config
|
||||
/usr/share/qcom/sensors/registry /mnt/vendor/persist/sensors/registry/registry
|
||||
/usr/share/qcom/sensors/sns_reg.conf /vendor/etc/sensors/sns_reg_config
|
||||
/usr/share/qcom/socinfo /sys/devices/soc0
|
||||
|
||||
These files and directories should be populated with files from your device's
|
||||
Android firmware.
|
||||
|
||||
If you can pass the `-R` option, the convention is to pass `-R
|
||||
/usr/share/qcom/SOC/VENDOR/DEVICE`, where SOC is the SoC name in lowercase,
|
||||
VENDOR is the capitalized name of the device vendor, and DEVICE is the device
|
||||
name (e.g. `-R /usr/share/qcom/sdm845/SHIFT/axolotl` or `-R
|
||||
/usr/share/qcom/sdm845/Thundercomm/db845c`).
|
||||
|
||||
# Future plans
|
||||
|
||||
Reverse tunnels are separated by the process that opens the file descriptor and
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
cc_binary {
|
||||
name: "chrecd",
|
||||
defaults: ["hexagonrpc_defaults"],
|
||||
srcs: [
|
||||
"interfaces.c",
|
||||
"main.c",
|
||||
],
|
||||
shared_libs: [
|
||||
"libhexagonrpc",
|
||||
],
|
||||
vendor: true,
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Context Hub Runtime Environment interface - method definitions
|
||||
*
|
||||
* Copyright (C) 2025 HexagonRPC Contributors
|
||||
*
|
||||
* This file is part of HexagonRPC.
|
||||
*
|
||||
* HexagonRPC is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libhexagonrpc/hexagonrpc.h>
|
||||
|
||||
const struct hrpc_method_def_interp4 chre_slpi_start_thread_def = {
|
||||
.msg_id = 0,
|
||||
.n_args = 0,
|
||||
.args = NULL,
|
||||
.n_inner_types = 0,
|
||||
.inner_types = NULL,
|
||||
};
|
||||
|
||||
const struct hrpc_method_def_interp4 chre_slpi_wait_on_thread_exit_def = {
|
||||
.msg_id = 1,
|
||||
.n_args = 0,
|
||||
.args = NULL,
|
||||
.n_inner_types = 0,
|
||||
.inner_types = NULL,
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Context Hub Runtime Environment interface - API
|
||||
*
|
||||
* Copyright (C) 2025 HexagonRPC Contributors
|
||||
*
|
||||
* This file is part of HexagonRPC.
|
||||
*
|
||||
* HexagonRPC is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACE_CHRE_SLPI_H
|
||||
#define INTERFACE_CHRE_SLPI_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libhexagonrpc/hexagonrpc.h>
|
||||
|
||||
extern struct hrpc_method_def_interp4 chre_slpi_start_thread_def;
|
||||
static inline int chre_slpi_start_thread(int fd, uint32_t hdl)
|
||||
{
|
||||
return hexagonrpc(&chre_slpi_start_thread_def, fd, hdl);
|
||||
}
|
||||
|
||||
extern struct hrpc_method_def_interp4 chre_slpi_wait_on_thread_exit_def;
|
||||
static inline int chre_slpi_wait_on_thread_exit(int fd, uint32_t hdl)
|
||||
{
|
||||
return hexagonrpc(&chre_slpi_wait_on_thread_exit_def, fd, hdl);
|
||||
}
|
||||
|
||||
|
||||
#endif /* INTERFACE_CHRE_SLPI_H */
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* FastRPC operating system interface - context initialization
|
||||
* FastRPC interface list for building method definitions
|
||||
*
|
||||
* Copyright (C) 2024 The Sensor Shell Contributors
|
||||
* Copyright (C) 2023 The Sensor Shell Contributors
|
||||
*
|
||||
* This file is part of HexagonRPC.
|
||||
* This file is part of sensh.
|
||||
*
|
||||
* HexagonRPC is free software: you can redistribute it and/or modify
|
||||
* Sensh is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -19,12 +19,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef APPS_MEM_H
|
||||
#define APPS_MEM_H
|
||||
#define HEXAGONRPC_BUILD_METHOD_DEFINITIONS 1
|
||||
|
||||
#include "listener.h"
|
||||
|
||||
struct fastrpc_interface *fastrpc_apps_mem_init(int fd);
|
||||
void fastrpc_apps_mem_deinit(struct fastrpc_interface *iface);
|
||||
|
||||
#endif
|
||||
#include "interfaces/chre_slpi.def"
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Context Hub Runtime Environment interface
|
||||
*
|
||||
* Copyright (C) 2023 The Sensor Shell Contributors
|
||||
*
|
||||
* This file is part of sensh.
|
||||
*
|
||||
* Sensh is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACE_CHRE_SLPI_DEF
|
||||
#define INTERFACE_CHRE_SLPI_DEF
|
||||
|
||||
#include <libhexagonrpc/interface.h>
|
||||
|
||||
HEXAGONRPC_DEFINE_REMOTE_METHOD(0, chre_slpi_start_thread, 0, 0, 0, 0)
|
||||
HEXAGONRPC_DEFINE_REMOTE_METHOD(1, chre_slpi_wait_on_thread_exit, 0, 0, 0, 0)
|
||||
|
||||
HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(0, chre_slpi3_start_thread)
|
||||
|
||||
static inline int chre_slpi3_start_thread(const struct fastrpc_context *ctx)
|
||||
{
|
||||
return hexagonrpc(&chre_slpi3_start_thread_def, ctx);
|
||||
}
|
||||
|
||||
HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(1, chre_slpi3_wait_on_thread_exit)
|
||||
|
||||
static inline int chre_slpi3_wait_on_thread_exit(const struct fastrpc_context *ctx)
|
||||
{
|
||||
return hexagonrpc(&chre_slpi3_wait_on_thread_exit_def, ctx);
|
||||
}
|
||||
|
||||
#endif /* INTERFACE_CHRE_SLPI_DEF */
|
||||
+74
-11
@@ -20,42 +20,105 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <libhexagonrpc/handle.h>
|
||||
#include <libhexagonrpc/fastrpc.h>
|
||||
#include <libhexagonrpc/interfaces/remotectl.def>
|
||||
#include <libhexagonrpc/session.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface/chre_slpi.h"
|
||||
#include "interfaces/chre_slpi.def"
|
||||
|
||||
/* TODO move these to libhexagonrpc since most clients use them */
|
||||
static int remotectl_open(int fd, char *name, struct fastrpc_context **ctx, void (*err_cb)(const char *err))
|
||||
{
|
||||
uint32_t handle;
|
||||
int32_t dlret;
|
||||
char err[256];
|
||||
int ret;
|
||||
|
||||
ret = fastrpc2(&remotectl_open_def, fd, REMOTECTL_HANDLE,
|
||||
strlen(name) + 1, name,
|
||||
&handle,
|
||||
&dlret,
|
||||
256, err);
|
||||
|
||||
if (ret == -1) {
|
||||
err_cb(strerror(errno));
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (dlret == -5) {
|
||||
err_cb(err);
|
||||
return dlret;
|
||||
}
|
||||
|
||||
*ctx = fastrpc_create_context(fd, handle);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int remotectl_close(struct fastrpc_context *ctx, void (*err_cb)(const char *err))
|
||||
{
|
||||
uint32_t dlret;
|
||||
char err[256];
|
||||
int ret;
|
||||
|
||||
ret = fastrpc2(&remotectl_close_def, ctx->fd, REMOTECTL_HANDLE,
|
||||
ctx->handle,
|
||||
&dlret,
|
||||
256, err);
|
||||
|
||||
if (ret == -1) {
|
||||
err_cb(strerror(errno));
|
||||
return ret;
|
||||
}
|
||||
|
||||
fastrpc_destroy_context(ctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void remotectl_err(const char *err)
|
||||
{
|
||||
fprintf(stderr, "Could not remotectl: %s\n", err);
|
||||
}
|
||||
|
||||
static int chre_slpi_start_thread(struct fastrpc_context *ctx)
|
||||
{
|
||||
return fastrpc(&chre_slpi_start_thread_def, ctx);
|
||||
}
|
||||
|
||||
static int chre_slpi_wait_on_thread_exit(struct fastrpc_context *ctx)
|
||||
{
|
||||
return fastrpc(&chre_slpi_wait_on_thread_exit_def, ctx);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
uint32_t hdl;
|
||||
char err[256];
|
||||
struct fastrpc_context *ctx;
|
||||
int fd, ret;
|
||||
|
||||
fd = hexagonrpc_fd_from_env();
|
||||
if (fd == -1)
|
||||
return 1;
|
||||
|
||||
ret = hexagonrpc_open(fd, "chre_slpi", &hdl, 256, err);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Could not open CHRE remote interface: %s\n", err);
|
||||
ret = remotectl_open(fd, "chre_slpi", &ctx, remotectl_err);
|
||||
if (ret)
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = chre_slpi_start_thread(fd, hdl);
|
||||
ret = chre_slpi_start_thread(ctx);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Could not start CHRE\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = chre_slpi_wait_on_thread_exit(fd, hdl);
|
||||
ret = chre_slpi_wait_on_thread_exit(ctx);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Could not wait for CHRE thread\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
err:
|
||||
hexagonrpc_close(fd, hdl);
|
||||
remotectl_close(ctx, remotectl_err);
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
executable('chrecd',
|
||||
'interface/chre_slpi.c',
|
||||
'interfaces.c',
|
||||
'main.c',
|
||||
c_args : cflags,
|
||||
include_directories : include,
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
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,
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
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
|
||||
@@ -1,18 +0,0 @@
|
||||
[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
|
||||
@@ -1,4 +0,0 @@
|
||||
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
|
||||
@@ -1,17 +0,0 @@
|
||||
[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
|
||||
@@ -1,4 +0,0 @@
|
||||
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
|
||||
@@ -1,13 +0,0 @@
|
||||
[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
|
||||
@@ -1,15 +0,0 @@
|
||||
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
|
||||
@@ -1,23 +0,0 @@
|
||||
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,
|
||||
}
|
||||
Loaded 20 of 63 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user