Fix gpio mapping on amd64 systems
"""Init file for HassIO addon docker object."""
import logging
import os
+from pathlib import Path
import docker
import requests
@@ -204,12 +205,12 @@ class DockerAddon(DockerInterface):
# GPIO support
if self.addon.with_gpio:
+ for gpio_path in ("/sys/class/gpio", "/sys/devices/platform/soc"):
+ if not Path(gpio_path).exists():
+ continue
volumes.update({
- "/sys/class/gpio": {
- 'bind': "/sys/class/gpio", 'mode': 'rw'
- },
- "/sys/devices/platform/soc": {
- 'bind': "/sys/devices/platform/soc", 'mode': 'rw'
+ gpio_path: {
+ 'bind': gpio_path, 'mode': 'rw'
},
})
