Lines Matching refs:uevent

61 struct uevent {  struct
365 static void parse_event(const char *msg, struct uevent *uevent) in parse_event() argument
367 uevent->action = ""; in parse_event()
368 uevent->path = ""; in parse_event()
369 uevent->subsystem = ""; in parse_event()
370 uevent->firmware = ""; in parse_event()
371 uevent->major = -1; in parse_event()
372 uevent->minor = -1; in parse_event()
373 uevent->partition_name = NULL; in parse_event()
374 uevent->partition_num = -1; in parse_event()
375 uevent->device_name = NULL; in parse_event()
381 uevent->action = msg; in parse_event()
384 uevent->path = msg; in parse_event()
387 uevent->subsystem = msg; in parse_event()
390 uevent->firmware = msg; in parse_event()
393 uevent->major = atoi(msg); in parse_event()
396 uevent->minor = atoi(msg); in parse_event()
399 uevent->partition_num = atoi(msg); in parse_event()
402 uevent->partition_name = msg; in parse_event()
405 uevent->device_name = msg; in parse_event()
415 uevent->action, uevent->path, uevent->subsystem, in parse_event()
416 uevent->firmware, uevent->major, uevent->minor); in parse_event()
420 static char **get_character_device_symlinks(struct uevent *uevent) in get_character_device_symlinks() argument
429 pdev = find_platform_device(uevent->path); in get_character_device_symlinks()
439 parent = strchr(uevent->path + pdev->path_len, '/'); in get_character_device_symlinks()
457 if (asprintf(&links[link_num], "/dev/usb/%s%.*s", uevent->subsystem, width, parent) > 0) in get_character_device_symlinks()
473 static char **get_block_device_symlinks(struct uevent *uevent) in get_block_device_symlinks() argument
484 pdev = find_platform_device(uevent->path); in get_block_device_symlinks()
488 } else if (!find_pci_device_prefix(uevent->path, buf, sizeof(buf))) { in get_block_device_symlinks()
504 if (uevent->partition_name) { in get_block_device_symlinks()
505 p = strdup(uevent->partition_name); in get_block_device_symlinks()
507 if (strcmp(uevent->partition_name, p)) in get_block_device_symlinks()
508 NOTICE("Linking partition '%s' as '%s'\n", uevent->partition_name, p); in get_block_device_symlinks()
516 if (uevent->partition_num >= 0) { in get_block_device_symlinks()
517 if (asprintf(&links[link_num], "%s/by-num/p%d", link_path, uevent->partition_num) > 0) in get_block_device_symlinks()
523 slash = strrchr(uevent->path, '/'); in get_block_device_symlinks()
560 static void handle_platform_device_event(struct uevent *uevent) in handle_platform_device_event() argument
562 const char *path = uevent->path; in handle_platform_device_event()
564 if (!strcmp(uevent->action, "add")) in handle_platform_device_event()
566 else if (!strcmp(uevent->action, "remove")) in handle_platform_device_event()
570 static const char *parse_device_name(struct uevent *uevent, unsigned int len) in parse_device_name() argument
575 if((uevent->major < 0) || (uevent->minor < 0)) in parse_device_name()
579 name = strrchr(uevent->path, '/'); in parse_device_name()
594 static void handle_block_device_event(struct uevent *uevent) in handle_block_device_event() argument
601 name = parse_device_name(uevent, 64); in handle_block_device_event()
608 if (!strncmp(uevent->path, "/devices/", 9)) in handle_block_device_event()
609 links = get_block_device_symlinks(uevent); in handle_block_device_event()
611 handle_device(uevent->action, devpath, uevent->path, 1, in handle_block_device_event()
612 uevent->major, uevent->minor, links); in handle_block_device_event()
644 static void handle_generic_device_event(struct uevent *uevent) in handle_generic_device_event() argument
651 name = parse_device_name(uevent, 64); in handle_generic_device_event()
656 ueventd_subsystem_find_by_name(uevent->subsystem); in handle_generic_device_event()
663 devname = uevent->device_name; in handle_generic_device_event()
672 uevent->subsystem); in handle_generic_device_event()
679 } else if (!strncmp(uevent->subsystem, "usb", 3)) { in handle_generic_device_event()
680 if (!strcmp(uevent->subsystem, "usb")) { in handle_generic_device_event()
681 if (uevent->device_name) { in handle_generic_device_event()
682 if (!assemble_devpath(devpath, "/dev", uevent->device_name)) in handle_generic_device_event()
691 int bus_id = uevent->minor / 128 + 1; in handle_generic_device_event()
692 int device_id = uevent->minor % 128 + 1; in handle_generic_device_event()
704 } else if (!strncmp(uevent->subsystem, "graphics", 8)) { in handle_generic_device_event()
707 } else if (!strncmp(uevent->subsystem, "drm", 3)) { in handle_generic_device_event()
710 } else if (!strncmp(uevent->subsystem, "oncrpc", 6)) { in handle_generic_device_event()
713 } else if (!strncmp(uevent->subsystem, "adsp", 4)) { in handle_generic_device_event()
716 } else if (!strncmp(uevent->subsystem, "msm_camera", 10)) { in handle_generic_device_event()
719 } else if(!strncmp(uevent->subsystem, "input", 5)) { in handle_generic_device_event()
722 } else if(!strncmp(uevent->subsystem, "mtd", 3)) { in handle_generic_device_event()
725 } else if(!strncmp(uevent->subsystem, "sound", 5)) { in handle_generic_device_event()
728 } else if(!strncmp(uevent->subsystem, "misc", 4) && in handle_generic_device_event()
736 links = get_character_device_symlinks(uevent); in handle_generic_device_event()
741 handle_device(uevent->action, devpath, uevent->path, 0, in handle_generic_device_event()
742 uevent->major, uevent->minor, links); in handle_generic_device_event()
745 static void handle_device_event(struct uevent *uevent) in handle_device_event() argument
747 …if (!strcmp(uevent->action,"add") || !strcmp(uevent->action, "change") || !strcmp(uevent->action, … in handle_device_event()
748 fixup_sys_perms(uevent->path); in handle_device_event()
750 if (!strncmp(uevent->subsystem, "block", 5)) { in handle_device_event()
751 handle_block_device_event(uevent); in handle_device_event()
752 } else if (!strncmp(uevent->subsystem, "platform", 8)) { in handle_device_event()
753 handle_platform_device_event(uevent); in handle_device_event()
755 handle_generic_device_event(uevent); in handle_device_event()
802 static void process_firmware_event(struct uevent *uevent) in process_firmware_event() argument
810 uevent->firmware, uevent->path); in process_firmware_event()
812 l = asprintf(&root, SYSFS_PREFIX"%s/", uevent->path); in process_firmware_event()
835 l = asprintf(&file, "%s/%s", firmware_dirs[i], uevent->firmware); in process_firmware_event()
842 INFO("firmware: copy success { '%s', '%s' }\n", root, uevent->firmware); in process_firmware_event()
844 INFO("firmware: copy failure { '%s', '%s' }\n", root, uevent->firmware); in process_firmware_event()
857 INFO("firmware: could not open '%s': %s\n", uevent->firmware, strerror(errno)); in process_firmware_event()
875 static void handle_firmware_event(struct uevent *uevent) in handle_firmware_event() argument
879 if(strcmp(uevent->subsystem, "firmware")) in handle_firmware_event()
882 if(strcmp(uevent->action, "add")) in handle_firmware_event()
888 process_firmware_event(uevent); in handle_firmware_event()
907 struct uevent uevent; in handle_device_fd() local
908 parse_event(msg, &uevent); in handle_device_fd()
919 handle_device_event(&uevent); in handle_device_fd()
920 handle_firmware_event(&uevent); in handle_device_fd()