Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New hardware layer Supervisor #784

Merged
merged 7 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/add-ons/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ The configuration for an add-on is stored in `config.json`.
| host_ipc | bool | no | Default `false`. Allow to share the IPC namespace with others.
| host_dbus | bool | no | Default `false`. Map the host D-Bus service into the add-on.
| host_pid | bool | no | Default `false`. Allow to run container on host PID namespace. Works only for not protected add-ons.
| devices | list | no | Device list to map into the add-on. Format is: `<path_on_host>:<path_in_container>:<cgroup_permissions>`. E.g., `/dev/ttyAMA0:/dev/ttyAMA0:rwm`
| udev | bool | no | Default `false`. Set this `true`, if your container runs an udev process of its own.
| auto_uart | bool | no | Default `false`. Auto mapping all UART/serial device from host into add-on.
| devices | list | no | Device list to map into the add-on. Format is: `<path_on_host>`. E.g., `/dev/ttyAMA0`
| homeassistant | string | no | Pin a minimum required Home Assistant Core version for the add-on. Value is a version string like `0.91.2`.
| hassio_role | str | no | Default `default`. Role-based access to Supervisor API. Available: `default`, `homeassistant`, `backup`, `manager` or `admin`
| hassio_api | bool | no | This add-on can access the Supervisor's REST API. Use `http://supervisor`.
Expand All @@ -142,6 +140,8 @@ The configuration for an add-on is stored in `config.json`.
| video | bool | no | Mark this add-on to use the internal video system. All available devices will be mapped into the add-on.
| gpio | bool | no | If this is set to `true`, `/sys/class/gpio` will map into add-on for access to GPIO interface from kernel. Some libraries also need `/dev/mem` and `SYS_RAWIO` for read/write access to this device. On systems with AppArmor enabled, you need to disable AppArmor or provide you own profile for the add-on, which is better for security.
| usb | bool | no | If this is set to `true`, it would map the raw USB access `/dev/bus/usb` into add-on with plug&play support.
| uart | bool | no | Default `false`. Auto mapping all UART/serial devices from the host into the add-on.
| udev | bool | no | Default `false`. Set this `true`, gets the host udev database read-only mounted into the add-on.
| devicetree | bool | no | Boolean. If this is set to True, `/device-tree` will map into add-on.
| kernel_modules | bool | no | Map host kernel modules and config into add-on (readonly).
| stdin | bool | no | Boolean. If enabled, you can use the STDIN with Home Assistant API.
Expand Down Expand Up @@ -212,6 +212,7 @@ We support:
- `port`
- `match(REGEX)`
- `list(val1|val2|...)`
- `device` / `device(filter)`: Device filter can be following format: `subsystem=TYPE` i.e. `subsystem=tty` for serial devices.

## Add-on extended build

Expand Down
33 changes: 17 additions & 16 deletions docs/api/supervisor/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -1092,23 +1092,27 @@ Get hardware information.

```json
{
"serial": ["/dev/xy"],
"input": ["Input device name"],
"disk": ["/dev/sdax"],
"gpio": ["gpiochip0", "gpiochip100"],
"audio": {
"CARD_ID": {
"name": "xy",
"type": "microphone",
"devices": [
"chan_id": "channel ID",
"chan_type": "type of device"
]
"devices": [
{
"name": "ttyACM0",
"sysfs": "/sys/devices/usb/00:01",
"dev_path": "/dev/ttyACM0",
"by_id": "/dev/serial/by-id/usb-Silicon_Labs-RFUSB_9017F723B061A7C01410CFCF-if00-port1",
"subsystem": "tty",
"attributes": {
"MINOR": "5"
}
}
}
]
}
```

**Returned data:**

| key | description |
| -------- | ------------------------------------------------------------ |
| devices | A list of [Device models](api/supervisor/models.md#device) |

</ApiEndpoint>

<ApiEndpoint path="/hardware/audio" method="get">
Expand All @@ -1132,9 +1136,6 @@ Get audio devices

</ApiEndpoint>

<ApiEndpoint path="/hardware/trigger" method="post">
Trigger UDEV reload.
</ApiEndpoint>

### Host

Expand Down
11 changes: 11 additions & 0 deletions docs/api/supervisor/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,14 @@ These models are describing objects that are getting returned from the superviso
| type | str | Type of the suggestion |
| context | str | In which context the suggestion occorse |
| reference | str or null | Depend on the Context, a reference to a other Model |

## Device

| key | type | description |
| ---------- | -------------- | --------------------------------------------------------------------- |
| name | string | Name of the device object |
| sysfs | string | Path to sysfs device object |
| dev_path | string | Path to devfs |
| subsystem | string or null | Subsystem type of the device (tty, input, sound, block, misc) |
| by_id | string or null | Udev by ID link |
| attributes | dict | A dict with pure udev device attributes for debug and understanding |