Skip to content

Feature request: Configurable CD read speed to improve read stability (PoC included) #59

Description

@strict-flower

Thanks for developing the crate, It has been very helpful!

This crate works well with most CDs in my environment, but I encountered unstable reading behaviour with a SACD + CD hybrid disc.

My tested environments are macOS Tahoe (26.5.2) and USB-connected BD drive (Logitec LBD-LPWAWU3NDB). Used this crate with fd71208.

I think It's a drive-and-disc compatibility issue because the CD layer of a hybrid SACD disc can be more sensitive to physical reading conditions. I found that limiting the read speed to 10x, or slower, resolved the problem.

The following macOS patch demonstrates the workaround. It is not production-quality but It was sufficient to read the affected disc reliably.

diff --git a/src/platform/macos/native/read_cd.c b/src/platform/macos/native/read_cd.c
index 815aef9..947ba55 100644
--- a/src/platform/macos/native/read_cd.c
+++ b/src/platform/macos/native/read_cd.c
@@ -83,6 +84,9 @@ bool read_cd_sectors(int fd, uint32_t lba, uint32_t sectors, uint32_t format_id,
     read.bufferLength = totalBytes;
     read.buffer = dst;

+    uint16_t speed = 1764;
+    ioctl(fd, DKIOCCDSETSPEED, &speed);
+
     int ret = ioctl(fd, DKIOCCDREAD, &read);

     if (ret < 0) {

In the future, I would like to use this crate with configurable read-speed setting. The patch above could serve as a Proof-of-Concept for such a feature.

I could also implement the corresponding Linux support, but I can't implement / test the Windows side because I don't have access to a Windows PC. For that reason, I haven't opened a PR or proposed a concrete API implementation yet.

If anyone with access to a Windows development environment is interested in this issue, I would be happy to collaborate on implementing the feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions