Raspberry Pi 5, while testing PiSound, I can’t use button.
Built pisound-btn from git clone, /usr/local/bin/pisound-btn can’t write to /sys/class/gpio/export
Does anyone get the button to work?
Raspberry Pi 5, while testing PiSound, I can’t use button.
Built pisound-btn from git clone, /usr/local/bin/pisound-btn can’t write to /sys/class/gpio/export
Does anyone get the button to work?
What is the output of:
ls -la /sys/class/gpio/
total 0
drwxrwxr-x 2 root gpio 0 Jan 5 20:19 .
drwxr-xr-x 71 root root 0 Jan 5 20:19 ..
--w--w---- 1 root gpio 16384 Jan 5 20:19 export
lrwxrwxrwx 1 root root 0 Jan 5 20:19 gpio416 -> ../../devices/platform/axi/1000120000.pcie/1f000d0000.gpio/gpiochip4/gpio/gpio416
lrwxrwxrwx 1 root gpio 0 Jan 5 20:19 gpiochip399 -> ../../devices/platform/axi/1000120000.pcie/1f000d0000.gpio/gpio/gpiochip399
lrwxrwxrwx 1 root gpio 0 Jan 5 20:19 gpiochip453 -> ../../devices/platform/soc/107d517c00.gpio/gpio/gpiochip453
lrwxrwxrwx 1 root gpio 0 Jan 5 20:19 gpiochip459 -> ../../devices/platform/soc/107d517c00.gpio/gpio/gpiochip459
lrwxrwxrwx 1 root gpio 0 Jan 5 20:19 gpiochip476 -> ../../devices/platform/soc/107d508500.gpio/gpio/gpiochip476
lrwxrwxrwx 1 root gpio 0 Jan 5 20:19 gpiochip480 -> ../../devices/platform/soc/107d508500.gpio/gpio/gpiochip480
--w--w---- 1 root gpio 16384 Jan 5 20:19 unexport
Are you trying to run pisound-btn
as the regular user? Is it member of the group gpio
?
What is the output of groups
and whoami
?
As the regular user ,
/usr/local/bin/pisound-btn
Failed writing to /sys/class/gpio/export! Error 22.
I’m a member of the gpio
, and
cat /etc/group
gpio:x:993:ME
systemctl status
× pisound-btn.service - Pisound button daemon autostart
Loaded: loaded (/lib/systemd/system/pisound-btn.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-01-05 20:19:15 KST; 18min ago
Duration: 105ms
Process: 933 ExecStart=/usr/local/bin/pisound-btn (code=exited, status=255/EXCEPTION)
Main PID: 933 (code=exited, status=255/EXCEPTION)
CPU: 2ms
Jan 05 20:19:15 host systemd[1]: Started pisound-btn.service - Pisound button daemon autostart.
Jan 05 20:19:15 host pisound-btn[933]: Failed writing to /sys/class/gpio/export! Error 22.
Jan 05 20:19:15 host systemd[1]: pisound-btn.service: Main process exited, code=exited, status=255/EXCEPTION
Jan 05 20:19:15 host systemd[1]: pisound-btn.service: Failed with result 'exit-code'.
Looks like the pin numbering got changed on Raspberry Pi 5:
https://forums.raspberrypi.com/viewtopic.php?p=2165403&sid=bcd2e8809999364ea1e36e7286ef5cc3#p2165403
Please post the output of cat /sys/kernel/debug/gpio
gpiochip4: GPIOs 399-452, parent: platform/1f000d0000.gpio, pinctrl-rp1:
gpio-399 (ID_SD )
gpio-400 (ID_SC )
gpio-401 (PIN3 )
gpio-402 (PIN5 )
gpio-403 (PIN7 )
gpio-404 (PIN29 )
gpio-405 (PIN31 )
gpio-406 (PIN26 |spi0 CS1 ) out hi ACTIVE LOW
gpio-407 (PIN24 |spi0 CS0 ) out hi ACTIVE LOW
gpio-408 (PIN21 )
gpio-409 (PIN19 )
gpio-410 (PIN23 )
gpio-411 (PIN32 |reset ) out hi
gpio-412 (PIN33 |osr ) out hi
gpio-413 (PIN8 )
gpio-414 (PIN10 )
gpio-415 (PIN36 |osr ) out lo
gpio-416 (PIN11 |button ) in hi ACTIVE LOW
gpio-417 (PIN12 )
gpio-418 (PIN35 )
gpio-419 (PIN38 )
gpio-420 (PIN40 )
gpio-421 (PIN15 )
gpio-422 (PIN16 )
gpio-423 (PIN18 |reset ) out hi
gpio-424 (PIN22 |data_available ) in lo
gpio-425 (PIN37 |osr ) out lo
gpio-426 (PIN13 )
gpio-427 (PCIE_RP1_WAKE )
gpio-428 (FAN_TACH )
gpio-429 (HOST_SDA )
gpio-430 (HOST_SCL )
gpio-431 (ETH_RST_N |phy-reset ) out hi ACTIVE LOW
gpio-432 (- )
gpio-433 (CD0_IO0_MICCLK |cam0_reg ) out lo
gpio-434 (CD0_IO0_MICDAT0 )
gpio-435 (RP1_PCIE_CLKREQ_N )
gpio-436 (- )
gpio-437 (CD0_SDA )
gpio-438 (CD0_SCL )
gpio-439 (CD1_SDA )
gpio-440 (CD1_SCL )
gpio-441 (USB_VBUS_EN )
gpio-442 (USB_OC_N )
gpio-443 (RP1_STAT_LED |PWR ) out hi ACTIVE LOW
gpio-444 (FAN_PWM )
gpio-445 (CD1_IO0_MICCLK |cam1_reg ) out lo
gpio-446 (2712_WAKE )
gpio-447 (CD1_IO1_MICDAT1 )
gpio-448 (EN_MAX_USB_CUR )
gpio-449 (- )
gpio-450 (- )
gpio-451 (- )
gpio-452 (- )
gpiochip3: GPIOs 453-458, parent: platform/107d517c00.gpio, gpio-brcmstb@107d517c20:
gpio-453 (HDMI0_SCL )
gpio-454 (HDMI0_SDA )
gpio-455 (HDMI1_SCL )
gpio-456 (HDMI1_SDA )
gpio-457 (PMIC_SCL )
gpio-458 (PMIC_SDA )
gpiochip2: GPIOs 459-475, parent: platform/107d517c00.gpio, gpio-brcmstb@107d517c00:
gpio-459 (RP1_SDA )
gpio-460 (RP1_SCL )
gpio-461 (RP1_RUN |RP1 RUN pin ) out hi
gpio-462 (SD_IOVDD_SEL |vdd-sd-io ) out hi
gpio-463 (SD_PWR_ON |sd_vcc_reg ) out hi
gpio-464 (SD_CDET_N )
gpio-465 (SD_FLG_N )
gpio-466 (- )
gpio-467 (2712_WAKE )
gpio-468 (2712_STAT_LED |ACT ) out hi ACTIVE LOW
gpio-469 (- )
gpio-470 (- )
gpio-471 (PMIC_INT )
gpio-472 (UART_TX_FS )
gpio-473 (UART_RX_FS )
gpio-474 (- )
gpio-475 (- )
gpiochip1: GPIOs 476-479, parent: platform/107d508500.gpio, gpio-brcmstb@107d508520:
gpio-476 (WIFI_SDIO_D0 )
gpio-477 (WIFI_SDIO_D1 )
gpio-478 (WIFI_SDIO_D2 )
gpio-479 (WIFI_SDIO_D3 )
gpiochip0: GPIOs 480-511, parent: platform/107d508500.gpio, gpio-brcmstb@107d508500:
gpio-480 (- )
gpio-481 (2712_BOOT_CS_N |spi10 CS0 ) out hi ACTIVE LOW
gpio-482 (2712_BOOT_MISO )
gpio-483 (2712_BOOT_MOSI )
gpio-484 (2712_BOOT_SCLK )
gpio-485 (- )
gpio-486 (- )
gpio-487 (- )
gpio-488 (- )
gpio-489 (- )
gpio-490 (- )
gpio-491 (- )
gpio-492 (- )
gpio-493 (- )
gpio-494 (PCIE_SDA )
gpio-495 (PCIE_SCL )
gpio-496 (- )
gpio-497 (- )
gpio-498 (- )
gpio-499 (- )
gpio-500 (PWR_GPIO |pwr_button ) in hi ACTIVE LOW
gpio-501 (2712_G21_FS )
gpio-502 (- )
gpio-503 (- )
gpio-504 (BT_RTS )
gpio-505 (BT_CTS )
gpio-506 (BT_TXD )
gpio-507 (BT_RXD )
gpio-508 (WL_ON |wl_on_reg ) out hi
gpio-509 (BT_ON |shutdown ) out hi
gpio-510 (WIFI_SDIO_CLK )
gpio-511 (WIFI_SDIO_CMD )
Try changing these original lines in pisound-btn.c:
static int gpio_is_pin_valid(int pin)
{
return pin >= 0 && pin < 100;
}
to:
static int gpio_is_pin_valid(int pin)
{
return pin >= 0 && pin < 1000;
}
And:
static int g_button_pin = 17;
To:
static int g_button_pin = 416;
Then run make && sudo make install
again.
It works well! Thank you!!
Happy New Year!
2024년 1월월 5일 (금) 11:00 오후, Giedrius via Blokas Community <[hello@blokas.io](mailto:2024년 1월월 5일 (금) 11:00 오후, Giedrius via Blokas Community < 작성됨: