Detect USB floppy drives on Linux and fix media type handling#1005
Merged
Conversation
Linux only surfaced optical and fixed/removable block devices, so floppy drives were never offered as dump targets even though Aaru and DiscImageCreator can dump them and Windows already tags floppies via WMI. Add a dedicated floppy enumerator that scans /dev for "fd" followed by digits (fd0, fd1, ...), tags each as InternalDriveType.Floppy, and lists it like an optical drive with media presence left to the dumping program. It is gated behind the fixed-drive toggle to match how Windows surfaces floppies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
USB floppy drives enumerate as removable SCSI disks (/dev/sd*), not /dev/fd* nodes, so a removable block device whose media matches a standard floppy geometry (360 KB to 2.88 MB) is now classified as InternalDriveType.Floppy. Floppy drives are listed regardless of the fixed-drive toggle, alongside optical drives, so USB floppies appear without also surfacing fixed disks. Classifying the drive as Floppy makes GetPhysicalMediaType return FloppyDisk, satisfying the removable/floppy check in DumpEnvironment.ParametersValid so DiscImageCreator dumps with fd. This mirrors how Windows tags floppy media via Win32_LogicalDisk.MediaType. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The media type ComboBox in both the Avalonia and WPF frontends bound SelectedItem to a CurrentMediaType property that was renamed to CurrentPhysicalMediaType in the RedumpLib 1.11 migration (a4c9ee6), which updated the code-behind but not the XAML markup. The stale binding failed silently, so changing the media type never wrote back to the view model and the generated DiscImageCreator command was never refreshed (it stayed cd even when Floppy Disk was selected). Point both bindings at CurrentPhysicalMediaType. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rives # Conflicts: # CHANGELIST.md # MPF.Avalonia/Windows/MainWindow.axaml
CacheCurrentMediaType only set _detectedPhysicalMediaType on a successful detection and never cleared it, so a type detected for one drive (e.g. FloppyDisk) carried over when switching to a drive whose media could not be read -- an empty optical drive would keep showing Floppy Disk instead of the system default (CD-ROM). Clear the remembered type at the start of each drive's caching so only a fresh detection sets it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rives # Conflicts: # CHANGELIST.md
mnadareski
reviewed
Jul 2, 2026
| if (CurrentDrive is null) | ||
| return; | ||
|
|
||
| // Forget the type detected for any previously selected drive; only a fresh |
Member
There was a problem hiding this comment.
Oh, that actually makes a lot of sense. That probably explains a lot of weird interactions.
| </ComboBox> | ||
| <ComboBox x:Name="MediaTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="Right" | ||
| ItemsSource="{Binding MediaTypes}" SelectedItem="{Binding Path=CurrentMediaType, Converter={StaticResource ElementConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | ||
| ItemsSource="{Binding MediaTypes}" SelectedItem="{Binding Path=CurrentPhysicalMediaType, Converter={StaticResource ElementConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
Match Windows, where floppy drives enumerate as removable media that is only queried when fixed drives are shown. The default program, Redumper, does not support floppy dumping, so hiding floppies by default avoids listing an unusable target for most users. Requested in review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mnadareski
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks this PR into full USB floppy support for the Linux GUI, plus two related media-type fixes that the first change surfaced.
Changes
1. Detect USB floppy drives and always list floppies (
d3e61e7d)USB floppy drives enumerate as removable SCSI disks (
/dev/sd*), not/dev/fd*nodes, so a removable block device whose media matches a standard floppy geometry (360 KB to 2.88 MB) is now classified asInternalDriveType.Floppy. Floppy drives are listed regardless of the fixed-drive toggle, alongside optical drives, so a USB floppy appears without also surfacing fixed disks. Classifying the drive asFloppymakesGetPhysicalMediaTypereturnFloppyDisk, which satisfies the removable/floppy check inDumpEnvironment.ParametersValid. This mirrors how Windows tags floppy media viaWin32_LogicalDisk.MediaType.2. Fix media type dropdown not updating dumping parameters (
08bec53b)The media type
ComboBoxin both the Avalonia and WPF frontends boundSelectedItemto aCurrentMediaTypeproperty that was renamed toCurrentPhysicalMediaTypein the RedumpLib 1.11 migration (a4c9ee6d), which updated the code-behind but not the XAML markup. The stale binding failed silently, so changing the media type never wrote back to the view model and the generated DiscImageCreator command was never refreshed (it stayedcdeven when Floppy Disk was selected). Both bindings now point atCurrentPhysicalMediaType.3. Reset detected media type when switching drives (
f2dcebf1)CacheCurrentMediaTypeonly set_detectedPhysicalMediaTypeon a successful detection and never cleared it, so a type detected for one drive (e.g.FloppyDisk) carried over when switching to a drive whose media could not be read — an empty optical drive kept showing Floppy Disk instead of the system default. The remembered type is now cleared at the start of each drive's caching, so only a fresh detection sets it.Testing
Tested end-to-end on Fedora with a NEC USB floppy drive (enumerated as
/dev/sdh):fdandcd).fdcommand segfaults on Linux for this drive (it reads the SCSI inquiry, then crashes before dumping), so the dump was done with Aaru. That crash is a DiscImageCreator issue, separate from this PR — noting it since the media type dropdown targets DIC.MPF.Frontend.Test: 558/558 pass, clean build (merged currentmaster).Note for packagers
Raw access to a USB floppy (a
root:disk/dev/sd*block device) requires a udev rule granting the desktop user access, e.g.:This is a system-configuration matter outside MPF, but relevant if MPF is packaged for Linux.
Prepared with AI assistance (Claude Opus 4.8) and reviewed before submission.