Loading init/devices.c +39 −13 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ struct uevent { const char *subsystem; const char *firmware; const char *partition_name; const char *device_name; int partition_num; int major; int minor; Loading Loading @@ -335,6 +336,7 @@ static void parse_event(const char *msg, struct uevent *uevent) uevent->minor = -1; uevent->partition_name = NULL; uevent->partition_num = -1; uevent->device_name = NULL; /* currently ignoring SEQNUM */ while(*msg) { Loading Loading @@ -362,6 +364,9 @@ static void parse_event(const char *msg, struct uevent *uevent) } else if(!strncmp(msg, "PARTNAME=", 9)) { msg += 9; uevent->partition_name = msg; } else if(!strncmp(msg, "DEVNAME=", 8)) { msg += 8; uevent->device_name = msg; } /* advance to after the next \0 */ Loading Loading @@ -579,6 +584,26 @@ static void handle_generic_device_event(struct uevent *uevent) if (!strncmp(uevent->subsystem, "usb", 3)) { if (!strcmp(uevent->subsystem, "usb")) { if (uevent->device_name) { /* * create device node provided by kernel if present * see drivers/base/core.c */ char *p = devpath; snprintf(devpath, sizeof(devpath), "/dev/%s", uevent->device_name); /* skip leading /dev/ */ p += 5; /* build directories */ while (*p) { if (*p == '/') { *p = 0; make_dir(devpath, 0755); *p = '/'; } p++; } } else { /* This imitates the file system that would be created * if we were using devfs instead. * Minors are broken up into groups of 128, starting at "001" Loading @@ -591,6 +616,7 @@ static void handle_generic_device_event(struct uevent *uevent) snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d", bus_id); make_dir(devpath, 0755); snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d/%03d", bus_id, device_id); } } else { /* ignore other USB events */ return; Loading Loading
init/devices.c +39 −13 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ struct uevent { const char *subsystem; const char *firmware; const char *partition_name; const char *device_name; int partition_num; int major; int minor; Loading Loading @@ -335,6 +336,7 @@ static void parse_event(const char *msg, struct uevent *uevent) uevent->minor = -1; uevent->partition_name = NULL; uevent->partition_num = -1; uevent->device_name = NULL; /* currently ignoring SEQNUM */ while(*msg) { Loading Loading @@ -362,6 +364,9 @@ static void parse_event(const char *msg, struct uevent *uevent) } else if(!strncmp(msg, "PARTNAME=", 9)) { msg += 9; uevent->partition_name = msg; } else if(!strncmp(msg, "DEVNAME=", 8)) { msg += 8; uevent->device_name = msg; } /* advance to after the next \0 */ Loading Loading @@ -579,6 +584,26 @@ static void handle_generic_device_event(struct uevent *uevent) if (!strncmp(uevent->subsystem, "usb", 3)) { if (!strcmp(uevent->subsystem, "usb")) { if (uevent->device_name) { /* * create device node provided by kernel if present * see drivers/base/core.c */ char *p = devpath; snprintf(devpath, sizeof(devpath), "/dev/%s", uevent->device_name); /* skip leading /dev/ */ p += 5; /* build directories */ while (*p) { if (*p == '/') { *p = 0; make_dir(devpath, 0755); *p = '/'; } p++; } } else { /* This imitates the file system that would be created * if we were using devfs instead. * Minors are broken up into groups of 128, starting at "001" Loading @@ -591,6 +616,7 @@ static void handle_generic_device_event(struct uevent *uevent) snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d", bus_id); make_dir(devpath, 0755); snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d/%03d", bus_id, device_id); } } else { /* ignore other USB events */ return; Loading