Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tableau-parm sometimes fails to open devices. #1

Open
pix opened this issue Dec 9, 2016 · 0 comments
Open

tableau-parm sometimes fails to open devices. #1

pix opened this issue Dec 9, 2016 · 0 comments

Comments

@pix
Copy link

pix commented Dec 9, 2016

It seems that r/w opening is required for tableau-parm to work sometimes since scsi_pt_open_device. Since I'm not sure about the reason behind opening it this way, I
only open it r/w if it fails first.

---
 src/tableau-parm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/tableau-parm.c b/src/tableau-parm.c
index cbc5b77..e07e967 100644
--- a/src/tableau-parm.c
+++ b/src/tableau-parm.c
@@ -477,9 +477,14 @@ int main(int argc, char** argv)
    */
   sg_fd = scsi_pt_open_device(dev_file, 0 /* rw */, 0);
   if (sg_fd < 0) {
-    fprintf(stderr, "ERROR: scsi_pt_open_device failed on '%s' with: %s\n",
+    fprintf(stderr, "WARN: scsi_pt_open_device (ro) failed on '%s' with: %s\n",
 	    dev_file, strerror(-sg_fd));
-    return 1;
+    sg_fd = scsi_pt_open_device(dev_file, 1 /* rw */, 0);
+    if (sg_fd < 0) {
+      fprintf(stderr, "ERROR: scsi_pt_open_device failed on '%s' with: %s\n",
+          dev_file, strerror(-sg_fd));
+      return 1;
+    }
   }
 
   cmd_ret = sendCommand(sg_fd, tableau_query_cmd, 6, 
-- 
2.10.2

Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant