From owner-freebsd-scsi@FreeBSD.ORG Mon May 30 20:39:00 2011 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3E80106564A for ; Mon, 30 May 2011 20:39:00 +0000 (UTC) (envelope-from dan@langille.org) Received: from nyi.unixathome.org (nyi.unixathome.org [64.147.113.42]) by mx1.freebsd.org (Postfix) with ESMTP id 812BD8FC0C for ; Mon, 30 May 2011 20:39:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by nyi.unixathome.org (Postfix) with ESMTP id A009E50852 for ; Mon, 30 May 2011 21:38:59 +0100 (BST) X-Virus-Scanned: amavisd-new at unixathome.org Received: from nyi.unixathome.org ([127.0.0.1]) by localhost (nyi.unixathome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id afdbmKZIH1Fl for ; Mon, 30 May 2011 21:38:59 +0100 (BST) Received: from smtp-auth.unixathome.org (smtp-auth.unixathome.org [10.4.7.7]) (Authenticated sender: hidden) by nyi.unixathome.org (Postfix) with ESMTPSA id 216CA50830 for ; Mon, 30 May 2011 21:38:59 +0100 (BST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) From: Dan Langille In-Reply-To: Date: Mon, 30 May 2011 16:38:57 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <0D43CD5E-89F7-4A1C-A0C3-6DBA8039F367@langille.org> References: To: freebsd-scsi@freebsd.org X-Mailer: Apple Mail (2.1084) Subject: Re: Does the tape library need cleaning? X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 20:39:00 -0000 On May 28, 2011, at 6:03 PM, Dan Langille wrote: > I'm wondering if there is a way to query my tape library to see if = cleaning is required? This information is shown on the display of the = unit, but I'd like to query the device and display it on a webpage. >=20 > Here is what I have. >=20 > $ mtx -f /dev/pass11 inquiry > Product Type: Medium Changer > Vendor ID: 'DEC ' > Product ID: 'TL800 (C) DEC' > Revision: '0326' > Attached Changer API: No >=20 > I'm guessing I need to know more about about the scsi commands I can = send to the device and use camcontrol to extract the information. Much = like this command pulls back data (as extracted from a a: >=20 >=20 > set -- `camcontrol cmd $tape -v -t 3 -c "4d 0 43 0 0 0 0 0 40 0" -i = 64 \ Reading = http://support.gateway.com/s/Manuals/servers/quantum_7000_product_manual.p= df shows me that cleaning status detection is possible. I started by understanding what my script (provided by a third partty) = does. Based on my script, I know that 43 is read statistics (as opposed to 42 = which is write statistics). So far, I've learned a bit about CDB and know that 4d =3D 'LOG SENSE'. According to 5.4.8 LOG SENSE (4Dh), the third parameter, 43, seems to be = the PC and Page Code. 43 =3D 0100 0101 * The 4 specifies cumulative values (see figure 5-20 LOG Page Control = Definitions) * The 3 specifies Last n Errors Events Page ( see figure 5-21 LOG SENSE = Pages Supported) Does this make sense to anyone else? Section 5.4.8.6 Device Status Log Sense Page (3Eh) seems to have what I = need. Particularly: * parameter code (0001h) * ASC 80h ASCQ 01h =3D=3D Cleaning Required It is at this point that I start getting confused about what camcontrol = command I should use. I don't know how to incorporate 3E into the camcontrol command. It = seems that 4D is the key.... I'm confused... > "{skip} *i4 \ > {skip} *i4 \ > {Corrected errors with substantial delay } i4 \ > {skip} *i4 \ > {Corrected errors with possible delay } i4 \ > {skip} *i4 \ > {Total errors } i4 \ > {skip} *i4 \ > {Total errors corrected } i4 \ > {skip} *i4 \ > {Total times correction algorithm processed} i4 \ > {skip} *i4 \ > {Total bytes processed } i2 i3 i3 \ > {skip} *i4 \ > {Total uncorrected errors } i4" The above output is related to Table 5-18 on page 114. > ` > echo " Corrected errors with substantial delay: $1" > echo " Corrected errors with possible delay : $2" > echo " Total errors : $3" > echo " Total errors corrected : $4" > echo " Total times correction algorithm used : $5" > tmp=3D`echo "($6 * 16777216 + $7) * 16777216 + $8" | bc` > echo " Total bytes processed : $tmp" --=20 Dan Langille - http://langille.org