Skip to content

[13.4-stable] pkg/debug: fix COM port detection#5891

Open
christoph-zededa wants to merge 2 commits intolf-edge:13.4-stablefrom
christoph-zededa:13.4-fix_spec_com_port_newer_kernel
Open

[13.4-stable] pkg/debug: fix COM port detection#5891
christoph-zededa wants to merge 2 commits intolf-edge:13.4-stablefrom
christoph-zededa:13.4-fix_spec_com_port_newer_kernel

Conversation

@christoph-zededa
Copy link
Copy Markdown
Contributor

Description

Based on #5876

Newer kernels no longer expose /sys/class/tty//device/resources. Switch to reading port and IRQ directly from the per-tty sysfs files /sys/class/tty//port and /sys/class/tty/*/irq.

On x86_64, a port value of 0x0 indicates no hardware is present and the entry is skipped. The IO port range is computed as base to base+7 to match the standard 8-byte UART register window.

Qemu tests:
Effect on EVE master:
4 COM ports are detected, instead of 0

Effect on EVE 14.5:
4 COM ports are detected, instead of 1
This is because the serial port connected via PCI was detected, but not the ones via uart8250.

[debug] root@linuxkit-525400123456:~$ ls -l /sys/class/tty/ | grep ttyS
lrwxrwxrwx    1 root     root             0 Apr 28 10:14 ttyS0 -> ../../devices/pnp0/00:03/tty/ttyS0
lrwxrwxrwx    1 root     root             0 Apr 28 10:14 ttyS1 -> ../../devices/platform/serial8250/tty/ttyS1
lrwxrwxrwx    1 root     root             0 Apr 28 10:14 ttyS2 -> ../../devices/platform/serial8250/tty/ttyS2
lrwxrwxrwx    1 root     root             0 Apr 28 10:14 ttyS3 -> ../../devices/platform/serial8250/tty/ttyS3

How to test and validate this PR

Run spec.sh and check that all COM ports are printed.

Changelog notes

Fix COM port detection in spec.sh

Also, to the PRs that should be backported into any stable branch, please
add a label stable.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR

For backport PRs (remove it if it's not a backport):

  • I've added a reference link to the original PR
  • PR's title follows the template

And the last but not least:

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

Please, check the boxes above after submitting the PR in interactive mode.

christoph-zededa and others added 2 commits May 4, 2026 13:51
Newer kernels no longer expose /sys/class/tty/*/device/resources.
Switch to reading port and IRQ directly from the per-tty
sysfs files /sys/class/tty/*/port and /sys/class/tty/*/irq.

On x86_64, a port value of 0x0 indicates no hardware is present and
the entry is skipped. The IO port range is computed as base to base+7
to match the standard 8-byte UART register window.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Christoph Ostarek <christoph@zededa.com>
(cherry picked from commit d4449f4)
after spec.sh fix

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
(cherry picked from commit 8d72d88)
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 27.29%. Comparing base (8077a3d) to head (6a984c4).
⚠️ Report is 186 commits behind head on 13.4-stable.

Additional details and impacted files
@@               Coverage Diff               @@
##           13.4-stable    #5891      +/-   ##
===============================================
+ Coverage        24.78%   27.29%   +2.51%     
===============================================
  Files                8        8              
  Lines             1138      828     -310     
===============================================
- Hits               282      226      -56     
+ Misses             788      534     -254     
  Partials            68       68              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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