diff options
| author | 2021-12-24 01:10:18 -0800 | |
|---|---|---|
| committer | 2022-06-28 12:25:06 +0200 | |
| commit | ab5b4d8d4c0e90c05d80f80c7e99a6516de9b5c6 (patch) | |
| tree | 792dd6b6fb4a9efdda541fe54b3d1c838bc9498b | |
| parent | 17c02beca2f99b27dab5c1f83cfe4e33036e462b (diff) | |
| download | libirecovery-ab5b4d8d4c0e90c05d80f80c7e99a6516de9b5c6.tar.gz libirecovery-ab5b4d8d4c0e90c05d80f80c7e99a6516de9b5c6.tar.bz2 | |
Introduce non-persistent setenvnp command
| -rw-r--r-- | include/libirecovery.h | 1 | ||||
| -rw-r--r-- | src/libirecovery.c | 24 |
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 | |||
| 156 | irecv_error_t irecv_saveenv(irecv_client_t client); | 156 | irecv_error_t irecv_saveenv(irecv_client_t client); |
| 157 | irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value); | 157 | irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value); |
| 158 | irecv_error_t irecv_setenv(irecv_client_t client, const char* variable, const char* value); | 158 | irecv_error_t irecv_setenv(irecv_client_t client, const char* variable, const char* value); |
| 159 | irecv_error_t irecv_setenv_np(irecv_client_t client, const char* variable, const char* value); | ||
| 159 | irecv_error_t irecv_reboot(irecv_client_t client); | 160 | irecv_error_t irecv_reboot(irecv_client_t client); |
| 160 | irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value); | 161 | irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value); |
| 161 | 162 | ||
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 | |||
| 3114 | #endif | 3114 | #endif |
| 3115 | } | 3115 | } |
| 3116 | 3116 | ||
| 3117 | IRECV_API irecv_error_t irecv_setenv_np(irecv_client_t client, const char* variable, const char* value) { | ||
| 3118 | #ifdef USE_DUMMY | ||
| 3119 | return IRECV_E_UNSUPPORTED; | ||
| 3120 | #else | ||
| 3121 | char command[256]; | ||
| 3122 | |||
| 3123 | if (check_context(client) != IRECV_E_SUCCESS) | ||
| 3124 | return IRECV_E_NO_DEVICE; | ||
| 3125 | |||
| 3126 | if(variable == NULL || value == NULL) { | ||
| 3127 | return IRECV_E_UNKNOWN_ERROR; | ||
| 3128 | } | ||
| 3129 | |||
| 3130 | memset(command, '\0', sizeof(command)); | ||
| 3131 | snprintf(command, sizeof(command)-1, "setenvnp %s %s", variable, value); | ||
| 3132 | irecv_error_t error = irecv_send_command_raw(client, command, 0); | ||
| 3133 | if(error != IRECV_E_SUCCESS) { | ||
| 3134 | return error; | ||
| 3135 | } | ||
| 3136 | |||
| 3137 | return IRECV_E_SUCCESS; | ||
| 3138 | #endif | ||
| 3139 | } | ||
| 3140 | |||
| 3117 | IRECV_API irecv_error_t irecv_reboot(irecv_client_t client) { | 3141 | IRECV_API irecv_error_t irecv_reboot(irecv_client_t client) { |
| 3118 | #ifdef USE_DUMMY | 3142 | #ifdef USE_DUMMY |
| 3119 | return IRECV_E_UNSUPPORTED; | 3143 | return IRECV_E_UNSUPPORTED; |
