aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Busch <morphis@gravedo.de>2012-02-20 05:49:25 +0100
committerSimon Busch <morphis@gravedo.de>2012-02-20 05:49:25 +0100
commit0b260b93f81d1172a87d5d5ffac7707772f1866f (patch)
treed85490418476b14ab12a9e880ff44f101f9ff60e
parent6f57cb2128394a90f4924264e4f6eaf67e21d976 (diff)
downloadexternal_libsamsung-ipc-0b260b93f81d1172a87d5d5ffac7707772f1866f.zip
external_libsamsung-ipc-0b260b93f81d1172a87d5d5ffac7707772f1866f.tar.gz
external_libsamsung-ipc-0b260b93f81d1172a87d5d5ffac7707772f1866f.tar.bz2
Import two methods from samsung-ril to deal with rfs read/write nv item message types
-rw-r--r--include/rfs.h3
-rw-r--r--samsung-ipc/rfs.c67
-rw-r--r--vapi/samsung-ipc-1.0.vapi20
3 files changed, 89 insertions, 1 deletions
diff --git a/include/rfs.h b/include/rfs.h
index 3f8708d..6fbc0f0 100644
--- a/include/rfs.h
+++ b/include/rfs.h
@@ -54,6 +54,9 @@ void nv_data_md5_check(struct ipc_client *client);
int nv_data_read(struct ipc_client *client, int offset, int length, char *buf);
int nv_data_write(struct ipc_client *client, int offset, int length, char *buf);
+struct ipc_rfs_io_confirm* ipc_rfs_create_io_confirm_for_nv_write_item(struct ipc_client *client, struct ipc_message_info *info);
+struct ipc_rfs_io_confirm* ipc_rfs_create_io_confirm_for_nv_read_item(struct ipc_client *client, struct ipc_message_info *info);
+
#endif
// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c
index 26e8c08..5484c98 100644
--- a/samsung-ipc/rfs.c
+++ b/samsung-ipc/rfs.c
@@ -223,7 +223,6 @@ nv_data_backup_create_write:
ipc_client_log(client, "nv_data_backup_create: writing nv_data.bin to .nv_data.bak failed too many times\n");
unlink("/efs/.nv_data.bak");
goto exit;
-
}
/* Read the newly-written .nv_data.bak. */
@@ -619,4 +618,70 @@ int nv_data_write(struct ipc_client *client, int offset, int length, char *buf)
return 0;
}
+struct ipc_rfs_io_confirm* ipc_rfs_create_io_confirm_for_nv_read_item(struct ipc_client *client, struct ipc_message_info *info)
+{
+ struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data;
+ struct ipc_rfs_io_confirm *rfs_io_conf;
+ void *rfs_data;
+ int rc;
+
+ if(rfs_io == NULL)
+ {
+ ipc_client_log(client, "ERROR: Request message is invalid: aseq = %i", info->aseq);
+ return NULL;
+ }
+
+ rfs_io_conf = malloc(rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
+ memset(rfs_io_conf, 0, rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
+ rfs_data = rfs_io_conf + sizeof(struct ipc_rfs_io_confirm);
+
+ ipc_client_log(client, "Asked to read 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
+ rc = nv_data_read(client, rfs_io->offset, rfs_io->length, rfs_data);
+
+ ipc_client_log(client, "Read rfs_data dump:");
+ ipc_hex_dump(client, rfs_data, rfs_io->length);
+
+ ipc_client_log(client, "Preparing RFS IO Confirm message (rc is %d)", rc);
+ rfs_io_conf->confirm = rc < 0 ? 0 : 1;
+ rfs_io_conf->offset = rfs_io->offset;
+ rfs_io_conf->length = rfs_io->length;
+
+ // ipc_rfs_send(IPC_RFS_NV_READ_ITEM, rfs_io_conf, rfs_io->length + sizeof(struct ipc_rfs_io_confirm), info->aseq);
+ // free(rfs_io_conf);
+
+ return rfs_io_conf;
+}
+
+struct ipc_rfs_io_confirm* ipc_rfs_create_io_confirm_for_nv_write_item(struct ipc_client *client, struct ipc_message_info *info)
+{
+ struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data;
+ struct ipc_rfs_io_confirm *rfs_io_conf;
+ void *rfs_data;
+ int rc;
+
+ if (rfs_io == NULL)
+ {
+ ipc_client_log(client, "ERROR: Request message is invalid: aseq = %i", info->aseq);
+ return;
+ }
+
+ rfs_data = info->data + sizeof(struct ipc_rfs_io);
+
+ ipc_client_log(client, "Write rfs_data dump:");
+ ipc_hex_dump(client, rfs_data, rfs_io->length);
+
+ ipc_client_log(client, "Asked to write 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
+ rc = nv_data_write(client, rfs_io->offset, rfs_io->length, rfs_data);
+
+ ipc_client_log(client, "Sending RFS IO Confirm message (rc is %d)", rc);
+ rfs_io_conf = (struct ipc_rfs_io_confirm*) malloc(sizeof(struct ipc_rfs_io_confirm));
+ rfs_io_conf->confirm = rc < 0 ? 0 : 1;
+ rfs_io_conf->offset = rfs_io->offset;
+ rfs_io_conf->length = rfs_io->length;
+
+ // ipc_rfs_send(IPC_RFS_NV_WRITE_ITEM, &rfs_io_conf, sizeof(struct ipc_rfs_io_confirm), info->aseq);
+
+ return rfs_io_conf;
+}
+
// vim:ts=4:sw=4:expandtab
diff --git a/vapi/samsung-ipc-1.0.vapi b/vapi/samsung-ipc-1.0.vapi
index 7d863b6..a942e30 100644
--- a/vapi/samsung-ipc-1.0.vapi
+++ b/vapi/samsung-ipc-1.0.vapi
@@ -192,6 +192,8 @@ namespace SamsungIpc
SND_AUDIO_PATH_CTRL,
SND_RINGBACK_TONE_CTRL,
SND_CLOCK_CTRL,
+ RFS_NV_READ_ITEM,
+ RFS_NV_WRITE_ITEM,
}
/* ******************************************************************************** */
@@ -1179,6 +1181,24 @@ namespace SamsungIpc
/* ******************************************************************************** */
+ namespace Rfs
+ {
+ [CCode (cname = "struct ipc_rfs_io_confirm", destroy_function = "", free_function = "")]
+ public struct IoConfirm
+ {
+ public uint8 confirm;
+ public uint offset;
+ public uint length;
+ }
+
+ [CCode (cname = "ipc_rfs_create_io_confirm_for_nv_read_item")]
+ public IoConfirm create_io_confirm_for_nv_read_item(Client client, Request req);
+ [CCode (cname = "ipc_rfs_create_io_confirm_for_nv_write_item")]
+ public IoConfirm create_io_confirm_for_nv_write_item(Client client, Request req);
+ }
+
+ /* ******************************************************************************** */
+
[CCode (cname = "struct ipc_message_info", destroy_function = "", free_function = "")]
public struct Request
{