aboutsummaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* tools: ipc-modem: add option to call a numberDenis 'GNUtoo' Carikli2021-03-171-10/+27
| | | | | | | | | | | | | | | 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>
* tools: ipc-modem: fix potential out of bounds sim_pin memcpyDenis 'GNUtoo' Carikli2021-03-171-11/+12
| | | | | | | | | | 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>
* tools: ipc-modem: remove unused DEF_SIM_PIN definitionDenis 'GNUtoo' Carikli2021-03-171-1/+0
| | | | Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* tools: nv_data-imei: handle list-supported in a more generic wayDenis 'GNUtoo' Carikli2021-02-131-48/+48
| | | | | | | 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>
* tools: nv_data-imei: fix crash with commands options without commandDenis 'GNUtoo' Carikli2021-02-111-3/+4
| | | | | | | | | | | 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>
* tools: nv_data-imei: main: Fix uninitialized command and command_option structsDenis 'GNUtoo' Carikli2021-02-111-2/+2
| | | | | | | | | | | | 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>
* tools: nv_data-imei: Fix return-type compilation errors on Replicant 6.0Denis 'GNUtoo' Carikli2021-02-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* tools: nv_data-imei: get rid of "pointer of type 'void *' used in subtraction"Denis 'GNUtoo' Carikli2021-02-101-3/+3
| | | | | | | | | | | | | 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>
* Add sysexits.h for AndroidDenis 'GNUtoo' Carikli2021-02-101-0/+114
| | | | | | | | | | | | | | | | | | | | | 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>
* tools: nv_data-md5: Add testsDenis 'GNUtoo' Carikli2020-12-032-2/+73
| | | | Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* tools: nv_data-imei: fix unused-labelDenis 'GNUtoo' Carikli2020-12-031-1/+0
| | | | | | | | | | | | | | Without that fix, when building libsamsung-ipc under GNU/Linux with the "-Werror -W -Wall -Wunused -Wunused-function" CFLAGS, GCC and the autotools build system, we have: nv_data-imei.c: In function ‘bruteforce_imei_offset’: nv_data-imei.c:695:1: error: label ‘complete’ defined but not used [-Werror=unused-label] complete: ^~~~~~~~ Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Reviewed-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
* nv_data-imei: indicate that write-imei may or may not workDenis 'GNUtoo' Carikli2020-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | I had two Nexus S: after breaking one, I've tried moving the IMEI of the broken one on the working one: - Earlier I did some backups of the EFS. - I went into recovery mode - I removed the .nv_data.bak and .nv_data.bak.md5 files - I copied the .nv_data.bin to my computer and changed the IMEI with nv_data-imei - I copied back the .nv_data.bin and the generated .nv_data.bin.md5 and fixed the permissions. - I booted the device However not only the IMEI didn't change, but it was also set back to the old one in the file. I've also asked Paul Kocialkowski if he remembered if changing the IMEI worked in his original code or on which device he tried it, but he didn't remember. So more information is probably needed to either understand if that code is supposed to work and if so if there are conditions in which it works or doesn't work (specific EFS, devices, etc). Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* nv_data-imei: Fix get_imei return codesDenis 'GNUtoo' Carikli2020-11-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | Negative error codes are used as per the kernel coding style, however userspace, especially the tests expect positive return code compliant with sysexits.h. So here we map EINVAL (Invalid argument) from errno.h to EX_USAGE (command line usage error). Without that fix we have: $ ./tools/nv_data-imei nv_data.bin bruteforce-imei -i 12345 The '12345' IMEI is invalid as it is composed of 5 digits instead of 15. errno_to_sysexit: error: unknown error code -1. errno_to_sysexit: error code -1 needs to be implemented lt-nv_data-imei: nv_data-imei.c:836: errno_to_sysexit: Assertion `false' failed. Aborted (core dumped) instead of: $ ./tools/nv_data-imei nv_data.bin bruteforce-imei -i 12345 The '12345' IMEI is invalid as it is composed of 5 digits instead of 15. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* nv_data-imei: fix leftover from bruteforce_imei_offsetDenis 'GNUtoo' Carikli2020-11-081-7/+18
| | | | | | | | | | | | At first I tried to do a bruteforce that computed the IMEI once for each location in the file. While this was inefficient, it kept the code simple enough to validate that it worked as the code wasn't tested before. However, during the rewrite of that loop to make it more efficient I forgot to complete it. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* nv_data-imei: handle missing command line arguments errorDenis 'GNUtoo' Carikli2020-11-071-0/+2
| | | | | | | | | | | | | | | | | Without that fix we have: $ ./tools/nv_data-imei nv_data.bin bruteforce-imei IMEI option required See nv_data-imei bruteforce-imei -h for more details. errno_to_sysexit: error: unknown error code -22. errno_to_sysexit: error code -22 needs to be implemented lt-nv_data-imei: nv_data-imei.c:823: errno_to_sysexit: Assertion `false' failed. Aborted (core dumped) instead of: $ ./tools/nv_data-imei nv_data.bin bruteforce-imei IMEI option required See nv_data-imei bruteforce-imei -h for more details. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* tools: Add a new nv_data-imei tool based on rfs-imeiDenis 'GNUtoo' Carikli2020-11-035-258/+1268
| | | | Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* tools: import preliminary rfs-imei implementation as-isPaul Kocialkowsk2020-11-031-0/+258
| | | | | | | | | | | | | | | | | | | | | | Knowing the format and offset of the IMEI location in nv_data.bin is a step forward to be able to to recreate nv_data.bin from scratch. This can be used to repair devices that have their EFS partition completely destroyed, without having to rely on nonfree tools to do it. When asking Paul Kocialkowsk if he knew the offset at which the IMEI were stored in the nv_data.bin files, he explained to me that he only found it for the XMM616 and also gave me an unfinished implementation for a tool to change it. In order to preserve all the information in the tool and its correct authorship, the tool source code wasn't altered. As it doesn't compile with current versions of libsamsung-ipc, it wasn't added to any of the build systems (Android.mk and autotools). This will have to be fixed in subsequent commits. Signed-off-by: Paul Kocialkowsk <contact@paulk.fr> GNUtoo: Added commit message Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* tools: reorder includesDenis 'GNUtoo' Carikli2020-07-213-10/+12
| | | | | | | | | | This reorders includes alphabetically and groups them together: - C standard library includes of depth 1 are grouped together - "System" libraries of depth > 1 age grouped together - The (lib)samsung-ipc include(s) is/are grouped together Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Reviewed-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
* tools: nv_data-md5: switch to Linux code styleDenis 'GNUtoo' Carikli2020-06-271-58/+57
| | | | | | | | | | | | | | | This contains no functional changes. The commented out code if any has also been preserved as it could be relevant to the understanding of the code. It will be kept until we understand why the code has been commented. In that case we either need to remove it completely or to replace it by a comment explaining why not having that code was necessary. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Reviewed-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
* tools: ipc-modem: switch to Linux code styleDenis 'GNUtoo' Carikli2020-06-271-393/+408
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This contains no functional changes. checkpatch.pl still produces warning on tools/ipc-modem.c but there were good reasons to ignore them: - Since there is no documentation for the samsung-ipc protocol, beside the libsamsung-ipc source code, the code that was commented out or between #if 0 #endif has been preserved as it could be relevant to the understanding of the protocol. It will be kept until we understand why the code has been commented. In that case we either need to remove it completely or to replace it by a comment explaining why not having that code was necessary. - checkpatch also emits many warnings for "quoted string split across lines". The issue here is that we have conflicting rules in the code style. - In one hand there is a limit of 80 characters per line. - On the other hand, user-visible strings should not be broken because "that breaks the ability to grep for them"[1]. So the strings were split in a way that limit the probability of not finding them in grep. The assignment of the global declaration to 0 also triggered a checkpatch.pl error: ERROR: do not initialise globals to 0 So they were fixed as the fix shouldn't induce any functional change: In the the C18 standard draft[2] in the Semantics section of the Initialization section (6.7.9) we have: If an object that has static or thread storage duration is not initialized explicitly, then: [...] - if it has arithmetic type, it is initialized to (positive or unsigned) zero; References: ----------- [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v5.6#n81 [2]The standard doesn't seem to be available for free, but the draft can be downloaded from the following URL: https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Reviewed-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
* tools: ipc-test: switch to Linux code styleDenis 'GNUtoo' Carikli2020-06-251-95/+93
| | | | | | | | | | | | | | This contains no functional changes. The commented out code if any has also been preserved as it could be relevant to the understanding of the code. It will be kept until we understand why the code has been commented. In that case we either need to remove it completely or to replace it by a comment explaining why not having that code was necessary. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* nv_data-md5: use linebreak when printing the md5 stringDenis 'GNUtoo' Carikli2020-01-301-1/+1
| | | | | | This enables easy copy-paste from a terminal. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* nv_data-md5: use ipc_client loggingDenis 'GNUtoo' Carikli2020-01-301-2/+45
| | | | | | | | Without that, functions like ipc_nv_data_md5_calculate won't print anything as the ipc_client logging requires a valid ipc_client. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* ipc_nv_data_md5_calculate: print errors when ipc_client is defined.Denis 'GNUtoo' Carikli2020-01-301-1/+2
| | | | | | | Without that, there are no ways to know the cause of failures with ipc_nv_data_md5_calculate. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* ipc-test: improve error reportingDenis 'GNUtoo' Carikli2020-01-181-9/+9
| | | | | Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Acked-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
* tools: get rid of unused variablesDenis 'GNUtoo' Carikli2019-12-052-4/+0
| | | | Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* tools: silence unused variable warningsDenis 'GNUtoo' Carikli2019-07-242-6/+12
| | | | Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
* tools: nv_data-md5 tool for calculating (salted) nv_data md5Paul Kocialkowski2016-02-022-0/+65
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Fix crash in modemctrl after a failed bootstrapPaul Wise2014-11-021-1/+1
|
* Properly handle errors bootstrapping modemPaul Wise2014-11-021-2/+6
|
* tools: Autotools intermediates cleanupPaul Kocialkowski2014-09-072-456/+0
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* tools: Proper arguments to ipc_client_pollPaul Kocialkowski2014-08-284-2/+458
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* tools: ipc-test test program, for various purposesPaul Kocialkowski2014-02-212-0/+142
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* tools: modemctrl tool rename, in favor of ipc-modemPaul Kocialkowski2014-02-212-5/+5
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* ipc: Consistent coding style and major cleanupPaul Kocialkowski2014-02-151-31/+31
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Prefer official Samsung IPC protocol namesPaul Kocialkowski2014-02-081-13/+12
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Follow consistent coding style in headersPaul Kocialkowski2014-02-061-19/+19
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Good-looking copyright blocks, with the right order in copyright linesPaul Kocialkowski2014-01-251-1/+0
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Rework handlers and ipc functions for better consistencyPaul Kocialkowski2013-06-271-37/+22
| | | | | | | | | | | | | | | | | | | | Detailed list of the changes introduced by this commit: * Rename ipc_client_bootstrap_modem to ipc_client_bootstrap * Rename ipc_client_new/free to ipc_client_create/destroy * Rename log_handler to log_callback and change arguments order * Remove handlers common data and fd mechanisms * Set transport, power and gprs common data for handlers * Add data_create and data_destroy handlers * Rework arguments order for handlers * Add poll transport handler * Remove functions types typedefs * Remove dumb ipc_client_send_* functions * Remove ipc_client_gprs_handlers_available * Adapt device files for the new API changes * Adapt modemctrl for the new API changes Change-Id: Ia9ba1045dbbf9f5e31a201aa8629b49019158972 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* modemctrl: Update Copyright block for better accuracyPaul Kocialkowski2013-06-251-3/+4
| | | | | Change-Id: I0ddd3a6b32920033c3d70f046aea3674f94fa75e Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Moved radio.h and types.h to samsung-ipc.h (API) and protocol.h (IPC protocol).Paul Kocialkowski2013-06-251-1/+1
| | | | | | | Also some minor headers cosmetics. Change-Id: Id2b988b118d956e91827b9b840e3f384424593ae Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Drop support for the (incomplete) old protocol implementation used on H1.Paul Kocialkowski2013-06-251-2/+0
| | | | | | | Also refactor headers: values aligned to 16x4 spaces and other cosmetics Change-Id: I5a6f2c2471599c88c4be74591117d0ab2dfaaddf Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* Fix outstanding compiler warningsSimon Busch2013-06-231-1/+6
| | | | Signed-off-by: Simon Busch <morphis@gravedo.de>
* modemctrl: Remove SIM initializing messagePaul Kocialkowski2013-03-071-3/+0
| | | | | Change-Id: If73a5bc5a87ae1bfdb0921ef16338be11cc7b989 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* switch to GPLv2+ as license as decided by all authors per mailSimon Busch2012-09-211-1/+1
|
* tools: drop not working forwarding toolSimon Busch2012-08-302-191/+0
|
* net: renaming some parts to be more reasonableSimon Busch2012-08-301-2/+2
|
* sec: rename ipc_sec_pin_status_response structureSimon Busch2012-08-291-4/+4
|
* sec: rename IPC_SEC_PIN_STATUS to IPC_SEC_SIM_STATUSSimon Busch2012-08-291-2/+2
|
* sec: refactor type naming to be clean and not misleadingSimon Busch2012-08-291-11/+11
|