| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
| |
TODO:
- move libsamsung-ipc-test in samsung-ipc/tests/
- cleanup the code
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
| |
TODO: check if it's the right way to fix it
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea here is to use that to validate that libsamsung-ipc works
fine by reading some information of the modem data or the SIM card
through libsamsung-ipc.
The code is written in a way that enables code sharing as much as
possible to be able to build other custom tests or tools for other
usages (like a PCSC interface to the SIM card for instance).
In the long run, the idea would be to be able to write very simple
applications without the huge boilerplate that is needed to handle
the modem and concentrate on the specific information the application
needs to send and receive.
A very simple application could for instance look like that:
/* A free softrware license */
/* Some includes */
/* callbacks for logging */
static int my_callback(struct ipc_client *client,
struct ipc_message *resp,
void* data)
{
/* User code */
}
static do_something(struct ipc_client *client)
{
/* User code */
}
int main(int argc, char** argv)
{
[...]
client = ipc_client_create(IPC_CLIENT_TYPE_FMT);
if (client == NULL) {
printf("Creating client failed\n");
return 1;
}
rc = init_modem(&client, STATE_LPM)
if (rc < 0)
return rc;
register_callback(&my_callback, NULL);
do_something(&client);
return 0;
}
The boilerplate would then be provided in another C file and/or
linked to from a small library.
+======+
| TODO |
+======+
The tool-name in this commit message need to be changed from
ipc-sim to ipc-imei as that was done in the code already.
On Replicant 6, we still have a segfault when
exiting though:
[D] ipc-sim: modem_read_loop done
[D] modem_stop: ipc_client_close
[D] modem_stop: ipc_client_power_off
[D] modem_stop: Modem stopped
[1] + Segmentation fault ipc-sim
In addition, we still need to fix the startup code as it
segfaults on Replicant 6 about 50% of the time:
[D] modem_start: requested state MODEM_STATE_LPM: 1
[D] Starting i9300 modem boot
[D] Opened modem image device
[D] Mapped modem image data to memory
[D] Opened modem boot device
[D] Opened modem link device
[D] Turned the modem off
[D] Turned the modem on
[D] Waited for link connected
[D] Wrote ATAT in ASCII
[D] Reading boot ACK failed
[D] Sending XMM626 HSIC PSI failed
[D] Booting failed: error -1
[1] + Stopped (signal) ipc-sim
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Fix tool name
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
| |
Signed-off-by: Simon Shields <simon@lineageos.org>
GNUtoo@cyberdimension.org: [rebase, fixes and cleanups]
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
| |
Signed-off-by: Simon Shields <simon@lineageos.org>
GNUtoo: rebase, fixes and cleanups
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
| |
TODO: check const * const * + pointer
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While libsamsung-ipc is not limited to Replicant (it can be used
on GNU/Linux or in other Android distributions), it is currently
maintained by Replicant.
In order to make that more clear, it was renamed by the commit
aa4f61805b2d8943e94847cae825ec209060569e ("Move libsamsung-ril
and libsamsung-ipc in vendor/replicant") in the Replicant manifest
repository[1].
Because of that we also need to adjust the git URL in the MAINTAINERS
file.
In addition we use https because it's safer than git:// as it uses
TLS, and because we have redirects in place for http(s) but not for
git://, so if the repository URL changes again, the old URL will
most likely continue to work with http(s).
[1]https://git.replicant.us/replicant/manifest.git
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
| |
This could enable other devices to use the TOC handling functions.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
| |
The samsung-ipc/Makefile.am became pretty big.
Because of that, it's It's better to split it to have one
Makefile.am per subdirectory.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we configure Replicant 11, libsamsung-ipc and libsamsung-ril
to have both libraries in /system/lib/, tools work fine on the
Galaxy SIII (GT-I9300):
# find -name libsamsung-ril.so 2>/dev/null
./system/lib/libsamsung-ril.so
# find -name libsamsung-ipc.so 2>/dev/null
./system/lib/libsamsung-ipc.so
# find -name nv_data-md5 2>/dev/null
./system/bin/nv_data-md5
# nv_data-md5
Usage: nv_data-md5 [nv_data.bin]
And libsamsung-ril tries to load libsamsung-ipc from the right
location in /system/lib/, but it fails due to the vendor and system
separation:
01-14 15:50:57.739 1475 1475 E RILD : dlopen failed:
dlopen failed: library "/system/lib/libsamsung-ril.so"
needed or dlopened by "/system/vendor/bin/hw/rild" is not
accessible for the namespace "(default)"
Adding LOCAL_PROPRIETARY_MODULE fixes that. Note that the name
of that property can be misleading here: libsamsung-ipc is free
software and shall remain free software.
Instead we need to understand LOCAL_PROPRIETARY_MODULE as a way
to tell the Android build system that libsamsung-ipc is not part
of the base Android code but instead that it is code that is
specific to a device, set of devices and/or Android distribution.
LOCAL_MODULE_RELATIVE_PATH cannot be used instead: even if the
binaies end up in /vendor/bin/hw/, and that the libraries ends
up in /vendor/lib/hw/, for some reasons the libraries can't be
found:
i9300:/ # /system/vendor/bin/hw/nv_data-md5
CANNOT LINK EXECUTABLE "/system/vendor/bin/hw/nv_data-md5":
library "libsamsung-ipc.so" not found: needed by main executable
And most importantly, rild has the same issue than before:
E RILD : dlopen failed: dlopen failed: library
"libsamsung-ipc.so" not found: needed by
/system/vendor/lib/hw/libsamsung-ril.so
in namespace (default)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A previous version of this patch was tested on the herolte,
however since then, several light functional changes were
introduced.
With the previous patch, it was possible to boot the modem
and it was probably possible to send message to, and receive
messages from the modem.
For the TARGET_DEVICE we use in our Android.mk, In the
Android.mk of android_device_samsung_herolte[1] we have:
ifneq ($(filter herolte, $(TARGET_DEVICE)),)
include $(call all-makefiles-under,$(LOCAL_PATH))
endif
so we can safely assume that the TARGET_DEVICE is herolte.
[1]https://github.com/LineageOS/android_device_samsung_herolte
Signed-off-by: Tony Garnock-Jones <tonyg@leastfixedpoint.com>
GNUtoo: rebased, code cleanup, more debug prints,
commit message content but not its summary.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These wrappers are meant to handle the case where read or writes
handles a smaller number of bytes than requested.
This way that handling doesn't need to be duplicated everywhere
in libsamsung-ipc.
Having access to the ipc_client struct could enable future
logging of read and writes without having to change any of the
code already using data_read and data_write.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Before that, the command infrastructure wasn't used for
list-supported which led to more manual parsing and more code.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Without that fix command can be NULL when it reaches this assert:
assert(command->options & OPTION_FILE);
The crash can be reproduced by running nv_data-imei with command
options but without the command itself, for example with
'nv_data-imei -i 1'.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was spotted by compiling nv_data-imei on Replicant 6: it gave
the following warning:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:1062:15:
warning: 'command' may be used uninitialized in this function
[-Wmaybe-uninitialized]
rc = command->func(nv_data_path, &offset);
^
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Replicant 6.0 we have:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:
In function 'main':
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:1064:1:
error: control reaches end of non-void function [-Werror=return-type]
In nv_data-imei's main we had:
int main(int argc, char * const argv[])
{
[...]
assert(false);
}
and for some reasons the Replicant 6.0 toolchain[1] doesn't recognize
that adding a 'return 0;' won't change anything, however doing
that is harmless and fixes that compilation error.
This issue also affected errno_to_sysexit in the same way:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:
In function 'errno_to_sysexit':
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:837:1: error:
control reaches end of non-void function [-Werror=return-type]
[1] The compiler used (which is built by vendor/replicant/build-toolchain)
returns the following when run with --version:
arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The TARGET_ERROR_FLAGS are available from build/core/config.mk
in Replicant 6.
-Werror=non-virtual-dtor was only added to CLANG because it fails
to be recognized with GCC:
cc1: error: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’
is not valid for C [-Werror]
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
The COMMON_GLOBAL_CFLAGS are available from build/core/config.mk
in Replicant 6.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When building nv_data-imei in Replicant 6 we have:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:
In function 'bruteforce_imei_offset':
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:675:18:
warning: pointer of type 'void *' used in subtraction [-Wpointer-arith]
(ptr - buffer),
^
Using a data type with a known size like char* avoids this error.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
| |
This enables to more easily add new flags.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The include has been imported from sysexits.h from Parabola i686.
As Replicant 6 and Replicant 11 don't have sysexits.h, the
compilation of nv_data-imei will fail if it's not provided somehow:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:32:22:
fatal error: sysexits.h: No such file or directory
#include <sysexits.h>
^
compilation terminated.
Being able to use sysexits.h is really interesting as it provides
a standard for applications exit codes.
In turn it enables to design tests that are more fine grained
and to avoid too messy test code while doing that, simply by
following this standard.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without that, it will end up using clang-10 while we now have
clang-11.
This will make Guix build clang-10 which is time consuming.
Instead by using the latest clang we can use binary packages
(Guix calls that substitutes) of clang which speeds up the
build of libsamsung-ipc a lot, since most of the time we don't
need to build any dependencies.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While ipc_group_string is not used by libsamsung-ipc (yet),
it's still a good idea to add it as tools and applications using
libsamsung-ipc can then use it to display the group of a command.
It's also a better idea to have it in libsamsung-ipc than in
each tool using it as libsamsung-ipc centralizes the knowledge
about the samsung-ipc protocol, so if new groups appear at some
point, the ipc_group_string function could be updated along the way.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
| |
Including samsung-ipc.h in a file without other includes results
in a compilation error:
.../include/samsung-ipc.h:161:1: error: unknown type name ‘off_t’
161 | off_t file_data_size(struct ipc_client *client, [...]
| ^~~~~
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Including samsung-ipc.h in a file without other includes results
in a compilation error:
.../include/samsung-ipc.h:51:2: error: unknown type name ‘size_t’
51 | size_t size;
| ^~~~~~
.../include/samsung-ipc.h:77:7: error: unknown type name ‘size_t’
77 | size_t size),
| ^~~~~~
.../include/samsung-ipc.h:26:1: note: ‘size_t’ is defined in header
‘<stddef.h>’;
did you forget to ‘#include <stddef.h>’?
25 | #include <sys/time.h>
+++ |+#include <stddef.h>
26 |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This separates more what is part of the header and what is not
so things are more clear to the people reading the code.
In addition, having all includes statements inside the #ifdef #endif
header guards avoids issues with the inclusion of headers that are
missing such guards. This can happen with headers imported from vendor
kernels.
So while headers imported from vendor kernels are typically not
included in the headers exported by libsamsung-ipc, it's still good
to have a consistent code style between exported and non exported
headers.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The scripts directory already has several scripts that are not
needed to use libsamsung-ipc, but all of them are (or were) useful
to work on patches for libsamsung-ipc.
As this also applies to the guix.scm and that scheme is a scripting
language, it would be more clear to have it moved in the scripts
directory.
In addition it could also make it more simple for distributions
to not ship these files if they aren't interested in having them
and/or if they only want files compatibles with the license
currently used by libsamsung-ipc (GPLv2 or later).
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently libsamsung-ipc assumes that the size of nv_data.bin
files are always 0x200000.
While it's supposed to be the case for all the devices we support,
it is still a good idea to make sure that a meaningful error message
is reported to the users of nv_data-md5.
For instance if we created an empty file of 1 kB with the following
command:
$ ddrescue -s 1k /dev/zero zero.img
and that we used nv_data-md5 on it:
$ ./tools/nv_data-md5 zero.img
[ipc] file_data_read: Error: rc < 0
[ipc] ipc_nv_data_md5_calculate failed: data is NULL
Calculating nv_data backup md5 failed
we had a completely meaningless error message.
With this patch the error message looks like that instead:
$ ./tools/nv_data-md5 zero.img
[ipc] ipc_nv_data_md5_calculate: Checking zero.img size failed:
requested size: 2097152, file size: 1000
Calculating nv_data backup md5 failed
Here users have at least a fighting chance of being able to understand
what is going wrong.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|