mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 02:56:31 +00:00
Support for udev device trigger (#1272)
This commit is contained in:
parent
c563f484c9
commit
3d665b9eec
@ -41,7 +41,7 @@ ADDONS_API_BYPASS = re.compile(
|
||||
r"^(?:"
|
||||
r"|/addons/self/(?!security|update)[^/]+"
|
||||
r"|/info"
|
||||
r"|/hardware/.+"
|
||||
r"|/hardware/trigger"
|
||||
r"|/services.*"
|
||||
r"|/discovery.*"
|
||||
r"|/auth"
|
||||
|
@ -188,3 +188,10 @@ class JsonFileError(HassioError):
|
||||
|
||||
class DockerAPIError(HassioError):
|
||||
"""Docker API error."""
|
||||
|
||||
|
||||
# Hardware
|
||||
|
||||
|
||||
class HardwareNotSupportedError(HassioNotSupportedError):
|
||||
"""Raise if hardware function is not supported."""
|
||||
|
@ -9,6 +9,7 @@ from typing import Any, Dict, Optional, Set
|
||||
import pyudev
|
||||
|
||||
from ..const import ATTR_DEVICES, ATTR_NAME, ATTR_TYPE, CHAN_ID, CHAN_TYPE
|
||||
from ..exceptions import HardwareNotSupportedError
|
||||
|
||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||
|
||||
@ -155,5 +156,8 @@ class Hardware:
|
||||
proc = await asyncio.create_subprocess_exec("udevadm", "trigger")
|
||||
|
||||
await proc.wait()
|
||||
if proc.returncode != 0:
|
||||
if proc.returncode == 0:
|
||||
return
|
||||
|
||||
_LOGGER.waring("udevadm device triggering fails!")
|
||||
raise HardwareNotSupportedError()
|
||||
|
Loading…
x
Reference in New Issue
Block a user