dvdisaster icon indicating copy to clipboard operation
dvdisaster copied to clipboard

macOS support

Open wojas opened this issue 4 years ago • 5 comments

Hi, I was wondering what it would take to make dvdisaster work on macOS.

I managed to compile it on macOS Big Sur 11.61 with a single hack (add a return; on line 103 of src/show-manual.c) to resolve this error:

src/show-manual.c: In function 'GuiShowURL':
src/show-manual.c:112:13: warning: implicit declaration of function 'pipe2'; did you mean 'pipe'? [-Wimplicit-function-declaration]
  112 |    result = pipe2(err_pipe, O_CLOEXEC);
      |             ^~~~~
      |             pipe
src/show-manual.c: At top level:
cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics
Linking  : dvdisaster
Undefined symbols for architecture x86_64:
  "_pipe2", referenced from:
      _GuiShowURL in show-manual.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [dvdisaster] Error 1

I configured and compiled with:

./configure CC=gcc-11
make -j CC=gcc-11

This resulted in a seemingly functional GUI, but with "No drives found":

dvdisaster-macos1

Is it just missing the drive detection code for macOS, or are there other issues that you know of that make macOS support problematic?

I assume that the main reason to drop macOS support is that you could not support and test it, because you do not have a mac? Would you be willing to accept a PR that fixes the macOS support?

I can perhaps try to do it if I find the time and it turns out to be not too hard. Do you happen to have some pointers where to look?

wojas avatar Dec 22 '21 14:12 wojas

Hello,

Sorry for the delay, I completely forgot to answer you, even though I read your message a few weeks ago!

The main reason for not "reviving" the macOS version along with the Windows one is indeed that I don't have any mac around, unfortunately. I would accept a macOS PR indeed, and there's a good news: GitHub supports macOS in GitHub Actions, so we would also be able to run the non-regression tests under mac, which is mandatory if we want to add support for this OS. If you're still interested in working on it, appart for the few adjustments you might need to do, there is a core function that is absent for the code right now: actual support for reading from CDs with a mac. Linux and Windows both have very specific code to do this. But you don't need to start from scratch: as dvdisaster already supported macOS at some point, this low-level OS code can be found on some old versions. Maybe it'll still work reasonably well on recent OS versions, after some adjustments.

speed47 avatar Jan 16 '22 19:01 speed47

Out of curiosity, I spent a few hours trying to get a working build under macOS without having a mac at my disposal. Through GitHub actions and trial/error, I have a build that passes all regression tests, but I have no idea whether it really works on an actual mac. If you have some time @wojas, you might want to give it a try, it's in the macos branch: https://github.com/speed47/dvdisaster/tree/macos

You'll need to brew install gtk+ glib gdk-pixbuf

speed47 avatar Mar 06 '22 11:03 speed47

Hi, I actually got it to detect my BD drive after adding some extra API calls. The cli version appeared to work fine.

The UI did not work as desired, the graphs did not update for some reason.

I was planning to clean it up and create a preliminary PR, but then ended up being busy with other things. I will try to dust it off when I have time!

wojas avatar Mar 06 '22 16:03 wojas

It looks like you branch (https://github.com/speed47/dvdisaster/commit/1a54355efbbd4306cf349fc6975eef5235f670ca) addresses some of my remaining open issues. When I have time, I will merge it in PR #58 and try it out. Thanks!

wojas avatar Mar 06 '22 16:03 wojas

Good to hear I could help you a bit, even without having a mac :) I also enabled CI on your PR.

speed47 avatar Mar 06 '22 18:03 speed47

Any Progress on that front? Would be really amazing to have it running on Mac!

jlnbxn avatar Aug 29 '23 17:08 jlnbxn

Okay, I got it to work. However, it’s not perfect. Compiling the macos branch and adding the low level code snippet for Blu-Ray drives provided by @wojas allows access to my burner, but upon trying to read a disc, it spits out the following:

Device IOBDServices/1 does not become ready: None; No additional sense information.

Pasted Graphic

Upon further investigation, I found out that the culprit seems to lie in the “TestUnitReady” code. Sending this SCSI command to my drive returns kSCSITaskStatus_DeliveryFailure, which is a MacOS specific SCSI Status Code that elaborates on the SCSIServiceResponse kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE. As such, it appears that the drive is simply unresponsive to this command. However, since the other SCSI layers for Linux and Windows don’t account for this contingency at all, it may not be a problem. In fact, the software runs just fine under Parallels and VMWarefusion (both using Debian 12). I suspect a problem with the firmware of the burner?

For reference, I'm using an M1 Macbook Air and a Verbatim-branded Pioneer BDR-UD03!

As an admitedly ugly workaround, I’ve added a check whether the current kSCSITaskStatus is kSCSITaskStatus_DeliveryFailure and the SCSI command is TestUnitReady (0x00), in which case the “SendPackage” function returns true. (Since the ioReturnValue is still a success, I don't expect many false positives. But as I said, it's not a perfect solution.) This doesn’t solve the mystery why the command doesn't work, but at least it accounts for multple issues, because “kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE” alone gives even less info. (See also: SCSITaskStatus)

Lastly, I added a timeout so it doesn't get stuck, which I took directly from Apple. (In the link, you can also see that the way the "Test Unit Ready" is sent is identical to the one used dvdisaster, which doesn't work on my drive at least.)

Otherwise, everything works as expected! Thanks for reviving this great project 🙏

Pasted Graphic 2

jlnbxn avatar Sep 10 '23 16:09 jlnbxn

Hey, thanks for looking into this!

I've allowed the regtests to run on GitHub from your PR, let's see what it says!

speed47 avatar Sep 13 '23 19:09 speed47

Closing this as support is now in v0.79.10-pl2 👍

speed47 avatar Sep 30 '23 11:09 speed47