python-voiceio 1.18.0__py3-none-any.whl → 1.18.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.
- {python_voiceio-1.18.0.dist-info → python_voiceio-1.18.2.dist-info}/METADATA +1 -1
- {python_voiceio-1.18.0.dist-info → python_voiceio-1.18.2.dist-info}/RECORD +16 -16
- voiceio/__init__.py +1 -1
- voiceio/cli/doctor.py +5 -6
- voiceio/cli/uninstall.py +2 -2
- voiceio/health.py +32 -17
- voiceio/hotkeys/evdev.py +42 -11
- voiceio/platform.py +152 -15
- voiceio/setup/noninteractive.py +4 -0
- voiceio/setup/steps.py +25 -7
- voiceio/setup/system.py +19 -5
- voiceio/typers/ydotool.py +12 -9
- {python_voiceio-1.18.0.dist-info → python_voiceio-1.18.2.dist-info}/WHEEL +0 -0
- {python_voiceio-1.18.0.dist-info → python_voiceio-1.18.2.dist-info}/entry_points.txt +0 -0
- {python_voiceio-1.18.0.dist-info → python_voiceio-1.18.2.dist-info}/licenses/LICENSE +0 -0
- {python_voiceio-1.18.0.dist-info → python_voiceio-1.18.2.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
python_voiceio-1.18.
|
|
2
|
-
voiceio/__init__.py,sha256=
|
|
1
|
+
python_voiceio-1.18.2.dist-info/licenses/LICENSE,sha256=Gz61o8jFTAvZUZyB3nWDB3DQQVuipjfPkVu9W8hBHM0,1072
|
|
2
|
+
voiceio/__init__.py,sha256=UGngD1th5e8ZpEKcPUfYxQaD9diK7IjChNXBj0_xMOE,23
|
|
3
3
|
voiceio/__main__.py,sha256=xT5QCGGreYMisHO7Lh_Y-xAQ2TOzG2D7npKknGNcWSY,53
|
|
4
4
|
voiceio/announce.py,sha256=oqNJn1c4j5bTQ00-LXNWZ3_hIC9L9Lb3rkp0-LwkCfY,3798
|
|
5
5
|
voiceio/app.py,sha256=tStX_aQyMhFK3NUFWvwowx0jW4a7szX6zkOoP7-lu60,49485
|
|
@@ -16,7 +16,7 @@ voiceio/display.py,sha256=ZGBNRjuvg3chkJjduyPJs4s5ZY5vqC_mcaov94PIPzo,5313
|
|
|
16
16
|
voiceio/errorlog.py,sha256=e5UKVp4p-UBg0tTpcBREY5KoHMFZFJ9oNK3vOh8H6jw,7044
|
|
17
17
|
voiceio/feedback.py,sha256=69Vepy2Z0gsDdpLzdLJbgrEHzSJm2luQ7yT4_nAnZCQ,9321
|
|
18
18
|
voiceio/focus.py,sha256=PGj839UUZE7ZPwaiLDTAX3S8d_QjwaT4y6ugXyylL9M,4304
|
|
19
|
-
voiceio/health.py,sha256=
|
|
19
|
+
voiceio/health.py,sha256=rgFlhTvLe-pneJB2mkQrz8vhvpauBkiA64dkms_etrc,28351
|
|
20
20
|
voiceio/hints.py,sha256=wQPVie-zX-SFfz3C0YxL40_51SCkF1Xt8F1vwI_5yoY,1440
|
|
21
21
|
voiceio/history.py,sha256=WNjfjakY8qwgRm3W6WBDlpS9CSgS8ecZ9RGGBZsW80w,5898
|
|
22
22
|
voiceio/idle_audio.py,sha256=0GEbm0g-a2uVxIMWEKpaYus06mnrc8qvWr09a85FWS0,7225
|
|
@@ -26,7 +26,7 @@ voiceio/llm_api.py,sha256=4jJ5U1Dop-3uoM9RM3bjUMxB4kYNNjwKbOwIIj0ll3U,9390
|
|
|
26
26
|
voiceio/mic_gain.py,sha256=lMSOz80-cb9X_ggShQttynjVRqcKd1tIUw9e64fEszM,4412
|
|
27
27
|
voiceio/numbers.py,sha256=CXJtlMhmV6_9Z1FtKAF4-RXycw8voV-BYHPBpdw1I6Y,13571
|
|
28
28
|
voiceio/pidlock.py,sha256=OZLNskUyv9_F3WgyHZWw8WmKt0W7ioxH6xgHitOwCww,1216
|
|
29
|
-
voiceio/platform.py,sha256=
|
|
29
|
+
voiceio/platform.py,sha256=yG3yWgP9xzQ7uXvfBDZ6AfQ3MFClrOh3rGm_YabeYzg,30095
|
|
30
30
|
voiceio/postcorrect.py,sha256=JN5l9xnyGfYq2_owSUwkJ513QiQQKxCrT3hjU5aJCpg,17322
|
|
31
31
|
voiceio/postprocess.py,sha256=01ILYaPObF3LZ7oLdCZC1iFQfAFzzGayWFCjCU8RKz8,7121
|
|
32
32
|
voiceio/power.py,sha256=mKiG5ioHbzgtW2S-OKGFOPzZFbG0HwUUyMn8kE5JRoQ,681
|
|
@@ -51,12 +51,12 @@ voiceio/wordfreq.py,sha256=AxmVgpQRfm2YAYQpHCRRrBUTpa12y_ngiFNScrGr4GM,3543
|
|
|
51
51
|
voiceio/cli/__init__.py,sha256=nUgKtKbcVPoOyi68co9YPyfFSiwobfA7tY9ZZdTZ33k,9919
|
|
52
52
|
voiceio/cli/configcmd.py,sha256=YF7t-LkwEYEGH4qcO86xehWVX0LvltqxjDFpMF5ljjA,2858
|
|
53
53
|
voiceio/cli/corrections.py,sha256=OBjgiOhtWlTQpQq0HLAvk5-EfKJ7NNt-hnNBHm7obEc,4247
|
|
54
|
-
voiceio/cli/doctor.py,sha256=
|
|
54
|
+
voiceio/cli/doctor.py,sha256=YNFiAI-pIwpRqqEe8ukZ8RLK8IGFcdk5iVJLrEVI0XA,13276
|
|
55
55
|
voiceio/cli/history.py,sha256=7FvEEgdw8jf5XXvC7-4S7iIpcjBbn7dx4czIijg61C0,2597
|
|
56
56
|
voiceio/cli/learn.py,sha256=RtGzDgosTW0q3poHjfZ2ZHiljvWBcGxa-xD6XERSkUU,38001
|
|
57
57
|
voiceio/cli/models.py,sha256=3WFgljWKPXl706P2u3HvLZOKFQGWHMhV63kBNl_59QI,7732
|
|
58
58
|
voiceio/cli/servicecmd.py,sha256=6VpxMAPetzbqy019gHaV3wXhkZdmh2LCLixij77e_Ks,5086
|
|
59
|
-
voiceio/cli/uninstall.py,sha256=
|
|
59
|
+
voiceio/cli/uninstall.py,sha256=TE4wpRl7aznYUgmvHIo9ER_Tj4L_AUjfmU6i4yGEzf0,9408
|
|
60
60
|
voiceio/cli/vocab.py,sha256=lxxuSukefvIHV4fFSduCQQewXY0_Bvf5sDnG4bqLWH8,4418
|
|
61
61
|
voiceio/core/__init__.py,sha256=K0b4duczohS3IrIMLp9fYhfb-GeuyQaOVH_8teYGsQM,277
|
|
62
62
|
voiceio/core/bias.py,sha256=Kxxy7UJOZbA4gYJJbJVL27-1mMaMCm8WTujDNJR9WUY,6093
|
|
@@ -76,7 +76,7 @@ voiceio/data/__init__.py,sha256=kbyKP4Jaz3Q-rGkUPnVq5zo5d3dii254q7qIDCG4vHw,59
|
|
|
76
76
|
voiceio/hotkeys/__init__.py,sha256=rGXSGZLD2mS_Ep2HfVdRdkUKNr4xagySlL1FM00cYgk,735
|
|
77
77
|
voiceio/hotkeys/base.py,sha256=EFBjdPxwQSBoHPRhz763SSAOs3YSll6w74DrsSbcjmc,916
|
|
78
78
|
voiceio/hotkeys/chain.py,sha256=8pvPhipmxWwmGG9DRXy8dlEKTPFILxNzYO-adcvw5Ps,2800
|
|
79
|
-
voiceio/hotkeys/evdev.py,sha256=
|
|
79
|
+
voiceio/hotkeys/evdev.py,sha256=sotovEZZqwzeij2Wr3BgJn3zELOnvsTJ3WkqB2oedlQ,9631
|
|
80
80
|
voiceio/hotkeys/pynput_backend.py,sha256=YHBSVsln0EDx5dPvsp_RnDSHJClcYJ6yGwzPRLIdcMw,5069
|
|
81
81
|
voiceio/hotkeys/socket_backend.py,sha256=n4hHmWN1fRcTIszCSBnPLOAL4lWc9AVfH1mw1e7kL5Y,4758
|
|
82
82
|
voiceio/ibus/__init__.py,sha256=lNl3UkuetJUcYIqM0J66FEInA8l1HfHtdyra-jBnqco,3732
|
|
@@ -107,10 +107,10 @@ voiceio/setup/__init__.py,sha256=cXNo-LYhkoVA6pEKcnaAKEGma_A9Aiqffa3VRvV6Jm8,430
|
|
|
107
107
|
voiceio/setup/configfile.py,sha256=bDJdEhYlETjyXasVkCdfYTDq63ii9Dkh_Ywv5OT-P6M,4867
|
|
108
108
|
voiceio/setup/extras.py,sha256=NGk_uAWl4GQAPwRfw_0nEPsPvma7ics9DnZqjoHgCUY,9685
|
|
109
109
|
voiceio/setup/hotkey.py,sha256=xlDp2vWzsF73wbpvPSrwaqgjtiWnv294nzjlvHy0Ets,6473
|
|
110
|
-
voiceio/setup/noninteractive.py,sha256=
|
|
110
|
+
voiceio/setup/noninteractive.py,sha256=T5c8LTJseqbBGmPOdxWKBP8yH7Q6Se7ir8ORVZFEuog,11573
|
|
111
111
|
voiceio/setup/speech.py,sha256=6rNGgJyi6-Plxi998o76UbjJv1F2A_sxGOH2Xshz188,9292
|
|
112
|
-
voiceio/setup/steps.py,sha256=
|
|
113
|
-
voiceio/setup/system.py,sha256=
|
|
112
|
+
voiceio/setup/steps.py,sha256=slhCKcWDd6Mf0iI1qSFrSQQhCD3NBvCYpdAN9X53d_U,30138
|
|
113
|
+
voiceio/setup/system.py,sha256=gEFINv_Ofdqj1LMU_QpoWFzGrGv7EYiSsPDC4j6B0sU,7797
|
|
114
114
|
voiceio/setup/ui.py,sha256=h1gmerT_8EfWftSONUn5K5Ri19elNTRP2lwFAuxsGPc,13401
|
|
115
115
|
voiceio/sounds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
116
116
|
voiceio/sounds/alert.wav,sha256=raqr2ZVADP49Uv9VUJM7E1itMq0uOp-o5WTyIrGy7gk,38852
|
|
@@ -142,9 +142,9 @@ voiceio/typers/paste.py,sha256=2Pzi7NCFMc93pAgSCWdA0Z9DBxkHrZ-xgp6dSroIpIo,4616
|
|
|
142
142
|
voiceio/typers/pynput_type.py,sha256=f3w131YWJfNGd4IAcWtuKd2Gcwu3467QwGW3OBUEXNI,1927
|
|
143
143
|
voiceio/typers/wtype.py,sha256=11vOAKHjMat-fITd4sUoUWwgniyVp65EbH3i4mL6Vhg,1762
|
|
144
144
|
voiceio/typers/xdotool.py,sha256=OuT_zW_z07jSAqu9Cmn_gL1mJfQsiX62ecqFRvpAarQ,1332
|
|
145
|
-
voiceio/typers/ydotool.py,sha256=
|
|
146
|
-
python_voiceio-1.18.
|
|
147
|
-
python_voiceio-1.18.
|
|
148
|
-
python_voiceio-1.18.
|
|
149
|
-
python_voiceio-1.18.
|
|
150
|
-
python_voiceio-1.18.
|
|
145
|
+
voiceio/typers/ydotool.py,sha256=lSeYZPnkeKbwDg152t6b76eOmGx5PY0NOxCPd7ORf78,6168
|
|
146
|
+
python_voiceio-1.18.2.dist-info/METADATA,sha256=EBgD_Q76o4QDldowdzznV632B4rZDbuaamWwd22gVcY,9629
|
|
147
|
+
python_voiceio-1.18.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
148
|
+
python_voiceio-1.18.2.dist-info/entry_points.txt,sha256=iDIDmhvQ3xeN_CWsFne1t9STZ08I25I_wp0xmde_vMs,94
|
|
149
|
+
python_voiceio-1.18.2.dist-info/top_level.txt,sha256=piwtn309lD6uexQyXdZ-efAVBJF9y6Wfr48Z-8zkNhg,8
|
|
150
|
+
python_voiceio-1.18.2.dist-info/RECORD,,
|
voiceio/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.18.
|
|
1
|
+
__version__ = "1.18.2"
|
voiceio/cli/doctor.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import argparse
|
|
5
|
+
import shlex
|
|
5
6
|
import sys
|
|
6
7
|
|
|
7
8
|
|
|
@@ -44,13 +45,12 @@ def _confirm_privileged(description: str, command_str: str) -> bool:
|
|
|
44
45
|
|
|
45
46
|
def _run_privileged(description: str, argv: list[str], timeout: float,
|
|
46
47
|
cmd_str: str | None = None) -> bool | None:
|
|
47
|
-
"""Ask first, then run a root command
|
|
48
|
-
|
|
48
|
+
"""Ask first, then run a root command with sudo, doas or pkexec (see
|
|
49
|
+
platform.privileged_argv), else print it for the user to run as root.
|
|
49
50
|
|
|
50
51
|
Returns True when it ran, False when it failed or could not run, None
|
|
51
52
|
when the user declined. Raises nothing.
|
|
52
53
|
"""
|
|
53
|
-
import shlex
|
|
54
54
|
import subprocess
|
|
55
55
|
|
|
56
56
|
from voiceio import platform as plat
|
|
@@ -59,8 +59,7 @@ def _run_privileged(description: str, argv: list[str], timeout: float,
|
|
|
59
59
|
return None
|
|
60
60
|
run_argv = plat.privileged_argv(argv)
|
|
61
61
|
if run_argv is None:
|
|
62
|
-
print(
|
|
63
|
-
print(f" {cmd_str}")
|
|
62
|
+
print(plat.privilege_unavailable_message(argv))
|
|
64
63
|
return False
|
|
65
64
|
try:
|
|
66
65
|
subprocess.run(run_argv, check=True, timeout=timeout)
|
|
@@ -155,7 +154,7 @@ def _cmd_doctor(args: argparse.Namespace) -> None:
|
|
|
155
154
|
|
|
156
155
|
for b in report.hotkey_backends + report.typer_backends:
|
|
157
156
|
if not b.ok and b.fix_cmd:
|
|
158
|
-
cmd_str =
|
|
157
|
+
cmd_str = shlex.join(b.fix_cmd)
|
|
159
158
|
if _is_privileged_cmd(b.fix_cmd):
|
|
160
159
|
ran = _run_privileged(f"Fix {b.name}", b.fix_cmd, 120, cmd_str=cmd_str)
|
|
161
160
|
if ran is None:
|
voiceio/cli/uninstall.py
CHANGED
|
@@ -165,10 +165,10 @@ def _cmd_uninstall() -> None:
|
|
|
165
165
|
continue
|
|
166
166
|
cmd = f"sudo rm {rule_path}"
|
|
167
167
|
if _confirm_privileged(f"Remove the voiceio {what} udev rule", cmd):
|
|
168
|
-
from voiceio.platform import privileged_argv
|
|
168
|
+
from voiceio.platform import privilege_unavailable_message, privileged_argv
|
|
169
169
|
argv = privileged_argv(["sudo", "rm", rule_path])
|
|
170
170
|
if argv is None:
|
|
171
|
-
print(
|
|
171
|
+
print(privilege_unavailable_message(["sudo", "rm", rule_path]))
|
|
172
172
|
continue
|
|
173
173
|
try:
|
|
174
174
|
subprocess.run(argv, timeout=120)
|
voiceio/health.py
CHANGED
|
@@ -19,6 +19,7 @@ class BackendStatus:
|
|
|
19
19
|
reason: str = ""
|
|
20
20
|
fix_hint: str = ""
|
|
21
21
|
fix_cmd: list[str] = field(default_factory=list)
|
|
22
|
+
optional: bool = False # failing, but another backend covers it
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
@dataclass
|
|
@@ -72,6 +73,8 @@ def check_health(p: plat.Platform | None = None) -> HealthReport:
|
|
|
72
73
|
fix_hint=probe.fix_hint, fix_cmd=probe.fix_cmd,
|
|
73
74
|
))
|
|
74
75
|
|
|
76
|
+
_mark_evdev_optional(report)
|
|
77
|
+
|
|
75
78
|
# Probe typer backends
|
|
76
79
|
for name, backend, probe in typer_chain.resolve(p):
|
|
77
80
|
report.typer_backends.append(BackendStatus(
|
|
@@ -128,6 +131,26 @@ def check_health(p: plat.Platform | None = None) -> HealthReport:
|
|
|
128
131
|
return report
|
|
129
132
|
|
|
130
133
|
|
|
134
|
+
def _mark_evdev_optional(report: HealthReport) -> None:
|
|
135
|
+
"""On X11 a working pynput covers the hotkey: show evdev as optional and
|
|
136
|
+
drop its root-only udev fix, so `doctor --fix` doesn't run it."""
|
|
137
|
+
from voiceio.hotkeys.evdev import NOT_NEEDED_ON_X11, evdev_optional
|
|
138
|
+
pynput_ok = any(b.name == "pynput" and b.ok for b in report.hotkey_backends)
|
|
139
|
+
try:
|
|
140
|
+
from voiceio.config import load
|
|
141
|
+
backend = load().hotkey.backend
|
|
142
|
+
except Exception:
|
|
143
|
+
backend = "auto"
|
|
144
|
+
if not evdev_optional(report.platform.display_server, pynput_ok, backend):
|
|
145
|
+
return
|
|
146
|
+
for b in report.hotkey_backends:
|
|
147
|
+
if b.name == "evdev" and not b.ok:
|
|
148
|
+
b.optional = True
|
|
149
|
+
b.reason = NOT_NEEDED_ON_X11
|
|
150
|
+
b.fix_hint = ""
|
|
151
|
+
b.fix_cmd = []
|
|
152
|
+
|
|
153
|
+
|
|
131
154
|
def _kde_input_method_warning(p: plat.Platform, kwinrc: Path | None = None) -> str:
|
|
132
155
|
"""KWin on Wayland only hands text to the input method picked under
|
|
133
156
|
Virtual Keyboard; without IBus there, voiceio has no live preview."""
|
|
@@ -147,10 +170,6 @@ def _kde_input_method_warning(p: plat.Platform, kwinrc: Path | None = None) -> s
|
|
|
147
170
|
"System Settings → Keyboard → Virtual Keyboard → IBus Wayland, then log out and in.")
|
|
148
171
|
|
|
149
172
|
|
|
150
|
-
# What CTranslate2 4.x's CUDA build loads at the first encode.
|
|
151
|
-
_CUDA_LIBS = ("libcublas.so.12", "libcudnn.so.9")
|
|
152
|
-
|
|
153
|
-
|
|
154
173
|
def _gpu_libs_warning() -> str:
|
|
155
174
|
"""Why Whisper can't use the GPU it sees, when that's a missing CUDA
|
|
156
175
|
library (a torch for another CUDA major, pulled in by the train extra,
|
|
@@ -161,23 +180,16 @@ def _gpu_libs_warning() -> str:
|
|
|
161
180
|
from voiceio.core.decoders.catalog import is_whisper
|
|
162
181
|
if cfg.device not in ("auto", "cuda") or not is_whisper(cfg.name):
|
|
163
182
|
return ""
|
|
164
|
-
|
|
165
|
-
if ctranslate2.get_cuda_device_count() == 0:
|
|
166
|
-
return ""
|
|
167
|
-
except Exception: # noqa: BLE001 — no faster-whisper, or no CUDA build
|
|
183
|
+
except Exception: # noqa: BLE001
|
|
168
184
|
return ""
|
|
169
|
-
|
|
170
|
-
missing
|
|
171
|
-
|
|
172
|
-
try:
|
|
173
|
-
ctypes.CDLL(lib)
|
|
174
|
-
except OSError:
|
|
175
|
-
missing.append(lib)
|
|
185
|
+
missing = plat.missing_cuda_libs()
|
|
186
|
+
if missing is None:
|
|
187
|
+
return plat.cuda_device_problem()
|
|
176
188
|
if not missing:
|
|
177
189
|
return ""
|
|
178
190
|
return (f"A GPU is present but {', '.join(missing)} can't be loaded, so Whisper "
|
|
179
|
-
"decodes on CPU.
|
|
180
|
-
"
|
|
191
|
+
f"decodes on CPU. {plat.cuda_libs_hint(missing)}. Or set "
|
|
192
|
+
"model.device = \"cpu\" in config.toml to stay on CPU.")
|
|
181
193
|
|
|
182
194
|
|
|
183
195
|
def _check_features() -> FeatureGroups:
|
|
@@ -423,6 +435,9 @@ def _check_line(label: str, ok: bool, detail: str = "",
|
|
|
423
435
|
def _backend_line(b: BackendStatus, active: bool = False) -> list[str]:
|
|
424
436
|
lines = []
|
|
425
437
|
tag = f" {CYAN}◀ active{RESET}" if active else ""
|
|
438
|
+
if b.optional and not b.ok:
|
|
439
|
+
lines.append(f" {DIM}○{RESET} {b.name} {DIM}{b.reason}{RESET}")
|
|
440
|
+
return lines
|
|
426
441
|
detail = ""
|
|
427
442
|
if not b.ok:
|
|
428
443
|
detail = b.reason
|
voiceio/hotkeys/evdev.py
CHANGED
|
@@ -26,20 +26,47 @@ def uaccess_rule() -> str:
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def uaccess_install_cmd() -> list[str]:
|
|
29
|
-
"""argv that installs the uaccess rule and applies it
|
|
30
|
-
|
|
31
|
-
One ``sh -c`` so the whole privileged action shows as a single
|
|
32
|
-
doctor's consent prompt.
|
|
33
|
-
|
|
34
|
-
`
|
|
29
|
+
"""argv that installs the uaccess rule and applies it, as root.
|
|
30
|
+
|
|
31
|
+
One root ``sh -c`` so the whole privileged action shows as a single
|
|
32
|
+
string in doctor's consent prompt. It starts with ``sudo``;
|
|
33
|
+
platform.privileged_argv swaps that for doas or pkexec when needed, and
|
|
34
|
+
the script itself never calls sudo. `mkdir -p` because some distros
|
|
35
|
+
(Gentoo) ship no /etc/udev/rules.d. `trigger` re-runs the rules for
|
|
36
|
+
existing input devices, so access is granted immediately — no re-login,
|
|
37
|
+
unlike the `input` group.
|
|
35
38
|
"""
|
|
36
39
|
script = (
|
|
37
|
-
f"
|
|
38
|
-
f"
|
|
39
|
-
"&&
|
|
40
|
-
"&&
|
|
40
|
+
f"mkdir -p {shlex.quote(str(Path(UACCESS_RULE_PATH).parent))} "
|
|
41
|
+
f"&& printf %s {shlex.quote(uaccess_rule())} > {UACCESS_RULE_PATH} "
|
|
42
|
+
"&& udevadm control --reload-rules "
|
|
43
|
+
"&& udevadm trigger --subsystem-match=input --action=change"
|
|
41
44
|
)
|
|
42
|
-
return ["sh", "-c", script]
|
|
45
|
+
return ["sudo", "sh", "-c", script]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Shown by setup and doctor instead of a failing evdev check.
|
|
49
|
+
NOT_NEEDED_ON_X11 = "optional, not needed: pynput handles the hotkey on X11"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def evdev_optional(display_server: str, pynput_ok: bool, backend: str = "auto") -> bool:
|
|
53
|
+
"""True when evdev access is not needed: on X11 the chain tries pynput
|
|
54
|
+
first, so a working pynput covers the hotkey. Not when the config pins
|
|
55
|
+
the evdev backend, and never on Wayland, where evdev is the only
|
|
56
|
+
physical listener.
|
|
57
|
+
"""
|
|
58
|
+
return display_server == "x11" and pynput_ok and backend != "evdev"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _pynput_covers_hotkey() -> bool:
|
|
62
|
+
try:
|
|
63
|
+
from voiceio.config import load
|
|
64
|
+
from voiceio.hotkeys.pynput_backend import PynputHotkey
|
|
65
|
+
from voiceio.platform import _detect_display_server
|
|
66
|
+
return evdev_optional(_detect_display_server(), PynputHotkey().probe().ok,
|
|
67
|
+
load().hotkey.backend)
|
|
68
|
+
except Exception:
|
|
69
|
+
return False
|
|
43
70
|
|
|
44
71
|
|
|
45
72
|
def nixos_hint() -> str:
|
|
@@ -127,6 +154,10 @@ class EvdevHotkey:
|
|
|
127
154
|
ok=False, reason="No permission to read /dev/input",
|
|
128
155
|
fix_hint=nixos_hint(),
|
|
129
156
|
)
|
|
157
|
+
if _pynput_covers_hotkey():
|
|
158
|
+
# The udev rule needs root; don't offer it for nothing.
|
|
159
|
+
return ProbeResult(ok=False, reason="No permission to read /dev/input",
|
|
160
|
+
fix_hint=NOT_NEEDED_ON_X11)
|
|
130
161
|
return ProbeResult(
|
|
131
162
|
ok=False, reason="No permission to read /dev/input",
|
|
132
163
|
fix_hint=(
|
voiceio/platform.py
CHANGED
|
@@ -268,16 +268,29 @@ def _has_tty() -> bool:
|
|
|
268
268
|
return True
|
|
269
269
|
|
|
270
270
|
|
|
271
|
-
def
|
|
272
|
-
"""
|
|
271
|
+
def _runs_without_password(tool: str) -> bool:
|
|
272
|
+
"""`sudo -n true` / `doas -n true`: cached credentials or a no-password
|
|
273
|
+
rule, so the tool works with no terminal to ask."""
|
|
273
274
|
import subprocess
|
|
274
275
|
try:
|
|
275
|
-
return subprocess.run([
|
|
276
|
+
return subprocess.run([tool, "-n", "true"], capture_output=True,
|
|
276
277
|
timeout=5).returncode == 0
|
|
277
278
|
except (OSError, subprocess.TimeoutExpired):
|
|
278
279
|
return False
|
|
279
280
|
|
|
280
281
|
|
|
282
|
+
def _sudo_without_password() -> bool:
|
|
283
|
+
return _runs_without_password("sudo")
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def _doas_without_password() -> bool:
|
|
287
|
+
return _runs_without_password("doas")
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def _is_root() -> bool:
|
|
291
|
+
return hasattr(os, "geteuid") and os.geteuid() == 0
|
|
292
|
+
|
|
293
|
+
|
|
281
294
|
# Flags that make a package manager prompt; dropped instead (emerge has no
|
|
282
295
|
# subcommand to put a yes-flag after, and without --ask it never asks).
|
|
283
296
|
_ASK_FLAGS: dict[str, tuple[str, ...]] = {"emerge": ("--ask", "-a")}
|
|
@@ -296,13 +309,15 @@ def _assume_yes(argv: list[str]) -> list[str]:
|
|
|
296
309
|
def privileged_argv(argv: list[str]) -> list[str] | None:
|
|
297
310
|
"""How to run a command that needs root from here, or None if it can't be.
|
|
298
311
|
|
|
299
|
-
A command needs root when it starts with sudo or is a shell script that
|
|
300
|
-
calls sudo
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
else
|
|
312
|
+
A command needs root when it starts with sudo, or is a shell script that
|
|
313
|
+
calls sudo. Commands are written with sudo; this picks the tool that
|
|
314
|
+
exists. Already root: run it without sudo. With a terminal: sudo if
|
|
315
|
+
installed, else doas (Gentoo, Alpine), else pkexec, each asking for the
|
|
316
|
+
password. Without one (setup driven by an agent, a launcher, a GUI)
|
|
317
|
+
nothing can ask on a terminal: `sudo -n` or `doas -n` when they need no
|
|
318
|
+
password; else pkexec, whose polkit agent shows the desktop's password
|
|
319
|
+
dialog. Else None, and the caller prints the command for the user to run
|
|
320
|
+
as root (see privilege_unavailable_message).
|
|
306
321
|
Ask the user before calling this: it never asks.
|
|
307
322
|
"""
|
|
308
323
|
if not argv:
|
|
@@ -310,17 +325,53 @@ def privileged_argv(argv: list[str]) -> list[str] | None:
|
|
|
310
325
|
direct = argv[0] == "sudo"
|
|
311
326
|
if not direct and not any("sudo " in a for a in argv[1:]):
|
|
312
327
|
return argv
|
|
328
|
+
# A script with inner sudo runs whole under the tool; as root its sudo
|
|
329
|
+
# needs no password.
|
|
330
|
+
rest = argv[1:] if direct else argv
|
|
331
|
+
if _is_root() and direct:
|
|
332
|
+
return rest
|
|
333
|
+
has_sudo, has_doas = bool(shutil.which("sudo")), bool(shutil.which("doas"))
|
|
334
|
+
has_pkexec = bool(shutil.which("pkexec"))
|
|
313
335
|
if _has_tty():
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
336
|
+
if has_sudo:
|
|
337
|
+
return argv
|
|
338
|
+
if has_doas:
|
|
339
|
+
return ["doas", *rest]
|
|
340
|
+
return ["pkexec", *rest] if has_pkexec else None
|
|
341
|
+
rest = _assume_yes(rest) if direct else argv
|
|
342
|
+
if has_sudo and _sudo_without_password():
|
|
317
343
|
return ["sudo", "-n", *rest] if direct else argv
|
|
318
|
-
if
|
|
319
|
-
|
|
344
|
+
if has_doas and _doas_without_password():
|
|
345
|
+
return ["doas", "-n", *rest]
|
|
346
|
+
if has_pkexec and (os.environ.get("WAYLAND_DISPLAY") or os.environ.get("DISPLAY")):
|
|
320
347
|
return ["pkexec", *rest]
|
|
321
348
|
return None
|
|
322
349
|
|
|
323
350
|
|
|
351
|
+
def has_privilege_tool() -> bool:
|
|
352
|
+
return any(shutil.which(t) for t in ("sudo", "doas", "pkexec"))
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def as_root_command(argv: list[str]) -> str:
|
|
356
|
+
"""The command to type in a root shell: the argv without its sudo."""
|
|
357
|
+
import re
|
|
358
|
+
import shlex
|
|
359
|
+
if argv and argv[0] == "sudo":
|
|
360
|
+
argv = argv[1:]
|
|
361
|
+
return shlex.join(re.sub(r"\bsudo (-n )?", "", a) for a in argv)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def privilege_unavailable_message(argv: list[str]) -> str:
|
|
365
|
+
"""Why privileged_argv gave up, and what to run instead (indented lines)."""
|
|
366
|
+
import shlex
|
|
367
|
+
if not has_privilege_tool():
|
|
368
|
+
return (" No sudo, doas or pkexec found. Run this as root "
|
|
369
|
+
"(e.g. in a shell from `su -`):\n"
|
|
370
|
+
f" {as_root_command(argv)}")
|
|
371
|
+
return (" No terminal to ask for your password, and no pkexec. Run it yourself:\n"
|
|
372
|
+
f" {shlex.join(argv)}")
|
|
373
|
+
|
|
374
|
+
|
|
324
375
|
# Package name overrides per package manager (when they differ from apt names)
|
|
325
376
|
_PKG_NAMES: dict[str, dict[str, str]] = {
|
|
326
377
|
"dnf": {
|
|
@@ -335,6 +386,7 @@ _PKG_NAMES: dict[str, dict[str, str]] = {
|
|
|
335
386
|
"portaudio19-dev": "portaudio",
|
|
336
387
|
"gir1.2-ayatanaappindicator3-0.1": "libayatana-appindicator",
|
|
337
388
|
"espeak-ng": "espeak-ng",
|
|
389
|
+
"cudnn": "cudnn",
|
|
338
390
|
},
|
|
339
391
|
"zypper": {
|
|
340
392
|
"gir1.2-ibus-1.0": "typelib-1_0-IBus-1_0",
|
|
@@ -356,6 +408,9 @@ _PKG_NAMES: dict[str, dict[str, str]] = {
|
|
|
356
408
|
},
|
|
357
409
|
# Gentoo atoms. Names not listed stay bare (`emerge ydotool`), which
|
|
358
410
|
# emerge resolves when the name is unique in the tree.
|
|
411
|
+
"apt": {
|
|
412
|
+
"cudnn": "nvidia-cudnn",
|
|
413
|
+
},
|
|
359
414
|
"emerge": {
|
|
360
415
|
"ibus": "app-i18n/ibus",
|
|
361
416
|
"gir1.2-ibus-1.0": "app-i18n/ibus", # typelib comes with USE=introspection
|
|
@@ -367,6 +422,7 @@ _PKG_NAMES: dict[str, dict[str, str]] = {
|
|
|
367
422
|
"xclip": "x11-misc/xclip",
|
|
368
423
|
"wl-clipboard": "gui-apps/wl-clipboard",
|
|
369
424
|
"wtype": "gui-apps/wtype",
|
|
425
|
+
"cudnn": "dev-libs/cudnn",
|
|
370
426
|
},
|
|
371
427
|
"nix": {
|
|
372
428
|
"gir1.2-ibus-1.0": "ibus",
|
|
@@ -412,6 +468,87 @@ def pkg_install(*packages: str) -> str:
|
|
|
412
468
|
return f"{prefix} {' '.join(mapped)}"
|
|
413
469
|
|
|
414
470
|
|
|
471
|
+
# ── CUDA libraries ───────────────────────────────────────────────────────────
|
|
472
|
+
|
|
473
|
+
# What CTranslate2 4.x's CUDA build loads at the first encode.
|
|
474
|
+
CUDA_LIBS = ("libcublas.so.12", "libcudnn.so.9")
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
def missing_cuda_libs() -> list[str] | None:
|
|
478
|
+
"""The CUDA_LIBS the loader can't open, or None when CTranslate2 sees no
|
|
479
|
+
NVIDIA GPU (or has no CUDA build). [] means the GPU is usable."""
|
|
480
|
+
try:
|
|
481
|
+
import ctranslate2
|
|
482
|
+
if ctranslate2.get_cuda_device_count() == 0:
|
|
483
|
+
return None
|
|
484
|
+
except Exception: # noqa: BLE001 — no faster-whisper, or no CUDA build
|
|
485
|
+
return None
|
|
486
|
+
import ctypes
|
|
487
|
+
missing = []
|
|
488
|
+
for lib in CUDA_LIBS:
|
|
489
|
+
try:
|
|
490
|
+
ctypes.CDLL(lib)
|
|
491
|
+
except OSError:
|
|
492
|
+
missing.append(lib)
|
|
493
|
+
return missing
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
def nvidia_gpu_present() -> bool:
|
|
497
|
+
"""An NVIDIA GPU with its kernel driver loaded, asked of the OS rather
|
|
498
|
+
than of CTranslate2 (which reports 0 devices when libcuda won't load)."""
|
|
499
|
+
if os.path.exists("/proc/driver/nvidia/version") or os.path.exists("/dev/nvidia0"):
|
|
500
|
+
return True
|
|
501
|
+
if not shutil.which("nvidia-smi"):
|
|
502
|
+
return False
|
|
503
|
+
import subprocess
|
|
504
|
+
try:
|
|
505
|
+
r = subprocess.run(["nvidia-smi", "-L"], capture_output=True, text=True, timeout=3)
|
|
506
|
+
except (OSError, subprocess.SubprocessError):
|
|
507
|
+
return False
|
|
508
|
+
return r.returncode == 0 and "GPU" in r.stdout
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
def cuda_device_problem() -> str:
|
|
512
|
+
"""Why CTranslate2 sees no CUDA device on a machine that has an NVIDIA
|
|
513
|
+
GPU, or "" (no GPU, no CTranslate2, or it sees the device)."""
|
|
514
|
+
try:
|
|
515
|
+
import ctranslate2
|
|
516
|
+
except Exception: # noqa: BLE001 — no faster-whisper installed
|
|
517
|
+
return ""
|
|
518
|
+
try:
|
|
519
|
+
if ctranslate2.get_cuda_device_count() > 0:
|
|
520
|
+
return ""
|
|
521
|
+
except Exception: # noqa: BLE001 — treat a failing query as no device
|
|
522
|
+
pass
|
|
523
|
+
if not nvidia_gpu_present():
|
|
524
|
+
return ""
|
|
525
|
+
import ctypes
|
|
526
|
+
try:
|
|
527
|
+
ctypes.CDLL("libcuda.so.1")
|
|
528
|
+
why = ""
|
|
529
|
+
except OSError:
|
|
530
|
+
why = " (libcuda.so.1 can't be loaded)"
|
|
531
|
+
return (f"NVIDIA GPU found, but CTranslate2 sees no CUDA device{why}: check that "
|
|
532
|
+
"the driver's libcuda.so.1 loads (ldconfig -p | grep libcuda.so.1) and "
|
|
533
|
+
"that nvidia-smi works.")
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
def cuda_libs_hint(missing: list[str]) -> str:
|
|
537
|
+
"""Where to look for the libraries missing_cuda_libs() named."""
|
|
538
|
+
hint = ""
|
|
539
|
+
if any("cudnn" in lib for lib in missing):
|
|
540
|
+
hint = "cuDNN 9 is a separate package from the CUDA toolkit"
|
|
541
|
+
# Only the managers whose package name we know; others stay generic.
|
|
542
|
+
mgr = _detect_pkg_manager()
|
|
543
|
+
if "cudnn" in _PKG_NAMES.get(mgr, {}):
|
|
544
|
+
# Older Debian/Ubuntu releases package cuDNN 8; NVIDIA's repo has 9.
|
|
545
|
+
alt = " or NVIDIA's CUDA repo" if mgr == "apt" else ""
|
|
546
|
+
hint += f" ({pkg_install('cudnn')}{alt})"
|
|
547
|
+
hint += ". "
|
|
548
|
+
return (hint + "The libraries must be on the loader path: "
|
|
549
|
+
"ldconfig -p | grep -E 'cublas.so.12|cudnn.so.9'")
|
|
550
|
+
|
|
551
|
+
|
|
415
552
|
# ── System-dependency preflight ──────────────────────────────────────────────
|
|
416
553
|
#
|
|
417
554
|
# The #1 install funnel killer is missing *system* packages: a C toolchain to
|
voiceio/setup/noninteractive.py
CHANGED
|
@@ -85,6 +85,10 @@ def run_setup_noninteractive(answers: dict | None = None, *, install_deps: bool
|
|
|
85
85
|
if install_deps or answers.get("install_system_deps"):
|
|
86
86
|
argv = plat.privileged_argv(cmd.split())
|
|
87
87
|
if argv is None:
|
|
88
|
+
if not plat.has_privilege_tool():
|
|
89
|
+
return _fail("preflight", "no sudo, doas or pkexec: run this as root "
|
|
90
|
+
f"(e.g. with su), then re-run setup: "
|
|
91
|
+
f"{plat.as_root_command(cmd.split())}", 4)
|
|
88
92
|
return _fail("preflight", "no terminal for sudo to ask a password and no "
|
|
89
93
|
f"pkexec: run it yourself, then re-run setup: {cmd}", 4)
|
|
90
94
|
_progress("preflight", status="installing", cmd=repr(" ".join(argv)))
|
voiceio/setup/steps.py
CHANGED
|
@@ -179,16 +179,34 @@ def _print_capability_checks(checks: dict) -> None:
|
|
|
179
179
|
"fallback" if checks["xdotool"] else f"optional: {pkg_install('xdotool')}",
|
|
180
180
|
optional=True)
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
"will use GPU" if checks["cuda"] else "will use CPU (still fast)",
|
|
184
|
-
optional=True)
|
|
182
|
+
_print_cuda_check(checks)
|
|
185
183
|
|
|
186
184
|
if checks["is_linux"]:
|
|
185
|
+
from voiceio.hotkeys.evdev import NOT_NEEDED_ON_X11
|
|
187
186
|
from voiceio.hotkeys.evdev import access_hint as evdev_access_hint
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
if checks["evdev_access"]:
|
|
188
|
+
_print_check("Keyboard access (evdev)", True, "evdev hotkeys available")
|
|
189
|
+
elif checks.get("evdev_optional"):
|
|
190
|
+
_print_check("Keyboard access (evdev)", False, NOT_NEEDED_ON_X11, optional=True)
|
|
191
|
+
else:
|
|
192
|
+
_print_check("Keyboard access (evdev)", False, evdev_access_hint())
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def _print_cuda_check(checks: dict) -> None:
|
|
196
|
+
missing = checks.get("cuda_missing")
|
|
197
|
+
if missing: # an NVIDIA GPU, but CTranslate2 can't load its libraries
|
|
198
|
+
from voiceio.platform import cuda_libs_hint
|
|
199
|
+
_print_check("CUDA GPU", False,
|
|
200
|
+
f"GPU found, but {', '.join(missing)} can't be loaded: will use CPU",
|
|
201
|
+
optional=True)
|
|
202
|
+
print(f" {DIM}{cuda_libs_hint(missing)}{RESET}")
|
|
203
|
+
elif problem := checks.get("cuda_device_problem"):
|
|
204
|
+
_print_check("CUDA GPU", False, "will use CPU", optional=True)
|
|
205
|
+
print(f" {DIM}{problem}{RESET}")
|
|
206
|
+
else:
|
|
207
|
+
_print_check("CUDA GPU", checks["cuda"],
|
|
208
|
+
"will use GPU" if checks["cuda"] else "will use CPU (still fast)",
|
|
209
|
+
optional=True)
|
|
192
210
|
|
|
193
211
|
|
|
194
212
|
def _print_tray_check() -> bool:
|
voiceio/setup/system.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""System probes for setup: binaries, audio/GPU/evdev checks, system-package preflight."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
import os
|
|
5
4
|
import shutil
|
|
6
5
|
import subprocess
|
|
7
6
|
import sys
|
|
@@ -79,9 +78,12 @@ def _check_system() -> dict:
|
|
|
79
78
|
elif _is_mac:
|
|
80
79
|
checks["display"] = "darwin"
|
|
81
80
|
else:
|
|
82
|
-
|
|
81
|
+
# XDG_SESSION_TYPE, else WAYLAND_DISPLAY/DISPLAY (startx sessions
|
|
82
|
+
# often have XDG_SESSION_TYPE=tty).
|
|
83
|
+
from voiceio.platform import _detect_display_server
|
|
84
|
+
checks["display"] = _detect_display_server()
|
|
83
85
|
|
|
84
|
-
# pynput
|
|
86
|
+
# pynput: the Windows/macOS backend, and the first hotkey backend on X11
|
|
85
87
|
checks["pynput"] = False
|
|
86
88
|
if _is_win or _is_mac:
|
|
87
89
|
try:
|
|
@@ -89,6 +91,9 @@ def _check_system() -> dict:
|
|
|
89
91
|
checks["pynput"] = True
|
|
90
92
|
except ImportError:
|
|
91
93
|
pass
|
|
94
|
+
elif checks["display"] == "x11":
|
|
95
|
+
from voiceio.hotkeys.pynput_backend import PynputHotkey
|
|
96
|
+
checks["pynput"] = PynputHotkey().probe().ok
|
|
92
97
|
|
|
93
98
|
# Linux-only typer binaries
|
|
94
99
|
checks["xdotool"] = _check_binary("xdotool") if checks["is_linux"] else False
|
|
@@ -126,12 +131,21 @@ def _check_system() -> dict:
|
|
|
126
131
|
checks["cuda"] = "cuda" in ctranslate2.get_supported_compute_types("cuda")
|
|
127
132
|
except Exception:
|
|
128
133
|
checks["cuda"] = False
|
|
134
|
+
from voiceio.platform import missing_cuda_libs
|
|
135
|
+
checks["cuda_missing"] = missing_cuda_libs() # None: CTranslate2 sees no GPU
|
|
136
|
+
if checks["cuda_missing"] is None:
|
|
137
|
+
from voiceio.platform import cuda_device_problem
|
|
138
|
+
checks["cuda_device_problem"] = cuda_device_problem()
|
|
129
139
|
|
|
130
140
|
# evdev keyboard access (Linux only): udev uaccess rule or input group
|
|
131
141
|
checks["evdev_access"] = False
|
|
132
142
|
if checks["is_linux"]:
|
|
133
143
|
from voiceio.hotkeys.evdev import EvdevHotkey
|
|
134
144
|
checks["evdev_access"] = EvdevHotkey().probe().ok
|
|
145
|
+
# On X11 pynput covers the hotkey; the udev rule (root) is not needed.
|
|
146
|
+
from voiceio.hotkeys.evdev import evdev_optional
|
|
147
|
+
checks["evdev_optional"] = checks["is_linux"] and evdev_optional(
|
|
148
|
+
checks["display"], checks["pynput"])
|
|
135
149
|
|
|
136
150
|
return checks
|
|
137
151
|
|
|
@@ -165,8 +179,8 @@ def _preflight_deps(interactive: bool = True, install_deps: bool = False) -> Non
|
|
|
165
179
|
|
|
166
180
|
argv = plat.privileged_argv(cmd.split())
|
|
167
181
|
if argv is None:
|
|
168
|
-
print(f" {YELLOW}⚠{RESET}
|
|
169
|
-
print(f" {DIM}
|
|
182
|
+
print(f" {YELLOW}⚠{RESET}{plat.privilege_unavailable_message(cmd.split())}")
|
|
183
|
+
print(f" {DIM}Then re-run setup.{RESET}")
|
|
170
184
|
return
|
|
171
185
|
print(f"\n {CYAN}Running:{RESET} {' '.join(argv)}\n")
|
|
172
186
|
try:
|
voiceio/typers/ydotool.py
CHANGED
|
@@ -22,19 +22,22 @@ UINPUT_UDEV_RULE = 'KERNEL=="uinput", GROUP="input", MODE="0660", TAG+="uaccess"
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def uinput_udev_install_cmd() -> list[str]:
|
|
25
|
-
"""argv that installs the udev rule and reloads it
|
|
25
|
+
"""argv that installs the udev rule and reloads it, as root.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
One root ``sh -c`` so the whole privileged action is visible as one
|
|
28
|
+
string in the consent prompt; platform.privileged_argv swaps the leading
|
|
29
|
+
sudo for doas or pkexec when needed. `mkdir -p` because some distros
|
|
30
|
+
(Gentoo) ship no /etc/udev/rules.d.
|
|
29
31
|
"""
|
|
32
|
+
rules_dir = os.path.dirname(UINPUT_UDEV_RULE_PATH)
|
|
30
33
|
script = (
|
|
31
|
-
f"
|
|
32
|
-
f"
|
|
33
|
-
f"&&
|
|
34
|
-
f"&&
|
|
35
|
-
f"&&
|
|
34
|
+
f"mkdir -p {shlex.quote(rules_dir)} "
|
|
35
|
+
f"&& printf %s {shlex.quote(UINPUT_UDEV_RULE)} > {UINPUT_UDEV_RULE_PATH} "
|
|
36
|
+
f"&& modprobe uinput "
|
|
37
|
+
f"&& udevadm control --reload-rules "
|
|
38
|
+
f"&& udevadm trigger /dev/uinput"
|
|
36
39
|
)
|
|
37
|
-
return ["sh", "-c", script]
|
|
40
|
+
return ["sudo", "sh", "-c", script]
|
|
38
41
|
|
|
39
42
|
|
|
40
43
|
def uinput_manual_instructions() -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|