| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Having everything needed in the same struct will simplify the code
later on as we could also move the global variables there as well.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is ongoing work to make libsamsung-ipc and the modem drivers of
the Galaxy SIII (GT-I9300) work on top of an upstream kernel instead
of kernels derived from the vendor kernels.
For that work it's convenient to be able to store the kernel the
kernel logs in systemd-journald along with the output of ipc-modem.
If the kernel is built with CONFIG_LOCALVERSION_AUTO, we can track the
exact kernel revision used. And if the modem driver crashed, we can
still have the logs in journald at the next reboot. It also enables us
to store logs over a long period of time and get back to old logs.
However when running ipc-modem through a systemd service unit, the
output is piped to systemd, and we only get the following output with
journalctl -u <service> .service:
Started [Service Unit Description].
This is because when a program is piped, line buffering changes from
line buffered (the default when outputing to stdout on a terminal
according to setbuf(3)) to fully buffered.
To fix that we add a syslog log-target. Several programs already have
a --syslog (like OpenVPN) or --log-target= (like PulseAudio) command
line argument.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
| |
This enables to add other log callbacks than printf / stdout later on.
The ipc_modem_log function is inspired from ipc_client_log.
This change should contain no functional changes.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no use in making multiple calls to printf when only one call
is sufficient.
It's also a good practice to do that in general, especially when part
of the code can print to the console at any time, to ensure that that
all the buffer is printed contiguously and not interleaved with other
prints.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
| |
This enables to add more definitions later and to also add functions
prototypes there.
This change contains no functional changes.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
This makes the code more readable. It should contain no functional
changes.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
This ensures that the content of theses arrays cannot be changed at
runtime.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without the commit 355433ab5f17f25ca202ec092d989b267fd78c19
(tools: nv_data_imei: get rid of missing initializer warning),
we have the following warnings when building Replicant 6.0:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:245:2:
warning: missing initializer for field 'option' of 'struct
command_option' [-Wmissing-field-initializers]
{ /* Sentinel */ },
^
In file included from
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:39:0:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.h:65:10:
note: 'option' declared here
uint8_t option;
^
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:277:2:
warning: missing initializer for field 'name' of 'struct command'
[-Wmissing-field-initializers]
{ /* Sentinel */ },
^
In file included from
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:39:0:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.h:57:14:
note: 'name' declared here
const char *name;
^
The addition of -Werror=pedantic in guix.scm enables to detect these
as the build would then fail:
CC nv_data-imei.o
nv_data-imei.c:245:2: error:
ISO C forbids empty initializer braces [-Werror=pedantic]
245 | { /* Sentinel */ },
| ^
nv_data-imei.c:277:2: error:
ISO C forbids empty initializer braces [-Werror=pedantic]
277 | { /* Sentinel */ },
| ^
CC nv_data-md5.o
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without that fix, we have the following warnings on Replicant 6.0:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:245:2:
warning: missing initializer for field 'option' of 'struct
command_option' [-Wmissing-field-initializers]
{ /* Sentinel */ },
^
In file included from
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:39:0:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.h:65:10:
note: 'option' declared here
uint8_t option;
^
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:277:2:
warning: missing initializer for field 'name' of 'struct command'
[-Wmissing-field-initializers]
{ /* Sentinel */ },
^
In file included from
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:39:0:
hardware/replicant/libsamsung-ipc/tools/nv_data-imei.h:57:14:
note: 'name' declared here
const char *name;
^
Note that even if the code isn't valid C17 code, the warning is
harmless since the arrays of struct is declared outside functions
(static storage duration), so the "Sentinel" will be filled with zeros
anyway.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without that fix, when building the 'libsamsung-ipc' package through
scripts/guix.scm, we have the following warning:
CC partitions/android/android.lo
partitions/android/android.c:
In function ‘open_android_modem_partition_by_name’:
partitions/android/android.c:87:3: warning:
‘strncpy’ specified bound depends on the length of
the source argument [-Wstringop-overflow=]
87 | strncpy(path, partitions_dirnames[i],
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88 | strlen(partitions_dirnames[i]));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC partitions/toc/toc.lo
CCLD libsamsung-ipc.la
The warning is hamless because:
- The source (partitions_dirnames[i]) is hardcoded.
- The desitination buffer size was allocated more space than
the length of partitions_dirnames[i].
However it's good to silence non problematic warnings in order to
better detect really serious issues.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
| |
This was introduced by the commit
5a643dd89e2636cea19d9642c3a205d2d20250ec (ipc_utils: add
ipc_group_string)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without that fix we have compilation errors:
nv_data-imei.c: In function ‘get_imei’:
nv_data-imei.c:181:12: error: format ‘%d’ expects argument of type
‘int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’}
[-Werror=format=]
181 | printf("In addition it is also invalid"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
184 | len, IMEI_LENGTH);
| ~~~
| |
| size_t {aka long unsigned int}
nv_data-imei.c:183:14: note: format string is defined here
183 | "%d digits instead of %d.\n",
| ~^
| |
| int
| %ld
nv_data-imei.c:193:12: error: format ‘%d’ expects argument of type
‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’}
[-Werror=format=]
193 | printf("The '%s' "
| ^~~~~~~~~~~
......
196 | imei->optarg, len, IMEI_LENGTH);
| ~~~
| |
| size_t {aka long unsigned int}
nv_data-imei.c:195:14: note: format string is defined here
195 | "%d digits instead of %d.\n",
| ~^
| |
| int
| %ld
This issue was introduced in commit
1cd1a569bef21ed3bfaeda15fb210ef6fd218152 (tools: Add a new
nv_data-imei tool based on rfs-imei)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
This makes it easier to build-test all the latest commits before
sending patches or pushing patches.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For now -DIPC_DEVICE_NAME is only used to force to use a specific
device driver instead of trying to find out automatically which driver
to use. So with it all the drivers are still compiled in and there is
only one string that changes between builds with different
-DIPC_DEVICE_NAME.
There are some advantages in being able to not use -DIPC_DEVICE_NAME:
- If one day, only the relevant driver(s) are compiled with
-DIPC_DEVICE_NAME, we would still be able to compile-test all the
code by not setting -DIPC_DEVICE_NAME.
- Not hardcoding the device name would be a good step toward having
Android images that work on multiple devices.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
The usage of this PKGBUILD is similar to the guix.scm file in the same
directory: it can be used to test the build of the current source.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running the tests in an out of tree build directory (here in
scripts/src/), without that fix, we have the following error in
src/samsung-ipc/tests/test-suite.log when running 'make check':
FAIL: nv_data-md5
=================
Traceback (most recent call last):
File "[...]/scripts/src/tools/../../../tools/nv_data-md5.py", line 69, in <module>
rc = main()
File "[...]/scripts/src/tools/../../../tools/nv_data-md5.py", line 64, in main
nv_data_md5 = NvDataMD5()
File "[...]/scripts/src/tools/../../../tools/nv_data-md5.py", line 39, in __init__
self.nv_data_md5 = sh.Command(srcdir + os.sep + 'nv_data-md5')
File "/usr/lib/python3.9/site-packages/sh.py", line 1342, in __init__
raise CommandNotFound(path)
sh.CommandNotFound: ../../../tools/nv_data-md5
FAIL nv_data-md5.py (exit status: 1)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running the tests in an out of tree build directory (here in
scripts/src/), without that fix, we have the following error in
src/samsung-ipc/tests/test-suite.log when running 'make check':
FAIL: nv_data-imei
==================
Traceback (most recent call last):
File "[...]/scripts/src/tools/../../../tools/nv_data-imei.py", line 122, in <module>
rc = main()
File "[...]/scripts/src/tools/../../../tools/nv_data-imei.py", line 117, in main
nv_data_imei = NvDataImei()
File "[...]/scripts/src/tools/../../../tools/nv_data-imei.py", line 53, in __init__
self.nv_data_imei = sh.Command(srcdir + os.sep + 'nv_data-imei')
File "/usr/lib/python3.9/site-packages/sh.py", line 1342, in __init__
raise CommandNotFound(path)
sh.CommandNotFound: ../../../tools/nv_data-imei
FAIL nv_data-imei.py (exit status: 1)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running the tests in an out of tree build directory (here in
scripts/src/), without that fix, we have the following error in
src/samsung-ipc/tests/test-suite.log when running 'make check':
FAIL: ipc-modem
===============
Traceback (most recent call last):
File "[...]/scripts/src/tools/../../../tools/ipc-modem.py", line 79, in <module>
rc = main()
File "[...]/scripts/src/tools/../../../tools/ipc-modem.py", line 74, in main
ipc_modem = IpcModem()
File "[...]/scripts/src/tools/../../../tools/ipc-modem.py", line 39, in __init__
ipc_modem = sh.Command(srcdir + os.sep + 'ipc-modem')
File "/usr/lib/python3.9/site-packages/sh.py", line 1342, in __init__
raise CommandNotFound(path)
sh.CommandNotFound: ../../../tools/ipc-modem
FAIL ipc-modem.py (exit status: 1)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running the tests in an out of tree build directory (here in
scripts/src/), without that fix, we have the following error in
src/samsung-ipc/tests/test-suite.log when running 'make check':
============================================================
libsamsung-ipc 0.7.0: samsung-ipc/tests/test-suite.log
============================================================
# TOTAL: 1
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
FAIL: libsamsung-ipc-test
=========================
Traceback (most recent call last):
File "[...]/scripts/src/samsung-ipc/tests/../../../../samsung-ipc/tests/libsamsung-ipc-test.py", line 54, in <module>
main()
File "[...]/scripts/src/samsung-ipc/tests/../../../../samsung-ipc/tests/libsamsung-ipc-test.py", line 50, in main
tests = libsamsung_ipc_test()
File "[...]/scripts/src/samsung-ipc/tests/../../../../samsung-ipc/tests/libsamsung-ipc-test.py", line 33, in __init__
self.run = sh.Command(srcdir + os.sep + "libsamsung-ipc-test")
File "/usr/lib/python3.9/site-packages/sh.py", line 1342, in __init__
raise CommandNotFound(path)
sh.CommandNotFound: ../../../../samsung-ipc/tests/libsamsung-ipc-test
FAIL libsamsung-ipc-test.py (exit status: 1)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having a code style makes the code easier to read.
As for which code style to use, the code style defined by the
PEP 8 [1] is used in the python standard library and in the main
Python distribution.
Its official nature (it's standardized by python) probably makes it
the most well known and used code style adopted by python programmers.
In it we have a section about string quotes:
String Quotes
-------------
In Python, single-quoted strings and double-quoted strings are the
same. This PEP does not make a recommendation for this. Pick a rule
and stick to it. When a string contains single or double quote
characters, however, use the other one to avoid backslashes in the
string. It improves readability.
For triple-quoted strings, always use double quote characters to be
consistent with the docstring convention in PEP 257.
Since "if __name__ == '__main__':" is widely used, we choose to use the
single quotes.
[1]https://www.python.org/dev/peps/pep-0008/
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Guix, if we have all the required dependencies installed, running
./autogen.sh && ./configure && make fails with the following error:
CCLD libsamsung-ipc-test
ld: /gnu/store/cm6wv72061h65lri2aqgwa8bvncls51h-openssl-1.1.1l/lib/libcrypto.so: undefined reference to `fstat@GLIBC_2.33'
ld: /gnu/store/cm6wv72061h65lri2aqgwa8bvncls51h-openssl-1.1.1l/lib/libcrypto.so: undefined reference to `stat@GLIBC_2.33'
The same command works when using guix shell or guix environment
(still with all the dependencies).
Having a manifest file in libsamsung-ipc will enable Guix system users
to easily work on libsamsung-ipc without having to use trial and error
to get a working setup.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
While the tests don't talk to a real modem, they are still useful
to detect regressions with the use of threads.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
| |
This enables to test things like the threads usage without the
need for a real modem implementing the samsung-ipc protocol. This
could for instance be used in libsamsung-ipc automated tests.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
As this is done once all options have been parsed,
it enables to only print some options when debug is on.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
| |
This enables to more easily enables to share the parsed command
line arguments across different functions and it also enables
to add new command line arguments more easily.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without that fix, if some arguments were set and no
command was given, ipc-modem would proceed anyway:
$ ./tools/ipc-modem --debug
[I] Debug enabled
[...]
As it's expected to at least be used with a command
to do something meaningful, without that fix, it
could misslead users into thinking that everything
is fine when it's not or vice versa.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
| |
This makes the code easier to read as we separate the command line
handling from the IPC code.
In addition it also enables to more easily add RFS support later
on as the IPC code is not mixed with command line handling.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
While --help is parsed in the command line, it wasn't described
in the help itself.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
| |
The help and the code is sorted alphabetically.
It should contain no functional changes.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When working on applications using libsamsung-ipc, we sometimes
have functions that have an ipc client type argument and that
work for all 3 ipc client types, or want to refactorize the
code to do that in order to make the code more clean and generic.
However in these cases, these functions often needed to output
some error message or tell users what is going on through
logging prints, and the code ends up being way cleaner if there
is a generic function to get the name of the ipc client type.
In many cases it makes sense not to use the full
IPC_CLIENT_TYPE_<type> name but only the <name> type in these
messages, so because it's easier to add IPC_CLIENT_TYPE_ to the
<type> than removing it, it makes sense to only return the string
associated to the type (like "FMT", "RFS" or "DUMMY".
The least significant number of the library version was also
bumped as we are adding a new function, but the applications that
were built against older libsamsung-ipc revisions should still work.
However applications that depends on this ipc_client_type_string
will not work with previous versions of libsamsung-ipc.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
| |
There are already 4 string functions and combined together, they
already take more than 300 lines, so it makes sense to move
them in a separate file.
In addition, it will also clarify in which files new string functions
are supposed to be added in.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Replicant 6.0, ipc-modem is shipped in the images.
When it will make it in released images, it will be very useful for
regression testing and for tests that don't involve the full Android
stack[1].
For such tests to work, users are expected to disable the modem (with
'modem.sh off') before.
In this configuration, the test utilities like ipc-modem use the
system libsamsung-ipc as they are linked dynamically against it.
However if we want to also do regression testing with code that
is being worked on, it's very convenient to build test utilities
that have libsamsung-ipc built-in: This way it can test our the
code that is being worked on without interfering in any way with
the Android stack.
The static version of ipc-modem can for instance be built with the
following commands in the Replicant source code directory:
$ source build/envsetup.sh
$ lunch replicant_i9300-userdebug
$ make ipc-modem-static
It can then be run with the following commands (for the GT-I9300):
$ adb root
$ adb remount
$ adb push \
out/target/product/i9300/system/bin/ipc-modem-static \
/system/bin/
$ adb shell "modem.sh off"
$ adb wait-for-device
$ adb root
$ adb shell ipc-modem-static [...]
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Running tests (and even just running autogen.sh) produces
files used during the tests, and so git has to ignore these
as they are produced during the build procedure.
Ideally they should have been added to gitignore when I added
the tests that generated these files but I forgot.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Without this patch, after compiling libsamsung-ipc, git status
shows tools/nv_data-imei in the list of untracked files.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Text editors produce temporary files. They can often be used to
recover data in case of computer crash or abrupt shut down.
However when using text editors like Emacs and Vim, temporary
files often end up in the source directory, so as they are not
part of the official libsamsung-ipc source code we need to tell
git to ignore them.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When compiling nv-data-md5 under Replicant 6 we have:
hardware/replicant/libsamsung-ipc/tools/nv_data-md5.c:
In function 'main':
hardware/replicant/libsamsung-ipc/tools/nv_data-md5.c:103:1:
error:
control reaches end of non-void function [-Werror=return-type]
}
^
cc1: some warnings being treated as errors
So we simply need to add a return in the error path.
While we're at it, we use an exit code referenced in sysexits.h
to follow a standard. This can help differentiating between
different types of errors.
Thanks to that, it can also simplify the code when writing tests.
As Android doesn't have sysexits.h, we also need to use the one that
has been copied inside libsamsung-ipc in tools/include/glibc, else
it would also fail to compile because of the missing header file.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ipc-modem tool contained commented code to call a specific
phone number.
This patch reuses that code and retrieve the number to call from
the command line.
The number to call is expected to be in the same country as the
caller SIM card and network. Adding support for international
calls could be done by computing the right prefix instead of
hardcoding the IPC_CALL_PREFIX_NONE prefix.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
| |
If for instance "1234" is given as pin, the size of optarg
should be 5 but memcpy would copy 8.
In addition, the current code also makes sure that there is a
terminating null byte ('\0') inside the sim_pin array.
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Libraries typically have a public API and some internal
implementation of that API. In libsamsung-ipc, the public
API is defined in the include/ directory from the top directory.
When compiling and installing libsamsung-ipc, that include/
directory is installed as well.
Anything that is not defined in include/ is not part of that
public API.
However here we need to precisely test functions that are not
part of that public API: The open_android_modem_partition
function being tested here is only used by the herolte device,
and that device doesn't have a battery that is easily replaceable,
so most Replicant contributors will not want to get that device.
As currently all the non static symbols of libsamsung-ipc are
exported and that open_android_modem_partition isn't static,
we can simply link to libsamsung-ipc for now and use its
internal headers to access the functions to test.
If at some point, libsamsung-ipc only exports the symbols defined
in include/ we would need to find other ways to run such tests,
for instance by using test frameworks that take care of that or by
compiling libsamsung-ipc source code into the test programs.
Some of the code of the libsamsung-ipc-test utility was adapted
from code from the nv_data-md5 utility (which is currently in
tools/).
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
This code could also be useful for other devices and in any cases
it's not device specific.
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>
|