diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-04-30 15:11:08 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-04-30 15:11:08 +0200 |
commit | 55d88805edf029f53df61ab028582e632991e960 (patch) | |
tree | 31e68921501005c39dad71b19d75fa15529139d8 | |
parent | 78312fa0c5497b089bb82e55ebe50ac6b8ce4bf9 (diff) | |
parent | 9ccc05d2beeb11aa19e6d6ffd1cf287382fd13a7 (diff) | |
download | barebox-55d88805edf029f53df61ab028582e632991e960.tar.gz barebox-55d88805edf029f53df61ab028582e632991e960.tar.xz |
Merge tag 'j-master-fixes' of git://git.jcrosoft.org/barebox
Master Fixes
usb driver name (driver_d)
Menu fixes
-rw-r--r-- | commands/menu.c | 17 | ||||
-rw-r--r-- | common/menu.c | 9 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 1 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 1 | ||||
-rw-r--r-- | include/menu.h | 1 |
5 files changed, 18 insertions, 11 deletions
diff --git a/commands/menu.c b/commands/menu.c index e5ce5a9aae..8833d749b1 100644 --- a/commands/menu.c +++ b/commands/menu.c @@ -41,14 +41,14 @@ typedef enum { struct cmd_menu { char *menu; menu_action action; + char *description; + int auto_select; #if defined(CONFIG_CMD_MENU_MANAGEMENT) int entry; int re_entrant; - char *description; char *command; char *submenu; int num; - int auto_select; menu_entry_type type; int box_state; #endif @@ -58,7 +58,7 @@ struct cmd_menu { #define OPTS "m:earlc:d:RsSn:u:A:b:B:" #define is_entry(x) ((x)->entry) #else -#define OPTS "m:ls" +#define OPTS "m:lsA:d:" #define is_entry(x) (0) #endif @@ -334,6 +334,12 @@ static int do_menu(int argc, char *argv[]) case 's': cm.action = action_show; break; + case 'A': + cm.auto_select = simple_strtoul(optarg, NULL, 10); + break; + case 'd': + cm.description = optarg; + break; #if defined(CONFIG_CMD_MENU_MANAGEMENT) case 'e': cm.entry = 1; @@ -350,9 +356,6 @@ static int do_menu(int argc, char *argv[]) case 'u': cm.submenu = optarg; break; - case 'd': - cm.description = optarg; - break; case 'R': cm.re_entrant = 1; break; @@ -362,8 +365,6 @@ static int do_menu(int argc, char *argv[]) case 'n': cm.num = simple_strtoul(optarg, NULL, 10); break; - case 'A': - cm.auto_select = simple_strtoul(optarg, NULL, 10); case 'b': cm.type = MENU_ENTRY_BOX; cm.box_state = simple_strtoul(optarg, NULL, 10); diff --git a/common/menu.c b/common/menu.c index fd21e52a31..191bd64cd2 100644 --- a/common/menu.c +++ b/common/menu.c @@ -252,7 +252,7 @@ static void print_menu(struct menu *m) int menu_show(struct menu *m) { - int ch; + int ch, ch_previous = 0; int escape = 0; int countdown; int auto_display_len = 16; @@ -296,7 +296,7 @@ int menu_show(struct menu *m) do { if (m->auto_select >= 0) - ch = KEY_ENTER; + ch = KEY_RETURN; else ch = getc(); @@ -340,7 +340,11 @@ int menu_show(struct menu *m) print_menu_entry(m, m->selected, 1); break; case KEY_ENTER: + if (ch_previous == KEY_RETURN) + break; case KEY_RETURN: + if (ch_previous == KEY_ENTER) + break; clear(); gotoXY(1,1); m->selected->action(m, m->selected); @@ -351,6 +355,7 @@ int menu_show(struct menu *m) default: break; } + ch_previous = ch; } while(1); return 0; diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 7039a2cb75..f10bcad0b2 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -1275,6 +1275,7 @@ static int usb_hub_probe(struct usb_device *dev, int ifnum) int usb_driver_register(struct usb_driver *drv) { + drv->driver.name = drv->name; drv->driver.bus = &usb_bus_type; return register_driver(&drv->driver); } diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 5f15464711..fa3691af15 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -621,7 +621,6 @@ static struct usb_driver usb_storage_driver = { static int __init usb_stor_init(void) { - usb_storage_driver.name = usb_storage_driver.driver.name; return usb_driver_register(&usb_storage_driver); } device_initcall(usb_stor_init); diff --git a/include/menu.h b/include/menu.h index 6e7b555263..0a93418643 100644 --- a/include/menu.h +++ b/include/menu.h @@ -76,6 +76,7 @@ static inline struct menu* menu_alloc(void) if (m) { INIT_LIST_HEAD(&m->entries); m->nb_entries = 0; + m->auto_select = -1; } return m; } |