Skip to content

Commit bf09b94

Browse files
committed
Document -v,--verbose and support multiple -v arguments for even more output
1 parent d0683ac commit bf09b94

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
=== Next ===
2+
- Command-line: Document the -v,--verbose command in the help page and
3+
support multiple -v args to further increase verbosity.
4+
15
=== Version 2.1.32 ===
26
- Add PSX to USB adapter firmware version 1.0.3
37

src/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static void printUsage(void)
5757
printf(" --noconfirm Skip asking the user for confirmation.\n");
5858
printf(" -c, --channel chn Specify channel to use where applicable (for multi-player adapters\n");
5959
printf(" and raw commands, development commands and GC2N64 I/O)\n");
60+
printf(" -v, --verbose Increase output verbosity.\n");
6061
printf("\n");
6162
printf("Configuration commands:\n");
6263
printf(" --get_version Read adapter firmware version\n");
@@ -302,6 +303,7 @@ struct option longopts[] = {
302303
{ "n64_crcd", required_argument, NULL, OPT_N64_CRCD },
303304
{ "enable_highres", 0, NULL, OPT_HIGHRES },
304305
{ "debug", 0, NULL, OPT_DEBUG },
306+
{ "verbose", 0, NULL, 'v' },
305307
{ },
306308
};
307309

@@ -375,7 +377,7 @@ int main(int argc, char **argv)
375377
use_first = 1;
376378
break;
377379
case 'v':
378-
verbose = 1;
380+
verbose++;
379381
break;
380382
case 'h':
381383
printUsage();

src/rntlib/raphnetadapter.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static int dusbr_verbose = 0;
3232
static int rnt_readSupportedFeatures(rnt_hdl_t hdl, struct rnt_dyn_features *dst_dynfeat);
3333

3434
#define IS_VERBOSE() (dusbr_verbose)
35+
#define IS_VERY_VERBOSE() (dusbr_verbose>1)
3536

3637
struct supported_adapter {
3738
uint16_t vid, pid;
@@ -536,6 +537,7 @@ int rnt_send_cmd(rnt_hdl_t hdl, const unsigned char *cmd, int cmdlen)
536537
buffer[0] = 0x00; // report ID set to 0 (device has only one)
537538
memcpy(buffer + 1, cmd, cmdlen);
538539

540+
539541
while (attempts_left--) {
540542
n = hid_send_feature_report(hdev, buffer, sizeof(buffer));
541543
if (n >= 0) {
@@ -596,6 +598,9 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
596598
int n;
597599
uint64_t time_start, time_now;
598600

601+
if (IS_VERY_VERBOSE()) {
602+
printf("Sending command."); fflush(stdout);
603+
}
599604
n = rnt_send_cmd(hdl, outcmd, outlen);
600605
if (n<0) {
601606
// only complain when this fails on non-legacy devices
@@ -605,6 +610,7 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
605610
}
606611

607612
time_start = getMilliseconds();
613+
time_now = time_start;
608614

609615
/* Answer to the command comes later. For now, this is polled, but in
610616
* the future an interrupt-in transfer could be used. */
@@ -615,7 +621,9 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
615621
break;
616622
}
617623
if (n==0) {
618-
// printf("."); fflush(stdout);
624+
// if (IS_VERY_VERBOSE()) {
625+
// printf("*"); fflush(stdout);
626+
// }
619627
}
620628

621629
time_now = getMilliseconds();
@@ -626,6 +634,10 @@ int rnt_exchange(rnt_hdl_t hdl, unsigned char *outcmd, int outlen, unsigned char
626634

627635
} while (n==0);
628636

637+
if (IS_VERY_VERBOSE()) {
638+
printf("Done (%d ms)\n", (int)(time_now - time_start));
639+
}
640+
629641
return n;
630642
}
631643

0 commit comments

Comments
 (0)