summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rick Mark2021-12-24 01:10:18 -0800
committerGravatar Nikias Bassen2022-06-28 12:25:06 +0200
commitab5b4d8d4c0e90c05d80f80c7e99a6516de9b5c6 (patch)
tree792dd6b6fb4a9efdda541fe54b3d1c838bc9498b
parent17c02beca2f99b27dab5c1f83cfe4e33036e462b (diff)
downloadlibirecovery-ab5b4d8d4c0e90c05d80f80c7e99a6516de9b5c6.tar.gz
libirecovery-ab5b4d8d4c0e90c05d80f80c7e99a6516de9b5c6.tar.bz2
Introduce non-persistent setenvnp command
-rw-r--r--include/libirecovery.h1
-rw-r--r--src/libirecovery.c24
2 files changed, 25 insertions, 0 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index a65c6fd..a33e49a 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -156,6 +156,7 @@ irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, unsigned lo
irecv_error_t irecv_saveenv(irecv_client_t client);
irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value);
irecv_error_t irecv_setenv(irecv_client_t client, const char* variable, const char* value);
+irecv_error_t irecv_setenv_np(irecv_client_t client, const char* variable, const char* value);
irecv_error_t irecv_reboot(irecv_client_t client);
irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value);
diff --git a/src/libirecovery.c b/src/libirecovery.c
index a2ef567..8fbfce4 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -3114,6 +3114,30 @@ IRECV_API irecv_error_t irecv_setenv(irecv_client_t client, const char* variable
#endif
}
+IRECV_API irecv_error_t irecv_setenv_np(irecv_client_t client, const char* variable, const char* value) {
+#ifdef USE_DUMMY
+ return IRECV_E_UNSUPPORTED;
+#else
+ char command[256];
+
+ if (check_context(client) != IRECV_E_SUCCESS)
+ return IRECV_E_NO_DEVICE;
+
+ if(variable == NULL || value == NULL) {
+ return IRECV_E_UNKNOWN_ERROR;
+ }
+
+ memset(command, '\0', sizeof(command));
+ snprintf(command, sizeof(command)-1, "setenvnp %s %s", variable, value);
+ irecv_error_t error = irecv_send_command_raw(client, command, 0);
+ if(error != IRECV_E_SUCCESS) {
+ return error;
+ }
+
+ return IRECV_E_SUCCESS;
+#endif
+}
+
IRECV_API irecv_error_t irecv_reboot(irecv_client_t client) {
#ifdef USE_DUMMY
return IRECV_E_UNSUPPORTED;