I found some utilities that are capable of dealing with DVD region settings on OS X: DVD Info X, and Region X. DVD Info X will display the region code of your drive without requiring to have a DVD inserted.
Region X is more interesting because although it doesn't directly serve your purpose, its source is available. Looking at it I found that the ScanAll
method in Region X.m
is what you need. More specifically, the interesting case is the one where the disk name isn't found (because there's no disk mounted) and a SCSI command is used to find out the DVD drive's properties (the printf
calls are my addition):
task = (*scsitaskinterface)->CreateSCSITask(scsitaskinterface);
if (task)
{
cdb[0] = 0xa4;
cdb[1] = 0x00;
cdb[2] = 0x00;
cdb[3] = 0x00;
cdb[4] = 0x00;
cdb[5] = 0x00;
cdb[6] = 0x00;
cdb[7] = 0x00;
cdb[8] = (sizeof(DVDInfo) >> 8) & 0xff;
cdb[9] = sizeof(DVDInfo) & 0xff;
cdb[10] = 0x08;
cdb[11] = 0x00;
memset(&DVDInfo, 0, sizeof(DVDInfo));
ProcessCDB(task, cdb, 12, DirIn, &DVDInfo, sizeof(DVDInfo), 30000);
printf("drive region %#hhx\n", DVDInfo.driveRegion);
printf("number of region changes left: %hhu\n", DVDInfo.numberUserResets);
if (DVDInfo.rpcScheme == 0) RPC1++;
if (DVDInfo.rpcScheme != 0) RPC2++;
(*task)->Release(task);
}
I ran this on my Macbook Pro and the result was as expected.
Obviously you'll need to massage it in order to isolate that part into something you can use, but I think that this code will be a useful starting point.