Changeset 5f15a425fcaacd155a301ab8324cedad2a3ea651

Show
Ignore:
Timestamp:
27/11/05 12:30:14 (3 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1133091014 +0000
git-parent:

[7af8b2413813eb84e0643109f68b5fbe36b43ca1]

git-author:
Clément Stenac <zorglub@videolan.org> 1133091014 +0000
Message:

Fix new HAL interaction

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/services_discovery/hal.c

    rcaaf675 r5f15a42  
    105105 
    106106    DBusError           dbus_error; 
     107    DBusConnection      *p_connection; 
    107108 
    108109    p_sd->pf_run = Run; 
     
    112113 
    113114#ifdef HAVE_HAL_1 
    114     if( !( p_sys->p_ctx = libhal_ctx_init_direct( &dbus_error ) ) ) 
    115 #else 
    116     if( !( p_sys->p_ctx = hal_initialize( NULL, FALSE ) ) ) 
    117 #endif 
    118     { 
     115    p_sys->p_ctx = libhal_ctx_new(); 
     116    if( !p_sys->p_ctx ) 
     117    { 
     118        msg_Err( p_sd, "Unable to create HAL context") ; 
    119119        free( p_sys ); 
     120        return VLC_EGENERIC; 
     121    } 
     122    p_connection = dbus_bus_get( DBUS_BUS_SYSTEM, &dbus_error ); 
     123    if( dbus_error_is_set( &dbus_error ) ) 
     124    { 
     125        msg_Err( p_sd, "Unable to connect to DBUS: %s", dbus_error.message ); 
     126        dbus_error_free( &dbus_error ); 
     127        free( p_sys ); 
     128        return VLC_EGENERIC; 
     129    } 
     130    libhal_ctx_set_dbus_connection( p_sys->p_ctx, p_connection ); 
     131    if( !libhal_ctx_init( p_sys->p_ctx, &dbus_error ) ) 
     132#else 
     133    if( !(p_sys->p_ctx = hal_initialize( NULL, FALSE ) ) ) 
     134#endif 
     135    { 
    120136        msg_Err( p_sd, "hal not available : %s", dbus_error.message ); 
     137        dbus_error_free( &dbus_error ); 
     138        free( p_sys ); 
    121139        return VLC_EGENERIC; 
    122140    } 
  • src/libvlc.c

    r7b885b9 r5f15a42  
    25572557    char *block_dev; 
    25582558    dbus_bool_t b_dvd; 
     2559    DBusConnection *p_connection; 
     2560    DBusError       error; 
    25592561 
    25602562#ifdef HAVE_HAL_1 
    2561     if( ( ctx = libhal_ctx_init_direct( NULL ) ) ) 
     2563    ctx =  libhal_ctx_new(); 
     2564    if( !ctx ) return; 
     2565    dbus_error_init( &error ); 
     2566    p_connection = dbus_bus_get ( DBUS_BUS_SYSTEM, &error ); 
     2567    if( dbus_error_is_set( &error ) ) 
     2568    { 
     2569        dbus_error_free( &error ); 
     2570        return; 
     2571    } 
     2572    libhal_ctx_set_dbus_connection( ctx, p_connection ); 
     2573    if( !libhal_ctx_init( ctx, &error ) ) 
    25622574#else 
    25632575    if( ( ctx = hal_initialize( NULL, FALSE ) ) ) 
     
    26192631#endif 
    26202632    } 
     2633    else 
     2634    { 
     2635        msg_Dbg( p_vlc, "Unable to get HAL device properties" ); 
     2636    } 
    26212637#endif 
    26222638}