From 60f2337927efe4116a6675fccdf1021f51c86937 Mon Sep 17 00:00:00 2001 From: pancake Date: Wed, 25 Apr 2007 21:05:03 +0200 Subject: * import of the 'set-get-query_header' from Robert Schuster 1) name the simple functions get_foo and set_foo (and make them more consistent e.g. set_rd_mode and get_rd_mode). 2) moved remaining simple queries from main.c into query.c 3) created separate query.h header and included it in main.c 4) implemented get_usb_mode (they do not have this in the proprietary flasher) and added this function to a normal run (-> you will see the current USB mode when running with -i) --- src/main.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index a463c26..df1fe85 100644 --- a/src/main.c +++ b/src/main.c @@ -19,6 +19,8 @@ */ #include "main.h" +#include "query.h" + #include #include #include @@ -176,26 +178,6 @@ void unpack_fiasco_image(char *file) // TODO } -int query_sw_version() -{ - int ret; - char bytes[1024]; - - strcpy(bytes, "version:sw-release"); - ret = usb_control_msg(dev, CMD_WRITE, 18, 0, 0, (char *)&bytes, 18, 2000); - if (ret<0) { - fprintf(stderr, "error: cannot write query 18\n"); - return 0; - } - ret = usb_control_msg(dev, CMD_QUERY, 20, 0, 0, (char *)&bytes, 512, 2000); - if (ret<0) { - fprintf(stderr, "error: b0rken swversion read!\n"); - return 0; - } - printf("SWVERSION GOT: %s\n", bytes); //???+strlen(bytes)+1)); - return 1; -} - int main(int argc, char **argv) { struct usb_device_descriptor udd; @@ -320,16 +302,18 @@ int main(int argc, char **argv) // if (info) sleep(1); // take breath - query_root_device(); // only for flashing - query_rdmode_device(); - query_hw_revision(); // get hardware revision: + get_root_device(); // only for flashing + get_rd_mode(); + get_usb_mode(); + + get_hw_revision(); // get hardware revision: if (pcs_n) { int c; check_nolo_order(); - query_sw_version(); - query_nolo_version(); + get_sw_version(); + get_nolo_version(); for(c=0;c