~ubuntu-branches/debian/squeeze/hal/squeeze

« back to all changes in this revision

Viewing changes to hald/linux/addons/addon-acpi.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-10-23 12:33:58 UTC
  • Revision ID: james.westby@ubuntu.com-20071023123358-xaf8mjc5n84d5gtz
Tags: upstream-0.5.10
ImportĀ upstreamĀ versionĀ 0.5.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
                        case 20490: /* Tablet rotated back*/
155
155
                                button = "tabletpc_rotate_normal";
156
156
                                break;
 
157
                        case 28672: /* killswitch */
 
158
                                button = "killswitch";
 
159
                                break;
157
160
                        default:
158
161
                                break;
159
162
                        
179
182
        DBusError error;
180
183
        char event[256];
181
184
 
 
185
        dbus_error_init (&error);
 
186
 
182
187
        while (fgets (event, sizeof event, eventfp))
183
188
        {
184
189
                HAL_DEBUG (("event is '%s'", event));
194
199
                                HAL_DEBUG (("button event"));
195
200
 
196
201
                                /* TODO: only rescan if button got state */
197
 
                                dbus_error_init (&error);
198
202
                                if (libhal_device_rescan (ctx, udi, &error)) {
199
 
                                        dbus_error_init (&error);
200
203
                                        type = libhal_device_get_property_string(ctx, udi, 
201
204
                                                                                 "button.type",
202
205
                                                                                 &error);
 
206
                                        if (dbus_error_is_set (&error)) {
 
207
                                                dbus_error_free (&error);
 
208
                                        }
 
209
 
203
210
                                        if (type != NULL) {
204
211
                                                libhal_device_emit_condition (ctx, udi, "ButtonPressed",
205
212
                                                                              type, &error);
210
217
                                }
211
218
                        } else if (strncmp (acpi_path, "ac_adapter", sizeof ("ac_adapter") - 1) == 0) {
212
219
                                HAL_DEBUG (("ac_adapter event"));
213
 
                                dbus_error_init (&error);
214
220
                                libhal_device_rescan (ctx, udi, &error);
215
221
                        } else if (strncmp (acpi_path, "battery", sizeof ("battery") - 1) == 0) {
216
222
                                HAL_DEBUG (("battery event"));
217
 
                                dbus_error_init (&error);
218
223
                                libhal_device_rescan (ctx, udi, &error);
219
224
#ifdef BUILD_ACPI_IBM
220
225
                        } else if (strncmp (acpi_path, "ibm/hotkey", sizeof ("ibm/hotkey") -1) == 0) {
234
239
                }
235
240
        }
236
241
 
237
 
        dbus_error_free (&error);
238
242
        fclose (eventfp);
239
243
}
240
244