diff options
Diffstat (limited to 'src/query.c')
-rw-r--r-- | src/query.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/query.c b/src/query.c index e8a331c..77a8b33 100644 --- a/src/query.c +++ b/src/query.c @@ -1,6 +1,6 @@ /* * 0xFFFF - Open Free Fiasco Firmware Flasher - * Copyright (C) 2007,2008 pancake <@youterm.com> + * Copyright (C) 2007-2009 pancake <@youterm.com> * * 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 @@ -46,8 +46,7 @@ int get_status() */ int set_usb_mode(unsigned int mode) { - if (mode > 1) - { + if (mode > 1) { printf("Invalid USB mode specified '%d'.\n", mode); return -1; } @@ -79,7 +78,7 @@ int get_usb_mode() } sprintf(strbuf, "Device's USB mode is '%s'\n", (mode) ? "host" : "client"); - printf(strbuf); + printf("%s", strbuf); return 0; } @@ -178,7 +177,6 @@ int get_root_device() { unsigned char opcode; - strbuf[0] = '\0'; if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_RDFLAGS, 0, 1, (char *)&opcode, 1, 2000) < 0) { fprintf(stderr, "Cannot query root device\n"); return -1; @@ -189,8 +187,7 @@ int get_root_device() return -1; } - sprintf(strbuf, "Root device is: %s\n", root_devices[opcode]); - printf(strbuf); + printf("Root device is: %s\n", root_devices[opcode]); return 0; } @@ -292,13 +289,13 @@ int get_rd_flags() { unsigned short flags = 0; - if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_RDFLAGS, 0, 3, (void *) &flags, sizeof(flags), 2000) == -1) { + if (usb_control_msg (dev, CMD_QUERY, NOLO_GET_RDFLAGS, 0, 3, (void *) &flags,sizeof(flags), 2000) == -1) { fprintf(stderr, "Cannot get rd flags\n"); sprintf(strbuf, "error: Cannot read rd flags\n"); return -1; } - sprintf(strbuf, + sprintf (strbuf, "Current rd flag setting:\n" "disable OMAP watchdog : %s\n" "disable RETU watchdog : %s\n" @@ -310,7 +307,7 @@ int get_rd_flags() , (flags & 0x08) ? "set" : "not set" , (flags & 0x10) ? "set" : "not set" , (flags & 0x20) ? "set" : "not set"); - printf(strbuf); + puts (strbuf); return 0; } @@ -338,7 +335,6 @@ int get_nolo_version() return 0; } - int get_sw_version() { int ret; @@ -359,8 +355,8 @@ int get_sw_version() if (bytes[0]) { sprintf(strbuf, "Software Version: %s\n", bytes); printf("Software Version: %s\n", bytes); //???+strlen(bytes)+1)); - } else - printf("No software version detected\n"); + } else printf("No software version detected\n"); + return 1; } |