From owner-freebsd-scsi Tue Aug 25 10:10:47 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA27561 for freebsd-scsi-outgoing; Tue, 25 Aug 1998 10:10:47 -0700 (PDT) (envelope-from owner-freebsd-scsi@FreeBSD.ORG) Received: from panzer.plutotech.com (panzer.plutotech.com [206.168.67.125]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA27552; Tue, 25 Aug 1998 10:10:42 -0700 (PDT) (envelope-from ken@panzer.plutotech.com) Received: (from ken@localhost) by panzer.plutotech.com (8.8.8/8.8.5) id LAA15177; Tue, 25 Aug 1998 11:09:39 -0600 (MDT) From: "Kenneth D. Merry" Message-Id: <199808251709.LAA15177@panzer.plutotech.com> Subject: Re: Parse sense data with camcontrol into shell variable! In-Reply-To: <199808250703.HAA14327@mitch.hrz.uni-bielefeld.de> from =?ISO-8859-1?Q?Lars_K=F6ller?= at "Aug 25, 98 09:03:59 am" To: Lars.Koeller@post.uni-bielefeld.de (Lars =?iso-8859-1?Q?K=F6ller?=) Date: Tue, 25 Aug 1998 11:09:39 -0600 (MDT) Cc: freebsd-scsi@FreeBSD.ORG, gibbs@FreeBSD.ORG, ken@plutotech.com X-Mailer: ELM [version 2.4ME+ PL28s (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Lars Köller wrote... > -------- > > Hallo experts! > > I just rewrite a ADIC DAT AutoLoader script from scsi to chio! The > problem is to get the sense data (19 bytes) from the changer. The > chio command is not able to solve this problem. > > However, I need only byte number 19 from the sense data, cause it > contains data about an open doors of the changer etc. > > How can I parse the data with camcontrol into a shell variable. > Request sense data command is "03 ....", so it should look like > > camcontrol -n ch -c "03 0 0 0 13 0" -O ....... Hmm, try something like this: camcontrol -n ch -u 0 -c "03 00 00 00 64 00" -I 64 "s18 b8" Or perhaps: camcontrol -n ch -u 0 -c "03 00 00 00 64 00" -I 64 "s18 i1" The "s" argument tells it to skip that many bytes. The 'b' argument tells it to print out that many bits. The 'i' argument tells it to print the data as an n-byte integer. (where 1 <= n <= 4) A few hints/notes about command parsing in camcontrol: - -I is equivalent to -i in scsi(8) - -O is equivalent to -o in scsi(8) - unlike scsi(8), you can't specify arguments to the CDB. i.e. you can't do stuff like: camcontrol -n da -u 0 -c "v 00 00 00 00 00" 0 This is because I didn't figure out exactly how I wanted to do the argument parsing when I first wrote the buffer parsing code, and I haven't had time to work on it since. It isn't a very big deal, though...it's generally easy enough to just fill out the CDB. Arguments are supported for -I and -O, however. - camcontrol doesn't yet support reading data from stdin (for -O) or writing data to stdout (for -I) Ken -- Kenneth Merry ken@plutotech.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message