Commit aab17bb8 authored by Christophe Massiot's avatar Christophe Massiot

* dvbiscovery: Support adapters with multiple frontends. * dvblast,...

* dvbiscovery: Support adapters with multiple frontends. * dvblast, dvblastctl: Trust the process's umask. * en50221.c: In XML mode, output the name of the CAM.
parent def397a3
......@@ -41,7 +41,6 @@ int i_comm_fd = -1;
*****************************************************************************/
void comm_Open( void )
{
int i_mask;
int i_size = 65535;
struct sockaddr_un sun_server;
......@@ -57,18 +56,15 @@ void comm_Open( void )
sun_server.sun_family = AF_UNIX;
strncpy( sun_server.sun_path, psz_srv_socket, sizeof(sun_server.sun_path) );
sun_server.sun_path[sizeof(sun_server.sun_path) - 1] = '\0';
i_mask = umask(077);
if ( bind( i_comm_fd, (struct sockaddr *)&sun_server,
SUN_LEN(&sun_server) ) < 0 )
{
msg_Err( NULL, "cannot bind comm socket (%s)", strerror(errno) );
umask( i_mask );
close( i_comm_fd );
i_comm_fd = -1;
return;
}
umask( i_mask );
}
/*****************************************************************************
......
......@@ -362,10 +362,10 @@ static void FrontendPoll( void )
IF_UP( FE_HAS_LOCK )
{
int32_t i_value = 0;
msg_Dbg( NULL, "frontend has acquired lock" );
msg_Info( NULL, "frontend has acquired lock" );
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"1\"/>\n");
printf("<STATUS type=\"lock\" status=\"1\" />\n");
break;
default:
printf("frontend has acquired lock\n" );
......
......@@ -136,17 +136,14 @@ int main( int i_argc, char **ppsz_argv )
strncpy( sun_client.sun_path, psz_client_socket,
sizeof(sun_client.sun_path) );
sun_client.sun_path[sizeof(sun_client.sun_path) - 1] = '\0';
i_mask = umask(077);
if ( bind( i_fd, (struct sockaddr *)&sun_client,
SUN_LEN(&sun_client) ) < 0 )
{
msg_Err( NULL, "cannot bind (%s)", strerror(errno) );
umask( i_mask );
close( i_fd );
exit(255);
}
umask( i_mask );
memset( &sun_server, 0, sizeof(sun_server) );
sun_server.sun_family = AF_UNIX;
......
......@@ -1025,11 +1025,23 @@ static void ApplicationInformationHandle( access_t * p_access, int i_session_id,
d = GetLength( d, &l );
{
char psz_name[l + 1];
char *psz_name = malloc(l + 1);
memcpy( psz_name, d, l );
psz_name[l] = '\0';
msg_Info( p_access, "CAM: %s, %02X, %04X, %04X",
psz_name, i_type, i_manufacturer, i_code );
switch (i_print_type)
{
case PRINT_XML:
psz_name = dvb_string_xml_escape(psz_name);
printf("<STATUS type=\"cam\" status=\"1\" cam_name=\"%s\" cam_type=\"%d\" cam_manufacturer=\"%d\" cam_product=\"%d\" />\n",
psz_name, i_type, i_manufacturer, i_code);
break;
default:
printf("CAM: name=%s type=%d manufacturer=%d product=%d\n",
psz_name, i_type, i_manufacturer, i_code);
}
free(psz_name);
}
break;
}
......@@ -1986,6 +1998,15 @@ void en50221_Init( void )
*****************************************************************************/
void en50221_Reset( void )
{
switch (i_print_type)
{
case PRINT_XML:
printf("<STATUS type=\"cam\" status=\"0\" />\n");
break;
default:
break;
}
memset( p_slots, 0, sizeof(ci_slot_t) * MAX_CI_SLOTS );
if( i_ca_type & CA_CI_LINK )
......
......@@ -29,15 +29,16 @@ LOCK_TIMEOUT=2500
QUIT_TIMEOUT=15000
usage() {
echo "Usage: $0 [-a <adapter #>] [-S <diseqc sat num>] [-c <conf file>]" >&2
echo "Usage: $0 [-a <adapter #>] [-n <frontend #>] [-S <diseqc sat num>] [-c <conf file>]" >&2
exit 1
}
conf_file_passed=""
adapter=""
frontend=""
diseqc=""
TEMP=`getopt -o a:S:c: -n "$0" -- "$@"`
TEMP=`getopt -o a:n:S:c: -n "$0" -- "$@"`
if test $? -ne 0; then
usage
......@@ -51,6 +52,10 @@ while :; do
adapter="-a $2"
shift 2
;;
-n)
frontend="-n $2"
shift 2
;;
-c)
conf_file_passed=$2
shift 2
......@@ -69,7 +74,7 @@ while :; do
esac
done
type=`$DVBLAST $diseqc $adapter -f 0 2>&1 | grep '^debug: Frontend' | sed 's/^debug: Frontend ".*" type "\(.*\)" supports:$/\1/'`
type=`$DVBLAST $diseqc $adapter $frontend -f 0 2>&1 | grep '^debug: Frontend' | sed 's/^debug: Frontend ".*" type "\(.*\)" supports:$/\1/'`
tune=""
conf_file=""
......@@ -115,7 +120,7 @@ signal_catch() {
exec_dvblast() {
tmp_file=`mktemp`
$DVBLAST $diseqc $adapter -O $LOCK_TIMEOUT -Q $QUIT_TIMEOUT -q4 -x xml $opts >| $tmp_file &
$DVBLAST $diseqc $adapter $frontend -O $LOCK_TIMEOUT -Q $QUIT_TIMEOUT -q4 -x xml $opts >| $tmp_file &
childpid=$!
wait $childpid
if test $? -eq 0; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment