Added option to run as rootless user
This commit is contained in:
parent
09ecad4981
commit
c026b357a0
2 changed files with 6 additions and 4 deletions
|
|
@ -103,9 +103,6 @@ def toggle_input_plugin(toggle):
|
||||||
:raises Exception: If the units can't be reloaded
|
:raises Exception: If the units can't be reloaded
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if os.geteuid() != 0:
|
|
||||||
raise PermissionError("The input plugin must be toggled as root")
|
|
||||||
|
|
||||||
service_path = "/lib/systemd/system/bluetooth.service"
|
service_path = "/lib/systemd/system/bluetooth.service"
|
||||||
service = None
|
service = None
|
||||||
with open(service_path, "r") as f:
|
with open(service_path, "r") as f:
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,10 @@ class Nxbt():
|
||||||
|
|
||||||
# Disable the BlueZ input plugin so we can use the
|
# Disable the BlueZ input plugin so we can use the
|
||||||
# HID control/interrupt Bluetooth ports
|
# HID control/interrupt Bluetooth ports
|
||||||
toggle_input_plugin(False)
|
try:
|
||||||
|
toggle_input_plugin(False)
|
||||||
|
except PermissionError:
|
||||||
|
pass
|
||||||
|
|
||||||
# Exit handler
|
# Exit handler
|
||||||
atexit.register(self._on_exit)
|
atexit.register(self._on_exit)
|
||||||
|
|
@ -661,6 +664,7 @@ class Nxbt():
|
||||||
"initializing" or
|
"initializing" or
|
||||||
"connecting" or
|
"connecting" or
|
||||||
"reconnecting" or
|
"reconnecting" or
|
||||||
|
"connected" or
|
||||||
"crashed"
|
"crashed"
|
||||||
"finished_macros":
|
"finished_macros":
|
||||||
A list of UUIDs
|
A list of UUIDs
|
||||||
|
|
@ -771,6 +775,7 @@ class _ControllerManager():
|
||||||
def remove_controller(self, index):
|
def remove_controller(self, index):
|
||||||
|
|
||||||
self._children[index].kill()
|
self._children[index].kill()
|
||||||
|
self.state.pop(index, None)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue