gpiod 2.4.1__tar.gz → 2.4.2__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.
Files changed (66) hide show
  1. {gpiod-2.4.1/gpiod.egg-info → gpiod-2.4.2}/PKG-INFO +1 -1
  2. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/ext/line-settings.c +0 -4
  3. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/ext/request.c +12 -0
  4. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/version.py +1 -1
  5. {gpiod-2.4.1 → gpiod-2.4.2/gpiod.egg-info}/PKG-INFO +1 -1
  6. {gpiod-2.4.1 → gpiod-2.4.2}/lib/chip-info.c +3 -3
  7. {gpiod-2.4.1 → gpiod-2.4.2}/lib/internal.c +1 -1
  8. {gpiod-2.4.1 → gpiod-2.4.2}/lib/internal.h +1 -1
  9. {gpiod-2.4.1 → gpiod-2.4.2}/lib/line-request.c +5 -0
  10. {gpiod-2.4.1 → gpiod-2.4.2}/lib/line-settings.c +1 -1
  11. gpiod-2.4.2/libgpiod-version.txt +1 -0
  12. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_line_request.py +22 -0
  13. gpiod-2.4.1/libgpiod-version.txt +0 -1
  14. {gpiod-2.4.1 → gpiod-2.4.2}/LICENSE +0 -0
  15. {gpiod-2.4.1 → gpiod-2.4.2}/MANIFEST.in +0 -0
  16. {gpiod-2.4.1 → gpiod-2.4.2}/README.md +0 -0
  17. {gpiod-2.4.1 → gpiod-2.4.2}/build_tests.py +0 -0
  18. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/__init__.py +0 -0
  19. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/_ext.pyi +0 -0
  20. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/_internal.py +0 -0
  21. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/chip.py +0 -0
  22. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/chip_info.py +0 -0
  23. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/edge_event.py +0 -0
  24. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/exception.py +0 -0
  25. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/ext/chip.c +0 -0
  26. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/ext/common.c +0 -0
  27. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/ext/internal.h +0 -0
  28. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/ext/line-config.c +0 -0
  29. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/ext/module.c +0 -0
  30. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/info_event.py +0 -0
  31. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/line.py +0 -0
  32. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/line_info.py +0 -0
  33. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/line_request.py +0 -0
  34. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/line_settings.py +0 -0
  35. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod/py.typed +0 -0
  36. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod.egg-info/SOURCES.txt +0 -0
  37. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod.egg-info/dependency_links.txt +0 -0
  38. {gpiod-2.4.1 → gpiod-2.4.2}/gpiod.egg-info/top_level.txt +0 -0
  39. {gpiod-2.4.1 → gpiod-2.4.2}/include/gpiod.h +0 -0
  40. {gpiod-2.4.1 → gpiod-2.4.2}/lib/chip.c +0 -0
  41. {gpiod-2.4.1 → gpiod-2.4.2}/lib/edge-event.c +0 -0
  42. {gpiod-2.4.1 → gpiod-2.4.2}/lib/info-event.c +0 -0
  43. {gpiod-2.4.1 → gpiod-2.4.2}/lib/line-config.c +0 -0
  44. {gpiod-2.4.1 → gpiod-2.4.2}/lib/line-info.c +0 -0
  45. {gpiod-2.4.1 → gpiod-2.4.2}/lib/misc.c +0 -0
  46. {gpiod-2.4.1 → gpiod-2.4.2}/lib/request-config.c +0 -0
  47. {gpiod-2.4.1 → gpiod-2.4.2}/lib/uapi/gpio.h +0 -0
  48. {gpiod-2.4.1 → gpiod-2.4.2}/pyproject.toml +0 -0
  49. {gpiod-2.4.1 → gpiod-2.4.2}/setup.cfg +0 -0
  50. {gpiod-2.4.1 → gpiod-2.4.2}/setup.py +0 -0
  51. {gpiod-2.4.1 → gpiod-2.4.2}/tests/__init__.py +0 -0
  52. {gpiod-2.4.1 → gpiod-2.4.2}/tests/__main__.py +0 -0
  53. {gpiod-2.4.1 → gpiod-2.4.2}/tests/gpiosim/__init__.py +0 -0
  54. {gpiod-2.4.1 → gpiod-2.4.2}/tests/gpiosim/chip.py +0 -0
  55. {gpiod-2.4.1 → gpiod-2.4.2}/tests/gpiosim/ext.c +0 -0
  56. {gpiod-2.4.1 → gpiod-2.4.2}/tests/helpers.py +0 -0
  57. {gpiod-2.4.1 → gpiod-2.4.2}/tests/system/__init__.py +0 -0
  58. {gpiod-2.4.1 → gpiod-2.4.2}/tests/system/ext.c +0 -0
  59. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_chip.py +0 -0
  60. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_chip_info.py +0 -0
  61. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_edge_event.py +0 -0
  62. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_info_event.py +0 -0
  63. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_line.py +0 -0
  64. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_line_info.py +0 -0
  65. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_line_settings.py +0 -0
  66. {gpiod-2.4.1 → gpiod-2.4.2}/tests/tests_module.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gpiod
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: Python bindings for libgpiod
5
5
  Author-email: Bartosz Golaszewski <brgl@bgdev.pl>
6
6
  License-Expression: LGPL-2.1-or-later
@@ -70,10 +70,6 @@ line_settings_init(line_settings_object *self, PyObject *args, PyObject *kwargs)
70
70
  gpiod_line_settings_set_debounce_period_us(self->settings,
71
71
  debounce_period);
72
72
 
73
- ret = gpiod_line_settings_set_edge_detection(self->settings, edge);
74
- if (ret)
75
- return set_error();
76
-
77
73
  ret = gpiod_line_settings_set_output_value(self->settings,
78
74
  output_value);
79
75
  if (ret)
@@ -149,6 +149,12 @@ static PyObject *request_get_values(request_object *self, PyObject *args)
149
149
  if (num_offsets < 0)
150
150
  return NULL;
151
151
 
152
+ if (num_offsets > (Py_ssize_t)self->num_lines) {
153
+ PyErr_SetString(PyExc_ValueError,
154
+ "number of offsets exceeds the number of requested lines");
155
+ return NULL;
156
+ }
157
+
152
158
  iter = PyObject_GetIter(offsets);
153
159
  if (!iter)
154
160
  return NULL;
@@ -212,6 +218,12 @@ static PyObject *request_set_values(request_object *self, PyObject *args)
212
218
  if (!ret)
213
219
  return NULL;
214
220
 
221
+ if (PyObject_Size(values) > (Py_ssize_t)self->num_lines) {
222
+ PyErr_SetString(PyExc_ValueError,
223
+ "number of offsets exceeds the number of requested lines");
224
+ return NULL;
225
+ }
226
+
215
227
  clear_buffers(self);
216
228
 
217
229
  /* Note: pos may not be contiguous. */
@@ -2,4 +2,4 @@
2
2
  # SPDX-FileCopyrightText: 2022 Linaro Ltd.
3
3
  # SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
4
4
 
5
- __version__ = "2.4.1"
5
+ __version__ = "2.4.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gpiod
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: Python bindings for libgpiod
5
5
  Author-email: Bartosz Golaszewski <brgl@bgdev.pl>
6
6
  License-Expression: LGPL-2.1-or-later
@@ -57,7 +57,7 @@ gpiod_chip_info_from_uapi(struct gpiochip_info *uapi_info)
57
57
  * GPIO device must have a name - don't bother checking this field. In
58
58
  * the worst case (would have to be a weird kernel bug) it'll be empty.
59
59
  */
60
- strncpy(info->name, uapi_info->name, sizeof(info->name));
60
+ strncpy(info->name, uapi_info->name, GPIO_MAX_NAME_SIZE);
61
61
 
62
62
  /*
63
63
  * The kernel sets the label of a GPIO device to "unknown" if it
@@ -65,9 +65,9 @@ gpiod_chip_info_from_uapi(struct gpiochip_info *uapi_info)
65
65
  * we got an empty string, do the same.
66
66
  */
67
67
  if (uapi_info->label[0] == '\0')
68
- strncpy(info->label, "unknown", sizeof(info->label));
68
+ strncpy(info->label, "unknown", GPIO_MAX_NAME_SIZE);
69
69
  else
70
- strncpy(info->label, uapi_info->label, sizeof(info->label));
70
+ strncpy(info->label, uapi_info->label, GPIO_MAX_NAME_SIZE);
71
71
 
72
72
  return info;
73
73
  }
@@ -139,7 +139,7 @@ void gpiod_line_mask_zero(uint64_t *mask)
139
139
  *mask = 0ULL;
140
140
  }
141
141
 
142
- bool gpiod_line_mask_test_bit(const uint64_t *mask, int nr)
142
+ bool gpiod_line_mask_test_bit(const uint64_t *mask, unsigned int nr)
143
143
  {
144
144
  return *mask & (1ULL << nr);
145
145
  }
@@ -41,7 +41,7 @@ int gpiod_set_output_value(enum gpiod_line_value in,
41
41
  int gpiod_ioctl(int fd, unsigned long request, void *arg);
42
42
 
43
43
  void gpiod_line_mask_zero(uint64_t *mask);
44
- bool gpiod_line_mask_test_bit(const uint64_t *mask, int nr);
44
+ bool gpiod_line_mask_test_bit(const uint64_t *mask, unsigned int nr);
45
45
  void gpiod_line_mask_set_bit(uint64_t *mask, unsigned int nr);
46
46
  void gpiod_line_mask_assign_bit(uint64_t *mask, unsigned int nr, bool value);
47
47
 
@@ -24,6 +24,11 @@ gpiod_line_request_from_uapi(struct gpio_v2_line_request *uapi_req,
24
24
  {
25
25
  struct gpiod_line_request *request;
26
26
 
27
+ if (uapi_req->num_lines > GPIO_V2_LINES_MAX) {
28
+ errno = EINVAL;
29
+ return NULL;
30
+ }
31
+
27
32
  request = malloc(sizeof(*request));
28
33
  if (!request)
29
34
  return NULL;
@@ -16,7 +16,7 @@ struct gpiod_line_settings {
16
16
  enum gpiod_line_bias bias;
17
17
  bool active_low;
18
18
  enum gpiod_line_clock event_clock;
19
- long debounce_period_us;
19
+ unsigned long debounce_period_us;
20
20
  enum gpiod_line_value output_value;
21
21
  };
22
22
 
@@ -0,0 +1 @@
1
+ 2.2.4
@@ -676,6 +676,28 @@ class LineRequestSurvivesParentChip(TestCase):
676
676
  req.release()
677
677
 
678
678
 
679
+ class UsingMoreLinesThanRequestedNotAllowed(TestCase):
680
+ def setUp(self) -> None:
681
+ self.sim = gpiosim.Chip(num_lines=4)
682
+
683
+ def tearDown(self) -> None:
684
+ del self.sim
685
+
686
+ def test_line_get_more_values_than_requested_lines(self) -> None:
687
+ with gpiod.request_lines(
688
+ self.sim.dev_path, config={0: gpiod.LineSettings(direction=Direction.INPUT)}
689
+ ) as req:
690
+ with self.assertRaises(ValueError):
691
+ req.get_values(list(range(64)))
692
+
693
+ def test_line_set_more_values_than_requested_lines(self) -> None:
694
+ with gpiod.request_lines(
695
+ self.sim.dev_path, config={0: gpiod.LineSettings(direction=Direction.OUTPUT)}
696
+ ) as req:
697
+ with self.assertRaises(ValueError):
698
+ req.set_values({i: Value.ACTIVE for i in range(64)})
699
+
700
+
679
701
  class LineRequestStringRepresentation(TestCase):
680
702
  def setUp(self) -> None:
681
703
  self.sim = gpiosim.Chip(num_lines=8)
@@ -1 +0,0 @@
1
- 2.2.3
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