~ubuntu-branches/ubuntu/lucid/hal/lucid-proposed

« back to all changes in this revision

Viewing changes to hald/linux/addons/addon-omap-backlight.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-12-03 01:21:24 UTC
  • mto: (1.1.18 squeeze)
  • mto: This revision was merged to the branch mainline in revision 165.
  • Revision ID: james.westby@ubuntu.com-20091203012124-3573qknop973uvc2
Tags: upstream-0.5.14
ImportĀ upstreamĀ versionĀ 0.5.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
             dbus_message_get_member (message));
159
159
#endif
160
160
        reply = NULL;
 
161
        dbus_error_init (&err);
161
162
 
162
163
        if (dbus_message_is_method_call (message,
163
164
                                         "org.freedesktop.Hal.Device.LaptopPanel",
164
165
                                         "SetBrightness")) {
165
166
                int brightness;
166
167
 
167
 
                dbus_error_init (&err);
168
168
                if (dbus_message_get_args (message,
169
169
                                           &err,
170
170
                                           DBUS_TYPE_INT32, &brightness,
195
195
                                                "GetBrightness")) {
196
196
                int brightness;
197
197
 
198
 
                dbus_error_init (&err);
199
198
                if (dbus_message_get_args (message,
200
199
                                           &err,
201
200
                                           DBUS_TYPE_INVALID)) {
223
222
        if (reply != NULL)
224
223
                dbus_message_unref (reply);
225
224
 
 
225
        LIBHAL_FREE_DBUS_ERROR (&err);
 
226
 
226
227
        return DBUS_HANDLER_RESULT_HANDLED;
227
228
}
228
229
 
240
241
main (int argc, char *argv[])
241
242
{
242
243
        DBusError err;
 
244
        int retval = 0;
243
245
 
244
246
        setup_logger ();
245
247
        setup_cb ();
254
256
        dbus_error_init (&err);
255
257
        if ((halctx = libhal_ctx_init_direct (&err)) == NULL) {
256
258
                HAL_ERROR (("Cannot connect to hald"));
257
 
                return -3;
 
259
                retval = -3;
 
260
                goto out;
258
261
        }
259
262
 
260
263
        conn = libhal_ctx_get_dbus_connection (halctx);
274
277
                                            "    </method>\n",
275
278
                                            &err)) {
276
279
                HAL_ERROR (("Cannot claim interface 'org.freedesktop.Hal.Device.LaptopPanel'"));
277
 
                return -4;
 
280
                retval = -4;
 
281
                goto out;
278
282
        }
279
283
 
280
 
        dbus_error_init (&err);
281
284
        if (!libhal_device_addon_is_ready (halctx, udi, &err)) {
282
 
                return -4;
 
285
                retval = -4;
 
286
                goto out;
283
287
        }
284
288
 
285
289
        bl_data.backlight_init (&bl_data);
286
290
        main_loop = g_main_loop_new (NULL, FALSE);
287
291
        g_main_loop_run (main_loop);
288
292
        return 0;
 
293
 
 
294
out:
 
295
        HAL_DEBUG (("An error occured, exiting cleanly"));
 
296
 
 
297
        LIBHAL_FREE_DBUS_ERROR (&err);
 
298
 
 
299
        if (halctx != NULL) {
 
300
                libhal_ctx_shutdown (halctx, &err);
 
301
                LIBHAL_FREE_DBUS_ERROR (&err);
 
302
                libhal_ctx_free (halctx);
 
303
        }
 
304
 
 
305
        return retval;
289
306
}