Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2007 14:38:40 +0200
From:      Tijl Coosemans <tijl@ulyssis.org>
To:        freebsd-stable@freebsd.org
Cc:        Ulrich Spoerlein <uspoerlein@gmail.com>
Subject:   Re: FreeBSD vs Region Code DVDs
Message-ID:  <200705041438.42358.tijl@ulyssis.org>
In-Reply-To: <20070503181646.GA1527@roadrunner.q.local>
References:  <20070503181646.GA1527@roadrunner.q.local>

next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_SlyOGSFrOyBh5Tr
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Thursday 03 May 2007 20:16:46 Ulrich Spoerlein wrote:
> I'm having a hard time getting my external (USB, Firewire) Plextor
> PX-755UF to read any retail DVDs at all. I can read any kind of CDs
> and also DVD-Rs. But mastered DVDs are invisible to FreeBSD.
> 
> I can not even read a single sector from such a DVD with the
> external drive, but it's working just fine with the internal one.
> It's really driving me nuts.

Maybe you have to change the drive region code (RPC 2). I had to do
this a couple years ago with a laptop's internal drive. Either that or
you need to find a patched firmware to make the drive region free
(RPC 1).

I wrote 2 simple programs back then to play with this, because I
couldn't find anything in the base system.

"regionget /dev/cd0" prints out the current drive region info, like:

vendor resets left: 4
user changes left: 3
drive region: 2
rpc type: 2

"regionset /dev/cd0 3" sets the drive region code to 3.

Don't forget that you can only change the region about 5 times
(user changes left field).

--Boundary-00=_SlyOGSFrOyBh5Tr
Content-Type: text/plain;
  charset="iso-8859-1";
  name="regionget.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="regionget.c"

#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/dvdio.h>
#include <unistd.h>

int main( int argc, char const *argv[] ) {
	int ret;
	int region;
	int fd;
	struct dvd_authinfo dvd;

	if( argc < 2 ) {
		fprintf( stderr, "Usage: %s <dvd device>\n", argv[ 0 ]);
		return -1;
	}

	fd = open( argv[ 1 ], O_RDONLY );
	if( fd < 0 ) {
		fprintf( stderr, "Failed to open %s\n", argv[ 1 ]);
		return -1;
	}

	memset( &dvd, 0, sizeof( struct dvd_authinfo ));
	dvd.format = DVD_REPORT_RPC;
	ret = ioctl( fd, DVDIOCREPORTKEY, &dvd );
	close( fd );
	if( ret < 0 ) {
		fprintf( stderr, "Failed to retrieve region info. Try with a disc in the drive.\n" );
		return -1;
	}
	dvd.region ^= 0xff;
	for( region = 0; dvd.region; dvd.region >>= 1 ) {
		region++;
		if( dvd.region == 1 ) break;
	}
	printf( "vendor resets left: %u\n", dvd.vend_rsts );
	printf( "user changes left: %u\n", dvd.user_rsts );
	printf( "drive region: %u\n", region );
	printf( "rpc type: %u\n", dvd.rpc_scheme + 1 );
	
	return 0;
}

--Boundary-00=_SlyOGSFrOyBh5Tr
Content-Type: text/plain;
  charset="iso-8859-1";
  name="regionset.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="regionset.c"

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/dvdio.h>
#include <unistd.h>

int main( int argc, char const *argv[] ) {
	int ret, fd;
	uint8_t region;
	struct dvd_authinfo dvd;

	if( argc < 3 ) {
		fprintf( stderr, "Usage: %s <dvd device> <region>\n", argv[ 0 ]);
		return -1;
	}

	ret = ( uint8_t ) strtol( argv[ 2 ], NULL, 10 );
	if( ret <= 0 || ret > 8 ) {
		fprintf( stderr, "Invalid region.\n" );
		return -1;
	}
	for( region = 0x01; ret > 1; ret-- ) {
		region <<= 1;
	}
	region ^= 0xff;

	fd = open( argv[ 1 ], O_RDONLY );
	if( fd < 0 ) {
		fprintf( stderr, "Failed to open %s\n", argv[ 1 ]);
		return -1;
	}

	memset( &dvd, 0, sizeof( struct dvd_authinfo ));
	dvd.format = DVD_SEND_RPC;
	dvd.region = region;
	ret = ioctl( fd, DVDIOCSENDKEY, &dvd );
	close( fd );
	if( ret < 0 ) {
		fprintf( stderr, "Failed to set region. Try with a disc in the drive.\n" );
		return -1;
	}
	
	return 0;
}

--Boundary-00=_SlyOGSFrOyBh5Tr--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705041438.42358.tijl>