Skip to content

Conversation

@chochien
Copy link

Description

The mediacard_combo storage watcher was unable to detect SD card readers that appear as SCSI/USB mass storage devices (/dev/sda) instead of mmcblk devices. This caused insertion tests to timeout.

This patch enhances MediacardComboStorage._parse_journal_line() to:

  • Detect insertions via 'detected capacity change from 0 to X' messages
  • Detect removals via 'detected capacity change from X to 0' messages
  • Extract partition names from 'sda: sda1' style journal entries
  • Label these devices as 'SD/MMC via USB reader'

The fix allows the action state to be updated dynamically, properly handling multiple insert/remove cycles even when a card is already inserted at test start.

Tested with USB SD card readers that enumerate as /dev/sda devices.

Resolved issues

Fixes: https://warthogs.atlassian.net/browse/CPL-258

Documentation

N/A

Tests

sudo ./run_watcher.py insertion mediacard_combo
Wait for the "INSERT NOW" prompt, then insert the card.

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.82%. Comparing base (1c4f2c0) to head (2635eba).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2254   +/-   ##
=======================================
  Coverage   53.81%   53.82%           
=======================================
  Files         406      406           
  Lines       43288    43294    +6     
  Branches     7997     7999    +2     
=======================================
+ Hits        23296    23302    +6     
  Misses      19179    19179           
  Partials      813      813           
Flag Coverage Δ
checkbox-support 65.32% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@chochien chochien changed the title Fix: Support SD card readers that appear as USB mass storage devices Fix: Support SD card readers that appear as USB mass storage devices (Bugfix) Dec 18, 2025
@chochien chochien force-pushed the fix-usb-sd-card-detection branch 2 times, most recently from 1407e27 to d6463da Compare December 18, 2025 08:11
@chochien chochien changed the title Fix: Support SD card readers that appear as USB mass storage devices (Bugfix) Fix: USB SD card reader support (Bugfix) Dec 18, 2025
@chochien chochien force-pushed the fix-usb-sd-card-detection branch 3 times, most recently from eb19539 to e26b49d Compare December 18, 2025 08:45
The mediacard_combo storage watcher was unable to detect SD card readers
that appear as SCSI/USB mass storage devices (/dev/sda) instead of
mmcblk devices. This caused insertion tests to timeout.

This patch enhances MediacardComboStorage._parse_journal_line() to:
- Detect insertions via 'detected capacity change from 0 to X' messages
- Detect removals via 'detected capacity change from X to 0' messages
- Label these devices as 'SD/MMC via USB reader'

The fix allows the action state to be updated dynamically, properly
handling multiple insert/remove cycles even when a card is already
inserted at test start. Partition extraction is handled by the existing
USBStorage parent class logic.

Comprehensive unit tests have been added to cover all new code paths:
- test_mediacard_combo_storage_usb_sd_card_reader_insertion
- test_mediacard_combo_storage_usb_sd_card_reader_removal
- test_mediacard_combo_storage_usb_sd_card_reader_partition
- test_mediacard_combo_storage_usb_sd_card_reader_action_update

Tested with USB SD card readers that enumerate as /dev/sda devices.
@chochien chochien force-pushed the fix-usb-sd-card-detection branch from e26b49d to 2635eba Compare December 18, 2025 09:05
@Hook25
Copy link
Collaborator

Hook25 commented Jan 12, 2026

Hello, please attach at least one passing test submission. The code lgtm, but I want to see it working

@Hook25 Hook25 self-requested a review January 12, 2026 10:07
@chochien
Copy link
Author

submission_2026-01-20T06.14.29.607611.html

@Hook25 Uploading the pass submission for your reference.

Copy link
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM, thanks for the sub

Copy link
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, didnt pay attention, are you sure?

# This is a removal - always update to reflect current action
self.action = "removal"

return super()._parse_journal_line(line_str)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just noticed this, are you sure you need it? It is done above (explicitly, this only calls USBStorage._parse_journal_line)

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.

2 participants