Tom-Hirschberger / MMM-GPIO-Notifications

Magic Mirror² Module which sends custom notifications based on GPIO events
MIT License
13 stars 3 forks source link

No GPIO device gpiochip4 #35

Closed Aergernis closed 1 month ago

Aergernis commented 2 months ago

Hi,

it seems there was a Systemupdate and after restarting the Pi5B, there is no gpiochip4 device anymore. only gpiochip0 is avaliable.

0|MagicMirror  | [2024-09-06 11:31:42.262] [LOG]   MMM-GPIO-Notifications: Using naming schema RaspberryPi_5B
0|MagicMirror  | [2024-09-06 11:31:42.263] [LOG]   MMM-GPIO-Notifications: Trying to registering pin: 4
0|MagicMirror  | [2024-09-06 11:31:42.263] [LOG]   MMM-GPIO-Notifications: Using chip (4) and line (4) info of GPIO4
0|MagicMirror  | [2024-09-06 11:31:42.264] [LOG]   MMM-GPIO-Notifications: Watched pin: 4 has low state delay of 1000!
0|MagicMirror  | [2024-09-06 11:31:42.264] [LOG]   MMM-GPIO-Notifications: Watched pin: 4 has high state delay of 1000!
0|MagicMirror  | terminate called after throwing an instance of 'std::system_error'
0|MagicMirror  |   what():  cannot open GPIO device gpiochip4: No such file or directory

Edit:

gpioinfo.json:

{
    "gpios": {
        "ID_SDA": [
            0,
            0
        ],
        "ID_SCL": [
            0,
            1
        ],
        "GPIO2": [
            0,
            2
        ],
        "GPIO3": [
            0,
            3
        ],
        "GPIO4": [
            0,
            4
        ],
        "GPIO5": [
            0,
            5
        ],
        "GPIO6": [
            0,
            6
        ],
        "GPIO7": [
            0,
            7
        ],
        "GPIO8": [
            0,
            8
        ],
        "GPIO9": [
            0,
            9
        ],
        "GPIO10": [
            0,
            10
        ],
        "GPIO11": [
            0,
            11
        ],
        "GPIO12": [
            0,
            12
        ],
        "GPIO13": [
            0,
            13
        ],
        "GPIO14": [
            0,
            14
        ],
        "GPIO15": [
            0,
            15
        ],
        "GPIO16": [
            0,
            16
        ],
        "GPIO17": [
            0,
            17
        ],
        "GPIO18": [
            0,
            18
        ],
        "GPIO19": [
            0,
            19
        ],
        "GPIO20": [
            0,
            20
        ],
        "GPIO21": [
            0,
            21
        ],
        "GPIO22": [
            0,
            22
        ],
        "GPIO23": [
            0,
            23
        ],
        "GPIO24": [
            0,
            24
        ],
        "GPIO25": [
            0,
            25
        ],
        "GPIO26": [
            0,
            26
        ],
        "GPIO27": [
            0,
            27
        ],
        "PCIE_RP1_WAKE": [
            0,
            28
        ],
        "FAN_TACH": [
            0,
            29
        ],
        "HOST_SDA": [
            0,
            30
        ],
        "HOST_SCL": [
            0,
            31
        ],
        "ETH_RST_N": [
            0,
            32
        ],
        "-": [
            12,
            16
        ],
        "CD0_IO0_MICCLK": [
            0,
            34
        ],
        "CD0_IO0_MICDAT0": [
            0,
            35
        ],
        "RP1_PCIE_CLKREQ_N": [
            0,
            36
        ],
        "CD0_SDA": [
            0,
            38
        ],
        "CD0_SCL": [
            0,
            39
        ],
        "CD1_SDA": [
            0,
            40
        ],
        "CD1_SCL": [
            0,
            41
        ],
        "USB_VBUS_EN": [
            0,
            42
        ],
        "USB_OC_N": [
            0,
            43
        ],
        "RP1_STAT_LED": [
            0,
            44
        ],
        "FAN_PWM": [
            0,
            45
        ],
        "CD1_IO0_MICCLK": [
            0,
            46
        ],
        "2712_WAKE": [
            12,
            8
        ],
        "CD1_IO1_MICDAT1": [
            0,
            48
        ],
        "EN_MAX_USB_CUR": [
            0,
            49
        ],
        "2712_BOOT_CS_N": [
            10,
            1
        ],
        "2712_BOOT_MISO": [
            10,
            2
        ],
        "2712_BOOT_MOSI": [
            10,
            3
        ],
        "2712_BOOT_SCLK": [
            10,
            4
        ],
        "PCIE_SDA": [
            10,
            14
        ],
        "PCIE_SCL": [
            10,
            15
        ],
        "PWR_GPIO": [
            10,
            20
        ],
        "2712_G21_FS": [
            10,
            21
        ],
        "BT_RTS": [
            10,
            24
        ],
        "BT_CTS": [
            10,
            25
        ],
        "BT_TXD": [
            10,
            26
        ],
        "BT_RXD": [
            10,
            27
        ],
        "WL_ON": [
            10,
            28
        ],
        "BT_ON": [
            10,
            29
        ],
        "WIFI_SDIO_CLK": [
            10,
            30
        ],
        "WIFI_SDIO_CMD": [
            10,
            31
        ],
        "WIFI_SDIO_D0": [
            11,
            0
        ],
        "WIFI_SDIO_D1": [
            11,
            1
        ],
        "WIFI_SDIO_D2": [
            11,
            2
        ],
        "WIFI_SDIO_D3": [
            11,
            3
        ],
        "RP1_SDA": [
            12,
            0
        ],
        "RP1_SCL": [
            12,
            1
        ],
        "RP1_RUN": [
            12,
            2
        ],
        "SD_IOVDD_SEL": [
            12,
            3
        ],
        "SD_PWR_ON": [
            12,
            4
        ],
        "SD_CDET_N": [
            12,
            5
        ],
        "SD_FLG_N": [
            12,
            6
        ],
        "2712_STAT_LED": [
            12,
            9
        ],
        "PMIC_INT": [
            12,
            12
        ],
        "UART_TX_FS": [
            12,
            13
        ],
        "UART_RX_FS": [
            12,
            14
        ],
        "HDMI0_SCL": [
            13,
            0
        ],
        "HDMI0_SDA": [
            13,
            1
        ],
        "HDMI1_SCL": [
            13,
            2
        ],
        "HDMI1_SDA": [
            13,
            3
        ],
        "PMIC_SCL": [
            13,
            4
        ],
        "PMIC_SDA": [
            13,
            5
        ]
    },
    "chips": {
        "gpiochip0": {
            "ID_SDA": 0,
            "ID_SCL": 1,
            "GPIO2": 2,
            "GPIO3": 3,
            "GPIO4": 4,
            "GPIO5": 5,
            "GPIO6": 6,
            "GPIO7": 7,
            "GPIO8": 8,
            "GPIO9": 9,
            "GPIO10": 10,
            "GPIO11": 11,
            "GPIO12": 12,
            "GPIO13": 13,
            "GPIO14": 14,
            "GPIO15": 15,
            "GPIO16": 16,
            "GPIO17": 17,
            "GPIO18": 18,
            "GPIO19": 19,
            "GPIO20": 20,
            "GPIO21": 21,
            "GPIO22": 22,
            "GPIO23": 23,
            "GPIO24": 24,
            "GPIO25": 25,
            "GPIO26": 26,
            "GPIO27": 27,
            "PCIE_RP1_WAKE": 28,
            "FAN_TACH": 29,
            "HOST_SDA": 30,
            "HOST_SCL": 31,
            "ETH_RST_N": 32,
            "-": 53,
            "CD0_IO0_MICCLK": 34,
            "CD0_IO0_MICDAT0": 35,
            "RP1_PCIE_CLKREQ_N": 36,
            "CD0_SDA": 38,
            "CD0_SCL": 39,
            "CD1_SDA": 40,
            "CD1_SCL": 41,
            "USB_VBUS_EN": 42,
            "USB_OC_N": 43,
            "RP1_STAT_LED": 44,
            "FAN_PWM": 45,
            "CD1_IO0_MICCLK": 46,
            "2712_WAKE": 47,
            "CD1_IO1_MICDAT1": 48,
            "EN_MAX_USB_CUR": 49
        },
        "gpiochip10": {
            "-": 23,
            "2712_BOOT_CS_N": 1,
            "2712_BOOT_MISO": 2,
            "2712_BOOT_MOSI": 3,
            "2712_BOOT_SCLK": 4,
            "PCIE_SDA": 14,
            "PCIE_SCL": 15,
            "PWR_GPIO": 20,
            "2712_G21_FS": 21,
            "BT_RTS": 24,
            "BT_CTS": 25,
            "BT_TXD": 26,
            "BT_RXD": 27,
            "WL_ON": 28,
            "BT_ON": 29,
            "WIFI_SDIO_CLK": 30,
            "WIFI_SDIO_CMD": 31
        },
        "gpiochip11": {
            "WIFI_SDIO_D0": 0,
            "WIFI_SDIO_D1": 1,
            "WIFI_SDIO_D2": 2,
            "WIFI_SDIO_D3": 3
        },
        "gpiochip12": {
            "RP1_SDA": 0,
            "RP1_SCL": 1,
            "RP1_RUN": 2,
            "SD_IOVDD_SEL": 3,
            "SD_PWR_ON": 4,
            "SD_CDET_N": 5,
            "SD_FLG_N": 6,
            "-": 16,
            "2712_WAKE": 8,
            "2712_STAT_LED": 9,
            "PMIC_INT": 12,
            "UART_TX_FS": 13,
            "UART_RX_FS": 14
        },
        "gpiochip13": {
            "HDMI0_SCL": 0,
            "HDMI0_SDA": 1,
            "HDMI1_SCL": 2,
            "HDMI1_SDA": 3,
            "PMIC_SCL": 4,
            "PMIC_SDA": 5
        }
    }
}
Aergernis commented 2 months ago

Just to be sure that it was a update i flashed a new stock image with Raspberry Pi Imager, run the convertGpioInfo2Json and generated a new gpioinfo.json. gpiochip4 was present at this time.

Before Updating System:

       _,met$$$$$gg.          pi@MagicMirror
    ,g$$$$$$$$$$$$$$$P.       --------------
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 12 (bookworm) aarch64
 ,$$P'              `$$$.     Host: Raspberry Pi 5 Model B Rev 1.0
',$$P       ,ggs.     `$$b:   Kernel: 6.6.31+rpt-rpi-2712
`d$$'     ,$P"'   .    $$$    Uptime: 25 mins
 $$P      d$'     ,    $$P    Packages: 1926 (dpkg)
 $$:      $$.   -    ,d$$'    Shell: bash 5.2.15
 $$;      Y$b._   _,d$P'      Resolution: 1920x1080
 Y$$.    `.`"Y$$$$P"'         Terminal: /dev/pts/0
 `$$b      "-.__              CPU: (4) @ 2.400GHz
  `Y$$                        Memory: 728MiB / 8048MiB
   `Y$$.
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""
{
    "gpios": {
        "-": [
            4,
            53
        ],
        "2712_BOOT_CS_N": [
            0,
            1
        ],
        "2712_BOOT_MISO": [
            0,
            2
        ],
        "2712_BOOT_MOSI": [
            0,
            3
        ],
        "2712_BOOT_SCLK": [
            0,
            4
        ],
        "PCIE_SDA": [
            0,
            14
        ],
        "PCIE_SCL": [
            0,
            15
        ],
        "PWR_GPIO": [
            0,
            20
        ],
        "2712_G21_FS": [
            0,
            21
        ],
        "BT_RTS": [
            0,
            24
        ],
        "BT_CTS": [
            0,
            25
        ],
        "BT_TXD": [
            0,
            26
        ],
        "BT_RXD": [
            0,
            27
        ],
        "WL_ON": [
            0,
            28
        ],
        "BT_ON": [
            0,
            29
        ],
        "WIFI_SDIO_CLK": [
            0,
            30
        ],
        "WIFI_SDIO_CMD": [
            0,
            31
        ],
        "WIFI_SDIO_D0": [
            1,
            0
        ],
        "WIFI_SDIO_D1": [
            1,
            1
        ],
        "WIFI_SDIO_D2": [
            1,
            2
        ],
        "WIFI_SDIO_D3": [
            1,
            3
        ],
        "RP1_SDA": [
            2,
            0
        ],
        "RP1_SCL": [
            2,
            1
        ],
        "RP1_RUN": [
            2,
            2
        ],
        "SD_IOVDD_SEL": [
            2,
            3
        ],
        "SD_PWR_ON": [
            2,
            4
        ],
        "SD_CDET_N": [
            2,
            5
        ],
        "SD_FLG_N": [
            2,
            6
        ],
        "2712_WAKE": [
            4,
            47
        ],
        "2712_STAT_LED": [
            2,
            9
        ],
        "PMIC_INT": [
            2,
            12
        ],
        "UART_TX_FS": [
            2,
            13
        ],
        "UART_RX_FS": [
            2,
            14
        ],
        "HDMI0_SCL": [
            3,
            0
        ],
        "HDMI0_SDA": [
            3,
            1
        ],
        "HDMI1_SCL": [
            3,
            2
        ],
        "HDMI1_SDA": [
            3,
            3
        ],
        "PMIC_SCL": [
            3,
            4
        ],
        "PMIC_SDA": [
            3,
            5
        ],
        "ID_SDA": [
            4,
            0
        ],
        "ID_SCL": [
            4,
            1
        ],
        "GPIO2": [
            4,
            2
        ],
        "GPIO3": [
            4,
            3
        ],
        "GPIO4": [
            4,
            4
        ],
        "GPIO5": [
            4,
            5
        ],
        "GPIO6": [
            4,
            6
        ],
        "GPIO7": [
            4,
            7
        ],
        "GPIO8": [
            4,
            8
        ],
        "GPIO9": [
            4,
            9
        ],
        "GPIO10": [
            4,
            10
        ],
        "GPIO11": [
            4,
            11
        ],
        "GPIO12": [
            4,
            12
        ],
        "GPIO13": [
            4,
            13
        ],
        "GPIO14": [
            4,
            14
        ],
        "GPIO15": [
            4,
            15
        ],
        "GPIO16": [
            4,
            16
        ],
        "GPIO17": [
            4,
            17
        ],
        "GPIO18": [
            4,
            18
        ],
        "GPIO19": [
            4,
            19
        ],
        "GPIO20": [
            4,
            20
        ],
        "GPIO21": [
            4,
            21
        ],
        "GPIO22": [
            4,
            22
        ],
        "GPIO23": [
            4,
            23
        ],
        "GPIO24": [
            4,
            24
        ],
        "GPIO25": [
            4,
            25
        ],
        "GPIO26": [
            4,
            26
        ],
        "GPIO27": [
            4,
            27
        ],
        "PCIE_RP1_WAKE": [
            4,
            28
        ],
        "FAN_TACH": [
            4,
            29
        ],
        "HOST_SDA": [
            4,
            30
        ],
        "HOST_SCL": [
            4,
            31
        ],
        "ETH_RST_N": [
            4,
            32
        ],
        "CD0_IO0_MICCLK": [
            4,
            34
        ],
        "CD0_IO0_MICDAT0": [
            4,
            35
        ],
        "RP1_PCIE_CLKREQ_N": [
            4,
            36
        ],
        "CD0_SDA": [
            4,
            38
        ],
        "CD0_SCL": [
            4,
            39
        ],
        "CD1_SDA": [
            4,
            40
        ],
        "CD1_SCL": [
            4,
            41
        ],
        "USB_VBUS_EN": [
            4,
            42
        ],
        "USB_OC_N": [
            4,
            43
        ],
        "RP1_STAT_LED": [
            4,
            44
        ],
        "FAN_PWM": [
            4,
            45
        ],
        "CD1_IO0_MICCLK": [
            4,
            46
        ],
        "CD1_IO1_MICDAT1": [
            4,
            48
        ],
        "EN_MAX_USB_CUR": [
            4,
            49
        ]
    },
    "chips": {
        "gpiochip0": {
            "-": 23,
            "2712_BOOT_CS_N": 1,
            "2712_BOOT_MISO": 2,
            "2712_BOOT_MOSI": 3,
            "2712_BOOT_SCLK": 4,
            "PCIE_SDA": 14,
            "PCIE_SCL": 15,
            "PWR_GPIO": 20,
            "2712_G21_FS": 21,
            "BT_RTS": 24,
            "BT_CTS": 25,
            "BT_TXD": 26,
            "BT_RXD": 27,
            "WL_ON": 28,
            "BT_ON": 29,
            "WIFI_SDIO_CLK": 30,
            "WIFI_SDIO_CMD": 31
        },
        "gpiochip1": {
            "WIFI_SDIO_D0": 0,
            "WIFI_SDIO_D1": 1,
            "WIFI_SDIO_D2": 2,
            "WIFI_SDIO_D3": 3
        },
        "gpiochip2": {
            "RP1_SDA": 0,
            "RP1_SCL": 1,
            "RP1_RUN": 2,
            "SD_IOVDD_SEL": 3,
            "SD_PWR_ON": 4,
            "SD_CDET_N": 5,
            "SD_FLG_N": 6,
            "-": 16,
            "2712_WAKE": 8,
            "2712_STAT_LED": 9,
            "PMIC_INT": 12,
            "UART_TX_FS": 13,
            "UART_RX_FS": 14
        },
        "gpiochip3": {
            "HDMI0_SCL": 0,
            "HDMI0_SDA": 1,
            "HDMI1_SCL": 2,
            "HDMI1_SDA": 3,
            "PMIC_SCL": 4,
            "PMIC_SDA": 5
        },
        "gpiochip4": {
            "ID_SDA": 0,
            "ID_SCL": 1,
            "GPIO2": 2,
            "GPIO3": 3,
            "GPIO4": 4,
            "GPIO5": 5,
            "GPIO6": 6,
            "GPIO7": 7,
            "GPIO8": 8,
            "GPIO9": 9,
            "GPIO10": 10,
            "GPIO11": 11,
            "GPIO12": 12,
            "GPIO13": 13,
            "GPIO14": 14,
            "GPIO15": 15,
            "GPIO16": 16,
            "GPIO17": 17,
            "GPIO18": 18,
            "GPIO19": 19,
            "GPIO20": 20,
            "GPIO21": 21,
            "GPIO22": 22,
            "GPIO23": 23,
            "GPIO24": 24,
            "GPIO25": 25,
            "GPIO26": 26,
            "GPIO27": 27,
            "PCIE_RP1_WAKE": 28,
            "FAN_TACH": 29,
            "HOST_SDA": 30,
            "HOST_SCL": 31,
            "ETH_RST_N": 32,
            "-": 53,
            "CD0_IO0_MICCLK": 34,
            "CD0_IO0_MICDAT0": 35,
            "RP1_PCIE_CLKREQ_N": 36,
            "CD0_SDA": 38,
            "CD0_SCL": 39,
            "CD1_SDA": 40,
            "CD1_SCL": 41,
            "USB_VBUS_EN": 42,
            "USB_OC_N": 43,
            "RP1_STAT_LED": 44,
            "FAN_PWM": 45,
            "CD1_IO0_MICCLK": 46,
            "2712_WAKE": 47,
            "CD1_IO1_MICDAT1": 48,
            "EN_MAX_USB_CUR": 49
        }
    }
}

After updating System:

      _,met$$$$$gg.          pi@MagicMirror
    ,g$$$$$$$$$$$$$$$P.       --------------
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 12 (bookworm) aarch64
 ,$$P'              `$$$.     Host: Raspberry Pi 5 Model B Rev 1.0
',$$P       ,ggs.     `$$b:   Kernel: 6.6.47+rpt-rpi-2712
`d$$'     ,$P"'   .    $$$    Uptime: 34 secs
 $$P      d$'     ,    $$P    Packages: 1926 (dpkg)
 $$:      $$.   -    ,d$$'    Shell: bash 5.2.15
 $$;      Y$b._   _,d$P'      Terminal: /dev/pts/0
 Y$$.    `.`"Y$$$$P"'         CPU: (4) @ 2.400GHz
 `$$b      "-.__              Memory: 426MiB / 8048MiB
  `Y$$
   `Y$$.
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""

gpioinfo.json then is the same as in first post

Tom-Hirschberger commented 2 months ago

I and sorry for the late reply (also to the ticket in MMM-Screen-Powersave-Notification). I do not have much time to code at the moment but released a new version of the module a couple of seconds a ago which provides the new option forceInfoFileUsage.

If the option is set to true the build in device information (the information of the gpio lib i am using now) will be ignored and the gpioinfo.json is used (even if it is a known device).

This way your sensor should work at least.

Did not follow the discussion about the recent changes in the Raspberry Kernel after they broke a lot of libs for GPIO a couple of months ago. Maybe the community has prevailed to keep the old naming schema.

Aergernis commented 2 months ago

No big deal.

when using the force option MM is at least starting again, but cannot register pins.

0|MagicMirror  | [2024-09-06 21:02:03.679] [LOG]   MMM-GPIO-Notifications: Using naming schema Default
0|MagicMirror  | [2024-09-06 21:02:03.680] [LOG]   Force use of GPIO info file is configured. Using the information of gpioinfo.json instead of a specific device!
0|MagicMirror  | [2024-09-06 21:02:03.681] [LOG]   MMM-GPIO-Notifications: Trying to registering pin: 4
0|MagicMirror  | [2024-09-06 21:02:03.681] [LOG]   MMM-GPIO-Notifications: Using chip (0) and line (4) info of GPIO4
0|MagicMirror  | [2024-09-06 21:02:03.681] [LOG]   MMM-GPIO-Notifications: Watched pin: 4 has low state delay of 1000!
0|MagicMirror  | [2024-09-06 21:02:03.682] [LOG]   MMM-GPIO-Notifications: Watched pin: 4 has high state delay of 1000!
0|MagicMirror  | [2024-09-06 21:02:03.682] [LOG]   MMM-GPIO-Notifications: Unable to register pin: 4. Maybe it is already used by a other program!
0|MagicMirror  | [2024-09-06 21:02:03.682] [LOG]   MMM-GPIO-Notifications: Trying to registering pin: 18
0|MagicMirror  | [2024-09-06 21:02:03.682] [LOG]   MMM-GPIO-Notifications: Using chip (0) and line (18) info of GPIO18
0|MagicMirror  | [2024-09-06 21:02:03.682] [LOG]   MMM-GPIO-Notifications: Watched pin: 18 has low state delay of 1000!
0|MagicMirror  | [2024-09-06 21:02:03.683] [LOG]   MMM-GPIO-Notifications: Watched pin: 18 has high state delay of 1000!
0|MagicMirror  | [2024-09-06 21:02:03.683] [LOG]   MMM-GPIO-Notifications: Unable to register pin: 18. Maybe it is already used by a other program!
0|MagicMirror  | [2024-09-06 21:02:03.683] [LOG]   MMM-GPIO-Notifications: Trying to registering pin: 27
0|MagicMirror  | [2024-09-06 21:02:03.684] [LOG]   MMM-GPIO-Notifications: Using chip (0) and line (27) info of GPIO27
0|MagicMirror  | [2024-09-06 21:02:03.684] [LOG]   MMM-GPIO-Notifications: Watched pin: 27 has low state delay of 1000!
0|MagicMirror  | [2024-09-06 21:02:03.685] [LOG]   MMM-GPIO-Notifications: Watched pin: 27 has high state delay of 1000!
0|MagicMirror  | [2024-09-06 21:02:03.685] [LOG]   MMM-GPIO-Notifications: Unable to register pin: 27. Maybe it is already used by a other program!
Tom-Hirschberger commented 2 months ago

Just checked the Debian Bookworm Repository as things are working fine with the latest update on my Bullseye system. There has been a update of the underlying gpio library on 2024-08-28.

Did you run the generate script manually or did you run npm install in the module folder?

Can you try to run npm install and restart the mirror to see if it makes any difference please?

Aergernis commented 2 months ago

i only installed libgpiod-dev manualy (cause installing this module via mmpm sometimes fails). Then i just installe the module with mmpm.... so with npm install. Tried npm install and reboot. Still in use.

The last working Kernel is 6.6.44 (sudo rpi-update 44a287fe97c04506841fe3b3e794c70a2e01c7de)

Tom-Hirschberger commented 1 month ago

Just read that a OS update has been released in the last days which creates a logical link pointing of gpiochip0 to gpiochip4.

Even with the old version of this module things should work with the new kernel now.

Aergernis commented 1 month ago

Sorry for late reply. Didn't have time until now to test. Will try it tomorrow and report back.

Aergernis commented 1 month ago

Updated to latest Kernel und Software and it's working again. Thanks.