aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-04-14 04:27:29 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-05-25 03:03:45 +0200
commit7acef6c9973273a7aaf543f59d70a8fef602f049 (patch)
tree6247157c991240cd77b010a68ac91b65c80c8f7b
parent82d5fbffc9c8853326cad56232edc9dc02faa9a1 (diff)
downloadhardware_replicant_libsamsung-ipc-7acef6c9973273a7aaf543f59d70a8fef602f049.tar.gz
hardware_replicant_libsamsung-ipc-7acef6c9973273a7aaf543f59d70a8fef602f049.tar.bz2
hardware_replicant_libsamsung-ipc-7acef6c9973273a7aaf543f59d70a8fef602f049.zip
small-fixes
With the libsamsung-ipc.scm and without these fixes it fails with the following: CC ipc-modem-log.o ipc-modem.c: In function ‘modem_response_sms’: ipc-modem.c:268:3: error: a label can only be part of a statement and a declaration is not a statement 268 | struct ipc_sms_incoming_msg_header *header = resp->data; | ^~~~~~ ipc-modem.c:269:3: error: expected expression before ‘const’ 269 | const void *pdu = NULL; | ^~~~~ ipc-modem.c:307:3: error: ‘pdu’ undeclared (first use in this function) 307 | pdu = ipc_sms_incoming_msg_pdu_extract(resp->data, resp->size); | ^~~ Note that libsamsung-ipc.scm is just used to do tests with guix (especially to fix valgrind in guix to use it out of the box on ARM with ipc-modem as Parabola's valgrind is broken). I'll consider making packages later on when it might be useful for distributions (now it requires out of tree kernel drivers and the code to interact with is has not been merged in libsamsung-ipc yet). Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--scripts/libsamsung-ipc.scm98
-rw-r--r--tools/ipc-modem/ipc-modem.c12
2 files changed, 105 insertions, 5 deletions
diff --git a/scripts/libsamsung-ipc.scm b/scripts/libsamsung-ipc.scm
new file mode 100644
index 0000000..06e488c
--- /dev/null
+++ b/scripts/libsamsung-ipc.scm
@@ -0,0 +1,98 @@
+;;; Copyright © 2022 Denis Carikli <GNUtoo@cyberdimension.org>
+;;;
+;;; This file 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 file 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+;;; The guix.scm file is a convention: A file named guix.scm is
+;;; found in several project source code, either in the top
+;;; directory or in sub-directories like contrib for instance.
+
+(use-modules
+ (ice-9 popen)
+ (ice-9 rdelim)
+ (sxml ssax input-parse)
+ ((guix licenses) #:prefix license:)
+ (guix build-system android-ndk)
+ (guix build-system gnu)
+ (guix gexp)
+ (guix git-download)
+ (guix packages)
+ (gnu packages android)
+ (gnu packages autotools)
+ (gnu packages commencement)
+ (gnu packages curl)
+ (gnu packages disk)
+ (gnu packages linux)
+ (gnu packages llvm)
+ (gnu packages pkg-config)
+ (gnu packages python)
+ (gnu packages python-xyz)
+ (gnu packages tls)
+ (gnu packages valgrind))
+
+(define-public libsamsung-ipc
+ (package
+ (name "libsamsung-ipc")
+ (version (git-version "0.0" "HEAD" "1ae84b407cc187dabf4641924dab85969ffe9fb8"))
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://git.replicant.us/replicant-next/hardware_replicant_libsamsung-ipc")
+ (commit "1ae84b407cc187dabf4641924dab85969ffe9fb8")))
+ (sha256
+ (base32 "1hp27kziincsy03lc0pna6rlk13zq44hjkjr2hrg5v2k9cywas3z"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("autoreconf" ,autoconf)
+ ("aclocal" ,automake)
+ ("libcurl" ,curl)
+ ("ddrescue", ddrescue)
+ ("libc:debug", (@@ (gnu packages commencement) glibc-final) "debug")
+ ("libtool" ,libtool)
+ ("pkgconfig" ,pkg-config)
+ ("python" ,python)
+ ("python-sh" ,python-sh)
+ ("valgrind" ,valgrind)))
+ (inputs
+ `(("openssl" ,openssl)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'patch-python
+ (lambda _
+ (substitute* (find-files "." ".*\\.py$")
+ (("/usr/bin/env python") (which "python3")))
+ #t))
+ ;; (add-after 'patch-python 'fix-valgrind
+ ;; (lambda _
+ ;; (substitute* (find-files "." ".*\\.py$")
+ ;; (("'--leak-check=full',")
+ ;; (string-append
+ ;; "'--leak-check=full', '--extra-debuginfo-path="
+ ;; (assoc-ref %build-inputs "libc:debug")
+ ;; "/lib/debug',")))
+ ;; #t))
+ )
+ #:configure-flags
+ (list "--enable-debug"
+ "--enable-valgrind-tests")))
+ (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol")
+ (description
+ "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol,
+found in many Samsung smartphones and tablets.")
+ (home-page "https://www.replicant.us")
+ (license license:gpl2+)))
+
+(list libsamsung-ipc)
diff --git a/tools/ipc-modem/ipc-modem.c b/tools/ipc-modem/ipc-modem.c
index e81fdde..16ea2d4 100644
--- a/tools/ipc-modem/ipc-modem.c
+++ b/tools/ipc-modem/ipc-modem.c
@@ -249,6 +249,12 @@ void modem_response_sec(struct ipc_modem_data *data, struct ipc_message *resp)
static void modem_response_sms(struct ipc_modem_data *data,
struct ipc_message *resp)
{
+ struct ipc_sms_incoming_msg_header *header;
+ const void *pdu = NULL;
+ char *sms_text;
+ size_t pdu_size = 0;
+ int rc;
+
switch (resp->command) {
case IPC_SMS_DEVICE_READY:
if (data->state == MODEM_STATE_LPM) {
@@ -265,11 +271,7 @@ static void modem_response_sms(struct ipc_modem_data *data,
}
break;
case IPC_SMS_INCOMING_MSG:
- struct ipc_sms_incoming_msg_header *header = resp->data;
- const void *pdu = NULL;
- char *sms_text;
- size_t pdu_size = 0;
- int rc;
+ header = resp->data;
ipc_modem_log(
data->client,