--- kernel-source-diablo-2.6.21.orig/kernel-source/arch/arm/plat-omap/bootreason.c 2007-10-02 08:09:30.000000000 +0100 +++ kernel-source-diablo-2.6.21/kernel-source/arch/arm/plat-omap/bootreason.c 2009-06-11 10:49:15.000000000 +0100 @@ -30,8 +30,11 @@ #include #include #include +#include -static char boot_reason[16]; +#define MAX_LENGTH 16 + +static char boot_reason[MAX_LENGTH]; static int omap_bootreason_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) @@ -50,10 +53,28 @@ return len < count ? len : count; } +static int omap_bootreason_write_proc(struct file *file, const char __user *buffer, + unsigned long count, void *data) +{ +/* hacked code from acpi debug added in: PLZFIXKTHXBYE*/ + + char bootreason_new_string[MAX_LENGTH]; + + if (count > sizeof(bootreason_new_string) - 1) return -EINVAL; + + if (copy_from_user(bootreason_new_string, buffer, count)) return -EFAULT; + + strncpy(boot_reason, bootreason_new_string, count - 1); + boot_reason[count - 1] = 0; + + return count; +} + static int __init bootreason_init(void) { const struct omap_boot_reason_config *cfg; int reason_valid = 0; + struct proc_dir_entry *entry; cfg = omap_get_config(OMAP_TAG_BOOT_REASON, struct omap_boot_reason_config); if (cfg != NULL) { @@ -69,9 +90,11 @@ printk(KERN_INFO "Bootup reason: %s\n", boot_reason); - if (!create_proc_read_entry("bootreason", S_IRUGO, NULL, - omap_bootreason_read_proc, NULL)) - return -ENOMEM; + entry = create_proc_read_entry("bootreason", S_IFREG | S_IRUGO | S_IWUSR, NULL, omap_bootreason_read_proc, NULL); + + if (!entry) return -ENOMEM; + + entry->write_proc = omap_bootreason_write_proc; return 0; }