[Scsirastools-developers] RE: sgdiag, STOP_UNIT, and ATA-in-USB caddies
Brought to you by:
arcress
From: Alex B. <ale...@as...> - 2004-11-25 10:56:21
|
Hi Andy - On Mon, 22 Nov 2004, Cress, Andrew R wrote: > You could test it by using sgdiag: > c - to compose a command > 4 = length > E4 (or 99) > 00 > 00 > 00 > Response Data Length = 2 (this length probably doesn't matter) > Output Data Length = 0 > > Then, if it works, you can see how this is coded in sgdiag.c and make > your own version of the program with a special ATA sleep option. Thanks for the prompt reply. Unfortunately, no dice. I've no clue as to whether it's Linux's usb-storage layer or the USB/1394->ATA bridge (it's a Prolific-branded chipset) that's failing to pass the command on. I guess I'll just have to live with it for now. Ah well. :-) > Andy Cheers, Alex. > > -----Original Message----- > From: Alex Butcher [mailto:ale...@as...] > Sent: Saturday, November 20, 2004 9:27 AM > To: Cress, Andrew R > Subject: RE: sgdiag, STOP_UNIT, and ATA-in-USB caddies > > > Hi Andy - > > On Thu, 18 Nov 2004, Cress, Andrew R wrote: > >> You may need to contact Maxtor to get a tool or API function that will >> accept the spin down for ATA. If there is a command that the ATA > device >> will accept, it could be sent via sg encapsulation, I think. In fact, >> the 'c' option would allow such a command to be composed. > > According to the source for hdparm and > <http://my.execpc.com/~geezer/osd/misc/ata-idle.c>, the equivalent > command > is SLEEP, which is defined as 0xe6 or 0x99. > > hdparm does the following to send a drive to sleep: > > if (set_sleepnow) { > #ifndef WIN_SLEEPNOW1 > #define WIN_SLEEPNOW1 0xE6 > #endif > #ifndef WIN_SLEEPNOW2 > #define WIN_SLEEPNOW2 0x99 > #endif > unsigned char args1[4] = {WIN_SLEEPNOW1,0,0,0}; > unsigned char args2[4] = {WIN_SLEEPNOW2,0,0,0}; > if (get_sleepnow) > printf(" issuing sleep command\n"); > if (ioctl(fd, HDIO_DRIVE_CMD, &args1) > && ioctl(fd, HDIO_DRIVE_CMD, &args2)) > perror(" HDIO_DRIVE_CMD(sleep) failed"); > } > > With the exception of Seagate, these commands appear to be standard ATA. > Now, any ideas on how I can construct an equivalent SCSI CDB? > >> Andy > > Cheers, > Alex. > >> >> -----Original Message----- >> From: Alex Butcher [mailto:ale...@as...] >> Sent: Thursday, November 18, 2004 2:12 PM >> To: Cress, Andrew R >> Subject: sgdiag, STOP_UNIT, and ATA-in-USB caddies >> >> >> Hi - >> >> I've been looking for a tool to spin down the various ATA discs that I >> have >> USB caddies. scsi-spin and scsi-idle use an ioctl that's deprecated >> under >> Linux kernel 2.6.9 (the kernel logs a message saying to port to > SG_IO), >> but >> your sgdiag appears to fit the bill. Unfortunately, when I try to send >> the >> STOP_UNIT command, I get the following: >> >> > ======================================================================== >> == >> sgdiag utility v1.12 for SCSI disks >> ****************************************** >> Log file /var/log/sgdiag.log is open, debug=0 >> >> Num Name [bus:ch:id:lun] Type Vendor Device_Model FW Serial# > Size >> 0 /dev/sg0 [1:0:0:0] Disk Maxtor 5 3073U6 DA62 [em] >> >> c = Compose Command to send 1 = Do bug 1 (sense_len = 18) >> r = Reset SCSI bus 2 = Do bug 2 (INQ hang) >> i = Special Ser# Inquiries 3 = Do bug 3 (fmt w short timeout) >> f = Format SCSI disk w = Wipe SCSI disk (fmt wo glist) >> s = Start Unit d = Send Diagnostic self-test >> t = sTop Unit >> Enter Selection ('q' to quit) : t >> >> Device Num (0 to 0) : 0 >> Issuing stop_unit for /dev/sg0 >> stop_unit: Check Condition Driver_status=0x08 > (DRIVER_SENSE,SUGGEST_OK) >> sense error, key=05 asc=20 ascq=00 Illegal Request, Invalid command >> operation code >> Info valid=0, Current >> stop_unit complete, status = -2 >> > ======================================================================== >> == >> >> I know this is not the intended use of this tool, but I'd appreciate >> your >> opinions on what's up, and whether it's possible to workaround it. >> Normally, >> I'd use hdparm -Y to spin down ATA drives, but as they show up as >> pseudo-SCSI >> devices when used with Linux's usb-storage driver, hdparm refuses to >> handle >> them. :-( >> >> Best Regards, >> Alex. >> > > -- Alex Butcher Brainbench MVP for Internet Security: www.brainbench.com Bristol, UK Need reliable and secure network systems? PGP/GnuPG ID:0x271fd950 <http://www.assursys.com/> |