gpiod 2.4.2__tar.gz → 2.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gpiod-2.4.2/gpiod.egg-info → gpiod-2.4.3}/PKG-INFO +1 -1
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/ext/chip.c +2 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/ext/line-config.c +4 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/ext/request.c +2 -3
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/version.py +1 -1
- {gpiod-2.4.2 → gpiod-2.4.3/gpiod.egg-info}/PKG-INFO +1 -1
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/chip-info.c +2 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/edge-event.c +5 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/line-config.c +42 -3
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/line-info.c +2 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/line-request.c +1 -1
- gpiod-2.4.3/libgpiod-version.txt +1 -0
- gpiod-2.4.2/libgpiod-version.txt +0 -1
- {gpiod-2.4.2 → gpiod-2.4.3}/LICENSE +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/MANIFEST.in +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/README.md +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/build_tests.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/__init__.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/_ext.pyi +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/_internal.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/chip.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/chip_info.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/edge_event.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/exception.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/ext/common.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/ext/internal.h +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/ext/line-settings.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/ext/module.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/info_event.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/line.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/line_info.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/line_request.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/line_settings.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod/py.typed +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod.egg-info/SOURCES.txt +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod.egg-info/dependency_links.txt +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/gpiod.egg-info/top_level.txt +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/include/gpiod.h +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/chip.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/info-event.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/internal.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/internal.h +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/line-settings.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/misc.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/request-config.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/lib/uapi/gpio.h +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/pyproject.toml +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/setup.cfg +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/setup.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/__init__.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/__main__.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/gpiosim/__init__.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/gpiosim/chip.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/gpiosim/ext.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/helpers.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/system/__init__.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/system/ext.c +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_chip.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_chip_info.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_edge_event.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_info_event.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_line.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_line_info.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_line_request.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_line_settings.py +0 -0
- {gpiod-2.4.2 → gpiod-2.4.3}/tests/tests_module.py +0 -0
|
@@ -79,7 +79,9 @@ static PyObject *chip_get_info(chip_object *self, PyObject *Py_UNUSED(ignored))
|
|
|
79
79
|
if (!type)
|
|
80
80
|
return NULL;
|
|
81
81
|
|
|
82
|
+
Py_BEGIN_ALLOW_THREADS;
|
|
82
83
|
info = gpiod_chip_get_info(self->chip);
|
|
84
|
+
Py_END_ALLOW_THREADS;
|
|
83
85
|
if (!info) {
|
|
84
86
|
Py_DECREF(type);
|
|
85
87
|
return PyErr_SetFromErrno(PyExc_OSError);
|
|
@@ -82,7 +82,6 @@ static PyObject *request_offsets(request_object *self, void *Py_UNUSED(ignored))
|
|
|
82
82
|
|
|
83
83
|
ret = PyList_SetItem(lines, i, line);
|
|
84
84
|
if (ret) {
|
|
85
|
-
Py_DECREF(line);
|
|
86
85
|
Py_DECREF(lines);
|
|
87
86
|
PyMem_Free(offsets);
|
|
88
87
|
return NULL;
|
|
@@ -165,6 +164,8 @@ static PyObject *request_get_values(request_object *self, PyObject *args)
|
|
|
165
164
|
next = PyIter_Next(iter);
|
|
166
165
|
if (!next) {
|
|
167
166
|
Py_DECREF(iter);
|
|
167
|
+
if (PyErr_Occurred())
|
|
168
|
+
return NULL;
|
|
168
169
|
break;
|
|
169
170
|
}
|
|
170
171
|
|
|
@@ -198,7 +199,6 @@ static PyObject *request_get_values(request_object *self, PyObject *args)
|
|
|
198
199
|
|
|
199
200
|
ret = PyList_SetItem(values, pos, val);
|
|
200
201
|
if (ret) {
|
|
201
|
-
Py_DECREF(val);
|
|
202
202
|
Py_DECREF(type);
|
|
203
203
|
return NULL;
|
|
204
204
|
}
|
|
@@ -339,7 +339,6 @@ static PyObject *request_read_edge_events(request_object *self, PyObject *args)
|
|
|
339
339
|
|
|
340
340
|
ret = PyList_SetItem(events, i, event_obj);
|
|
341
341
|
if (ret) {
|
|
342
|
-
Py_DECREF(event_obj);
|
|
343
342
|
Py_DECREF(events);
|
|
344
343
|
Py_DECREF(type);
|
|
345
344
|
return NULL;
|
|
@@ -58,6 +58,7 @@ gpiod_chip_info_from_uapi(struct gpiochip_info *uapi_info)
|
|
|
58
58
|
* the worst case (would have to be a weird kernel bug) it'll be empty.
|
|
59
59
|
*/
|
|
60
60
|
strncpy(info->name, uapi_info->name, GPIO_MAX_NAME_SIZE);
|
|
61
|
+
info->name[GPIO_MAX_NAME_SIZE] = '\0';
|
|
61
62
|
|
|
62
63
|
/*
|
|
63
64
|
* The kernel sets the label of a GPIO device to "unknown" if it
|
|
@@ -68,6 +69,7 @@ gpiod_chip_info_from_uapi(struct gpiochip_info *uapi_info)
|
|
|
68
69
|
strncpy(info->label, "unknown", GPIO_MAX_NAME_SIZE);
|
|
69
70
|
else
|
|
70
71
|
strncpy(info->label, uapi_info->label, GPIO_MAX_NAME_SIZE);
|
|
72
|
+
info->label[GPIO_MAX_NAME_SIZE] = '\0';
|
|
71
73
|
|
|
72
74
|
return info;
|
|
73
75
|
}
|
|
@@ -184,6 +184,11 @@ int gpiod_edge_event_buffer_read_fd(int fd,
|
|
|
184
184
|
if (max_events > buffer->capacity)
|
|
185
185
|
max_events = buffer->capacity;
|
|
186
186
|
|
|
187
|
+
if (max_events == 0) {
|
|
188
|
+
buffer->num_events = 0;
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
187
192
|
rd = read(fd, buffer->event_data,
|
|
188
193
|
max_events * sizeof(*buffer->event_data));
|
|
189
194
|
if (rd < 0) {
|
|
@@ -90,13 +90,50 @@ static struct per_line_config *find_config(struct gpiod_line_config *config,
|
|
|
90
90
|
return &config->line_configs[config->num_configs++];
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/*
|
|
94
|
+
* Count offsets in the input array that would require a new slot in the
|
|
95
|
+
* config: those not already present in config->line_configs and not repeated
|
|
96
|
+
* earlier in the same offsets array.
|
|
97
|
+
*/
|
|
98
|
+
static size_t count_new_offsets(const struct gpiod_line_config *config,
|
|
99
|
+
const unsigned int *offsets, size_t num_offsets)
|
|
100
|
+
{
|
|
101
|
+
size_t i, j, num_new = 0;
|
|
102
|
+
bool existing;
|
|
103
|
+
|
|
104
|
+
for (i = 0; i < num_offsets; i++) {
|
|
105
|
+
existing = false;
|
|
106
|
+
|
|
107
|
+
for (j = 0; j < config->num_configs; j++) {
|
|
108
|
+
if (config->line_configs[j].offset == offsets[i]) {
|
|
109
|
+
existing = true;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!existing) {
|
|
115
|
+
for (j = 0; j < i; j++) {
|
|
116
|
+
if (offsets[j] == offsets[i]) {
|
|
117
|
+
existing = true;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!existing)
|
|
124
|
+
num_new++;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return num_new;
|
|
128
|
+
}
|
|
129
|
+
|
|
93
130
|
GPIOD_API int gpiod_line_config_add_line_settings(
|
|
94
131
|
struct gpiod_line_config *config, const unsigned int *offsets,
|
|
95
132
|
size_t num_offsets, struct gpiod_line_settings *settings)
|
|
96
133
|
{
|
|
97
134
|
struct per_line_config *per_line;
|
|
98
135
|
struct settings_node *node, *old;
|
|
99
|
-
size_t i;
|
|
136
|
+
size_t i, new_offsets;
|
|
100
137
|
|
|
101
138
|
assert(config);
|
|
102
139
|
|
|
@@ -105,7 +142,9 @@ GPIOD_API int gpiod_line_config_add_line_settings(
|
|
|
105
142
|
return -1;
|
|
106
143
|
}
|
|
107
144
|
|
|
108
|
-
|
|
145
|
+
new_offsets = count_new_offsets(config, offsets, num_offsets);
|
|
146
|
+
|
|
147
|
+
if ((config->num_configs + new_offsets) > LINES_MAX) {
|
|
109
148
|
errno = E2BIG;
|
|
110
149
|
return -1;
|
|
111
150
|
}
|
|
@@ -143,7 +182,7 @@ GPIOD_API int gpiod_line_config_add_line_settings(
|
|
|
143
182
|
old->prev->next = old->next;
|
|
144
183
|
if (old->next)
|
|
145
184
|
old->next->prev = old->prev;
|
|
146
|
-
|
|
185
|
+
gpiod_line_settings_free(old->settings);
|
|
147
186
|
free(old);
|
|
148
187
|
}
|
|
149
188
|
}
|
|
@@ -149,9 +149,11 @@ gpiod_line_info_from_uapi(struct gpio_v2_line_info *uapi_info)
|
|
|
149
149
|
|
|
150
150
|
info->offset = uapi_info->offset;
|
|
151
151
|
strncpy(info->name, uapi_info->name, GPIO_MAX_NAME_SIZE);
|
|
152
|
+
info->name[GPIO_MAX_NAME_SIZE] = '\0';
|
|
152
153
|
|
|
153
154
|
info->used = !!(uapi_info->flags & GPIO_V2_LINE_FLAG_USED);
|
|
154
155
|
strncpy(info->consumer, uapi_info->consumer, GPIO_MAX_NAME_SIZE);
|
|
156
|
+
info->consumer[GPIO_MAX_NAME_SIZE] = '\0';
|
|
155
157
|
|
|
156
158
|
if (uapi_info->flags & GPIO_V2_LINE_FLAG_OUTPUT)
|
|
157
159
|
info->direction = GPIOD_LINE_DIRECTION_OUTPUT;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.2.5
|
gpiod-2.4.2/libgpiod-version.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.2.4
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|