summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-05-17 14:24:03 -0400
committerMike Lockwood <lockwood@android.com>2010-05-17 14:24:36 -0400
commitc0d8fb5842f57bbc244e9c9596707787caabf44e (patch)
treea7d76b7167e61a6d784434fcf1119f5973c4de8a /init
parent509f7399b8f246f506307b22039e63323ec09622 (diff)
parente95aad61d841e7a472b4141808bbca0c7135b0f5 (diff)
downloadsystem_core-c0d8fb5842f57bbc244e9c9596707787caabf44e.zip
system_core-c0d8fb5842f57bbc244e9c9596707787caabf44e.tar.gz
system_core-c0d8fb5842f57bbc244e9c9596707787caabf44e.tar.bz2
DO NOT MERGE resolved conflicts for merge of e95aad61 to kraken
this change is already in master Change-Id: Ica43eae28b50d89d50217851aff7e62978abfa27 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'init')
-rw-r--r--init/builtins.c1
-rw-r--r--init/devices.c25
2 files changed, 24 insertions, 2 deletions
diff --git a/init/builtins.c b/init/builtins.c
index 4326ebc..e0ccf9f 100644
--- a/init/builtins.c
+++ b/init/builtins.c
@@ -258,6 +258,7 @@ static struct {
const char *name;
unsigned flag;
} mount_flags[] = {
+ { "move", MS_MOVE },
{ "noatime", MS_NOATIME },
{ "nosuid", MS_NOSUID },
{ "nodev", MS_NODEV },
diff --git a/init/devices.c b/init/devices.c
index fa96f7c..663cdfe 100644
--- a/init/devices.c
+++ b/init/devices.c
@@ -327,6 +327,7 @@ err:
static void handle_device_event(struct uevent *uevent)
{
char devpath[96];
+ int devpath_ready = 0;
char *base, *name;
char **links = NULL;
int block;
@@ -356,7 +357,26 @@ static void handle_device_event(struct uevent *uevent)
} else {
block = 0;
/* this should probably be configurable somehow */
- if(!strncmp(uevent->subsystem, "graphics", 8)) {
+ if (!strncmp(uevent->subsystem, "usb", 3)) {
+ if (!strcmp(uevent->subsystem, "usb")) {
+ /* 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 */
+ mkdir("/dev/bus", 0755);
+ mkdir("/dev/bus/usb", 0755);
+ snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d", bus_id);
+ mkdir(devpath, 0755);
+ snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d/%03d", bus_id, device_id);
+ devpath_ready = 1;
+ } else {
+ /* ignore other USB events */
+ return;
+ }
+ } else if (!strncmp(uevent->subsystem, "graphics", 8)) {
base = "/dev/graphics/";
mkdir(base, 0755);
} else if (!strncmp(uevent->subsystem, "oncrpc", 6)) {
@@ -386,7 +406,8 @@ static void handle_device_event(struct uevent *uevent)
base = "/dev/";
}
- snprintf(devpath, sizeof(devpath), "%s%s", base, name);
+ if (!devpath_ready)
+ snprintf(devpath, sizeof(devpath), "%s%s", base, name);
if(!strcmp(uevent->action, "add")) {
make_device(devpath, block, uevent->major, uevent->minor);