From 242e1a8b2cc6c6a3c7207cf0c6b86e9deb3e3888 Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Mon, 15 Jun 2009 21:46:24 +0000 Subject: add sg_read_block_limits; sg_reset: option for target reset git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@276 6180dd3e-e324-4e3e-922d-17de1ae2f315 --- src/sg_reset.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/sg_reset.c') diff --git a/src/sg_reset.c b/src/sg_reset.c index cf12933d..3417d966 100644 --- a/src/sg_reset.c +++ b/src/sg_reset.c @@ -26,7 +26,7 @@ #define ME "sg_reset: " -static char * version_str = "0.55 20090317"; +static char * version_str = "0.56 20090615"; #ifndef SG_SCSI_RESET #define SG_SCSI_RESET 0x2284 @@ -39,6 +39,9 @@ static char * version_str = "0.55 20090317"; #define SG_SCSI_RESET_HOST 3 #endif +#ifndef SG_SCSI_RESET_TARGET +#define SG_SCSI_RESET_TARGET 4 +#endif int main(int argc, char * argv[]) @@ -47,6 +50,7 @@ int main(int argc, char * argv[]) int do_device_reset = 0; int do_bus_reset = 0; int do_host_reset = 0; + int do_target_reset = 0; char * file_name = 0; for (k = 1; k < argc; ++k) { @@ -56,6 +60,8 @@ int main(int argc, char * argv[]) do_bus_reset = 1; else if (0 == strcmp("-h", argv[k])) do_host_reset = 1; + else if (0 == strcmp("-t", argv[k])) + do_target_reset = 1; else if (0 == strcmp("-V", argv[k])) { fprintf(stderr, "Version string: %s\n", version_str); exit(0); @@ -68,10 +74,11 @@ int main(int argc, char * argv[]) } if (0 == file_name) { printf( - "Usage: sg_reset [-b] [-d] [-h] [-V] DEVICE\n"); + "Usage: sg_reset [-b] [-d] [-h] [-t] [-V] DEVICE\n"); printf(" where: -b attempt a SCSI bus reset\n"); printf(" -d attempt a SCSI device reset\n"); printf(" -h attempt a host adapter reset\n"); + printf(" -t attempt a SCSI target reset\n"); printf(" -V print version string then exit\n\n"); printf(" {if no switch given then check if reset underway}\n"); printf("To reset use '-d' first, if that is unsuccessful, " @@ -91,6 +98,10 @@ int main(int argc, char * argv[]) printf(ME "starting device reset\n"); k = SG_SCSI_RESET_DEVICE; } + else if (do_target_reset) { + printf(ME "starting target reset\n"); + k = SG_SCSI_RESET_TARGET; + } else if (do_bus_reset) { printf(ME "starting bus reset\n"); k = SG_SCSI_RESET_BUS; @@ -121,6 +132,8 @@ int main(int argc, char * argv[]) printf(ME "did nothing, device is normal mode\n"); else if (SG_SCSI_RESET_DEVICE == k) printf(ME "completed device reset\n"); + else if (SG_SCSI_RESET_TARGET == k) + printf(ME "completed target reset\n"); else if (SG_SCSI_RESET_BUS == k) printf(ME "completed bus reset\n"); else if (SG_SCSI_RESET_HOST == k) -- cgit v1.2.3