[gnome-build-meta] Integrated the atinout command
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta] Integrated the atinout command
- Date: Sun, 25 Sep 2022 19:50:45 +0000 (UTC)
commit ec0b721435db575831af6bc4bbd98a9e363ed364
Author: Owen Park <owen park codethink co uk>
Date: Mon Aug 15 15:52:39 2022 +0100
Integrated the atinout command
- atinout is a tool used to communicate with modems via serial.
Link to issue:
https://gitlab.codethink.co.uk/co097/co097/-/issues/62
- These changes/patches are based on a PKGBUILD made for Arch
Linux on a Pinephone:
https://github.com/dreemurrs-embedded/Pine64-Arch/tree/master/PKGBUILDS/pine64/atinout
Part-of: <https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/1727>
elements/custom/atinout.bst | 13 ++++
elements/vm/deps.bst | 1 +
...e-gcc-happy-by-adding-fallthrough-comment.patch | 25 +++++++
.../0002-do-not-rely-on-CR-in-modem-output.patch | 84 ++++++++++++++++++++++
4 files changed, 123 insertions(+)
---
diff --git a/elements/custom/atinout.bst b/elements/custom/atinout.bst
new file mode 100644
index 000000000..0cd75776a
--- /dev/null
+++ b/elements/custom/atinout.bst
@@ -0,0 +1,13 @@
+description: atinout is a low level application for communicating with modems over
+ serial.
+kind: make
+sources:
+- kind: tar
+ url: https://sourceforge.net/projects/atinout/files/v0.9.1/atinout-0.9.1.tar.gz/download
+ ref: 4d15c8288aca414e11cd304686b172696104c5e42bf776300311c005634854a2
+- kind: patch
+ path: files/atinout/0001-make-gcc-happy-by-adding-fallthrough-comment.patch
+- kind: patch
+ path: files/atinout/0002-do-not-rely-on-CR-in-modem-output.patch
+build-depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
diff --git a/elements/vm/deps.bst b/elements/vm/deps.bst
index c297b99fb..d9324dfb5 100644
--- a/elements/vm/deps.bst
+++ b/elements/vm/deps.bst
@@ -7,3 +7,4 @@ depends:
- core-deps/feedbackd.bst
- core/calls.bst
- freedesktop-sdk.bst:components/iputils.bst
+- custom/atinout.bst
diff --git a/files/atinout/0001-make-gcc-happy-by-adding-fallthrough-comment.patch
b/files/atinout/0001-make-gcc-happy-by-adding-fallthrough-comment.patch
new file mode 100644
index 000000000..ce7800fe0
--- /dev/null
+++ b/files/atinout/0001-make-gcc-happy-by-adding-fallthrough-comment.patch
@@ -0,0 +1,25 @@
+From ca2e04f8b069d269172f0d55d3716a809537f696 Mon Sep 17 00:00:00 2001
+From: Beralt Meppelink <b meppelink riwo eu>
+Date: Fri, 27 Oct 2017 09:12:18 +0200
+Subject: [PATCH 1/2] make gcc happy by adding fallthrough comment
+
+---
+ atinout.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/atinout.c b/atinout.c
+index d04f300..924b5bc 100644
+--- a/atinout.c
++++ b/atinout.c
+@@ -150,7 +150,7 @@ static bool is_final_result(const char * const response)
+ if (strcmp(&response[1], "K\r\n") == 0) {
+ return true;
+ }
+- /* no break */
++ // fallthrough
+ default:
+ return false;
+ }
+--
+2.23.0
+
diff --git a/files/atinout/0002-do-not-rely-on-CR-in-modem-output.patch
b/files/atinout/0002-do-not-rely-on-CR-in-modem-output.patch
new file mode 100644
index 000000000..593dc8538
--- /dev/null
+++ b/files/atinout/0002-do-not-rely-on-CR-in-modem-output.patch
@@ -0,0 +1,84 @@
+From 65dae46181119867cd8e93ca5b33d3b0cf3df08c Mon Sep 17 00:00:00 2001
+From: Beralt Meppelink <b meppelink riwo eu>
+Date: Fri, 27 Oct 2017 10:42:50 +0200
+Subject: [PATCH 2/2] do not rely on CR in modem output
+
+---
+ atinout.c | 24 +++++++++++-------------
+ 1 file changed, 11 insertions(+), 13 deletions(-)
+
+diff --git a/atinout.c b/atinout.c
+index 924b5bc..4cd7689 100644
+--- a/atinout.c
++++ b/atinout.c
+@@ -34,7 +34,6 @@
+
+ #define MAX_LINE_LENGTH (4 * 1024)
+ static char buf[MAX_LINE_LENGTH];
+-static char buf2[MAX_LINE_LENGTH];
+
+ static struct option long_options[] = {
+ {"help", no_argument, NULL, 'h'},
+@@ -125,36 +124,36 @@ static bool is_final_result(const char * const response)
+ }
+ return false;
+ case 'B':
+- if (strcmp(&response[1], "USY\r\n") == 0) {
++ if (strcmp(&response[1], "USY\n") == 0) {
+ return true;
+- }
++ }
++
+ return false;
+
+ case 'E':
+- if (strcmp(&response[1], "RROR\r\n") == 0) {
++ if (strcmp(&response[1], "RROR\n") == 0) {
+ return true;
+ }
+ return false;
+ case 'N':
+- if (strcmp(&response[1], "O ANSWER\r\n") == 0) {
++ if (strcmp(&response[1], "O ANSWER\n") == 0) {
+ return true;
+ }
+- if (strcmp(&response[1], "O CARRIER\r\n") == 0) {
++ if (strcmp(&response[1], "O CARRIER\n") == 0) {
+ return true;
+ }
+- if (strcmp(&response[1], "O DIALTONE\r\n") == 0) {
++ if (strcmp(&response[1], "O DIALTONE\n") == 0) {
+ return true;
+ }
+ return false;
+ case 'O':
+- if (strcmp(&response[1], "K\r\n") == 0) {
++ if (strcmp(&response[1], "K\n") == 0) {
+ return true;
+ }
+ // fallthrough
+ default:
+ return false;
+ }
+-
+ }
+
+ int main(int argc, char *argv[])
+@@ -248,11 +247,10 @@ int main(int argc, char *argv[])
+ fprintf(stderr, "EOF from modem\n");
+ return EXIT_FAILURE;
+ }
+- strcpy(buf2, line);
+- strip_cr(buf2);
+- res = fputs(buf2, output);
++ strip_cr(line);
++ res = fputs(line, output);
+ if (res < 0) {
+- fprintf(stderr, "failed to write '%s' to output file (res = %d)\n", buf2,
res);
++ fprintf(stderr, "failed to write '%s' to output file (res = %d)\n", line,
res);
+ return EXIT_FAILURE;
+ }
+ } while (! is_final_result(line));
+--
+2.23.0
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]