libusb 1.0.24b3__zip → 1.0.26__zip

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 (73) hide show
  1. libusb-1.0.26/.readthedocs.yml +15 -0
  2. {libusb-1.0.24b3 → libusb-1.0.26}/CHANGES.rst +54 -6
  3. {libusb-1.0.24b3 → libusb-1.0.26}/LICENSE +3 -3
  4. {libusb-1.0.24b3 → libusb-1.0.26}/MANIFEST.in +2 -2
  5. {libusb-1.0.24b3 → libusb-1.0.26}/PKG-INFO +84 -23
  6. {libusb-1.0.24b3 → libusb-1.0.26}/README.rst +7 -6
  7. {libusb-1.0.24b3 → libusb-1.0.26}/docs/conf.py +4 -23
  8. {libusb-1.0.24b3 → libusb-1.0.26}/examples/dpfp.py +32 -18
  9. {libusb-1.0.24b3 → libusb-1.0.26}/examples/dpfp_threaded.py +2 -2
  10. {libusb-1.0.24b3 → libusb-1.0.26}/examples/ezusb.py +26 -15
  11. {libusb-1.0.24b3 → libusb-1.0.26}/examples/fxload.py +15 -9
  12. {libusb-1.0.24b3 → libusb-1.0.26}/examples/hotplugtest.py +29 -15
  13. {libusb-1.0.24b3 → libusb-1.0.26}/examples/listdevs.py +5 -3
  14. {libusb-1.0.24b3 → libusb-1.0.26}/examples/sam3u_benchmark.py +14 -5
  15. {libusb-1.0.24b3 → libusb-1.0.26}/examples/testlibusb.py +9 -5
  16. {libusb-1.0.24b3 → libusb-1.0.26}/examples/win32.py +10 -2
  17. {libusb-1.0.24b3 → libusb-1.0.26}/examples/xusb.py +159 -80
  18. libusb-1.0.26/pyproject.toml +287 -0
  19. libusb-1.0.26/setup.cfg +4 -0
  20. libusb-1.0.26/src/libusb/__about__.py +6 -0
  21. libusb-1.0.26/src/libusb/__config__.py +1 -0
  22. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb/__init__.py +4 -4
  23. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb/_config.py +4 -4
  24. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb/_dll.py +2 -2
  25. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb/_libusb.py +402 -134
  26. libusb-1.0.26/src/libusb/_platform/__init__.py +40 -0
  27. {libusb-1.0.24b3/src/libusb/_platform/_osx → libusb-1.0.26/src/libusb/_platform/_linux}/__init__.py +12 -10
  28. libusb-1.0.26/src/libusb/_platform/_linux/aarch64/libusb-1.0.so +0 -0
  29. libusb-1.0.26/src/libusb/_platform/_linux/x64/libusb-1.0.so +0 -0
  30. libusb-1.0.26/src/libusb/_platform/_linux/x86/libusb-1.0.so +0 -0
  31. {libusb-1.0.24b3/src/libusb/_platform/_linux → libusb-1.0.26/src/libusb/_platform/_macos}/__init__.py +19 -10
  32. libusb-1.0.26/src/libusb/_platform/_macos/x64/10.7/libusb-1.0.0.dylib +0 -0
  33. libusb-1.0.26/src/libusb/_platform/_macos/x64/11.6/libusb-1.0.0.dylib +0 -0
  34. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb/_platform/_windows/__init__.py +10 -5
  35. libusb-1.0.26/src/libusb/_platform/_windows/x64/libusb-1.0.dll +0 -0
  36. libusb-1.0.26/src/libusb/_platform/_windows/x86/libusb-1.0.dll +0 -0
  37. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb.egg-info/PKG-INFO +84 -23
  38. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb.egg-info/SOURCES.txt +14 -9
  39. libusb-1.0.26/src/libusb.egg-info/requires.txt +16 -0
  40. {libusb-1.0.24b3 → libusb-1.0.26}/tests/__init__.py +2 -2
  41. {libusb-1.0.24b3 → libusb-1.0.26}/tests/__main__.py +2 -2
  42. {libusb-1.0.24b3 → libusb-1.0.26}/tests/test_main.py +5 -2
  43. {libusb-1.0.24b3 → libusb-1.0.26}/tests/testlib.py +100 -4
  44. libusb-1.0.26/tests/tman_init_context.py +105 -0
  45. libusb-1.0.26/tests/tman_set_option.py +214 -0
  46. libusb-1.0.24b3/tests/stress.py → libusb-1.0.26/tests/tman_stress.py +36 -17
  47. libusb-1.0.26/tests/tman_stress_mt.py +301 -0
  48. libusb-1.0.26/tests/umockdev.py_ +1148 -0
  49. libusb-1.0.26/tests/win32.py +81 -0
  50. libusb-1.0.24b3/.readthedocs.yml +0 -9
  51. libusb-1.0.24b3/pyproject.toml +0 -3
  52. libusb-1.0.24b3/setup.cfg +0 -219
  53. libusb-1.0.24b3/setup.py +0 -1
  54. libusb-1.0.24b3/src/libusb/__about__.py +0 -6
  55. libusb-1.0.24b3/src/libusb/__config__.py +0 -1
  56. libusb-1.0.24b3/src/libusb/_platform/__init__.py +0 -36
  57. libusb-1.0.24b3/src/libusb/_platform/_linux/x64/libusb-1.0.so +0 -0
  58. libusb-1.0.24b3/src/libusb/_platform/_osx/x64/libusb-1.0.dylib +0 -0
  59. libusb-1.0.24b3/src/libusb/_platform/_windows/x64/libusb-1.0.dll +0 -0
  60. libusb-1.0.24b3/src/libusb/_platform/_windows/x86/libusb-1.0.dll +0 -0
  61. libusb-1.0.24b3/src/libusb.egg-info/entry_points.txt +0 -3
  62. libusb-1.0.24b3/src/libusb.egg-info/requires.txt +0 -14
  63. {libusb-1.0.24b3 → libusb-1.0.26}/docs/CHANGES.rst +0 -0
  64. {libusb-1.0.24b3 → libusb-1.0.26}/docs/README.rst +0 -0
  65. {libusb-1.0.24b3 → libusb-1.0.26}/docs/_static/libusb.png +0 -0
  66. {libusb-1.0.24b3 → libusb-1.0.26}/docs/_templates/.keep +0 -0
  67. {libusb-1.0.24b3 → libusb-1.0.26}/docs/index.rst +0 -0
  68. {libusb-1.0.24b3/src/libusb/_platform/_linux → libusb-1.0.26/src/libusb/_platform/_macos}/x86/.keep +0 -0
  69. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb/libusb.cfg +0 -0
  70. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb.egg-info/dependency_links.txt +0 -0
  71. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb.egg-info/not-zip-safe +0 -0
  72. {libusb-1.0.24b3 → libusb-1.0.26}/src/libusb.egg-info/top_level.txt +0 -0
  73. {libusb-1.0.24b3/src/libusb/_platform/_osx/x86 → libusb-1.0.26/tests/data}/.keep +0 -0
@@ -0,0 +1,15 @@
1
+ version: 2
2
+ build:
3
+ os: "ubuntu-22.04"
4
+ tools:
5
+ python: "3.11"
6
+ python:
7
+ install:
8
+ - method: pip
9
+ path: .
10
+ extra_requirements:
11
+ - doc
12
+ sphinx:
13
+ builder: html
14
+ configuration: docs/conf.py
15
+ fail_on_warning: true
@@ -1,9 +1,57 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 1.0.26 (2024-02-05)
5
+ -------------------
6
+ - API partially updated from 1.0.27 but still supports only 1.0.26.
7
+ - Improvements and some little bugfixes.
8
+ - Examples and tests are upgraded from 1.0.27.
9
+
10
+ 1.0.26rc4 (2024-01-25)
11
+ ----------------------
12
+ - Setup update (now based on tox >= 4.0).
13
+ - Cleanup.
14
+
15
+ 1.0.26rc2 (2023-12-20)
16
+ ----------------------
17
+ - Add linux aarch64 support.
18
+
19
+ 1.0.26rc1 (2023-12-15)
20
+ ----------------------
21
+ - Add support for Python 3.12
22
+ - Drop support for Python 3.7
23
+ - Add support for PyPy 3.10
24
+ - Drop support for PyPy 3.7 and 3.8
25
+ - Copyright year update.
26
+
27
+ 1.0.26b5 (2022-09-10)
28
+ ---------------------
29
+ - Tox configuration has been moved to pyproject.toml
30
+
31
+ 1.0.26b4 (2022-08-25)
32
+ ---------------------
33
+ - | Downgrade of included shared libraries for Linux:
34
+ | libusb v.1.0.26 -> v.1.0.24 (for now based on Debian's 11 (bullseye)),
35
+ | because of loading issues of v.1.0.26 from Debian's 12 (bookworm)
36
+ | shared libraries.
37
+ - Setup update.
38
+
39
+ 1.0.26b3 (2022-07-25)
40
+ ---------------------
41
+ - Setup update (currently based mainly on pyproject.toml).
42
+ - Update for macOS (dlls are included for v.10.7+ and v.11.6+ 64bit).
43
+
44
+ 1.0.26b2 (2022-07-18)
45
+ ---------------------
46
+ - Upgrade for Windows: libusb v.1.0.24 -> v.1.0.26
47
+ - Update for macOS (v.11.6 64bit).
48
+ - Add support for Python 3.10 and 3.11
49
+ - Add support for PyPy 3.7, 3.8 and 3.9
50
+ - Setup update.
51
+
4
52
  1.0.24b3 (2022-01-10)
5
53
  ---------------------
6
- - Drop support for Python 3.6.
54
+ - Drop support for Python 3.6
7
55
  - Copyright year update.
8
56
  - Setup update.
9
57
 
@@ -30,8 +78,8 @@ Changelog
30
78
  - | Upgrade for Windows: libusb v.1.0.22 -> v.1.0.23
31
79
  | (partially; without libusb_wrap_sys_device, because
32
80
  | original Windows v.1.0.23 dlls do not export this function).
33
- - Add support for Python 3.9.
34
- - Drop support for Python 3.5.
81
+ - Add support for Python 3.9
82
+ - Drop support for Python 3.5
35
83
  - Setup update.
36
84
  - Cleanup.
37
85
 
@@ -52,9 +100,9 @@ Changelog
52
100
 
53
101
  1.0.22b5 (2019-11-14)
54
102
  ---------------------
55
- - Drop support for Python 2.
56
- - Drop support for Python 3.4.
57
- - Add support for Python 3.8.
103
+ - Drop support for Python 2
104
+ - Drop support for Python 3.4
105
+ - Add support for Python 3.8
58
106
  - Setup update and cleanup.
59
107
 
60
108
  1.0.22b4 (2019-02-15)
@@ -1,4 +1,6 @@
1
- Copyright (c) 2016-2022 Adam Karpierz
1
+ zlib License
2
+
3
+ Copyright (C) 2016-2024 Adam Karpierz
2
4
 
3
5
  This software is provided 'as-is', without any express or implied
4
6
  warranty. In no event will the authors be held liable for any damages
@@ -12,8 +14,6 @@ freely, subject to the following restrictions:
12
14
  claim that you wrote the original software. If you use this software
13
15
  in a product, an acknowledgment in the product documentation would be
14
16
  appreciated but is not required.
15
-
16
17
  2. Altered source versions must be plainly marked as such, and must not be
17
18
  misrepresented as being the original software.
18
-
19
19
  3. This notice may not be removed or altered from any source distribution.
@@ -1,6 +1,6 @@
1
- # Copyright (c) 2016-2022 Adam Karpierz
1
+ # Copyright (c) 2016 Adam Karpierz
2
2
  # Licensed under the zlib/libpng License
3
- # https://opensource.org/licenses/Zlib
3
+ # https://opensource.org/license/zlib
4
4
 
5
5
  include README.rst
6
6
  include CHANGES.rst
@@ -1,38 +1,52 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: libusb
3
- Version: 1.0.24b3
3
+ Version: 1.0.26
4
4
  Summary: Python binding for the libusb C library.
5
- Home-page: https://pypi.org/project/libusb/
6
5
  Author: Adam Karpierz
7
6
  Author-email: adam@karpierz.net
8
7
  Maintainer: Adam Karpierz
9
8
  Maintainer-email: adam@karpierz.net
10
- License: zlib/libpng License ; https://opensource.org/licenses/Zlib
11
- Download-URL: https://pypi.org/project/libusb/
9
+ License: zlib/libpng License ; https://opensource.org/license/zlib
10
+ Project-URL: Homepage, https://pypi.org/project/libusb/
12
11
  Project-URL: Documentation, https://libusb.readthedocs.io/
12
+ Project-URL: Download, https://pypi.org/project/libusb/
13
13
  Project-URL: Source, https://github.com/karpierz/libusb
14
14
  Project-URL: Issues, https://github.com/karpierz/libusb/issues
15
15
  Keywords: usb,libusb
16
16
  Platform: any
17
- Classifier: Development Status :: 4 - Beta
17
+ Classifier: Development Status :: 5 - Production/Stable
18
18
  Classifier: Intended Audience :: Developers
19
19
  Classifier: License :: OSI Approved :: zlib/libpng License
20
20
  Classifier: Operating System :: OS Independent
21
21
  Classifier: Natural Language :: Polish
22
22
  Classifier: Programming Language :: Python
23
23
  Classifier: Programming Language :: Python :: 3
24
- Classifier: Programming Language :: Python :: 3.7
25
24
  Classifier: Programming Language :: Python :: 3.8
26
25
  Classifier: Programming Language :: Python :: 3.9
26
+ Classifier: Programming Language :: Python :: 3.10
27
+ Classifier: Programming Language :: Python :: 3.11
28
+ Classifier: Programming Language :: Python :: 3.12
27
29
  Classifier: Programming Language :: Python :: 3 :: Only
28
30
  Classifier: Programming Language :: Python :: Implementation :: CPython
29
- Classifier: Programming Language :: Python :: Implementation :: Stackless
31
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
30
32
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
31
- Requires-Python: <4.0.0,>=3.7.0
33
+ Requires-Python: <4.0.0,>=3.8.1
32
34
  Description-Content-Type: text/x-rst; charset=UTF-8
35
+ License-File: LICENSE
36
+ Requires-Dist: setuptools>=68.2.2
37
+ Requires-Dist: pkg-about>=1.1.5
33
38
  Provides-Extra: doc
39
+ Requires-Dist: Sphinx>=7.1.2; extra == "doc"
40
+ Requires-Dist: sphinx-toolbox>=3.5.0; extra == "doc"
41
+ Requires-Dist: sphinx-tabs>=3.4.1; extra == "doc"
42
+ Requires-Dist: sphinx-copybutton>=0.5.1; extra == "doc"
43
+ Requires-Dist: sphinxcontrib-spelling>=7.7.0; extra == "doc"
44
+ Requires-Dist: sphinx-lint>=0.6.7; extra == "doc"
45
+ Requires-Dist: restructuredtext-lint>=1.4.0; extra == "doc"
46
+ Requires-Dist: nbsphinx>=0.8.10; extra == "doc"
34
47
  Provides-Extra: test
35
- License-File: LICENSE
48
+ Requires-Dist: deepdiff>=6.7.1; extra == "test"
49
+ Requires-Dist: rich>=13.7.0; extra == "test"
36
50
 
37
51
  libusb
38
52
  ======
@@ -111,10 +125,10 @@ Installation
111
125
 
112
126
  Prerequisites:
113
127
 
114
- + Python 3.7 or higher
128
+ + Python 3.8 or higher
115
129
 
116
130
  * https://www.python.org/
117
- * 3.7 with C libusb 1.0.22 is a primary test environment.
131
+ * with C libusb 1.0.26 is a primary test environment.
118
132
 
119
133
  + pip and setuptools
120
134
 
@@ -136,7 +150,7 @@ Prerequisites:
136
150
 
137
151
  python -m pip install --upgrade tox
138
152
 
139
- Visit `development page`_.
153
+ Visit `Development page`_.
140
154
 
141
155
  Installation from sources:
142
156
 
@@ -161,9 +175,9 @@ or on development mode:
161
175
  License
162
176
  =======
163
177
 
164
- | Copyright (c) 2016-2022 Adam Karpierz
178
+ | Copyright (c) 2016-2024 Adam Karpierz
165
179
  | Licensed under the zlib/libpng License
166
- | https://opensource.org/licenses/Zlib
180
+ | https://opensource.org/license/zlib
167
181
  | Please refer to the accompanying LICENSE file.
168
182
 
169
183
  Authors
@@ -174,16 +188,65 @@ Authors
174
188
  .. |package| replace:: libusb
175
189
  .. |package_bold| replace:: **libusb**
176
190
  .. |respository| replace:: https://github.com/karpierz/libusb.git
177
- .. _development page: https://github.com/karpierz/libusb
191
+ .. _Development page: https://github.com/karpierz/libusb
178
192
  .. _PyPI record: https://pypi.org/project/libusb/
179
193
  .. _Documentation: https://libusb.readthedocs.io/
194
+ .. _USB Vendors: https://devicehunt.com/all-usb-vendors
180
195
 
181
196
  Changelog
182
197
  =========
183
198
 
199
+ 1.0.26 (2024-02-05)
200
+ -------------------
201
+ - API partially updated from 1.0.27 but still supports only 1.0.26.
202
+ - Improvements and some little bugfixes.
203
+ - Examples and tests are upgraded from 1.0.27.
204
+
205
+ 1.0.26rc4 (2024-01-25)
206
+ ----------------------
207
+ - Setup update (now based on tox >= 4.0).
208
+ - Cleanup.
209
+
210
+ 1.0.26rc2 (2023-12-20)
211
+ ----------------------
212
+ - Add linux aarch64 support.
213
+
214
+ 1.0.26rc1 (2023-12-15)
215
+ ----------------------
216
+ - Add support for Python 3.12
217
+ - Drop support for Python 3.7
218
+ - Add support for PyPy 3.10
219
+ - Drop support for PyPy 3.7 and 3.8
220
+ - Copyright year update.
221
+
222
+ 1.0.26b5 (2022-09-10)
223
+ ---------------------
224
+ - Tox configuration has been moved to pyproject.toml
225
+
226
+ 1.0.26b4 (2022-08-25)
227
+ ---------------------
228
+ - | Downgrade of included shared libraries for Linux:
229
+ | libusb v.1.0.26 -> v.1.0.24 (for now based on Debian's 11 (bullseye)),
230
+ | because of loading issues of v.1.0.26 from Debian's 12 (bookworm)
231
+ | shared libraries.
232
+ - Setup update.
233
+
234
+ 1.0.26b3 (2022-07-25)
235
+ ---------------------
236
+ - Setup update (currently based mainly on pyproject.toml).
237
+ - Update for macOS (dlls are included for v.10.7+ and v.11.6+ 64bit).
238
+
239
+ 1.0.26b2 (2022-07-18)
240
+ ---------------------
241
+ - Upgrade for Windows: libusb v.1.0.24 -> v.1.0.26
242
+ - Update for macOS (v.11.6 64bit).
243
+ - Add support for Python 3.10 and 3.11
244
+ - Add support for PyPy 3.7, 3.8 and 3.9
245
+ - Setup update.
246
+
184
247
  1.0.24b3 (2022-01-10)
185
248
  ---------------------
186
- - Drop support for Python 3.6.
249
+ - Drop support for Python 3.6
187
250
  - Copyright year update.
188
251
  - Setup update.
189
252
 
@@ -210,8 +273,8 @@ Changelog
210
273
  - | Upgrade for Windows: libusb v.1.0.22 -> v.1.0.23
211
274
  | (partially; without libusb_wrap_sys_device, because
212
275
  | original Windows v.1.0.23 dlls do not export this function).
213
- - Add support for Python 3.9.
214
- - Drop support for Python 3.5.
276
+ - Add support for Python 3.9
277
+ - Drop support for Python 3.5
215
278
  - Setup update.
216
279
  - Cleanup.
217
280
 
@@ -232,9 +295,9 @@ Changelog
232
295
 
233
296
  1.0.22b5 (2019-11-14)
234
297
  ---------------------
235
- - Drop support for Python 2.
236
- - Drop support for Python 3.4.
237
- - Add support for Python 3.8.
298
+ - Drop support for Python 2
299
+ - Drop support for Python 3.4
300
+ - Add support for Python 3.8
238
301
  - Setup update and cleanup.
239
302
 
240
303
  1.0.22b4 (2019-02-15)
@@ -280,5 +343,3 @@ Changelog
280
343
  0.0.1 (2016-09-23)
281
344
  ------------------
282
345
  - Initial release.
283
-
284
-
@@ -75,10 +75,10 @@ Installation
75
75
 
76
76
  Prerequisites:
77
77
 
78
- + Python 3.7 or higher
78
+ + Python 3.8 or higher
79
79
 
80
80
  * https://www.python.org/
81
- * 3.7 with C libusb 1.0.22 is a primary test environment.
81
+ * with C libusb 1.0.26 is a primary test environment.
82
82
 
83
83
  + pip and setuptools
84
84
 
@@ -100,7 +100,7 @@ Prerequisites:
100
100
 
101
101
  python -m pip install --upgrade tox
102
102
 
103
- Visit `development page`_.
103
+ Visit `Development page`_.
104
104
 
105
105
  Installation from sources:
106
106
 
@@ -125,9 +125,9 @@ or on development mode:
125
125
  License
126
126
  =======
127
127
 
128
- | Copyright (c) 2016-2022 Adam Karpierz
128
+ | Copyright (c) 2016-2024 Adam Karpierz
129
129
  | Licensed under the zlib/libpng License
130
- | https://opensource.org/licenses/Zlib
130
+ | https://opensource.org/license/zlib
131
131
  | Please refer to the accompanying LICENSE file.
132
132
 
133
133
  Authors
@@ -138,6 +138,7 @@ Authors
138
138
  .. |package| replace:: libusb
139
139
  .. |package_bold| replace:: **libusb**
140
140
  .. |respository| replace:: https://github.com/karpierz/libusb.git
141
- .. _development page: https://github.com/karpierz/libusb
141
+ .. _Development page: https://github.com/karpierz/libusb
142
142
  .. _PyPI record: https://pypi.org/project/libusb/
143
143
  .. _Documentation: https://libusb.readthedocs.io/
144
+ .. _USB Vendors: https://devicehunt.com/all-usb-vendors
@@ -4,29 +4,7 @@
4
4
  # list see the documentation:
5
5
  # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
6
 
7
- import re
8
- from pathlib import Path
9
- from setuptools.config import read_configuration
10
- from packaging import version
11
-
12
- top_dir = Path(__file__).resolve().parents[1]
13
- metadata = read_configuration(top_dir/"setup.cfg",
14
- ignore_option_errors=True)["metadata"]
15
- copyr_patt = r"^\s*__copyright__\s*=\s*"
16
- class about:
17
- __title__ = metadata["name"]
18
- __summary__ = metadata.get("description")
19
- __uri__ = metadata.get("url")
20
- __version__ = str(version.parse(metadata["version"]))
21
- __author__ = metadata.get("author")
22
- __maintainer__ = metadata.get("maintainer")
23
- __email__ = metadata.get("author_email")
24
- __license__ = metadata.get("license")
25
- __copyright__ = eval(next((re.split(copyr_patt, line)[1] for line in
26
- next(top_dir.glob("src/**/__about__.py"))
27
- .open("rt", encoding="utf-8")
28
- if re.split(copyr_patt, line)[1:]), "None"))
29
- del read_configuration, version, metadata, copyr_patt
7
+ __import__("pkg_about").about_from_setup()
30
8
 
31
9
  def setup(app):
32
10
  pass
@@ -70,8 +48,11 @@ extensions = [
70
48
  #'sphinx.ext.coverage',
71
49
  'sphinx.ext.ifconfig',
72
50
  'sphinx.ext.napoleon',
51
+ #'sphinx_toolbox',
73
52
  'sphinx_tabs.tabs',
53
+ 'sphinx_copybutton',
74
54
  'sphinxcontrib.spelling',
55
+ 'nbsphinx',
75
56
  ]
76
57
 
77
58
  # Needed for e.g. linkcheck builder
@@ -1,6 +1,6 @@
1
- # Copyright (c) 2016-2022 Adam Karpierz
1
+ # Copyright (c) 2016 Adam Karpierz
2
2
  # Licensed under the zlib/libpng License
3
- # https://opensource.org/licenses/Zlib
3
+ # https://opensource.org/license/zlib
4
4
 
5
5
  # libusb example program to manipulate U.are.U 4000B fingerprint scanner.
6
6
  # Copyright © 2007 Daniel Drake <dsd@gentoo.org>
@@ -34,18 +34,20 @@ import libusb as usb
34
34
  from libusb._platform import defined, is_posix, is_windows
35
35
  if is_windows: import win32
36
36
 
37
+ usb_strerror = lambda r: usb.strerror(r).decode("utf-8")
38
+
37
39
  if defined("DPFP_THREADED"):
38
40
 
39
41
  if is_posix:
40
42
 
41
- THREAD_RETURN_VALUE = NULL
42
43
  semaphore_t = ct.POINTER(sem_t)
43
44
  thread_t = pthread_t
44
45
  thread_return_t = ct.c_void_p
46
+ THREAD_RETURN_VALUE = NULL
45
47
 
46
48
  def semaphore_create() -> semaphore_t:
47
- name = "/org.libusb.example.dpfp_threaded:%d" % int(getpid())
48
- semaphore: semaphore_t = sem_open(name, O_CREAT | O_EXCL, 0, 0)
49
+ name = "/org.libusb.example.dpfp_threaded:{:d}".format(int(getpid()))
50
+ semaphore: semaphore_t = sem_open(name, O_CREAT | O_EXCL, 0, 0)
49
51
  if semaphore == SEM_FAILED:
50
52
  return NULL;
51
53
  # Remove semaphore so that it does not persist after process exits
@@ -61,7 +63,7 @@ if defined("DPFP_THREADED"):
61
63
  def semaphore_destroy(semaphore: semaphore_t):
62
64
  sem_close(semaphore)
63
65
 
64
- # void *(*thread_entry)(arg: ct.c_void_p)
66
+ # thread_return_t (*thread_entry)(arg: ct.c_void_p)
65
67
  def thread_create(thread: ct.POINTER(thread_t),
66
68
  thread_entry,
67
69
  arg: ct.c_void_p) -> int:
@@ -73,7 +75,6 @@ if defined("DPFP_THREADED"):
73
75
 
74
76
  elif is_windows:
75
77
 
76
- THREAD_RETURN_VALUE = 0
77
78
  semaphore_t = win32.HANDLE
78
79
  thread_t = win32.HANDLE
79
80
  if defined("__CYGWIN__"):
@@ -81,6 +82,7 @@ if defined("DPFP_THREADED"):
81
82
  else:
82
83
  #thread_return_t = ct.c_uint
83
84
  thread_return_t = win32.DWORD
85
+ THREAD_RETURN_VALUE = 0
84
86
 
85
87
  def semaphore_create() -> semaphore_t:
86
88
  return win32.CreateSemaphore(None, 0, 1, None)
@@ -190,7 +192,10 @@ def find_dpfp_device() -> int:
190
192
  global devh
191
193
  global VID, PID
192
194
  devh = usb.open_device_with_vid_pid(None, VID, PID)
193
- return 0 if devh else -errno.ENODEV
195
+ if not devh:
196
+ ct.set_errno(errno.ENODEV)
197
+ return -1
198
+ return 0
194
199
 
195
200
 
196
201
  def print_f0_data() ->int:
@@ -287,12 +292,14 @@ def set_mode_async(data) -> int:
287
292
  try:
288
293
  buf = (ct.c_ubyte * (usb.LIBUSB_CONTROL_SETUP_SIZE + 1))()
289
294
  except:
290
- return -errno.ENOMEM
295
+ ct.set_errno(errno.ENOMEM)
296
+ return -1
291
297
 
292
298
  transfer = usb.alloc_transfer(0)
293
299
  if not transfer:
294
300
  del buf
295
- return -errno.ENOMEM
301
+ ct.set_errno(errno.ENOMEM)
302
+ return -1
296
303
 
297
304
  print("async set mode {:02x}".format(data))
298
305
  usb.fill_control_setup(buf, CTRL_OUT, USB_RQ, 0x4e, 0, 1)
@@ -519,11 +526,13 @@ def alloc_transfers() -> int:
519
526
 
520
527
  img_transfer = usb.alloc_transfer(0)
521
528
  if not img_transfer:
522
- return -errno.ENOMEM
529
+ ct.set_errno(errno.ENOMEM)
530
+ return -1
523
531
 
524
532
  irq_transfer = usb.alloc_transfer(0)
525
533
  if not irq_transfer:
526
- return -errno.ENOMEM
534
+ ct.set_errno(errno.ENOMEM)
535
+ return -1
527
536
 
528
537
  usb.fill_bulk_transfer(img_transfer, devh, EP_DATA,
529
538
  imgbuf, ct.sizeof(imgbuf),
@@ -536,7 +545,6 @@ def alloc_transfers() -> int:
536
545
 
537
546
  #static
538
547
  def sighandler(signum, frame):
539
-
540
548
  request_exit(1)
541
549
 
542
550
 
@@ -564,9 +572,12 @@ def main(argv=sys.argv[1:]):
564
572
  global irq_transfer
565
573
  global do_exit
566
574
 
567
- r = usb.init(None)
575
+ r = (usb.init_context(None, None, 0)
576
+ if hasattr(usb, "init_context") else
577
+ usb.init(None))
568
578
  if r < 0:
569
- print("failed to initialise libusb {} - {}".format(r, usb.strerror(r)), file=sys.stderr)
579
+ print("failed to initialise libusb {} - {}".format(r, usb_strerror(r)),
580
+ file=sys.stderr)
570
581
  sys.exit(1)
571
582
 
572
583
  r = find_dpfp_device()
@@ -577,7 +588,8 @@ def main(argv=sys.argv[1:]):
577
588
 
578
589
  r = usb.claim_interface(devh, 0)
579
590
  if r < 0:
580
- print("claim interface error {} - {}".format(r, usb.strerror(r)), file=sys.stderr)
591
+ print("claim interface error {} - {}".format(r, usb_strerror(r)),
592
+ file=sys.stderr)
581
593
  return abs(r)
582
594
  print("claimed interface")
583
595
 
@@ -635,12 +647,14 @@ def main(argv=sys.argv[1:]):
635
647
  if img_transfer:
636
648
  r = usb.cancel_transfer(img_transfer)
637
649
  if r < 0:
638
- print("failed to cancel transfer {} - {}".format(r, usb.strerror(r)), file=sys.stderr)
650
+ print("failed to cancel transfer {} - {}".format(r, usb_strerror(r)),
651
+ file=sys.stderr)
639
652
 
640
653
  if irq_transfer:
641
654
  r = usb.cancel_transfer(irq_transfer)
642
655
  if r < 0:
643
- print("failed to cancel transfer {} - {}".format(r, usb.strerror(r)), file=sys.stderr)
656
+ print("failed to cancel transfer {} - {}".format(r, usb_strerror(r)),
657
+ file=sys.stderr)
644
658
 
645
659
  while img_transfer or irq_transfer:
646
660
  if usb.handle_events(None) < 0:
@@ -1,6 +1,6 @@
1
- # Copyright (c) 2016-2022 Adam Karpierz
1
+ # Copyright (c) 2016 Adam Karpierz
2
2
  # Licensed under the zlib/libpng License
3
- # https://opensource.org/licenses/Zlib
3
+ # https://opensource.org/license/zlib
4
4
 
5
5
  # libusb example program to manipulate U.are.U 4000B fingerprint scanner.
6
6
  # Copyright © 2007 Daniel Drake <dsd@gentoo.org>
@@ -1,6 +1,6 @@
1
- # Copyright (c) 2016-2022 Adam Karpierz
1
+ # Copyright (c) 2016 Adam Karpierz
2
2
  # Licensed under the zlib/libpng License
3
- # https://opensource.org/licenses/Zlib
3
+ # https://opensource.org/license/zlib
4
4
 
5
5
  # Copyright © 2001 Stephen Williams (steve@icarus.com)
6
6
  # Copyright © 2001-2002 David Brownell (dbrownell@users.sourceforge.net)
@@ -29,6 +29,8 @@ import ctypes as ct
29
29
 
30
30
  import libusb as usb
31
31
 
32
+ usb_error_name = lambda status: usb.error_name(status).decode("utf-8")
33
+
32
34
  FX_TYPE_UNDEFINED = -1
33
35
  FX_TYPE_AN21 = 0 # Original AnchorChips parts
34
36
  FX_TYPE_FX1 = 1 # Updated Cypress versions
@@ -170,7 +172,7 @@ def ezusb_write(device, label, opcode, addr, data, size) -> int:
170
172
  global verbose
171
173
 
172
174
  if verbose > 1:
173
- logerror("{}, addr {:#010x} len %4u ({:#06x})\n",
175
+ logerror("{}, addr {:#010x} len {:4d} ({:#06x})\n",
174
176
  label, addr, size, size)
175
177
  status = usb.control_transfer(device,
176
178
  usb.LIBUSB_ENDPOINT_OUT |
@@ -183,11 +185,14 @@ def ezusb_write(device, label, opcode, addr, data, size) -> int:
183
185
  1000)
184
186
  if status != ct.c_int(size).value:
185
187
  if status < 0:
186
- logerror("{}: {}\n", label, usb.error_name(status))
188
+ logerror("{}: {}\n", label, usb_error_name(status))
187
189
  else:
188
190
  logerror("{} ==> {}\n", label, status)
189
191
 
190
- return 0 if status >= 0 else -errno.EIO
192
+ if status < 0:
193
+ ct.set_errno(errno.EIO)
194
+ return -1
195
+ return 0
191
196
 
192
197
 
193
198
  # Issues the specified vendor-specific read request.
@@ -202,7 +207,7 @@ def ezusb_read(device, label, opcode, addr, data, size) -> int:
202
207
  global verbose
203
208
 
204
209
  if verbose > 1:
205
- logerror("{}, addr {:#010x} len %4u ({:#06x})\n",
210
+ logerror("{}, addr {:#010x} len {:4d} ({:#06x})\n",
206
211
  label, addr, size, size)
207
212
  status = usb.control_transfer(device,
208
213
  usb.LIBUSB_ENDPOINT_IN |
@@ -215,11 +220,14 @@ def ezusb_read(device, label, opcode, addr, data, size) -> int:
215
220
  1000)
216
221
  if status != ct.c_int(size).value:
217
222
  if status < 0:
218
- logerror("{}: {}\n", label, usb.error_name(status))
223
+ logerror("{}: {}\n", label, usb_error_name(status))
219
224
  else:
220
225
  logerror("{} ==> {}\n", label, status)
221
226
 
222
- return 0 if status >= 0 else -errno.EIO
227
+ if status < 0:
228
+ ct.set_errno(errno.EIO)
229
+ return -1
230
+ return 0
223
231
 
224
232
 
225
233
  # Modifies the CPUCS register to stop or reset the CPU.
@@ -249,7 +257,7 @@ def ezusb_cpucs(device, addr, do_run: bool) -> bool:
249
257
  (not do_run or status != usb.LIBUSB_ERROR_IO)):
250
258
  mesg = "can't modify CPUCS"
251
259
  if status < 0:
252
- logerror("{}: {}\n", mesg, usb.error_name(status))
260
+ logerror("{}: {}\n", mesg, usb_error_name(status))
253
261
  else:
254
262
  logerror("{}\n", mesg)
255
263
  return False
@@ -257,7 +265,7 @@ def ezusb_cpucs(device, addr, do_run: bool) -> bool:
257
265
  return True
258
266
 
259
267
 
260
- # Send an FX3 jumpt to address command
268
+ # Send an FX3 jump to address command
261
269
  # Returns False on error.
262
270
 
263
271
  #static
@@ -281,7 +289,7 @@ def ezusb_fx3_jump(device, addr) -> bool:
281
289
  if status != 0 and status != usb.LIBUSB_ERROR_IO:
282
290
  mesg = "failed to send jump command"
283
291
  if status < 0:
284
- logerror("{}: {}\n", mesg, usb.error_name(status))
292
+ logerror("{}: {}\n", mesg, usb_error_name(status))
285
293
  else:
286
294
  logerror("{}\n", mesg)
287
295
  return False
@@ -390,7 +398,7 @@ def parse_ihex(image, context, is_external, poke) -> int:
390
398
  break;
391
399
 
392
400
  if rec_type != 0:
393
- logerror("unsupported record type: %u\n", rec_type)
401
+ logerror("unsupported record type: {:d}\n", rec_type)
394
402
  return -3
395
403
 
396
404
  if size * 2 + 11 > strlen(buf):
@@ -592,7 +600,8 @@ def ram_poke(context, addr, external, data, size) -> int:
592
600
  if ctx_mode == internal_only: # CPU should be stopped
593
601
  if external:
594
602
  logerror("can't write {} bytes external memory at {:#010x}\n", size, addr)
595
- return -errno.EINVAL
603
+ ct.set_errno(errno.EINVAL)
604
+ return -1
596
605
  elif ctx_mode == skip_internal: # CPU must be running
597
606
  if not external:
598
607
  if verbose >= 2:
@@ -605,10 +614,12 @@ def ram_poke(context, addr, external, data, size) -> int:
605
614
  return 0
606
615
  elif ctx_mode == _undef:
607
616
  logerror("bug\n")
608
- return -errno.EDOM
617
+ ct.set_errno(errno.EDOM)
618
+ return -1
609
619
  else:
610
620
  logerror("bug\n")
611
- return -errno.EDOM
621
+ ct.set_errno(errno.EDOM)
622
+ return -1
612
623
 
613
624
  ctx.total += size
614
625
  ctx.count += 1