• Home
  • Raw
  • Download

Lines Matching +full:no +full:- +full:verbose

2  * Copyright (c) 2015-2021 Douglas Gilbert.
4 * Use of this source code is governed by a BSD-style
7 * SPDX-License-Identifier: BSD-2-Clause
63 {"no-timestamp", no_argument, 0, 'N'},
69 {"verbose", no_argument, 0, 'v'},
94 "sg_timestamp [--elapsed] [--help] [--hex] [--milliseconds=MS]\n" in usage()
95 " [--no-timestamp] [--origin] [--raw] " in usage()
96 "[--readonly]\n" in usage()
97 " [--seconds=SECS] [--srep] [--verbose] " in usage()
98 "[--version]\n" in usage()
102 " --elapsed|-e show time as '<n> days hh:mm:ss.xxx' " in usage()
106 " '<n> days' if <n> is 0 (unless '-e' " in usage()
108 " --help|-h print out usage message, use twice for " in usage()
110 " --hex|-H output response in ASCII hexadecimal\n" in usage()
111 " --milliseconds=MS|-m MS set timestamp to MS " in usage()
113 " 1970-01-01 00:00:00 UTC\n" in usage()
114 " --no-timestamp|-N suppress output of timestamp\n" in usage()
115 " --origin|-o show Report timestamp origin " in usage()
120 " --raw|-r output Report timestamp response to " in usage()
123 " --readonly|-R open DEVICE read only (def: " in usage()
125 " --seconds=SECS|-s SECS set timestamp to SECS " in usage()
127 " 1970-01-01 00:00:00 UTC\n" in usage()
128 " --srep|-S output Report timestamp in seconds " in usage()
131 " --verbose|-v increase verbosity\n" in usage()
132 " --version|-V print version string and exit\n\n" in usage()
135 "The timestamp\nis SET if either the --milliseconds=MS or " in usage()
136 "--seconds=SECS option is given,\notherwise the existing " in usage()
139 "(or reset) or since 1970-01-01 00:00:00 UTC which also " in usage()
141 "Use '-hh' (the '-h' option twice) for examples.\n" in usage()
147 "'date --date=@<secs_since_epoch>' .\n" in usage()
167 pr2serr(" $ sg_timestamp -o -N /dev/sg1\n" in usage()
170 " $ sg_timestamp -oo -N /dev/sg1\n" in usage()
174 " $ sg_timestamp --elapsed /dev/sg1\n" in usage()
178 " $ sg_timestamp --seconds=`date +%%s` /dev/sg1\n\n" in usage()
179 " $ sg_timestamp -o -N /dev/sg1\n" in usage()
182 " $ sg_timestamp -e /dev/sg1\n" in usage()
185 "data-time\nstamp in UTC:\n\n" in usage()
186 " $ date -u -R --date=@`sg_timestamp -S /dev/sg1`\n" in usage()
191 /* Invokes a SCSI REPORT TIMESTAMP command. Return of 0 -> success,
192 * various SG_LIB_CAT_* positive values or -1 -> other errors */
195 bool noisy, int verbose) in sg_ll_rep_timestamp() argument
204 if (verbose) { in sg_ll_rep_timestamp()
215 return -1; in sg_ll_rep_timestamp()
220 res = do_scsi_pt(ptvp, sg_fd, DEF_PT_TIMEOUT, verbose); in sg_ll_rep_timestamp()
221 ret = sg_cmds_process_resp(ptvp, "report timestamp", res, noisy, verbose, in sg_ll_rep_timestamp()
223 if (-1 == ret) { in sg_ll_rep_timestamp()
228 } else if (-2 == ret) { in sg_ll_rep_timestamp()
243 if ((verbose > 2) && ((mx_resp_len - k) > 0)) { in sg_ll_rep_timestamp()
245 hex2stderr((const uint8_t *)resp, mx_resp_len - k, in sg_ll_rep_timestamp()
246 ((verbose > 3) ? -1 : 1)); in sg_ll_rep_timestamp()
253 /* Invokes the SET TIMESTAMP command. Return of 0 -> success, various
254 * SG_LIB_CAT_* positive values or -1 -> other errors */
257 int verbose) in sg_ll_set_timestamp() argument
267 if (verbose) { in sg_ll_set_timestamp()
273 if ((verbose > 1) && paramp && param_len) { in sg_ll_set_timestamp()
275 hex2stderr((const uint8_t *)paramp, param_len, -1); in sg_ll_set_timestamp()
282 return -1; in sg_ll_set_timestamp()
287 res = do_scsi_pt(ptvp, sg_fd, DEF_PT_TIMEOUT, verbose); in sg_ll_set_timestamp()
288 ret = sg_cmds_process_resp(ptvp, "set timestamp", res, noisy, verbose, in sg_ll_set_timestamp()
290 if (-1 == ret) { in sg_ll_set_timestamp()
295 } else if (-2 == ret) { in sg_ll_set_timestamp()
339 int verbose = 0; in main() local
351 if (c == -1) in main()
367 if (-1 == ll) { in main()
368 pr2serr("bad argument to '--milliseconds=MS'\n"); in main()
388 if (-1 == ll) { in main()
389 pr2serr("bad argument to '--seconds=SECS'\n"); in main()
401 ++verbose; in main()
432 pr2serr("but override: '-vV' given, zero verbose and continue\n"); in main()
435 verbose = 0; in main()
437 pr2serr("set '-vv'\n"); in main()
438 verbose = 2; in main()
440 pr2serr("keep verbose=%d\n", verbose); in main()
443 pr2serr("Not in DEBUG mode, so '-vV' has no special action\n"); in main()
451 pr2serr("either --milliseconds=MS or --seconds=SECS may be given, " in main()
463 sg_fd = sg_cmds_open_device(device_name, readonly, verbose); in main()
465 if (verbose) in main()
467 safe_strerror(-sg_fd)); in main()
468 ret = sg_convert_errno(-sg_fd); in main()
476 res = sg_ll_set_timestamp(sg_fd, d_buff, 12, true, verbose); in main()
479 res = sg_ll_rep_timestamp(sg_fd, d_buff, 12, NULL, true, verbose); in main()
530 sg_get_category_sense_str(res, sizeof(b), b, verbose); in main()
539 pr2serr("close error: %s\n", safe_strerror(-res)); in main()
541 ret = sg_convert_errno(-res); in main()
544 if (0 == verbose) { in main()
546 pr2serr("Some error occurred, try again with '-v' " in main()
547 "or '-vv' for more information\n"); in main()