aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-bsp/i2cdev/i2cdev/fix-musl.patch
blob: a15514bafebe98122b9a1122979d9fc36939325a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
From ce3affeb45a65649dda1edc9a4f0586e9db47ada Mon Sep 17 00:00:00 2001
Message-Id: <ce3affeb45a65649dda1edc9a4f0586e9db47ada.1705064898.git.joerg.sommer@navimatix.de>
From: =?UTF-8?q?J=C3=B6rg=20Sommer?= <joerg.sommer@navimatix.de>
Date: Fri, 12 Jan 2024 13:59:51 +0100
Subject: [PATCH] lsi2c: Replace error() by fprintf, drop error.h

The MUSL C library doesn't support error.h. Because the only usage of this
is the *error* function in lsi2c.c, this gets replaced by a *fprintf*. This
doesn't print the program name, but keeps the message and the error
description.

Upstream-Status: Submitted [https://github.com/costad2/i2cdev/pull/5]
---
 libi2cdev/access.c         | 1 -
 libi2cdev/i2c-bus-parser.c | 1 -
 libi2cdev/i2c-dev-path.c   | 1 -
 libi2cdev/i2c-error.c      | 1 -
 libi2cdev/init.c           | 2 --
 libi2cdev/sysfs.c          | 1 -
 lsi2c/lsi2c.c              | 4 ++--
 7 files changed, 2 insertions(+), 9 deletions(-)

--- a/libi2cdev/access.c
+++ b/libi2cdev/access.c
@@ -16,7 +16,6 @@
 
 #include "busses.h"
 #include "data.h"
-#include "error.h"
 #include "sysfs.h"
 
 #include "i2cdiscov.h"
--- a/libi2cdev/i2c-bus-parser.c
+++ b/libi2cdev/i2c-bus-parser.c
@@ -27,9 +27,9 @@
 #include <dirent.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <error.h>
 #include <alloca.h>
 #include <search.h>
+#include <libgen.h>
 
 #include "common.h"
 #include "sysfs.h"
--- a/libi2cdev/i2c-dev-path.c
+++ b/libi2cdev/i2c-dev-path.c
@@ -11,7 +11,6 @@
 #include <string.h>
 #include <errno.h>
 #include <stdio.h>
-#include <error.h>
 
 #include <linux/limits.h>
 
--- a/libi2cdev/i2c-error.c
+++ b/libi2cdev/i2c-error.c
@@ -9,7 +9,6 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <error.h>
 #include <errno.h>
 #include <stdbool.h>
 #include <stdarg.h>
--- a/libi2cdev/init.c
+++ b/libi2cdev/init.c
@@ -16,10 +16,8 @@
 #include <errno.h>
 #include <dirent.h>
 #include <unistd.h>
-#include <error.h>
 #include <limits.h>
 #include <ctype.h>
-#include <error.h>
 #include <fcntl.h>
 #include <assert.h>
 
--- a/libi2cdev/sysfs.c
+++ b/libi2cdev/sysfs.c
@@ -17,8 +17,8 @@
 #include <assert.h>
 #include <string.h>
 #include <fcntl.h>
-#include <error.h>
 #include <errno.h>
+#include <libgen.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
--- a/lsi2c/lsi2c.c
+++ b/lsi2c/lsi2c.c
@@ -38,7 +38,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include <error.h>
 #include <getopt.h>
 #include <stdbool.h>
 
@@ -205,7 +204,8 @@ static int read_config_file(const char *
         if (err < 0) {
             err = -err;
         }
-        error(0, err, "Failed to initialize i2cdevices");
+        fflush(stdout);
+        fprintf(stderr, "Failed to initialize i2cdevices: %s", strerror(err));
         if (config_file) {
             fclose(config_file);
         }