Commit 5f15a425 authored by Clément Stenac's avatar Clément Stenac

Fix new HAL interaction

parent 7af8b241
......@@ -104,6 +104,7 @@ static int Open( vlc_object_t *p_this )
playlist_view_t *p_view;
DBusError dbus_error;
DBusConnection *p_connection;
p_sd->pf_run = Run;
p_sd->p_sys = p_sys;
......@@ -111,13 +112,30 @@ static int Open( vlc_object_t *p_this )
dbus_error_init( &dbus_error );
#ifdef HAVE_HAL_1
if( !( p_sys->p_ctx = libhal_ctx_init_direct( &dbus_error ) ) )
p_sys->p_ctx = libhal_ctx_new();
if( !p_sys->p_ctx )
{
msg_Err( p_sd, "Unable to create HAL context") ;
free( p_sys );
return VLC_EGENERIC;
}
p_connection = dbus_bus_get( DBUS_BUS_SYSTEM, &dbus_error );
if( dbus_error_is_set( &dbus_error ) )
{
msg_Err( p_sd, "Unable to connect to DBUS: %s", dbus_error.message );
dbus_error_free( &dbus_error );
free( p_sys );
return VLC_EGENERIC;
}
libhal_ctx_set_dbus_connection( p_sys->p_ctx, p_connection );
if( !libhal_ctx_init( p_sys->p_ctx, &dbus_error ) )
#else
if( !( p_sys->p_ctx = hal_initialize( NULL, FALSE ) ) )
if( !(p_sys->p_ctx = hal_initialize( NULL, FALSE ) ) )
#endif
{
free( p_sys );
msg_Err( p_sd, "hal not available : %s", dbus_error.message );
dbus_error_free( &dbus_error );
free( p_sys );
return VLC_EGENERIC;
}
......
......@@ -2556,9 +2556,21 @@ static void InitDeviceValues( vlc_t *p_vlc )
char **devices;
char *block_dev;
dbus_bool_t b_dvd;
DBusConnection *p_connection;
DBusError error;
#ifdef HAVE_HAL_1
if( ( ctx = libhal_ctx_init_direct( NULL ) ) )
ctx = libhal_ctx_new();
if( !ctx ) return;
dbus_error_init( &error );
p_connection = dbus_bus_get ( DBUS_BUS_SYSTEM, &error );
if( dbus_error_is_set( &error ) )
{
dbus_error_free( &error );
return;
}
libhal_ctx_set_dbus_connection( ctx, p_connection );
if( !libhal_ctx_init( ctx, &error ) )
#else
if( ( ctx = hal_initialize( NULL, FALSE ) ) )
#endif
......@@ -2618,6 +2630,10 @@ static void InitDeviceValues( vlc_t *p_vlc )
hal_shutdown( ctx );
#endif
}
else
{
msg_Dbg( p_vlc, "Unable to get HAL device properties" );
}
#endif
}
......
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