Lines Matching defs:uevent
41 #include <cutils/uevent.h>
127 struct uevent {
354 static void parse_uevent(const char *msg, struct uevent *uevent)
356 uevent->action = "";
357 uevent->path = "";
358 uevent->subsystem = "";
359 uevent->ps_name = "";
360 uevent->ps_online = "";
361 uevent->ps_type = "";
366 LOGV("uevent str: %s\n", msg);
370 uevent->action = msg;
373 uevent->path = msg;
376 uevent->subsystem = msg;
379 uevent->ps_name = msg;
382 uevent->ps_online = msg;
385 uevent->ps_type = msg;
394 uevent->action, uevent->path, uevent->subsystem,
395 uevent->ps_name, uevent->ps_type, uevent->ps_online);
398 static void process_ps_uevent(struct charger *charger, struct uevent *uevent)
407 if (uevent->ps_type[0] == '\0') {
411 if (uevent->path[0] == '\0')
413 ret = asprintf(&path, "/sys/%s/type", uevent->path);
421 strlcpy(ps_type, uevent->ps_type, sizeof(ps_type));
427 online = atoi(uevent->ps_online);
428 supply = find_supply(charger, uevent->ps_name);
434 if (!strcmp(uevent->action, "add")) {
436 supply = add_supply(charger, uevent->ps_name, ps_type, uevent->path,
439 LOGE("cannot add supply '%s' (%s %d)\n", uevent->ps_name,
440 uevent->ps_type, online);
447 LOGE("supply '%s' already exists..\n", uevent->ps_name);
449 } else if (!strcmp(uevent->action, "remove")) {
456 } else if (!strcmp(uevent->action, "change")) {
459 uevent->ps_name, ps_type, online);
476 uevent->ps_name, ps_type, battery ? "" : online ? "online" : "offline",
477 uevent->action, charger->num_supplies_online, charger->num_supplies);
480 static void process_uevent(struct charger *charger, struct uevent *uevent)
482 if (!strcmp(uevent->subsystem, "power_supply"))
483 process_ps_uevent(charger, uevent);
496 struct uevent uevent;
507 parse_uevent(msg, &uevent);
508 process_uevent(charger, &uevent);
533 fd = openat(dfd, "uevent", O_WRONLY);