diff options
| author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-12-12 11:23:20 +0100 |
|---|---|---|
| committer | Gerrit Rockbox <gerrit@rockbox.org> | 2016-12-12 11:35:16 +0100 |
| commit | 8e82839fe29c8f5d5180a0cd9e7561c0d74dfabe (patch) | |
| tree | bbddfb2b51acf151d90019a1bdcea16680d1f782 /utils/hwstub/tools/hwstub_shell.cpp | |
| parent | 5b52ff2c93befe5fe86920bb8d9a68e7f0f5cee5 (diff) | |
| download | rockbox-8e82839fe29c8f5d5180a0cd9e7561c0d74dfabe.zip rockbox-8e82839fe29c8f5d5180a0cd9e7561c0d74dfabe.tar.gz rockbox-8e82839fe29c8f5d5180a0cd9e7561c0d74dfabe.tar.bz2 rockbox-8e82839fe29c8f5d5180a0cd9e7561c0d74dfabe.tar.xz | |
hwstub: various cleanups
- hwstub load now properly stops reading the log when the device returns a 0
size buffer instead of STALLing
- add debug output option to hwstub_load
- correctly report transfered size on write error
- add some debug error message in usb code so that some errors can be diagnosed
more easily
- add a batch mode to hwstub_shell to disable the interactive shell
- increase usb control timeout to 1sec, 100ms was really tight
- cap usb buffer size to ~4000 bytes because libusb has a hardwired limit of
4096 bytes for control transfers
Change-Id: Id3200ab99ce70a7a3b09ce7faeaafa4a0fac64c7
Diffstat (limited to 'utils/hwstub/tools/hwstub_shell.cpp')
| -rw-r--r-- | utils/hwstub/tools/hwstub_shell.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/hwstub/tools/hwstub_shell.cpp b/utils/hwstub/tools/hwstub_shell.cpp index 5fb3e13..b2cf2ce 100644 --- a/utils/hwstub/tools/hwstub_shell.cpp +++ b/utils/hwstub/tools/hwstub_shell.cpp @@ -1239,6 +1239,7 @@ void usage(void) printf("options:\n"); printf(" --help/-? Display this help\n"); printf(" --quiet/-q Quiet non-command messages\n"); + printf(" -b/--batch Disable interactive mode after running commands and files\n"); printf(" --verbose/-v Verbose output\n"); printf(" -i <init> Set lua init file (default is init.lua)\n"); printf(" -e <cmd> Execute <cmd> at startup\n"); @@ -1293,6 +1294,7 @@ int main(int argc, char **argv) { std::string dev_uri = hwstub::uri::default_uri().full_uri(); bool verbose = false; + bool batch = false; const char *lua_init = "init.lua"; std::vector< std::pair< exec_type, std::string > > startup_cmds; @@ -1309,11 +1311,12 @@ int main(int argc, char **argv) {"startfile", required_argument, 0, 'f'}, {"dev", required_argument, 0, 'd'}, {"verbose", no_argument, 0, 'v'}, + {"batch", no_argument, 0, 'b'}, {"debug-rw", no_argument, 0, OPT_DBG_RW}, {0, 0, 0, 0} }; - int c = getopt_long(argc, argv, "?qi:e:f:d:v", long_options, NULL); + int c = getopt_long(argc, argv, "?qi:e:f:d:vb", long_options, NULL); if(c == -1) break; switch(c) @@ -1344,6 +1347,9 @@ int main(int argc, char **argv) case OPT_DBG_RW: g_print_mem_rw = true; break; + case 'b': + batch = true; + break; default: abort(); } @@ -1441,7 +1447,9 @@ int main(int argc, char **argv) /* intercept CTRL+C */ signal(SIGINT, do_signal); // start interactive shell - luap_enter(g_lua, &g_exit); + if(!batch) + luap_enter(g_lua, &g_exit); + // cleanup lua_close(g_lua); // display log if handled |