led-controller-version-3 3.0.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.
- led_controller_version_3-3.0.2/.gitignore +11 -0
- led_controller_version_3-3.0.2/PKG-INFO +172 -0
- led_controller_version_3-3.0.2/README.md +141 -0
- led_controller_version_3-3.0.2/pyproject.toml +107 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/__init__.py +35 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/cli.py +146 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/contention.py +523 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/provider.py +158 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/registration.py +130 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/sink.py +108 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/transport.py +344 -0
- led_controller_version_3-3.0.2/src/lefx/device/respeaker/xvf.py +313 -0
- led_controller_version_3-3.0.2/src/lefx/engine/__init__.py +110 -0
- led_controller_version_3-3.0.2/src/lefx/engine/composer.py +203 -0
- led_controller_version_3-3.0.2/src/lefx/engine/config.py +27 -0
- led_controller_version_3-3.0.2/src/lefx/engine/errors.py +84 -0
- led_controller_version_3-3.0.2/src/lefx/engine/inputs.py +196 -0
- led_controller_version_3-3.0.2/src/lefx/engine/invocation.py +129 -0
- led_controller_version_3-3.0.2/src/lefx/engine/layers.py +114 -0
- led_controller_version_3-3.0.2/src/lefx/engine/library.py +181 -0
- led_controller_version_3-3.0.2/src/lefx/engine/packages/__init__.py +45 -0
- led_controller_version_3-3.0.2/src/lefx/engine/packages/loader.py +375 -0
- led_controller_version_3-3.0.2/src/lefx/engine/packages/manifest.py +308 -0
- led_controller_version_3-3.0.2/src/lefx/engine/registry.py +347 -0
- led_controller_version_3-3.0.2/src/lefx/engine/renderer.py +63 -0
- led_controller_version_3-3.0.2/src/lefx/engine/runtime.py +393 -0
- led_controller_version_3-3.0.2/src/lefx/engine/store.py +125 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/__init__.py +40 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/api.py +301 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/cli.py +380 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/client.py +165 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/config.py +305 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/discovery.py +308 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/hosting.py +123 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/paths.py +79 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/presentation.py +118 -0
- led_controller_version_3-3.0.2/src/lefx/interfaces/service.py +468 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/__init__.py +176 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/calibration.py +202 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/color.py +108 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/context.py +72 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/definitions.py +526 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/effects.py +63 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/errors.py +90 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/parameters.py +469 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/ports.py +76 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/validation.py +150 -0
- led_controller_version_3-3.0.2/src/lefx/sdk/values.py +212 -0
- led_controller_version_3-3.0.2/src/lefx/sets/core_set/__init__.py +32 -0
- led_controller_version_3-3.0.2/src/lefx/sets/core_set/core-set.lefxset +0 -0
- led_controller_version_3-3.0.2/src/lefx/sets/smartspeaker_set/__init__.py +32 -0
- led_controller_version_3-3.0.2/src/lefx/sets/smartspeaker_set/smartspeaker-set.lefxset +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Becomes .gitignore in the release repository.
|
|
2
|
+
#
|
|
3
|
+
# Short on purpose. This tree is generated, and the one thing that has to be
|
|
4
|
+
# tracked here and is *not* tracked in the development repository is the built
|
|
5
|
+
# .lefxset catalogue — output there, source here.
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.pyc
|
|
8
|
+
.venv/
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
*.egg-info/
|
|
@@ -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,141 @@
|
|
|
1
|
+
# led-controller-version-3
|
|
2
|
+
|
|
3
|
+
LED-Ring-Steuerung für den reSpeaker XVF3800 — das LEFX-V3-System.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install led-controller-version-3
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Das ist die Normalversion und für sich vollständig: Schema, Laufzeit,
|
|
10
|
+
Steuerungsoberfläche, die Hardware-Anbindung und beide Effektkataloge. Sie
|
|
11
|
+
spielt fertige `.lefx`- und `.lefxset`-Dateien auf einem reSpeaker ab und
|
|
12
|
+
braucht keines der optionalen Pakete.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
lefx serve --sink respeaker
|
|
16
|
+
lefx list states
|
|
17
|
+
lefx set state listening
|
|
18
|
+
lefx emit event notification
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Optionen
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install "led-controller-version-3[simulated-respeaker]" # Software-Geräteersatz mit Ringfenster
|
|
25
|
+
pip install "led-controller-version-3[effect-creation]" # Effekte erstellen: lefx-pack und lefx-studio
|
|
26
|
+
pip install "led-controller-version-3[all]" # beides
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Beide sind eigene Distributionen, keine Schalter. Was nicht installiert ist,
|
|
30
|
+
existiert im laufenden System nicht — Geräte werden über Entry Points gefunden,
|
|
31
|
+
nicht importiert.
|
|
32
|
+
|
|
33
|
+
Ohne Hardware:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install "led-controller-version-3[simulated-respeaker]"
|
|
37
|
+
lefx-simulator
|
|
38
|
+
lefx serve --sink simulator
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Was drin ist
|
|
42
|
+
|
|
43
|
+
| Modul | Rolle |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `lefx.sdk` | Der Vertrag zwischen Effektpaketen und der Engine |
|
|
46
|
+
| `lefx.engine` | Layer, Komposition, Lebenszyklen, Registry, Paketformat `lefx/3` |
|
|
47
|
+
| `lefx.interfaces` | HTTP-API v3, CLI, Client, Prozess-Hosting, Konfiguration |
|
|
48
|
+
| `lefx.device.respeaker` | USB-Transport, LED-Senke, DoA-Provider |
|
|
49
|
+
| `lefx.sets.core_set` | Referenzkatalog, gebaut als `.lefxset` |
|
|
50
|
+
| `lefx.sets.smartspeaker_set` | Sprachassistenz-Katalog |
|
|
51
|
+
|
|
52
|
+
**`lefx.sdk`** ist das Einzige, was ein Effektautor importiert: die
|
|
53
|
+
typ-spezifischen Definitionsklassen, die Parametertypen und ihre
|
|
54
|
+
Zulässigkeitsregeln, die kanonische Wertnormalisierung, die Farbmathematik, die
|
|
55
|
+
Kontexte und die Ports `FrameSink` und `InputProvider`. Es hängt an nichts. Eine
|
|
56
|
+
ungültige Definition ist nicht konstruierbar — geprüft wird im Konstruktor,
|
|
57
|
+
nicht in einem eigenen Validierungsschritt.
|
|
58
|
+
|
|
59
|
+
**`lefx.engine`** kennt Typen, Lebenszyklen und Layer, aber niemals eine
|
|
60
|
+
konkrete Definition-ID: Layerstapel und Komposition, die vier Lebenszyklusformen,
|
|
61
|
+
die Event-Warteschlange mit Priorität und FIFO, Runtime-Eingaben mit
|
|
62
|
+
Input-Health, die Registry und das Laden von `lefx/3`- und `lefxset/3`-Paketen.
|
|
63
|
+
|
|
64
|
+
**`lefx.interfaces`** trägt CLI und HTTP-API mit denselben Kommandos; keine der
|
|
65
|
+
beiden hat eigene Fachlogik. Dazu der Client, das Prozess-Hosting und die
|
|
66
|
+
Konfiguration.
|
|
67
|
+
|
|
68
|
+
## Effektsätze
|
|
69
|
+
|
|
70
|
+
Beide Kataloge sind enthalten. Welche geladen werden, entscheidet
|
|
71
|
+
`included_lefxset`:
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
included_lefxset: [core, smartspeaker]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
INCLUDED_LEFXSET=[core] lefx serve --sink respeaker
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Leer heißt: alle. Namen dürfen mit oder ohne `-set`-Suffix geschrieben werden.
|
|
82
|
+
|
|
83
|
+
## Konfiguration
|
|
84
|
+
|
|
85
|
+
Alles Projektweite steht in einer `config.yaml` im Arbeitsverzeichnis, unter
|
|
86
|
+
`~/.lefx/config.yaml`, oder wohin `LEFX_CONFIG` zeigt. Jeder Schlüssel lässt
|
|
87
|
+
sich als Umgebungsvariable in Großbuchstaben überschreiben — mit `LEFX_`-Präfix
|
|
88
|
+
oder ohne; ein Kommandozeilenschalter schlägt beides.
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
led_count: 12
|
|
92
|
+
sink: respeaker
|
|
93
|
+
port: 8765
|
|
94
|
+
included_lefxset: [core, smartspeaker]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`lefx config` zeigt, welcher Wert gerade gilt und woher er kommt.
|
|
98
|
+
|
|
99
|
+
## Wenn das Gerät belegt ist
|
|
100
|
+
|
|
101
|
+
Ein WinUSB-Handle ist exklusiv. Ein zweiter Prozess reiht sich nicht ein, er
|
|
102
|
+
bekommt `Errno 13` — das liest sich wie ein Treiber- oder Rechteproblem und
|
|
103
|
+
schickt einen in die falsche Richtung. Meistens läuft schlicht noch ein anderer
|
|
104
|
+
Controller.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
lefx-respeaker probe
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`probe` sagt, ob das Gerät ansprechbar ist, und listet andernfalls die Prozesse,
|
|
111
|
+
die ein USB-Gerät halten — mit Kommandozeile, denn erfahrungsgemäß heißen alle
|
|
112
|
+
Kandidaten `python.exe`.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
lefx-respeaker claim --dry-run
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`claim` beendet, was im Weg steht, und prüft danach nach. Zwei Dinge begrenzen
|
|
119
|
+
den Schaden:
|
|
120
|
+
|
|
121
|
+
- **Es wird einzeln beendet und nach jedem Schritt neu geprüft.** Sobald das
|
|
122
|
+
Gerät antwortet, hört es auf. Der Prozess, der wirklich im Weg war, ist damit
|
|
123
|
+
der letzte, den es trifft.
|
|
124
|
+
- **Fremde USB-Software wird nicht angefasst.** Maus-, Tastatur- und
|
|
125
|
+
RGB-Software hält dauerhaft offene WinUSB-Handles und taucht in derselben
|
|
126
|
+
Suche auf. Sie wird aufgelistet und in Ruhe gelassen; nur Prozesse, die sich
|
|
127
|
+
als reSpeaker-Software zu erkennen geben, kommen in Frage.
|
|
128
|
+
`--include-unrelated` hebt das auf — bewusst und einzeln.
|
|
129
|
+
|
|
130
|
+
Im Dienst ist dasselbe als Senken-Option verfügbar:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
lefx serve --sink respeaker --sink-option force_claim=true
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Eine Senken-Option und kein `lefx`-Schalter, weil `lefx` nichts über reSpeaker
|
|
137
|
+
wissen soll. Der Transport ruft es höchstens **einmal pro Verbindungszyklus**
|
|
138
|
+
auf, nur bei einem Zugriffsfehler: der Wiederholungsversuch läuft alle paar
|
|
139
|
+
Sekunden, und etwas, das in diesem Takt Prozesse beendet, wäre eine Plage. Ein
|
|
140
|
+
fehlendes Gerät gilt nicht als Konkurrenz — ein gezogenes Kabel ist kein fremder
|
|
141
|
+
Prozess.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "led-controller-version-3"
|
|
7
|
+
version = "3.0.2"
|
|
8
|
+
description = "LED ring control for the reSpeaker XVF3800 — the LEFX V3 effect system"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.12,<3.13"
|
|
12
|
+
keywords = ["respeaker", "xvf3800", "led", "effects", "lefx", "usb", "doa"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: End Users/Desktop",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Topic :: System :: Hardware :: Hardware Drivers",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
# Everything needed to play finished effects on a reSpeaker, and nothing that
|
|
23
|
+
# makes one. Four module layers and both catalogues, in one distribution
|
|
24
|
+
# because nothing ever installs a subset of them: no extra selects between the
|
|
25
|
+
# schema, the engine, the control surface and the hardware, so splitting them
|
|
26
|
+
# across four PyPI projects would be bookkeeping from the source tree leaking
|
|
27
|
+
# into the index.
|
|
28
|
+
#
|
|
29
|
+
# The layers are still layers. lefx.engine may not reach lefx.interfaces and
|
|
30
|
+
# neither may reach a device; that rule now lives in the architecture test over
|
|
31
|
+
# directories rather than in four dependency lists, and it is the same rule.
|
|
32
|
+
dependencies = [
|
|
33
|
+
# The control surface.
|
|
34
|
+
"fastapi>=0.135.3,<0.136",
|
|
35
|
+
"pydantic>=2.12.5,<2.13",
|
|
36
|
+
"uvicorn>=0.44.0,<0.45",
|
|
37
|
+
# config.yaml.
|
|
38
|
+
"PyYAML>=6.0.2,<7",
|
|
39
|
+
# The reSpeaker over USB.
|
|
40
|
+
"libusb-package>=1.0.26.3,<1.1",
|
|
41
|
+
"pyusb>=1.3.1,<2",
|
|
42
|
+
"tzdata>=2025.2; platform_system == 'Windows'",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
# Each of these is a distribution of its own, not a switch. What is not
|
|
46
|
+
# installed is not in the running system: devices arrive through entry points
|
|
47
|
+
# and are never imported, so uninstalling one removes it with no list to edit.
|
|
48
|
+
#
|
|
49
|
+
# The catalogues are deliberately not here. They ship with this package and are
|
|
50
|
+
# selected at runtime by included_lefxset, because choosing which effects to
|
|
51
|
+
# load is a configuration question, not an installation question.
|
|
52
|
+
[project.optional-dependencies]
|
|
53
|
+
simulated-respeaker = ["led-controller-version-3-device-simulated-respeaker[gui]==3.0.2"]
|
|
54
|
+
effect-creation = ["led-controller-version-3-effect-creation==3.0.2"]
|
|
55
|
+
all = [
|
|
56
|
+
"led-controller-version-3-device-simulated-respeaker[gui]==3.0.2",
|
|
57
|
+
"led-controller-version-3-effect-creation==3.0.2",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[project.scripts]
|
|
61
|
+
lefx = "lefx.interfaces.cli:main"
|
|
62
|
+
# Inspecting the device, and taking it back from another process that holds it.
|
|
63
|
+
# A separate command rather than only a service flag: force-claiming stops
|
|
64
|
+
# somebody's program, and that should be visible before it is triggered.
|
|
65
|
+
lefx-respeaker = "lefx.device.respeaker.cli:main"
|
|
66
|
+
|
|
67
|
+
# Output and input are registered separately so that a failing DoA read cannot
|
|
68
|
+
# take the LED output with it, and vice versa.
|
|
69
|
+
#
|
|
70
|
+
# A provider is named "<device>.<capability>". The device half keeps it distinct
|
|
71
|
+
# from the simulator's when both are installed; the capability half is the only
|
|
72
|
+
# part an effect names, so the same definition runs against either.
|
|
73
|
+
[project.entry-points."lefx.frame_sinks"]
|
|
74
|
+
respeaker = "lefx.device.respeaker.registration:create_frame_sink"
|
|
75
|
+
|
|
76
|
+
[project.entry-points."lefx.input_providers"]
|
|
77
|
+
"respeaker.doa" = "lefx.device.respeaker.registration:create_doa_provider"
|
|
78
|
+
|
|
79
|
+
# The catalogues, found the same way a device is. They happen to ship in this
|
|
80
|
+
# same distribution, but the service does not know that: it reads the group and
|
|
81
|
+
# uses what is registered, which is what leaves room for a set from anywhere.
|
|
82
|
+
[project.entry-points."lefx.effect_sets"]
|
|
83
|
+
core-set = "lefx.sets.core_set:package_file"
|
|
84
|
+
smartspeaker-set = "lefx.sets.smartspeaker_set:package_file"
|
|
85
|
+
|
|
86
|
+
[tool.hatch.build.targets.wheel]
|
|
87
|
+
packages = ["src/lefx"]
|
|
88
|
+
|
|
89
|
+
# The archives are built output, so they are gitignored, and hatchling excludes
|
|
90
|
+
# ignored files by default — a wheel with the modules in it and no catalogue.
|
|
91
|
+
# "artifacts" is the exception list for exactly that case: include them if they
|
|
92
|
+
# are there. Deliberately not force-include, which fails the build when they
|
|
93
|
+
# are absent and would make a fresh checkout unsyncable, since the tool that
|
|
94
|
+
# builds them is itself part of this workspace.
|
|
95
|
+
#
|
|
96
|
+
# That leaves one hole — a wheel built before the sets were — and it is closed
|
|
97
|
+
# where it belongs, in scripts/check_release.py, which opens the built wheel
|
|
98
|
+
# and looks for the archives inside.
|
|
99
|
+
[tool.hatch.build]
|
|
100
|
+
artifacts = ["src/lefx/sets/*/*.lefxset"]
|
|
101
|
+
|
|
102
|
+
[tool.hatch.build.targets.sdist]
|
|
103
|
+
include = ["src/lefx", "README.md"]
|
|
104
|
+
|
|
105
|
+
[project.urls]
|
|
106
|
+
Homepage = "https://github.com/marcosudau-vps/led_controller_respeaker-v3"
|
|
107
|
+
Source = "https://github.com/marcosudau-vps/led_controller_respeaker-v3"
|
|
@@ -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())
|