aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerie de Gram <j.de.gram@gmail.com>2011-08-03 23:00:41 +0200
committerJoerie de Gram <j.de.gram@gmail.com>2011-08-16 22:08:09 +0200
commit29e532d6a58a31f57755494d3ca213cdd9a04701 (patch)
treee95ce27f3ec8c1f7c499911ce84c0a027dd55373
parentd7b2d815afb0febb7b59223e7ecdb19fb9bfccb6 (diff)
downloadexternal_libsamsung-ipc-29e532d6a58a31f57755494d3ca213cdd9a04701.zip
external_libsamsung-ipc-29e532d6a58a31f57755494d3ca213cdd9a04701.tar.gz
external_libsamsung-ipc-29e532d6a58a31f57755494d3ca213cdd9a04701.tar.bz2
sec: add RSIM_ACCESS support
-rw-r--r--Android.mk1
-rw-r--r--include/sec.h15
-rw-r--r--sim.c47
3 files changed, 63 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 57109b7..fd5996d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -6,6 +6,7 @@ libmsm-h1_files := \
util.c \
hexdump.c \
call.c \
+ sim.c \
sms.c \
net.c \
misc.c
diff --git a/include/sec.h b/include/sec.h
index 187bf21..3ec961a 100644
--- a/include/sec.h
+++ b/include/sec.h
@@ -59,5 +59,20 @@ struct msm_sec_pin_status {
unsigned char key;
} __attribute__((__packed__));
+struct msm_sec_rsim_access_request {
+ unsigned char command;
+ unsigned short fileid;
+ unsigned char p1, p2, p3;
+} __attribute__((__packed__));
+
+struct msm_sec_rsim_access_response {
+ unsigned char sw1, sw2;
+ unsigned char len;
+} __attribute__((__packed__));
+
+void msm_sec_rsim_access(unsigned char command, unsigned short file_id,
+ unsigned char p1, unsigned char p2, unsigned char p3,
+ unsigned char *rdata, unsigned int length, int request_id);
+
#endif
diff --git a/sim.c b/sim.c
new file mode 100644
index 0000000..dd8777d
--- /dev/null
+++ b/sim.c
@@ -0,0 +1,47 @@
+/**
+ * This file is part of libmsm-h1.
+ *
+ * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
+ *
+ * libmsm-h1 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.
+ *
+ * libmsm-h1 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 libmsm-h1. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "radio_internal.h"
+
+void msm_sec_rsim_access(unsigned char command, unsigned short file_id,
+ unsigned char p1, unsigned char p2, unsigned char p3,
+ unsigned char *rdata, unsigned int length, int request_id)
+{
+ unsigned char msg[262];
+ struct msm_sec_rsim_access_request *rsim_req = (struct msm_sec_rsim_access_request*)&msg[0];
+ unsigned char *data = (msg + sizeof(*rsim_req));
+
+ memset(msg, 0, sizeof(msg));
+
+ rsim_req->command = command;
+ rsim_req->fileid = file_id;
+ rsim_req->p1 = p1;
+ rsim_req->p2 = p2;
+ rsim_req->p3 = p3;
+
+ if(length > 256) {
+ length = 256;
+ }
+
+ memcpy(data, rdata, length);
+
+ msm_send(MSM_SEC_RSIM_ACCESS, MSM_TYPE_GET, msg, sizeof(msg), request_id);
+}
+