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).
#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;
}
#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;
}
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to