• Home
  • Raw
  • Download

Lines Matching refs:uevent

58 struct uevent {  struct
307 static void parse_event(const char *msg, struct uevent *uevent) in parse_event() argument
309 uevent->action = ""; in parse_event()
310 uevent->path = ""; in parse_event()
311 uevent->subsystem = ""; in parse_event()
312 uevent->firmware = ""; in parse_event()
313 uevent->major = -1; in parse_event()
314 uevent->minor = -1; in parse_event()
315 uevent->partition_name = NULL; in parse_event()
316 uevent->partition_num = -1; in parse_event()
317 uevent->device_name = NULL; in parse_event()
323 uevent->action = msg; in parse_event()
326 uevent->path = msg; in parse_event()
329 uevent->subsystem = msg; in parse_event()
332 uevent->firmware = msg; in parse_event()
335 uevent->major = atoi(msg); in parse_event()
338 uevent->minor = atoi(msg); in parse_event()
341 uevent->partition_num = atoi(msg); in parse_event()
344 uevent->partition_name = msg; in parse_event()
347 uevent->device_name = msg; in parse_event()
356 uevent->action, uevent->path, uevent->subsystem, in parse_event()
357 uevent->firmware, uevent->major, uevent->minor); in parse_event()
360 static char **get_character_device_symlinks(struct uevent *uevent) in get_character_device_symlinks() argument
369 pdev = find_platform_device(uevent->path); in get_character_device_symlinks()
379 parent = strchr(uevent->path + pdev->path_len, '/'); in get_character_device_symlinks()
397 if (asprintf(&links[link_num], "/dev/usb/%s%.*s", uevent->subsystem, width, parent) > 0) in get_character_device_symlinks()
413 static char **parse_platform_block_device(struct uevent *uevent) in parse_platform_block_device() argument
428 pdev = find_platform_device(uevent->path); in parse_platform_block_device()
442 if (uevent->partition_name) { in parse_platform_block_device()
443 p = strdup(uevent->partition_name); in parse_platform_block_device()
452 if (uevent->partition_num >= 0) { in parse_platform_block_device()
453 if (asprintf(&links[link_num], "%s/by-num/p%d", link_path, uevent->partition_num) > 0) in parse_platform_block_device()
459 slash = strrchr(uevent->path, '/'); in parse_platform_block_device()
496 static void handle_platform_device_event(struct uevent *uevent) in handle_platform_device_event() argument
498 const char *path = uevent->path; in handle_platform_device_event()
500 if (!strcmp(uevent->action, "add")) in handle_platform_device_event()
502 else if (!strcmp(uevent->action, "remove")) in handle_platform_device_event()
506 static const char *parse_device_name(struct uevent *uevent, unsigned int len) in parse_device_name() argument
511 if((uevent->major < 0) || (uevent->minor < 0)) in parse_device_name()
515 name = strrchr(uevent->path, '/'); in parse_device_name()
527 static void handle_block_device_event(struct uevent *uevent) in handle_block_device_event() argument
534 name = parse_device_name(uevent, 64); in handle_block_device_event()
541 if (!strncmp(uevent->path, "/devices/", 9)) in handle_block_device_event()
542 links = parse_platform_block_device(uevent); in handle_block_device_event()
544 handle_device(uevent->action, devpath, uevent->path, 1, in handle_block_device_event()
545 uevent->major, uevent->minor, links); in handle_block_device_event()
548 static void handle_generic_device_event(struct uevent *uevent) in handle_generic_device_event() argument
555 name = parse_device_name(uevent, 64); in handle_generic_device_event()
559 if (!strncmp(uevent->subsystem, "usb", 3)) { in handle_generic_device_event()
560 if (!strcmp(uevent->subsystem, "usb")) { in handle_generic_device_event()
561 if (uevent->device_name) { in handle_generic_device_event()
567 snprintf(devpath, sizeof(devpath), "/dev/%s", uevent->device_name); in handle_generic_device_event()
585 int bus_id = uevent->minor / 128 + 1; in handle_generic_device_event()
586 int device_id = uevent->minor % 128 + 1; in handle_generic_device_event()
598 } else if (!strncmp(uevent->subsystem, "graphics", 8)) { in handle_generic_device_event()
601 } else if (!strncmp(uevent->subsystem, "drm", 3)) { in handle_generic_device_event()
604 } else if (!strncmp(uevent->subsystem, "oncrpc", 6)) { in handle_generic_device_event()
607 } else if (!strncmp(uevent->subsystem, "adsp", 4)) { in handle_generic_device_event()
610 } else if (!strncmp(uevent->subsystem, "msm_camera", 10)) { in handle_generic_device_event()
613 } else if(!strncmp(uevent->subsystem, "input", 5)) { in handle_generic_device_event()
616 } else if(!strncmp(uevent->subsystem, "mtd", 3)) { in handle_generic_device_event()
619 } else if(!strncmp(uevent->subsystem, "sound", 5)) { in handle_generic_device_event()
622 } else if(!strncmp(uevent->subsystem, "misc", 4) && in handle_generic_device_event()
629 links = get_character_device_symlinks(uevent); in handle_generic_device_event()
634 handle_device(uevent->action, devpath, uevent->path, 0, in handle_generic_device_event()
635 uevent->major, uevent->minor, links); in handle_generic_device_event()
638 static void handle_device_event(struct uevent *uevent) in handle_device_event() argument
640 if (!strcmp(uevent->action,"add") || !strcmp(uevent->action, "change")) in handle_device_event()
641 fixup_sys_perms(uevent->path); in handle_device_event()
643 if (!strncmp(uevent->subsystem, "block", 5)) { in handle_device_event()
644 handle_block_device_event(uevent); in handle_device_event()
645 } else if (!strncmp(uevent->subsystem, "platform", 8)) { in handle_device_event()
646 handle_platform_device_event(uevent); in handle_device_event()
648 handle_generic_device_event(uevent); in handle_device_event()
703 static void process_firmware_event(struct uevent *uevent) in process_firmware_event() argument
710 uevent->firmware, uevent->path); in process_firmware_event()
712 l = asprintf(&root, SYSFS_PREFIX"%s/", uevent->path); in process_firmware_event()
724 l = asprintf(&file1, FIRMWARE_DIR1"/%s", uevent->firmware); in process_firmware_event()
728 l = asprintf(&file2, FIRMWARE_DIR2"/%s", uevent->firmware); in process_firmware_event()
732 l = asprintf(&file3, FIRMWARE_DIR3"/%s", uevent->firmware); in process_firmware_event()
759 INFO("firmware: could not open '%s' %d\n", uevent->firmware, errno); in process_firmware_event()
767 INFO("firmware: copy success { '%s', '%s' }\n", root, uevent->firmware); in process_firmware_event()
769 INFO("firmware: copy failure { '%s', '%s' }\n", root, uevent->firmware); in process_firmware_event()
787 static void handle_firmware_event(struct uevent *uevent) in handle_firmware_event() argument
792 if(strcmp(uevent->subsystem, "firmware")) in handle_firmware_event()
795 if(strcmp(uevent->action, "add")) in handle_firmware_event()
801 process_firmware_event(uevent); in handle_firmware_event()
818 struct uevent uevent; in handle_device_fd() local
819 parse_event(msg, &uevent); in handle_device_fd()
821 handle_device_event(&uevent); in handle_device_fd()
822 handle_firmware_event(&uevent); in handle_device_fd()