if (ret)
return ret;
- switch (event->type) {
- case EV_SW:
- s = "switch";
- break;
- case EV_KEY:
- default:
- s = "button";
- break;
- }
-
- ret = bh_event_add_var(event, 0, "SUBSYSTEM=%s", s);
+ ret = bh_event_add_var(event, 0, "SUBSYSTEM=%s", "button");
if (ret)
return ret;
if (ret)
return ret;
+ if (event->type == EV_SW) {
+ ret = bh_event_add_var(event, 0, "TYPE=%s", "switch");
+ if (ret)
+ return ret;
+ }
+
ret = bh_event_add_var(event, 0, "SEEN=%ld", event->seen);
if (ret)
return ret;
return;
}
- if (bdata->last_state != -1)
+ if ((bdata->last_state != -1) || (type == EV_SW))
button_hotplug_event(bdata, type, button->code, state);
bdata->last_state = state;