Skip to content

fix(macos): relax drive detection filter and update dependency#222

Open
sengmonkham wants to merge 1 commit intobeagleboard:mainfrom
sengmonkham:fix/macos-drive-detection
Open

fix(macos): relax drive detection filter and update dependency#222
sengmonkham wants to merge 1 commit intobeagleboard:mainfrom
sengmonkham:fix/macos-drive-detection

Conversation

@sengmonkham
Copy link
Contributor

Fixes macOS drive detection issues where external drives were hidden.

#163

Changes Made
Updates bb-drivelist to v0.3.1.
Changed drive filter to include devices marked as SD cards, even if the OS reports them as non-removable.

Succesfully detected my external SSD(detected as FDisk_partition_scheme with size 256060514304 or ~256GB)
Tested on MacOS 26.2
2026-01-24_17-09-14

@sengmonkham
Copy link
Contributor Author

@Ayush1325 please review

@Ayush1325
Copy link
Member

@sengmonkham Can you please rebase and check if this is even required anymore. I think the disk filter problem should be fixed now.

@sengmonkham
Copy link
Contributor Author

@sengmonkham Can you please rebase and check if this is even required anymore. I think the disk filter problem should be fixed now.

I checked and it could not find my external drive both with my changes and without my changes. The external drive was excluded because macOS reported it with is_removable: false and is_card: false, despite correctly identifying the bus type as USB.

kawkoiharu@kawkois-MacBook-Air bb-imager-rs % cargo run --example repro_drives -p bb-flasher-sd
Finished dev profile [unoptimized + debuginfo] target(s) in 0.22s
Running target/debug/examples/repro_drives
--- Direct bb_drivelist output ---

DeviceDescriptor {
enumerator: "DiskArbitration",
bus_type: Some(
"Apple Fabric",
),
bus_version: None,
device: "/dev/disk0",
device_path: Some(
"IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController",
),
raw: "/dev/rdisk0",
description: "APPLE SSD AP0256Q Media",
error: None,
partition_table_type: Some(
"gpt",
),
size: 251000193024,
block_size: 4096,
logical_block_size: 4096,
mountpoints: [],
mountpoint_labels: [],
is_readonly: false,
is_system: true,
is_card: false,
is_scsi: false,
is_usb: false,
is_virtual: false,
is_removable: false,
is_uas: None,
}
DeviceDescriptor {
enumerator: "DiskArbitration",
bus_type: Some(
"Apple Fabric",
),
bus_version: None,
device: "/dev/disk1",
device_path: Some(
"IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController",
),
raw: "/dev/rdisk1",
description: "AppleAPFSMedia",
error: None,
partition_table_type: None,
size: 524288000,
block_size: 4096,
logical_block_size: 4096,
mountpoints: [
MountPoint {
path: "/System/Volumes/xarts",
label: None,
total_bytes: None,
available_bytes: None,
},
MountPoint {
path: "/System/Volumes/iSCPreboot",
label: None,
total_bytes: None,
available_bytes: None,
},
MountPoint {
path: "/System/Volumes/Hardware",
label: None,
total_bytes: None,
available_bytes: None,
},
],
mountpoint_labels: [
"xART",
"iSCPreboot",
"Hardware",
],
is_readonly: false,
is_system: true,
is_card: false,
is_scsi: false,
is_usb: false,
is_virtual: false,
is_removable: false,
is_uas: None,
}
DeviceDescriptor {
enumerator: "DiskArbitration",
bus_type: Some(
"Apple Fabric",
),
bus_version: None,
device: "/dev/disk2",
device_path: Some(
"IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController",
),
raw: "/dev/rdisk2",
description: "AppleAPFSMedia",
error: None,
partition_table_type: None,
size: 5368664064,
block_size: 4096,
logical_block_size: 4096,
mountpoints: [],
mountpoint_labels: [],
is_readonly: false,
is_system: true,
is_card: false,
is_scsi: false,
is_usb: false,
is_virtual: false,
is_removable: false,
is_uas: None,
}
DeviceDescriptor {
enumerator: "DiskArbitration",
bus_type: Some(
"Apple Fabric",
),
bus_version: None,
device: "/dev/disk3",
device_path: Some(
"IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController",
),
raw: "/dev/rdisk3",
description: "AppleAPFSMedia",
error: None,
partition_table_type: None,
size: 245107195904,
block_size: 4096,
logical_block_size: 4096,
mountpoints: [
MountPoint {
path: "/",
label: None,
total_bytes: None,
available_bytes: None,
},
MountPoint {
path: "/System/Volumes/VM",
label: None,
total_bytes: None,
available_bytes: None,
},
MountPoint {
path: "/System/Volumes/Preboot",
label: None,
total_bytes: None,
available_bytes: None,
},
MountPoint {
path: "/System/Volumes/Update",
label: None,
total_bytes: None,
available_bytes: None,
},
],
mountpoint_labels: [
"Macintosh HD",
"VM",
"Preboot",
"Update",
],
is_readonly: false,
is_system: true,
is_card: false,
is_scsi: false,
is_usb: false,
is_virtual: false,
is_removable: false,
is_uas: None,
}
DeviceDescriptor {
enumerator: "DiskArbitration",
bus_type: Some(
"Apple Fabric",
),
bus_version: None,
device: "/dev/disk3s1s1",
device_path: Some(
"IODeviceTree:/arm-io@10F00000/ans@77400000/iop-ans-nub/AppleANS3NVMeController",
),
raw: "/dev/rdisk3s1s1",
description: "com.apple.os.update-6089F13356F8D483C8F0189F0FF5A85520E1C92B712A1A2D1223B299E42F1F57",
error: None,
partition_table_type: None,
size: 245107195904,
block_size: 4096,
logical_block_size: 4096,
mountpoints: [],
mountpoint_labels: [],
is_readonly: true,
is_system: true,
is_card: false,
is_scsi: false,
is_usb: false,
is_virtual: false,
is_removable: false,
is_uas: None,
}
DeviceDescriptor {
enumerator: "DiskArbitration",
bus_type: Some(
"USB",
),
bus_version: None,
device: "/dev/disk4",
device_path: Some(
"IODeviceTree:/arm-io@10F00000/usb-drd0@82280000/usb-drd0-port-ss@00200000",
),
raw: "/dev/rdisk4",
description: "ST500LT0 12-1DG142 Media",
error: None,
partition_table_type: Some(
"gpt",
),
size: 500107862016,
block_size: 512,
logical_block_size: 512,
mountpoints: [
MountPoint {
path: "/Volumes/HDD",
label: None,
total_bytes: None,
available_bytes: None,
},
],
mountpoint_labels: [
"HDD",
],
is_readonly: false,
is_system: false,
is_card: false,
is_scsi: false,
is_usb: false,
is_virtual: false,
is_removable: false,
is_uas: None,
}

--- Filtered bb-flasher-sd output ---

Found 0 devices:

I tried expanding the filter to explicitly check for the USB bus:
.filter(|x| x.is_removable || x.is_card || x.bus_type.as_deref() == Some("USB"))
and it worked!

kawkoiharu@kawkois-MacBook-Air bb-imager-rs % cargo run --example repro_drives -p bb-flasher-sd
Compiling bb-flasher-sd v1.0.0 (/Users/kawkoiharu/code/gsoc/bb-imager-rs/bb-flasher-sd)
Finished dev profile [unoptimized + debuginfo] target(s) in 1.21s
Running target/debug/examples/repro_drives
Found 1 devices via bb-flasher-sd:
Device {
name: "SATA SSD Media",
path: "/dev/rdisk4",
size: 256060514304,
}
kawkoiharu@kawkois-MacBook-Air bb-imager-rs %

@sengmonkham sengmonkham force-pushed the fix/macos-drive-detection branch from 48a60a8 to a7ef007 Compare January 24, 2026 18:39
@Ayush1325
Copy link
Member

@sengmonkham SATA SSD Media does not seem to be a pendrive or SD card? Can you test with an SD Card specifically? Because that is what we need to filter. If you do not have SD card, a normal flashdrive should work as a replacement.

@sengmonkham
Copy link
Contributor Author

sengmonkham commented Jan 24, 2026

@Ayush1325 tested with an sd card using a card reader(i don't have a pendrive)
I think we need the bus_type == "USB" condistion for mac users because most macs don't have a USB A port and mac users use a dongle( i am using an usb hub which is being used to connect to external drives or card reader) to connect to other external devices and many drives get misclassified by the OS regarding "removability" when connected through hubs.

image

@Ayush1325
Copy link
Member

@Ayush1325 tested with an sd card using a card reader(i don't have a pendrive) I think we need the bus_type == "USB" condistion for mac users because most macs don't have a USB A port and mac users use a dongle( i am using an usb hub which is being used to connect to external drives or card reader) to connect to other external devices and many drives get misclassified by the OS regarding "removability" when connected through hubs.
image

Maybe I am wrong, but in ur screenshot, it seems like the removable property is being properly reported, at least in this case.

However, I don't particularly mind merging a filter for bus_type. I will test on windows an linux to see if we need to make it conditional on macos.

@sengmonkham
Copy link
Contributor Author

I'll try to run some more tests with different cards or even an pendrive and report back with my findings.

@Sahil7741
Copy link
Contributor

Sahil7741 commented Jan 24, 2026

@Ayush1325 tested with an sd card using a card reader(i don't have a pendrive) I think we need the bus_type == "USB" condistion for mac users because most macs don't have a USB A port and mac users use a dongle( i am using an usb hub which is being used to connect to external drives or card reader) to connect to other external devices and many drives get misclassified by the OS regarding "removability" when connected through hubs.
image

Maybe I am wrong, but in ur screenshot, it seems like the removable property is being properly reported, at least in this case.

However, I don't particularly mind merging a filter for bus_type. I will test on windows an linux to see if we need to make it conditional on macos.

I tried to connect my 2 sd card and 3 pendrives, only very old Sandisk pendrive was not detected by Imager else all were present.

Additionally I connected my 1TB SSD which was also not shown my Imager, but thats the expected behaviour as we dont want to flash ssd.

Generric Storage Devices are my 16 and 32 GB sd card where as hp, toshiba are pendrives and sandisk one is missing

Screenshot 2026-01-25 at 3 02 35 AM

@Sahil7741
Copy link
Contributor

@Ayush1325
what we can do is to add a button like RPI Imager where if a user wants to see system disk or all present disk we can show all of them, what do you suggest ?

I have already tried to implement that button last week, if you suggest then I can slightly modify it and raise a PR for button ?

ref RPI Imager
Screenshot 2026-01-25 at 4 13 01 AM
Screenshot 2026-01-25 at 4 12 22 AM

@Sahil7741
Copy link
Contributor

Here is what I Implemented last week

Screen.Recording.2026-01-25.at.4.54.14.AM.mov

@Ayush1325
Copy link
Member

@Ayush1325 what we can do is to add a button like RPI Imager where if a user wants to see system disk or all present disk we can show all of them, what do you suggest ?

I have already tried to implement that button last week, if you suggest then I can slightly modify it and raise a PR for button ?

ref RPI Imager Screenshot 2026-01-25 at 4 13 01 AM Screenshot 2026-01-25 at 4 12 22 AM

Well, I don't want to add the button unless there is a usecase for it. We do not currently support flashing images NVME. In case of BeageV-Fire, we do write the image directly to the flash on device instead of SD Card, so maybe that would be a reason, but I have no idea how BeagleV-Fire shows up on MacOS.

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.

3 participants

Comments