Lines Matching defs:uevent

42 #include <cutils/uevent.h>
128 struct uevent {
355 static void parse_uevent(const char *msg, struct uevent *uevent)
357 uevent->action = "";
358 uevent->path = "";
359 uevent->subsystem = "";
360 uevent->ps_name = "";
361 uevent->ps_online = "";
362 uevent->ps_type = "";
367 LOGV("uevent str: %s\n", msg);
371 uevent->action = msg;
374 uevent->path = msg;
377 uevent->subsystem = msg;
380 uevent->ps_name = msg;
383 uevent->ps_online = msg;
386 uevent->ps_type = msg;
395 uevent->action, uevent->path, uevent->subsystem,
396 uevent->ps_name, uevent->ps_type, uevent->ps_online);
399 static void process_ps_uevent(struct charger *charger, struct uevent *uevent)
408 if (uevent->ps_type[0] == '\0') {
412 if (uevent->path[0] == '\0')
414 ret = asprintf(&path, "/sys/%s/type", uevent->path);
422 strlcpy(ps_type, uevent->ps_type, sizeof(ps_type));
428 online = atoi(uevent->ps_online);
429 supply = find_supply(charger, uevent->ps_name);
435 if (!strcmp(uevent->action, "add")) {
437 supply = add_supply(charger, uevent->ps_name, ps_type, uevent->path,
440 LOGE("cannot add supply '%s' (%s %d)\n", uevent->ps_name,
441 uevent->ps_type, online);
448 LOGE("supply '%s' already exists..\n", uevent->ps_name);
450 } else if (!strcmp(uevent->action, "remove")) {
457 } else if (!strcmp(uevent->action, "change")) {
460 uevent->ps_name, ps_type, online);
477 uevent->ps_name, ps_type, battery ? "" : online ? "online" : "offline",
478 uevent->action, charger->num_supplies_online, charger->num_supplies);
481 static void process_uevent(struct charger *charger, struct uevent *uevent)
483 if (!strcmp(uevent->subsystem, "power_supply"))
484 process_ps_uevent(charger, uevent);
497 struct uevent uevent;
508 parse_uevent(msg, &uevent);
509 process_uevent(charger, &uevent);
534 fd = openat(dfd, "uevent", O_WRONLY);