Skip to content

Comments

Fix Luckfox GPIO chip resolution and button init races#309

Merged
3rdIteration merged 1 commit intoluckfox-staging-portabilityfrom
fix/luckfox-gpiochip-resolution-and-key2-busy
Feb 23, 2026
Merged

Fix Luckfox GPIO chip resolution and button init races#309
3rdIteration merged 1 commit intoluckfox-staging-portabilityfrom
fix/luckfox-gpiochip-resolution-and-key2-busy

Conversation

@3rdIteration
Copy link
Owner

Summary

  • resolve global GPIO line selectors to real /dev/gpiochipN device nodes on Luckfox systems where /sys/class/gpio chip names are base-numbered
  • make HardwareButtons.get_instance() thread-safe and exception-safe to avoid partial singleton state
  • add fallback behavior for bias open failures and improve startup resilience
  • add targeted tests covering resolver mapping, fallback mapping, failed init cleanup, and concurrent singleton initialization

Problem

Merging GPIO portability changes caused regressions on Luckfox Pico Mini:

  • attempts to open invalid chip paths like /dev/gpiochip32
  • poisoned HardwareButtons singleton state after init exceptions
  • startup races where multiple threads initialize button GPIO simultaneously
  • KEY2 line conflicts surfacing as Errno 16 when line ownership is contested

Validation

  • pytest -q tests/test_buttons_gpio_resolution.py (new tests)
  • pytest -q tests/test_io_config_profiles.py
  • device verification on Luckfox Pico Mini with line-number io_config mapping

@3rdIteration 3rdIteration merged commit 2457014 into luckfox-staging-portability Feb 23, 2026
1 of 6 checks passed
@3rdIteration 3rdIteration deleted the fix/luckfox-gpiochip-resolution-and-key2-busy branch February 23, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant