led-controller-version-3 3.0.2__py3-none-any.whl
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.
- led_controller_version_3-3.0.2.dist-info/METADATA +172 -0
- led_controller_version_3-3.0.2.dist-info/RECORD +52 -0
- led_controller_version_3-3.0.2.dist-info/WHEEL +4 -0
- led_controller_version_3-3.0.2.dist-info/entry_points.txt +13 -0
- lefx/device/respeaker/__init__.py +35 -0
- lefx/device/respeaker/cli.py +146 -0
- lefx/device/respeaker/contention.py +523 -0
- lefx/device/respeaker/provider.py +158 -0
- lefx/device/respeaker/registration.py +130 -0
- lefx/device/respeaker/sink.py +108 -0
- lefx/device/respeaker/transport.py +344 -0
- lefx/device/respeaker/xvf.py +313 -0
- lefx/engine/__init__.py +110 -0
- lefx/engine/composer.py +203 -0
- lefx/engine/config.py +27 -0
- lefx/engine/errors.py +84 -0
- lefx/engine/inputs.py +196 -0
- lefx/engine/invocation.py +129 -0
- lefx/engine/layers.py +114 -0
- lefx/engine/library.py +181 -0
- lefx/engine/packages/__init__.py +45 -0
- lefx/engine/packages/loader.py +375 -0
- lefx/engine/packages/manifest.py +308 -0
- lefx/engine/registry.py +347 -0
- lefx/engine/renderer.py +63 -0
- lefx/engine/runtime.py +393 -0
- lefx/engine/store.py +125 -0
- lefx/interfaces/__init__.py +40 -0
- lefx/interfaces/api.py +301 -0
- lefx/interfaces/cli.py +380 -0
- lefx/interfaces/client.py +165 -0
- lefx/interfaces/config.py +305 -0
- lefx/interfaces/discovery.py +308 -0
- lefx/interfaces/hosting.py +123 -0
- lefx/interfaces/paths.py +79 -0
- lefx/interfaces/presentation.py +118 -0
- lefx/interfaces/service.py +468 -0
- lefx/sdk/__init__.py +176 -0
- lefx/sdk/calibration.py +202 -0
- lefx/sdk/color.py +108 -0
- lefx/sdk/context.py +72 -0
- lefx/sdk/definitions.py +526 -0
- lefx/sdk/effects.py +63 -0
- lefx/sdk/errors.py +90 -0
- lefx/sdk/parameters.py +469 -0
- lefx/sdk/ports.py +76 -0
- lefx/sdk/validation.py +150 -0
- lefx/sdk/values.py +212 -0
- lefx/sets/core_set/__init__.py +32 -0
- lefx/sets/core_set/core-set.lefxset +0 -0
- lefx/sets/smartspeaker_set/__init__.py +32 -0
- lefx/sets/smartspeaker_set/smartspeaker-set.lefxset +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: led-controller-version-3
|
|
3
|
+
Version: 3.0.2
|
|
4
|
+
Summary: LED ring control for the reSpeaker XVF3800 — the LEFX V3 effect system
|
|
5
|
+
Project-URL: Homepage, https://github.com/marcosudau-vps/led_controller_respeaker-v3
|
|
6
|
+
Project-URL: Source, https://github.com/marcosudau-vps/led_controller_respeaker-v3
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Keywords: doa,effects,led,lefx,respeaker,usb,xvf3800
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: System :: Hardware :: Hardware Drivers
|
|
15
|
+
Requires-Python: <3.13,>=3.12
|
|
16
|
+
Requires-Dist: fastapi<0.136,>=0.135.3
|
|
17
|
+
Requires-Dist: libusb-package<1.1,>=1.0.26.3
|
|
18
|
+
Requires-Dist: pydantic<2.13,>=2.12.5
|
|
19
|
+
Requires-Dist: pyusb<2,>=1.3.1
|
|
20
|
+
Requires-Dist: pyyaml<7,>=6.0.2
|
|
21
|
+
Requires-Dist: tzdata>=2025.2; platform_system == 'Windows'
|
|
22
|
+
Requires-Dist: uvicorn<0.45,>=0.44.0
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Requires-Dist: led-controller-version-3-device-simulated-respeaker[gui]==3.0.2; extra == 'all'
|
|
25
|
+
Requires-Dist: led-controller-version-3-effect-creation==3.0.2; extra == 'all'
|
|
26
|
+
Provides-Extra: effect-creation
|
|
27
|
+
Requires-Dist: led-controller-version-3-effect-creation==3.0.2; extra == 'effect-creation'
|
|
28
|
+
Provides-Extra: simulated-respeaker
|
|
29
|
+
Requires-Dist: led-controller-version-3-device-simulated-respeaker[gui]==3.0.2; extra == 'simulated-respeaker'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# led-controller-version-3
|
|
33
|
+
|
|
34
|
+
LED-Ring-Steuerung für den reSpeaker XVF3800 — das LEFX-V3-System.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install led-controller-version-3
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Das ist die Normalversion und für sich vollständig: Schema, Laufzeit,
|
|
41
|
+
Steuerungsoberfläche, die Hardware-Anbindung und beide Effektkataloge. Sie
|
|
42
|
+
spielt fertige `.lefx`- und `.lefxset`-Dateien auf einem reSpeaker ab und
|
|
43
|
+
braucht keines der optionalen Pakete.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
lefx serve --sink respeaker
|
|
47
|
+
lefx list states
|
|
48
|
+
lefx set state listening
|
|
49
|
+
lefx emit event notification
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Optionen
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install "led-controller-version-3[simulated-respeaker]" # Software-Geräteersatz mit Ringfenster
|
|
56
|
+
pip install "led-controller-version-3[effect-creation]" # Effekte erstellen: lefx-pack und lefx-studio
|
|
57
|
+
pip install "led-controller-version-3[all]" # beides
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Beide sind eigene Distributionen, keine Schalter. Was nicht installiert ist,
|
|
61
|
+
existiert im laufenden System nicht — Geräte werden über Entry Points gefunden,
|
|
62
|
+
nicht importiert.
|
|
63
|
+
|
|
64
|
+
Ohne Hardware:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install "led-controller-version-3[simulated-respeaker]"
|
|
68
|
+
lefx-simulator
|
|
69
|
+
lefx serve --sink simulator
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Was drin ist
|
|
73
|
+
|
|
74
|
+
| Modul | Rolle |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `lefx.sdk` | Der Vertrag zwischen Effektpaketen und der Engine |
|
|
77
|
+
| `lefx.engine` | Layer, Komposition, Lebenszyklen, Registry, Paketformat `lefx/3` |
|
|
78
|
+
| `lefx.interfaces` | HTTP-API v3, CLI, Client, Prozess-Hosting, Konfiguration |
|
|
79
|
+
| `lefx.device.respeaker` | USB-Transport, LED-Senke, DoA-Provider |
|
|
80
|
+
| `lefx.sets.core_set` | Referenzkatalog, gebaut als `.lefxset` |
|
|
81
|
+
| `lefx.sets.smartspeaker_set` | Sprachassistenz-Katalog |
|
|
82
|
+
|
|
83
|
+
**`lefx.sdk`** ist das Einzige, was ein Effektautor importiert: die
|
|
84
|
+
typ-spezifischen Definitionsklassen, die Parametertypen und ihre
|
|
85
|
+
Zulässigkeitsregeln, die kanonische Wertnormalisierung, die Farbmathematik, die
|
|
86
|
+
Kontexte und die Ports `FrameSink` und `InputProvider`. Es hängt an nichts. Eine
|
|
87
|
+
ungültige Definition ist nicht konstruierbar — geprüft wird im Konstruktor,
|
|
88
|
+
nicht in einem eigenen Validierungsschritt.
|
|
89
|
+
|
|
90
|
+
**`lefx.engine`** kennt Typen, Lebenszyklen und Layer, aber niemals eine
|
|
91
|
+
konkrete Definition-ID: Layerstapel und Komposition, die vier Lebenszyklusformen,
|
|
92
|
+
die Event-Warteschlange mit Priorität und FIFO, Runtime-Eingaben mit
|
|
93
|
+
Input-Health, die Registry und das Laden von `lefx/3`- und `lefxset/3`-Paketen.
|
|
94
|
+
|
|
95
|
+
**`lefx.interfaces`** trägt CLI und HTTP-API mit denselben Kommandos; keine der
|
|
96
|
+
beiden hat eigene Fachlogik. Dazu der Client, das Prozess-Hosting und die
|
|
97
|
+
Konfiguration.
|
|
98
|
+
|
|
99
|
+
## Effektsätze
|
|
100
|
+
|
|
101
|
+
Beide Kataloge sind enthalten. Welche geladen werden, entscheidet
|
|
102
|
+
`included_lefxset`:
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
included_lefxset: [core, smartspeaker]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
INCLUDED_LEFXSET=[core] lefx serve --sink respeaker
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Leer heißt: alle. Namen dürfen mit oder ohne `-set`-Suffix geschrieben werden.
|
|
113
|
+
|
|
114
|
+
## Konfiguration
|
|
115
|
+
|
|
116
|
+
Alles Projektweite steht in einer `config.yaml` im Arbeitsverzeichnis, unter
|
|
117
|
+
`~/.lefx/config.yaml`, oder wohin `LEFX_CONFIG` zeigt. Jeder Schlüssel lässt
|
|
118
|
+
sich als Umgebungsvariable in Großbuchstaben überschreiben — mit `LEFX_`-Präfix
|
|
119
|
+
oder ohne; ein Kommandozeilenschalter schlägt beides.
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
led_count: 12
|
|
123
|
+
sink: respeaker
|
|
124
|
+
port: 8765
|
|
125
|
+
included_lefxset: [core, smartspeaker]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`lefx config` zeigt, welcher Wert gerade gilt und woher er kommt.
|
|
129
|
+
|
|
130
|
+
## Wenn das Gerät belegt ist
|
|
131
|
+
|
|
132
|
+
Ein WinUSB-Handle ist exklusiv. Ein zweiter Prozess reiht sich nicht ein, er
|
|
133
|
+
bekommt `Errno 13` — das liest sich wie ein Treiber- oder Rechteproblem und
|
|
134
|
+
schickt einen in die falsche Richtung. Meistens läuft schlicht noch ein anderer
|
|
135
|
+
Controller.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
lefx-respeaker probe
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`probe` sagt, ob das Gerät ansprechbar ist, und listet andernfalls die Prozesse,
|
|
142
|
+
die ein USB-Gerät halten — mit Kommandozeile, denn erfahrungsgemäß heißen alle
|
|
143
|
+
Kandidaten `python.exe`.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
lefx-respeaker claim --dry-run
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`claim` beendet, was im Weg steht, und prüft danach nach. Zwei Dinge begrenzen
|
|
150
|
+
den Schaden:
|
|
151
|
+
|
|
152
|
+
- **Es wird einzeln beendet und nach jedem Schritt neu geprüft.** Sobald das
|
|
153
|
+
Gerät antwortet, hört es auf. Der Prozess, der wirklich im Weg war, ist damit
|
|
154
|
+
der letzte, den es trifft.
|
|
155
|
+
- **Fremde USB-Software wird nicht angefasst.** Maus-, Tastatur- und
|
|
156
|
+
RGB-Software hält dauerhaft offene WinUSB-Handles und taucht in derselben
|
|
157
|
+
Suche auf. Sie wird aufgelistet und in Ruhe gelassen; nur Prozesse, die sich
|
|
158
|
+
als reSpeaker-Software zu erkennen geben, kommen in Frage.
|
|
159
|
+
`--include-unrelated` hebt das auf — bewusst und einzeln.
|
|
160
|
+
|
|
161
|
+
Im Dienst ist dasselbe als Senken-Option verfügbar:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
lefx serve --sink respeaker --sink-option force_claim=true
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Eine Senken-Option und kein `lefx`-Schalter, weil `lefx` nichts über reSpeaker
|
|
168
|
+
wissen soll. Der Transport ruft es höchstens **einmal pro Verbindungszyklus**
|
|
169
|
+
auf, nur bei einem Zugriffsfehler: der Wiederholungsversuch läuft alle paar
|
|
170
|
+
Sekunden, und etwas, das in diesem Takt Prozesse beendet, wäre eine Plage. Ein
|
|
171
|
+
fehlendes Gerät gilt nicht als Konkurrenz — ein gezogenes Kabel ist kein fremder
|
|
172
|
+
Prozess.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
lefx/device/respeaker/__init__.py,sha256=QrHx17ZekDdBhnafP04DBwMmyYY1OpHanYvtJ5JWFeA,1052
|
|
2
|
+
lefx/device/respeaker/cli.py,sha256=9BeXDIgVk8Rk2uh6ugnBvSCdJ8GVBpiisACwv68JdlM,5022
|
|
3
|
+
lefx/device/respeaker/contention.py,sha256=1cd0k4TF1UkTJddtnHclW8KvqGfzLUP8vtzy8nvTjgc,19476
|
|
4
|
+
lefx/device/respeaker/provider.py,sha256=m4mJSa9umraAai0s05JtDjTX4N9CBm0qC3aqTQFaVqw,5979
|
|
5
|
+
lefx/device/respeaker/registration.py,sha256=xYaudjPPJT9MewRQ6wPB_ATGX1GOz7lpPSKfFMERVcI,4119
|
|
6
|
+
lefx/device/respeaker/sink.py,sha256=a-CVfUhfWbmf_GRTTZcQsWAWLjsf7i1-FkniUXFEHOM,4374
|
|
7
|
+
lefx/device/respeaker/transport.py,sha256=lQMJNlLNIzfe6HFk80yqNbK0GRtgYL33NSFBaPdVbkg,12950
|
|
8
|
+
lefx/device/respeaker/xvf.py,sha256=PiFv9Rjrs9lYdzi4bCbWdrrW0DLEeEmGJZqWxkE_-AQ,25199
|
|
9
|
+
lefx/engine/__init__.py,sha256=6m1fy1JubUXwJLVCI5DA6qldMlnYAH5Cga2gEENk_2o,2767
|
|
10
|
+
lefx/engine/composer.py,sha256=Q8xQK9rSNZciZTXEpUfU2UBvjrKHRXiRcqaSDWmM-mw,7666
|
|
11
|
+
lefx/engine/config.py,sha256=KGOGuhvf4CgaWDruqsTxU8SsDRcc-SV2hXwMhphxDqY,734
|
|
12
|
+
lefx/engine/errors.py,sha256=IxKnpNG61ES-e2SSIXuwFqlG4zkCPfzqtoY1hhU9aZY,2645
|
|
13
|
+
lefx/engine/inputs.py,sha256=gvMGOrD-h6iUj9gN0TkT_TzQfCo-mOU-V-O4bFw9gKs,6627
|
|
14
|
+
lefx/engine/invocation.py,sha256=rlYLOcck8pqK8QP8GTzpsmX4Ca_VWITck14YlhzvR_o,4641
|
|
15
|
+
lefx/engine/layers.py,sha256=V0pJWrmhn4uZKg4KWclL39FK8FcENvvldDEkPm9wP5I,3619
|
|
16
|
+
lefx/engine/library.py,sha256=gxJASWZ5tV2E8LdlnwEvj8KZOBa0VaNsLBqIBPdxhBs,7054
|
|
17
|
+
lefx/engine/registry.py,sha256=bt8ZUe6R2yXgBMntM-r2A7L91dEuL5Yunk-N7019iWs,12464
|
|
18
|
+
lefx/engine/renderer.py,sha256=j9Rp5x05KmMMryZo6xQxDNOgmAd3j-ulIvKLR1471nE,1904
|
|
19
|
+
lefx/engine/runtime.py,sha256=1lPTeT807jHESXwHwiCOQWSYkxTMxIDFGjhl6RuPe0g,14685
|
|
20
|
+
lefx/engine/store.py,sha256=aWRUHiuFK6bK1YQYzCgbOCQXNL_hioeP6eXYG33UR_M,4349
|
|
21
|
+
lefx/engine/packages/__init__.py,sha256=pHB8-ABQoeiGUNj35fkrnnMncTLNj1aeXPc5ukuVqo8,1049
|
|
22
|
+
lefx/engine/packages/loader.py,sha256=QrG6XmCxz2iISuU-pBi-42emfphr3xqxW_jcBIrckmU,13373
|
|
23
|
+
lefx/engine/packages/manifest.py,sha256=cI-fUwyBYa9LqhM-H59swriz6L97sai7OGS-RTiT4rY,10446
|
|
24
|
+
lefx/interfaces/__init__.py,sha256=vPWg01_nrzTRo5fFBDavtJo9XzN9DYNllrrKW8LI7uA,997
|
|
25
|
+
lefx/interfaces/api.py,sha256=ZdON1Bmk4tFENH4SXaEuZc3u5O2TJN1HzVI7fZqmztQ,9736
|
|
26
|
+
lefx/interfaces/cli.py,sha256=UVgWCrLTy3qeJtmjj2yTsK-SF63Ui1RR_zSXblTplHo,14090
|
|
27
|
+
lefx/interfaces/client.py,sha256=PyenySWbki5N5j6erJ-KRB_i3FRnjMEW78xfRJ-8O5I,6079
|
|
28
|
+
lefx/interfaces/config.py,sha256=1-YZTCqeCuIf33UukSX72lllFxz_SngwJQH9ISl2ZxE,10459
|
|
29
|
+
lefx/interfaces/discovery.py,sha256=gjLSSyPGoGTJrmboU2StG1eO7YiBCNJSSF8Xrm4ZEsQ,11633
|
|
30
|
+
lefx/interfaces/hosting.py,sha256=V1yLg8CctyCoOU-RW8CP2LT_bxCrPMoOyIzGw3ah2G8,3461
|
|
31
|
+
lefx/interfaces/paths.py,sha256=t8mw5RcXYqVQwLfxoS2ZD9FirC4vm2wFs0J8O-hsdms,2648
|
|
32
|
+
lefx/interfaces/presentation.py,sha256=GTYAPfrkDDLY2YiQnWGIUhokikhd3LwuHbdlMHgOuXE,4253
|
|
33
|
+
lefx/interfaces/service.py,sha256=6Rl1h4lML6gQNjINRQy9RlsdQkiMcYLWIEH5Pm7fjvQ,18907
|
|
34
|
+
lefx/sdk/__init__.py,sha256=oE4cxqEJytEqMgpaT1jP2B1cNOPQUdb4DG_NU6KcED8,4356
|
|
35
|
+
lefx/sdk/calibration.py,sha256=6er8mLs1KWBH_XZ7mCnoi8nSCAqSdFr9DGdY1Ew5ZAw,7967
|
|
36
|
+
lefx/sdk/color.py,sha256=Ie0epyXpccnLnJBNDwhLiYXJiQl7cSEmK4xUssrXbfM,4169
|
|
37
|
+
lefx/sdk/context.py,sha256=ugHcwAKLY90-4E6NwGasSWryMVfoJqZLXUP2R_eJp7U,2301
|
|
38
|
+
lefx/sdk/definitions.py,sha256=pHO0Fx1_DjUHoxyKDI6_X0R7oL3eHdyapyDZuxCkGOQ,20455
|
|
39
|
+
lefx/sdk/effects.py,sha256=u7qxfSg4VxkgtfmuhC9eGDoOplLi_pNW1Lq-Bb0o97Q,2274
|
|
40
|
+
lefx/sdk/errors.py,sha256=sC5imlEIKCyzDXEzJ_ufeeIyiKiDAPqZswossdIGIcA,2731
|
|
41
|
+
lefx/sdk/parameters.py,sha256=JyiXe6Z1GWN7t6u2AXE8Ddtt-b-Fd4zyETOyso9sok4,19162
|
|
42
|
+
lefx/sdk/ports.py,sha256=fEKjFuRqTDZNycTR3NogjdJ2Hlo6KiP-voyLeqR6Gcc,2478
|
|
43
|
+
lefx/sdk/validation.py,sha256=j67g2nWsVYjylmLSkz6NmCHJcCtcCqM90Yc1vwgdoJs,5026
|
|
44
|
+
lefx/sdk/values.py,sha256=r8B1fMvMhI6Zal6sGHX0YoLIGLD23la-zJpskfB6CcY,7502
|
|
45
|
+
lefx/sets/core_set/__init__.py,sha256=_Mv22FaRrLyJ0Qh9eBLb1gREk4wNOzwfSmF5swN2vaA,1075
|
|
46
|
+
lefx/sets/core_set/core-set.lefxset,sha256=zK7B1K7dDVUehdXT73EfWD9ihHUlTyT85BFFmzjaT3Q,35532
|
|
47
|
+
lefx/sets/smartspeaker_set/__init__.py,sha256=UfBH0WnW441YGgeJ_SrtPx0_RMgjd-QWp5VzoaDRZKo,1099
|
|
48
|
+
lefx/sets/smartspeaker_set/smartspeaker-set.lefxset,sha256=Ti3vgdQfR_d1YsSLAM2Ae3kyVnNMmj3q0zrAJ0Mgbt8,58911
|
|
49
|
+
led_controller_version_3-3.0.2.dist-info/METADATA,sha256=QAxCiI8q5OA6OT-LuHKFn6DVrpsrLly4A4XQ0XeF124,6520
|
|
50
|
+
led_controller_version_3-3.0.2.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
51
|
+
led_controller_version_3-3.0.2.dist-info/entry_points.txt,sha256=bOG9jvpszt0S1DFj0C4It79TKlpC3VVRlB6OKlkazrE,400
|
|
52
|
+
led_controller_version_3-3.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[console_scripts]
|
|
2
|
+
lefx = lefx.interfaces.cli:main
|
|
3
|
+
lefx-respeaker = lefx.device.respeaker.cli:main
|
|
4
|
+
|
|
5
|
+
[lefx.effect_sets]
|
|
6
|
+
core-set = lefx.sets.core_set:package_file
|
|
7
|
+
smartspeaker-set = lefx.sets.smartspeaker_set:package_file
|
|
8
|
+
|
|
9
|
+
[lefx.frame_sinks]
|
|
10
|
+
respeaker = lefx.device.respeaker.registration:create_frame_sink
|
|
11
|
+
|
|
12
|
+
[lefx.input_providers]
|
|
13
|
+
respeaker.doa = lefx.device.respeaker.registration:create_doa_provider
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""reSpeaker XVF3800 hardware integration — USB transport, frame sink, DoA input.
|
|
2
|
+
|
|
3
|
+
Depends on ``lefx.sdk`` and nothing else from the system. The engine is never
|
|
4
|
+
imported here; it reaches this package through entry points, which is what makes
|
|
5
|
+
"not installed" and "not present" the same thing.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from .contention import Holder, ReleaseReport, device_probe, find_holders, release_device
|
|
11
|
+
from .provider import ReSpeakerDoaProvider, decode_doa
|
|
12
|
+
from .registration import create_doa_provider, create_frame_sink, shared_transport
|
|
13
|
+
from .sink import ReSpeakerFrameSink
|
|
14
|
+
from .transport import ConnectionState, UsbTransport
|
|
15
|
+
from .xvf import RING_LED_COUNT
|
|
16
|
+
|
|
17
|
+
__version__ = "3.0.0"
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"ConnectionState",
|
|
21
|
+
"Holder",
|
|
22
|
+
"RING_LED_COUNT",
|
|
23
|
+
"ReleaseReport",
|
|
24
|
+
"ReSpeakerDoaProvider",
|
|
25
|
+
"ReSpeakerFrameSink",
|
|
26
|
+
"UsbTransport",
|
|
27
|
+
"__version__",
|
|
28
|
+
"create_doa_provider",
|
|
29
|
+
"create_frame_sink",
|
|
30
|
+
"decode_doa",
|
|
31
|
+
"device_probe",
|
|
32
|
+
"find_holders",
|
|
33
|
+
"release_device",
|
|
34
|
+
"shared_transport",
|
|
35
|
+
]
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""``lefx-respeaker`` — look at the device before doing anything to it.
|
|
2
|
+
|
|
3
|
+
Force-claiming stops another program. That is not something to trigger blind
|
|
4
|
+
from a service flag with no way to see what it would hit first, so the same
|
|
5
|
+
machinery is available here as three commands that escalate in what they do:
|
|
6
|
+
|
|
7
|
+
lefx-respeaker probe is the device reachable, and if not, who else
|
|
8
|
+
is holding a USB device
|
|
9
|
+
lefx-respeaker claim -n what a claim would stop, stopping nothing
|
|
10
|
+
lefx-respeaker claim stop it, then check the device answers
|
|
11
|
+
|
|
12
|
+
``claim`` only ever stops processes that identify themselves as reSpeaker
|
|
13
|
+
software. Peripheral software — mouse, keyboard, RGB — holds WinUSB handles
|
|
14
|
+
permanently and shows up in the same search; it is listed and left alone unless
|
|
15
|
+
``--include-unrelated`` says otherwise, and even then one at a time with a
|
|
16
|
+
re-check after each.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import argparse
|
|
22
|
+
import json
|
|
23
|
+
import logging
|
|
24
|
+
import sys
|
|
25
|
+
|
|
26
|
+
from . import contention
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
30
|
+
parser = argparse.ArgumentParser(
|
|
31
|
+
prog="lefx-respeaker",
|
|
32
|
+
description="Inspect the reSpeaker and, if asked, take it from another process.",
|
|
33
|
+
)
|
|
34
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
35
|
+
|
|
36
|
+
probe = sub.add_parser("probe", help="Report whether the device can be talked to")
|
|
37
|
+
probe.add_argument("--json", action="store_true")
|
|
38
|
+
|
|
39
|
+
claim = sub.add_parser("claim", help="Stop what is holding the device, then re-check")
|
|
40
|
+
claim.add_argument(
|
|
41
|
+
"-n", "--dry-run", action="store_true", help="Report what would be stopped"
|
|
42
|
+
)
|
|
43
|
+
claim.add_argument(
|
|
44
|
+
"--include-unrelated",
|
|
45
|
+
action="store_true",
|
|
46
|
+
help="Also consider USB software not identifiable as reSpeaker software",
|
|
47
|
+
)
|
|
48
|
+
claim.add_argument("--json", action="store_true")
|
|
49
|
+
|
|
50
|
+
return parser
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def run_probe(as_json: bool) -> int:
|
|
54
|
+
reachable = contention.device_probe()()
|
|
55
|
+
holders = [] if reachable else contention.find_holders()
|
|
56
|
+
|
|
57
|
+
if as_json:
|
|
58
|
+
print(
|
|
59
|
+
json.dumps(
|
|
60
|
+
{"reachable": reachable, "holders": contention.as_dicts(holders)},
|
|
61
|
+
indent=2,
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
return 0 if reachable else 1
|
|
65
|
+
|
|
66
|
+
if reachable:
|
|
67
|
+
print("The reSpeaker is reachable.")
|
|
68
|
+
return 0
|
|
69
|
+
|
|
70
|
+
print("The reSpeaker is NOT reachable.")
|
|
71
|
+
if not holders:
|
|
72
|
+
print(
|
|
73
|
+
"\nNo process on this machine has a USB backend loaded, so this is not\n"
|
|
74
|
+
"another program holding the device. Look at the driver binding, or at\n"
|
|
75
|
+
"whether the device is plugged in at all."
|
|
76
|
+
)
|
|
77
|
+
return 1
|
|
78
|
+
|
|
79
|
+
print("\nProcesses holding a USB device:")
|
|
80
|
+
for holder in holders:
|
|
81
|
+
print(f" {holder.describe()}")
|
|
82
|
+
print(
|
|
83
|
+
"\nOnly the ones marked 'reSpeaker software' would be stopped by\n"
|
|
84
|
+
"'lefx-respeaker claim'. Try it with -n first."
|
|
85
|
+
)
|
|
86
|
+
return 1
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def run_claim(*, dry_run: bool, include_unrelated: bool, as_json: bool) -> int:
|
|
90
|
+
report = contention.release_device(
|
|
91
|
+
contention.device_probe(),
|
|
92
|
+
dry_run=dry_run,
|
|
93
|
+
only_related=not include_unrelated,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
if as_json:
|
|
97
|
+
print(
|
|
98
|
+
json.dumps(
|
|
99
|
+
{
|
|
100
|
+
"dry_run": report.dry_run,
|
|
101
|
+
"reachable_before": report.reachable_before,
|
|
102
|
+
"reachable_after": report.reachable_after,
|
|
103
|
+
"terminated": contention.as_dicts(report.terminated),
|
|
104
|
+
"candidates": contention.as_dicts(report.candidates),
|
|
105
|
+
"skipped": contention.as_dicts(report.skipped),
|
|
106
|
+
"failures": [
|
|
107
|
+
{"pid": holder.pid, "error": error}
|
|
108
|
+
for holder, error in report.failures
|
|
109
|
+
],
|
|
110
|
+
"note": report.note,
|
|
111
|
+
"summary": report.summary(),
|
|
112
|
+
},
|
|
113
|
+
indent=2,
|
|
114
|
+
)
|
|
115
|
+
)
|
|
116
|
+
return 0 if report.reachable_after or dry_run else 1
|
|
117
|
+
|
|
118
|
+
print(report.summary())
|
|
119
|
+
for holder in report.terminated:
|
|
120
|
+
print(f" stopped: {holder.describe()}")
|
|
121
|
+
for holder in report.candidates:
|
|
122
|
+
print(f" would stop: {holder.describe()}")
|
|
123
|
+
for holder in report.skipped:
|
|
124
|
+
print(f" left alone: {holder.describe()}")
|
|
125
|
+
for holder, error in report.failures:
|
|
126
|
+
print(f" could not stop pid {holder.pid}: {error}")
|
|
127
|
+
if report.note:
|
|
128
|
+
print(f"\n{report.note}")
|
|
129
|
+
return 0 if report.reachable_after or dry_run else 1
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def main(argv: list[str] | None = None) -> int:
|
|
133
|
+
args = build_parser().parse_args(argv)
|
|
134
|
+
logging.basicConfig(level=logging.WARNING, format="%(levelname)s: %(message)s")
|
|
135
|
+
|
|
136
|
+
if args.command == "probe":
|
|
137
|
+
return run_probe(args.json)
|
|
138
|
+
return run_claim(
|
|
139
|
+
dry_run=args.dry_run,
|
|
140
|
+
include_unrelated=args.include_unrelated,
|
|
141
|
+
as_json=args.json,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
if __name__ == "__main__": # pragma: no cover
|
|
146
|
+
raise SystemExit(main())
|