From ebb40dc50ebbd54d40f2ee9c0292ed83af1484f5 Mon Sep 17 00:00:00 2001 From: Sean Easton Date: Mon, 30 Jul 2012 13:40:12 -0400 Subject: [PATCH] Ported our code to the repo. --- drivers/usb/core/hub.c | 13 +++++++++++++ init/main.c | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 7978146..927a128 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1839,6 +1839,9 @@ fail: return err; } +/* **************************** */ +extern _Bool key_dev_found; +/* **************************** */ /** * usb_new_device - perform initial device setup (usbcore-internal) @@ -1896,6 +1899,16 @@ int usb_new_device(struct usb_device *udev) /* Tell the world! */ announce_device(udev); + /* **************************** */ + if(udev->serial != NULL) + { + if((strcmp(udev->serial, "3513001D97827E69")) == 0) /* Hard coded usb device serial here*/ + { + key_dev_found = 1; + } + } + /* **************************** */ + device_enable_async_suspend(&udev->dev); /* Register the device. The device driver is responsible * for configuring the device and invoking the add-device diff --git a/init/main.c b/init/main.c index 217ed23..082d30a 100644 --- a/init/main.c +++ b/init/main.c @@ -751,11 +751,35 @@ static void run_init_process(const char *init_filename) kernel_execve(init_filename, argv_init, envp_init); } +/* **************************** */ +_Bool key_dev_found; + +static void __init wait_for_key_dev(void) +{ + key_dev_found = 0; + + /* wait for any asynchronous scanning to complete */ + printk(KERN_INFO "Waiting for key device ...\n"); + while (driver_probe_done() != 0 || + key_dev_found == 0) + { + msleep(100); + } + async_synchronize_full(); + printk(KERN_INFO "Done waiting for key device ...\n"); +} +/* **************************** */ + /* This is a non __init function. Force it to be noinline otherwise gcc * makes it inline to init() and it becomes part of init.text section */ static noinline int init_post(void) { + /* **************************** */ + async_synchronize_full(); /* This is to make the log files easier to read */ + wait_for_key_dev(); /* This is what halts the boot process */ + /* **************************** */ + /* need to finish all async __init code before freeing the memory */ async_synchronize_full(); free_initmem(); -- 1.7.9.5