當usb driver是用usbmisc時,系統並不會長出對應的結點,
Driver=usb storage等看起來都正常,
所以看起來是必需手重加入:
system/core/init/devices.cpp
static void handle_generic_device_event(struct uevent *uevent) { const char *base; const char *name; char devpath[DEVPATH_LEN] = {0}; char **links = NULL; name = parse_device_name(uevent, 64); if (!name) return; struct ueventd_subsystem *subsystem = ueventd_subsystem_find_by_name(uevent->subsystem); //ERROR("TTest-%s, uevent->subsystem = %s\n", __FUNCTON__, uevent->subsystem); //ERROR("TTest-%s, uevent->device_name = %s\n", __FUNCTON__, uevent->device_name); if (subsystem) { const char *devname; switch (subsystem->devname_src) { case DEVNAME_UEVENT_DEVNAME: devname = uevent->device_name; break; case DEVNAME_UEVENT_DEVPATH: devname = name; break; default: ERROR("%s subsystem's devpath option is not set; ignoring event\n", uevent->subsystem); return; } if (!assemble_devpath(devpath, subsystem->dirname, devname)) return; mkdir_recursive_for_devpath(devpath); } else if (!strncmp(uevent->subsystem, "usb", 3)) { if (!strcmp(uevent->subsystem, "usb")) { if (uevent->device_name) { if (!assemble_devpath(devpath, "/dev", uevent->device_name)) return; mkdir_recursive_for_devpath(devpath); } 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" */ int bus_id = uevent->minor / 128 + 1; int device_id = uevent->minor % 128 + 1; /* build directories */ make_dir("/dev/bus", 0755); make_dir("/dev/bus/usb", 0755); 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 { //add for usblp (thermal printer) if(!strncmp(uevent->subsystem, "usbmisc", 7)) { if(!strncmp(uevent->device_name, "usb/lp", 6)){ base = "/dev/usb/"; make_dir(base, 0755); } } //end else /* ignore other USB events */ return; } } else if (!strncmp(uevent->subsystem, "graphics", 8)) { base = "/dev/graphics/"; make_dir(base, 0755); } else if (!strncmp(uevent->subsystem, "drm", 3)) { base = "/dev/dri/"; make_dir(base, 0755); } else if (!strncmp(uevent->subsystem, "oncrpc", 6)) { base = "/dev/oncrpc/"; make_dir(base, 0755); } else if (!strncmp(uevent->subsystem, "adsp", 4)) { base = "/dev/adsp/"; make_dir(base, 0755); } else if (!strncmp(uevent->subsystem, "msm_camera", 10)) { base = "/dev/msm_camera/"; make_dir(base, 0755); } else if(!strncmp(uevent->subsystem, "input", 5)) { base = "/dev/input/"; make_dir(base, 0755); } else if(!strncmp(uevent->subsystem, "mtd", 3)) { base = "/dev/mtd/"; make_dir(base, 0755); } else if(!strncmp(uevent->subsystem, "sound", 5)) { base = "/dev/snd/"; make_dir(base, 0755); } else if(!strncmp(uevent->subsystem, "misc", 4) && !strncmp(name, "log_", 4)) { INFO("kernel logger is deprecated\n"); base = "/dev/log/"; make_dir(base, 0755); name += 4; } else base = "/dev/"; links = get_character_device_symlinks(uevent); if (!devpath[0]) snprintf(devpath, sizeof(devpath), "%s%s", base, name); handle_device(uevent->action, devpath, uevent->path, 0, uevent->major, uevent->minor, links); }ref : 程序園
沒有留言:
張貼留言