Commit e9ea66ae authored by Sam Hocevar's avatar Sam Hocevar

  * Solaris DVD decryption support by H}kan Hjort <d95hjort@dtek.chalmers.se>.
parent 641341e8
......@@ -106,6 +106,10 @@ E: jimmy@via.ecp.fr
C: jimmy
D: IDCT and YUV transformations
N: H}kan Hjort
E: d95hjort@dtek.chalmers.se
D: Solaris port of the DVD ioctls
N: Samuel Hocevar
E: sam@zoy.org
C: sam
......
......@@ -4,7 +4,7 @@
HEAD
* Nothing yet.
* Solaris DVD decryption support by H}kan Hjort <d95hjort@dtek.chalmers.se>.
0.2.82
Tue, 7 Aug 2001 12:39:16 +0200
......
......@@ -3617,6 +3617,78 @@ EOF
fi
rm -f conftest*
ac_safe=`echo "/usr/include/sys/scsi/scsi_types.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for /usr/include/sys/scsi/scsi_types.h""... $ac_c" 1>&6
echo "configure:3623: checking for /usr/include/sys/scsi/scsi_types.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3628 "configure"
#include "confdefs.h"
#include </usr/include/sys/scsi/scsi_types.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3633: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "sys/scsi/impl/uscsi.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/scsi/impl/uscsi.h""... $ac_c" 1>&6
echo "configure:3652: checking for sys/scsi/impl/uscsi.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3657 "configure"
#include "confdefs.h"
#include <sys/scsi/impl/uscsi.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3662: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define SOLARIS_USCSI 1
EOF
else
echo "$ac_t""no" 1>&6
fi
else
echo "$ac_t""no" 1>&6
fi
if test x$LINUX_DVD_STRUCT = x1; then
cat >> confdefs.h <<\EOF
#define HAVE_LINUX_DVD_STRUCT 1
......@@ -3727,7 +3799,7 @@ if test "${enable_pth+set}" = set; then
enableval="$enable_pth"
if test x$enableval = xyes; then
echo $ac_n "checking for pth_init in -lpth""... $ac_c" 1>&6
echo "configure:3731: checking for pth_init in -lpth" >&5
echo "configure:3803: checking for pth_init in -lpth" >&5
ac_lib_var=`echo pth'_'pth_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -3735,7 +3807,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpth $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3739 "configure"
#line 3811 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
......@@ -3746,7 +3818,7 @@ int main() {
pth_init()
; return 0; }
EOF
if { (eval echo configure:3750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......@@ -3774,7 +3846,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
#line 3778 "configure"
#line 3850 "configure"
#include "confdefs.h"
#include <pth.h>
EOF
......@@ -3938,7 +4010,7 @@ if test "${enable_esd+set}" = set; then
# Extract the first word of "esd-config", so it can be a program name with args.
set dummy esd-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:3942: checking for $ac_word" >&5
echo "configure:4014: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_ESD_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -4005,17 +4077,17 @@ else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4009: checking for $ac_hdr" >&5
echo "configure:4081: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4014 "configure"
#line 4086 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4019: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4091: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4060,17 +4132,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4064: checking for $ac_hdr" >&5
echo "configure:4136: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4069 "configure"
#line 4141 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4138,7 +4210,7 @@ then
# Extract the first word of "sdl12-config", so it can be a program name with args.
set dummy sdl12-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:4142: checking for $ac_word" >&5
echo "configure:4214: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -4178,7 +4250,7 @@ fi
# Extract the first word of "sdl11-config", so it can be a program name with args.
set dummy sdl11-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:4182: checking for $ac_word" >&5
echo "configure:4254: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -4219,7 +4291,7 @@ fi
# Extract the first word of "sdl-config", so it can be a program name with args.
set dummy sdl-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:4223: checking for $ac_word" >&5
echo "configure:4295: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -4265,17 +4337,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4269: checking for $ac_hdr" >&5
echo "configure:4341: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4274 "configure"
#line 4346 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4338,17 +4410,17 @@ if test "${with_directx+set}" = set; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4342: checking for $ac_hdr" >&5
echo "configure:4414: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4347 "configure"
#line 4419 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4424: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4386,17 +4458,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4390: checking for $ac_hdr" >&5
echo "configure:4462: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4395 "configure"
#line 4467 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4508,7 +4580,7 @@ then
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:4512: checking for $ac_word" >&5
echo "configure:4584: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -4553,17 +4625,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4557: checking for $ac_hdr" >&5
echo "configure:4629: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4562 "configure"
#line 4634 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4614,17 +4686,17 @@ if test x$enable_x11 != xno; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4618: checking for $ac_hdr" >&5
echo "configure:4690: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4623 "configure"
#line 4695 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4676,17 +4748,17 @@ if test x$enable_xvideo != xno; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4680: checking for $ac_hdr" >&5
echo "configure:4752: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4685 "configure"
#line 4757 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4690: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4726,17 +4798,17 @@ if test "${enable_alsa+set}" = set; then
then
ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
echo "configure:4730: checking for sys/asoundlib.h" >&5
echo "configure:4802: checking for sys/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4735 "configure"
#line 4807 "configure"
#include "confdefs.h"
#include <sys/asoundlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4740: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -4753,7 +4825,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:4757: checking for main in -lasound" >&5
echo "configure:4829: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -4761,14 +4833,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4765 "configure"
#line 4837 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:4772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......
......@@ -256,6 +256,14 @@ AC_CHECK_HEADERS(sys/ioctl.h,[
LINUX_DVD_STRUCT=1
])
dnl
dnl Solaris: sys/scsi/generic/commands.h sys/scsi/impl/uscsi.h
dnl
AC_CHECK_HEADER(/usr/include/sys/scsi/scsi_types.h,[
AC_CHECK_HEADER(sys/scsi/impl/uscsi.h,[
AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
])
])
dnl
dnl Final tests to check what was detected
dnl
if test x$LINUX_DVD_STRUCT = x1; then
......
......@@ -2,7 +2,7 @@
* ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ioctl.c,v 1.7 2001/08/07 02:48:24 sam Exp $
* $Id: ioctl.c,v 1.8 2001/08/08 02:48:44 sam Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
......@@ -55,6 +55,12 @@
# include <malloc.h>
# include <scsi.h>
#endif
#ifdef SOLARIS_USCSI
# include <unistd.h>
# include <stropts.h>
# include </usr/include/sys/scsi/scsi_types.h>
# include <sys/scsi/impl/uscsi.h>
#endif
#include "config.h"
#include "common.h"
......@@ -72,6 +78,13 @@
static void BeInitRDC ( raw_device_command *, int );
#endif
/*****************************************************************************
* Local prototypes, Solaris specific
*****************************************************************************/
#if defined( SOLARIS_USCSI )
static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
#endif
/*****************************************************************************
* Local prototypes, win32 (aspi) specific
*****************************************************************************/
......@@ -117,6 +130,21 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = p_buffer[ 4 ];
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, 8 );
rs_cdb.cdb_opaque[ 6 ] = i_layer;
rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_COPYRIGHT;
i_ret = ioctl(i_fd, USCSICMD, &sc);
if( i_ret < 0 || sc.uscsi_status ) {
i_ret = -1;
}
*pi_copyright = p_buffer[ 4 ];
// s->copyright.rmi = p_buffer[ 5 ];
#elif defined( SYS_DARWIN )
*pi_copyright = 1;
......@@ -240,6 +268,22 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 2048 );
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, 2048 + 4 );
rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_DISCKEY;
rs_cdb.cdb_opaque[ 10 ] = *pi_agid << 6;
i_ret = ioctl( i_fd, USCSICMD, &sc );
if( i_ret < 0 || sc.uscsi_status )
{
i_ret = -1;
return i_ret;
}
memcpy( p_key, p_buffer + 4, 2048 );
#elif defined( SYS_DARWIN )
i_ret = 0;
......@@ -330,6 +374,20 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = p_buffer[ 7 ] >> 6;
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 8 );
rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
i_ret = ioctl( i_fd, USCSICMD, &sc );
if( i_ret < 0 || sc.uscsi_status )
{
i_ret = -1;
}
*pi_agid = p_buffer[ 7 ] >> 6;
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 8 );
......@@ -407,6 +465,20 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
memcpy( p_challenge, p_buffer + 4, 12 );
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 16 );
rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
i_ret = ioctl( i_fd, USCSICMD, &sc );
if( i_ret < 0 || sc.uscsi_status )
{
i_ret = -1;
}
memcpy( p_challenge, p_buffer + 4, 12 );
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 16 );
......@@ -499,6 +571,20 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
*pi_asf = p_buffer[ 7 ] & 1;
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 8 );
rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_ASF | (*pi_agid << 6);
i_ret = ioctl( i_fd, USCSICMD, &sc );
if( i_ret < 0 || sc.uscsi_status )
{
i_ret = -1;
}
*pi_asf = p_buffer[ 7 ] & 1;
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 8 );
......@@ -591,6 +677,20 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 8 );
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 12 );
rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
i_ret = ioctl( i_fd, USCSICMD, &sc );
if( i_ret < 0 || sc.uscsi_status )
{
i_ret = -1;
}
memcpy( p_key, p_buffer + 4, 8 );;
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 12 );
......@@ -673,6 +773,18 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 0 );
rs_cdb.cdb_opaque[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
i_ret = ioctl( i_fd, USCSICMD, &sc );
if( i_ret < 0 || sc.uscsi_status )
{
i_ret = -1;
}
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 0 );
......@@ -749,6 +861,21 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_SEND_KEY, 16 );
rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
p_buffer[ 1 ] = 0xe;
memcpy( p_buffer + 4, p_challenge, 12 );
if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
{
return -1;
}
return 0;
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 16 );
......@@ -833,6 +960,21 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_SEND_KEY, 12 );
rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
p_buffer[ 1 ] = 0xa;
memcpy( p_buffer + 4, p_key, 8 );
if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
{
return -1;
}
return 0;
#elif defined( WIN32 )
if( WIN2K ) /* NT/Win2000/Whistler */
{
......@@ -920,6 +1062,43 @@ static void BeInitRDC( raw_device_command *p_rdc, int i_type )
}
#endif
#if defined( SOLARIS_USCSI )
/*****************************************************************************
* SolarisInitUSCSI: initialize a USCSICMD structure for the Solaris kernel
*****************************************************************************
* This function initializes a Solaris userspace scsi command structure for
* future use, either a read command or a write command.
*****************************************************************************/
static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type )
{
union scsi_cdb *rs_cdb;
memset( p_sc->uscsi_cdb, 0, sizeof( union scsi_cdb ) );
memset( p_sc->uscsi_bufaddr, 0, p_sc->uscsi_buflen );
switch( i_type )
{
case GPCMD_SEND_KEY:
p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_WRITE;
break;
case GPCMD_READ_DVD_STRUCTURE:
case GPCMD_REPORT_KEY:
p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_READ;
break;
}
rs_cdb = (union scsi_cdb *)p_sc->uscsi_cdb;
rs_cdb->scc_cmd = i_type;
rs_cdb->cdb_opaque[ 8 ] = (p_sc->uscsi_buflen >> 8) & 0xff;
rs_cdb->cdb_opaque[ 9 ] = p_sc->uscsi_buflen & 0xff;
p_sc->uscsi_cdblen = 12;
USCSI_TIMEOUT( p_sc, 15 );
}
#endif
#if defined( WIN32 )
/*****************************************************************************
* WinInitSSC: initialize a ssc structure for the win32 aspi layer
......
......@@ -2,7 +2,7 @@
* ioctl.h: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ioctl.h,v 1.5 2001/07/07 21:10:58 gbazin Exp $
* $Id: ioctl.h,v 1.6 2001/08/08 02:48:44 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -45,6 +45,23 @@ int ioctl_SendKey2 ( int, int *, u8 * );
BeInitRDC( &rdc, (TYPE) );
#endif
/*****************************************************************************
* Common macro, Solaris specific
*****************************************************************************/
#if defined( SOLARIS_USCSI )
#define USCSI_TIMEOUT( SC, TO ) ( (SC)->uscsi_timeout = (TO) )
#define USCSI_RESID( SC ) ( (SC)->uscsi_resid )
#define INIT_USCSI( TYPE, SIZE ) \
struct uscsi_cmd sc; \
union scsi_cdb rs_cdb; \
u8 p_buffer[ (SIZE) ]; \
memset( &sc, 0, sizeof( struct uscsi_cmd ) ); \
sc.uscsi_cdb = (caddr_t)&rs_cdb; \
sc.uscsi_bufaddr = p_buffer; \
sc.uscsi_buflen = (SIZE); \
SolarisInitUSCSI( &sc, (TYPE) );
#endif