Lines Matching refs:uevent
62 struct uevent { struct
388 static void parse_event(const char *msg, struct uevent *uevent) in parse_event() argument
390 uevent->action = ""; in parse_event()
391 uevent->path = ""; in parse_event()
392 uevent->subsystem = ""; in parse_event()
393 uevent->firmware = ""; in parse_event()
394 uevent->major = -1; in parse_event()
395 uevent->minor = -1; in parse_event()
396 uevent->partition_name = NULL; in parse_event()
397 uevent->partition_num = -1; in parse_event()
398 uevent->device_name = NULL; in parse_event()
404 uevent->action = msg; in parse_event()
407 uevent->path = msg; in parse_event()
410 uevent->subsystem = msg; in parse_event()
413 uevent->firmware = msg; in parse_event()
416 uevent->major = atoi(msg); in parse_event()
419 uevent->minor = atoi(msg); in parse_event()
422 uevent->partition_num = atoi(msg); in parse_event()
425 uevent->partition_name = msg; in parse_event()
428 uevent->device_name = msg; in parse_event()
437 uevent->action, uevent->path, uevent->subsystem, in parse_event()
438 uevent->firmware, uevent->major, uevent->minor); in parse_event()
441 static char **get_character_device_symlinks(struct uevent *uevent) in get_character_device_symlinks() argument
450 pdev = find_platform_device(uevent->path); in get_character_device_symlinks()
460 parent = strchr(uevent->path + pdev->path_len, '/'); in get_character_device_symlinks()
478 if (asprintf(&links[link_num], "/dev/usb/%s%.*s", uevent->subsystem, width, parent) > 0) in get_character_device_symlinks()
494 static char **get_block_device_symlinks(struct uevent *uevent) in get_block_device_symlinks() argument
510 pdev = find_platform_device(uevent->path); in get_block_device_symlinks()
514 } else if (!find_pci_device_prefix(uevent->path, buf, sizeof(buf))) { in get_block_device_symlinks()
530 if (uevent->partition_name) { in get_block_device_symlinks()
531 p = strdup(uevent->partition_name); in get_block_device_symlinks()
533 if (strcmp(uevent->partition_name, p)) in get_block_device_symlinks()
534 NOTICE("Linking partition '%s' as '%s'\n", uevent->partition_name, p); in get_block_device_symlinks()
542 if (uevent->partition_num >= 0) { in get_block_device_symlinks()
543 if (asprintf(&links[link_num], "%s/by-num/p%d", link_path, uevent->partition_num) > 0) in get_block_device_symlinks()
549 slash = strrchr(uevent->path, '/'); in get_block_device_symlinks()
586 static void handle_platform_device_event(struct uevent *uevent) in handle_platform_device_event() argument
588 const char *path = uevent->path; in handle_platform_device_event()
590 if (!strcmp(uevent->action, "add")) in handle_platform_device_event()
592 else if (!strcmp(uevent->action, "remove")) in handle_platform_device_event()
596 static const char *parse_device_name(struct uevent *uevent, unsigned int len) in parse_device_name() argument
601 if((uevent->major < 0) || (uevent->minor < 0)) in parse_device_name()
605 name = strrchr(uevent->path, '/'); in parse_device_name()
620 static void handle_block_device_event(struct uevent *uevent) in handle_block_device_event() argument
627 name = parse_device_name(uevent, 64); in handle_block_device_event()
634 if (!strncmp(uevent->path, "/devices/", 9)) in handle_block_device_event()
635 links = get_block_device_symlinks(uevent); in handle_block_device_event()
637 handle_device(uevent->action, devpath, uevent->path, 1, in handle_block_device_event()
638 uevent->major, uevent->minor, links); in handle_block_device_event()
675 static void handle_generic_device_event(struct uevent *uevent) in handle_generic_device_event() argument
682 name = parse_device_name(uevent, 64); in handle_generic_device_event()
687 ueventd_subsystem_find_by_name(uevent->subsystem); in handle_generic_device_event()
694 devname = uevent->device_name; in handle_generic_device_event()
703 uevent->subsystem); in handle_generic_device_event()
710 } else if (!strncmp(uevent->subsystem, "usb", 3)) { in handle_generic_device_event()
711 if (!strcmp(uevent->subsystem, "usb")) { in handle_generic_device_event()
712 if (uevent->device_name) { in handle_generic_device_event()
713 if (!assemble_devpath(devpath, "/dev", uevent->device_name)) in handle_generic_device_event()
722 int bus_id = uevent->minor / 128 + 1; in handle_generic_device_event()
723 int device_id = uevent->minor % 128 + 1; in handle_generic_device_event()
735 } else if (!strncmp(uevent->subsystem, "graphics", 8)) { in handle_generic_device_event()
738 } else if (!strncmp(uevent->subsystem, "drm", 3)) { in handle_generic_device_event()
741 } else if (!strncmp(uevent->subsystem, "oncrpc", 6)) { in handle_generic_device_event()
744 } else if (!strncmp(uevent->subsystem, "adsp", 4)) { in handle_generic_device_event()
747 } else if (!strncmp(uevent->subsystem, "msm_camera", 10)) { in handle_generic_device_event()
750 } else if(!strncmp(uevent->subsystem, "input", 5)) { in handle_generic_device_event()
753 } else if(!strncmp(uevent->subsystem, "mtd", 3)) { in handle_generic_device_event()
756 } else if(!strncmp(uevent->subsystem, "sound", 5)) { in handle_generic_device_event()
759 } else if(!strncmp(uevent->subsystem, "misc", 4) && in handle_generic_device_event()
767 links = get_character_device_symlinks(uevent); in handle_generic_device_event()
772 handle_device(uevent->action, devpath, uevent->path, 0, in handle_generic_device_event()
773 uevent->major, uevent->minor, links); in handle_generic_device_event()
776 static void handle_device_event(struct uevent *uevent) in handle_device_event() argument
778 …if (!strcmp(uevent->action,"add") || !strcmp(uevent->action, "change") || !strcmp(uevent->action, … in handle_device_event()
779 fixup_sys_perms(uevent->path); in handle_device_event()
781 if (!strncmp(uevent->subsystem, "block", 5)) { in handle_device_event()
782 handle_block_device_event(uevent); in handle_device_event()
783 } else if (!strncmp(uevent->subsystem, "platform", 8)) { in handle_device_event()
784 handle_platform_device_event(uevent); in handle_device_event()
786 handle_generic_device_event(uevent); in handle_device_event()
841 static void process_firmware_event(struct uevent *uevent) in process_firmware_event() argument
848 uevent->firmware, uevent->path); in process_firmware_event()
850 l = asprintf(&root, SYSFS_PREFIX"%s/", uevent->path); in process_firmware_event()
862 l = asprintf(&file1, FIRMWARE_DIR1"/%s", uevent->firmware); in process_firmware_event()
866 l = asprintf(&file2, FIRMWARE_DIR2"/%s", uevent->firmware); in process_firmware_event()
870 l = asprintf(&file3, FIRMWARE_DIR3"/%s", uevent->firmware); in process_firmware_event()
897 INFO("firmware: could not open '%s' %d\n", uevent->firmware, errno); in process_firmware_event()
905 INFO("firmware: copy success { '%s', '%s' }\n", root, uevent->firmware); in process_firmware_event()
907 INFO("firmware: copy failure { '%s', '%s' }\n", root, uevent->firmware); in process_firmware_event()
926 static void handle_firmware_event(struct uevent *uevent) in handle_firmware_event() argument
931 if(strcmp(uevent->subsystem, "firmware")) in handle_firmware_event()
934 if(strcmp(uevent->action, "add")) in handle_firmware_event()
940 process_firmware_event(uevent); in handle_firmware_event()
957 struct uevent uevent; in handle_device_fd() local
958 parse_event(msg, &uevent); in handle_device_fd()
969 handle_device_event(&uevent); in handle_device_fd()
970 handle_firmware_event(&uevent); in handle_device_fd()