All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pat LaVarre <p.lavarre@ieee.org>
To: patmans@us.ibm.com
Cc: ronald@kuetemeier.com, stern@rowland.harvard.edu,
	linux-scsi@vger.kernel.org, usb-storage@one-eyed-alien.net,
	james.bottomley@steeleye.com
Subject: Re: [PATCH/RFT] mode sense madness always use page 8
Date: 31 Oct 2003 16:11:25 -0700	[thread overview]
Message-ID: <1067641884.11436.47.camel@patrh9> (raw)
In-Reply-To: <20031031101645.A14729@beaverton.ibm.com>

> You can use /dev/sdN with 2.6.

Seemingly I am required to substitute open O_NONBLOCK | O_RDONLY for
what was open O_RDWR e.g. per the patch below.

> > Also personally I find the source for that plscsi app impenetrably
> > awful to read.
> 
> Maybe you can rewrite it in c and get it into sg_utils.

Work in progress.

I feel I've thought thru SG_IO from the command line in depth, I think I
can do, I'm happy to detail my incomplete work here if people want to
see it, else I'll [ANNOUNCE] when next I have something running.

> > Can we cycle more quickly thru compile-test-edit up in user land, rather
> > than patching the kernel?
> 
> Good idea.
> 
> > sudo ./plscsi /dev/sg1 -v -i x1C -x "5A 00 08:00:00:00 00 00:1C 00"
> > sudo ./plscsi /dev/sg1 -v -i 4   -x "5A 00 3F:00:00:00 00 00:04 00"
> > sudo ./plscsi /dev/sg1 -v -i 4   -x "5A 00 00:00:00:00 00 00:04 00"
> > sudo ./plscsi /dev/sg1 -v -i xFF -x "5A 00 3F:00:00:00 00 00:FF 00"
> 
> Nice.

Thanks for saying.

> Does sg_utils have an equivalent tool?

I believe not yet.  I'm pushing forward at:

http://members.aol.com/plscsi/tools/gccscsi/

For example, there the bash-script command line:

sudo ./gss /dev/sg1 -i x1C -y "5A 00 08:00:00:00 00 00:1C 00"

can instead appear in .c as:

i(0x1C); y("5A 00 08:00:00:00 00 00:1C 00");

> ...

EOL = CR LF vs. EOL = LF, trailing blanks, etc. may make the following
patch difficult to apply.  But a tty log showing the change to
(O_NONBLOCK | O_RDONLY) from O_RDWR is:

$ uname -msr
Linux 2.6.0-test9 i686
$
$ cp o/sgio.cpp sgio.cpp
$ make
g++ -o plscsi -Wall *.c*
$ sudo ./plscsi /dev/cdrom
// sgioOpen.open: Read-only file system
// plscsi.sclOpenNext: "/dev/cdrom" not opened
// -x0001 = -1 = plscsi.main exit int
$ sudo ./plscsi /dev/sda
// sgioOpen.open: No medium found
// plscsi.sclOpenNext: "/dev/sda" not opened
// -x0001 = -1 = plscsi.main exit int
$
$ cp n/sgio.cpp sgio.cpp
$ make
g++ -o plscsi -Wall *.c*
$ sudo ./plscsi /dev/cdrom
export PLSCSI=/dev/cdrom      // @ LITE-ON  COMBO LTC-48161H KH0K
$ sudo ./plscsi /dev/sda
export PLSCSI=/dev/sda        // B IOMEGA   ZIP 250          61.T
$

Pat LaVarre

P.S. The plscsi patch is:

--- o/sgio.cpp	2002-09-21 12:25:18.000000000 -0600
+++ n/sgio.cpp	2003-10-31 15:38:43.000000000 -0700
@@ -116,6 +116,7 @@
     sgio->theErrFile = stderr;
 
     sgio->theOpenMode = O_RDWR; /* O_RDONLY often works */
+sgio->theOpenMode = (O_NONBLOCK | O_RDONLY);
     sgio->theFileDescriptor = -1;
     sgio->theSgVersionNum = 0; /* 0 = unknown */
 





  reply	other threads:[~2003-10-31 23:11 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1067293080.1075.8.camel@ronald.kuetemeier.com>
     [not found] ` <20031027145531.A2130@beaverton.ibm.com>
2003-10-28  3:51   ` [PATCH] SCSI: limit mode sense usage Ronald Kuetemeier
2003-10-28 15:03     ` [usb-storage] " Alan Stern
2003-10-28 15:16       ` Patrick Mansfield
2003-10-28 15:40         ` Alan Stern
2003-10-28 15:55           ` Ronald Kuetemeier
2003-10-28 16:15           ` Ronald Kuetemeier
2003-10-28 19:17             ` Alan Stern
2003-10-28 19:55               ` Ronald Kuetemeier
2003-10-28 20:29                 ` Alan Stern
2003-10-28 21:33                   ` Ronald Kuetemeier
2003-10-28 22:49                     ` Alan Stern
2003-10-28 23:37                       ` Pat LaVarre
2003-10-29  1:51                       ` Patrick Mansfield
2003-10-29  2:16                         ` Ronald Kuetemeier
2003-10-29  7:27                           ` Patrick Mansfield
2003-10-29  7:21                         ` Patrick Mansfield
2003-10-29 15:16                           ` Alan Stern
2003-10-29 16:04                             ` Ronald Kuetemeier
2003-10-29 15:09                         ` Alan Stern
2003-10-29 15:53                           ` Ronald Kuetemeier
2003-10-29 16:30                             ` Patrick Mansfield
2003-10-28 15:42         ` Ronald Kuetemeier
2003-10-29 16:46           ` [PATCH/RFT] check non-scsi part of status in scsi_status_is_good Patrick Mansfield
2003-10-29 17:53             ` Ronald Kuetemeier
2003-10-29 23:16               ` Patrick Mansfield
2003-10-30 15:11                 ` Alan Stern
2003-10-30 16:35                   ` Pat LaVarre
2003-10-30 17:18                     ` Patrick Mansfield
2003-10-30 17:38                       ` Pat LaVarre
2003-10-30 18:05                         ` [PATCH/RFT] mode sense madness always use page 8 Patrick Mansfield
2003-10-30 18:14                           ` Ronald Kuetemeier
2003-10-30 18:25                             ` Patrick Mansfield
2003-10-30 18:15                           ` Pat LaVarre
2003-10-30 18:56                           ` Alan Stern
2003-10-30 19:06                             ` Pat LaVarre
2003-10-30 20:00                               ` Alan Stern
2003-10-31 20:47                                 ` Pat LaVarre
2003-10-30 19:26                             ` Patrick Mansfield
2003-10-31 20:38                               ` Pat LaVarre
2003-11-03 21:40                                 ` Pat LaVarre
2003-10-30 19:25                           ` Ronald Kuetemeier
2003-10-30 19:39                             ` Pat LaVarre
2003-10-30 21:48                             ` Patrick Mansfield
2003-10-30 21:58                               ` Ronald Kuetemeier
2003-10-30 23:59                                 ` Pat LaVarre
2003-10-31 18:16                                   ` Patrick Mansfield
2003-10-31 23:11                                     ` Pat LaVarre [this message]
2003-11-06 23:11                                     ` Douglas Gilbert
2003-11-07 16:13                                       ` Pat LaVarre
2003-10-28 15:38       ` [PATCH] SCSI: limit mode sense usage Pat LaVarre
2003-10-28 20:56         ` Pat LaVarre
2003-10-28 22:28           ` Alan Stern
2003-10-28 22:54             ` Pat LaVarre
2003-10-29 14:49               ` Alan Stern
2003-10-29 15:43                 ` Pat LaVarre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1067641884.11436.47.camel@patrh9 \
    --to=p.lavarre@ieee.org \
    --cc=james.bottomley@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=patmans@us.ibm.com \
    --cc=ronald@kuetemeier.com \
    --cc=stern@rowland.harvard.edu \
    --cc=usb-storage@one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.