Home | History | Annotate | Download | only in charger

Lines Matching defs:uevent

42 #include <cutils/uevent.h>
132 struct uevent {
374 static void parse_uevent(const char *msg, struct uevent *uevent)
376 uevent->action = "";
377 uevent->path = "";
378 uevent->subsystem = "";
379 uevent->ps_name = "";
380 uevent->ps_online = "";
381 uevent->ps_type = "";
386 LOGV("uevent str: %s\n", msg);
390 uevent->action = msg;
393 uevent->path = msg;
396 uevent->subsystem = msg;
399 uevent->ps_name = msg;
402 uevent->ps_online = msg;
405 uevent->ps_type = msg;
414 uevent->action, uevent->path, uevent->subsystem,
415 uevent->ps_name, uevent->ps_type, uevent->ps_online);
418 static void process_ps_uevent(struct charger *charger, struct uevent *uevent)
427 if (uevent->ps_type[0] == '\0') {
431 if (uevent->path[0] == '\0')
433 ret = asprintf(&path, "/sys/%s/type", uevent->path);
441 strlcpy(ps_type, uevent->ps_type, sizeof(ps_type));
447 online = atoi(uevent->ps_online);
448 supply = find_supply(charger, uevent->ps_name);
454 if (!strcmp(uevent->action, "add")) {
456 supply = add_supply(charger, uevent->ps_name, ps_type, uevent->path,
459 LOGE("cannot add supply '%s' (%s %d)\n", uevent->ps_name,
460 uevent->ps_type, online);
467 LOGE("supply '%s' already exists..\n", uevent->ps_name);
469 } else if (!strcmp(uevent->action, "remove")) {
476 } else if (!strcmp(uevent->action, "change")) {
479 uevent->ps_name, ps_type, online);
496 uevent->ps_name, ps_type, battery ? "" : online ? "online" : "offline",
497 uevent->action, charger->num_supplies_online, charger->num_supplies);
500 static void process_uevent(struct charger *charger, struct uevent *uevent)
502 if (!strcmp(uevent->subsystem, "power_supply"))
503 process_ps_uevent(charger, uevent);
516 struct uevent uevent;
527 parse_uevent(msg, &uevent);
528 process_uevent(charger, &uevent);
553 fd = openat(dfd, "uevent", O_WRONLY);