#include "flash.h"
 #include "image.h"
+#include "../hello.h"
 
 
 struct faux_flash_bank
        return ERROR_OK;
 }
 
+static const struct command_registration faux_command_handlers[] = {
+       {
+               .name = "faux",
+               .mode = COMMAND_ANY,
+               .help = "faux flash command group",
+               .chain = hello_command_handlers,
+       },
+       COMMAND_REGISTRATION_DONE
+};
+
 struct flash_driver faux_flash = {
                .name = "faux",
+               .commands = faux_command_handlers,
                .flash_bank_command = &faux_flash_bank_command,
                .erase = &faux_erase,
                .protect = &faux_protect,
 
        return retval;
 }
 
-static const struct command_registration hello_command_handlers[] = {
+const struct command_registration hello_command_handlers[] = {
        {
                .name = "hello",
                .handler = &handle_hello_command,
 
--- /dev/null
+/***************************************************************************
+ *   Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net>             *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef OPENOCD_HELLO_H
+#define OPENOCD_HELLO_H
+
+struct command_context;
+struct command_registration;
+
+/// Register the hello commands in the specified command_context
+int hello_register_commands(struct command_context *cmd_ctx);
+
+/**
+ * Export the registration for the hello command group, so it can be
+ * embedded in example drivers.
+ */
+extern const struct command_registration hello_command_handlers[];
+
+#endif // OPENOCD_HELLO_H
 
 
 #include "interface.h"
 #include "bitbang.h"
+#include "../hello.h"
 
 
 /* my private tap controller state, which tracks state for calling code */
        return ERROR_OK;
 }
 
+static const struct command_registration dummy_command_handlers[] = {
+       {
+               .name = "dummy",
+               .mode = COMMAND_ANY,
+               .help = "dummy interface driver commands",
+
+               .chain = hello_command_handlers,
+       },
+       COMMAND_REGISTRATION_DONE,
+};
+
 /* The dummy driver is used to easily check the code path
  * where the target is unresponsive.
  */
 struct jtag_interface dummy_interface = {
                .name = "dummy",
 
+               .commands = dummy_command_handlers,
+
                .execute_queue = &bitbang_execute_queue,
 
                .speed = &dummy_speed,
 
 
 struct command_context *global_cmd_ctx;
 
-/// src/hello.c gives a simple example for writing new command modules
-int hello_register_commands(struct command_context *cmd_ctx);
-
 /* NB! this fn can be invoked outside this file for non PC hosted builds */
 struct command_context *setup_command_handler(void)
 {
 
        register_commands(cmd_ctx, NULL, openocd_command_handlers);
        /* register subsystem commands */
-       hello_register_commands(cmd_ctx);
        server_register_commands(cmd_ctx);
        telnet_register_commands(cmd_ctx);
        gdb_register_commands(cmd_ctx);