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