doug-gilbert / sdparm

official git-svn mirror for sdparm, access SCSI parameters (mode+VPD pages)
https://sg.danny.cz/sg/sdparm.html
Other
6 stars 5 forks source link

Can't query APM value on Windows #1

Open RNavega opened 2 years ago

RNavega commented 2 years ago

Hi, thanks a lot for your utility.
I'm trying to read the current APM value for my HDD, but I'm getting an error.

My OS:
Windows 8.1 x64

PD1:
WDC WD10JPVX-22JC3T0

D:\utils\sdparm>sdparm_64 -vv PD1
>>> about to open device name: PD1
    inquiry cdb: 12 00 00 00 24 00
    PD1: WDC       WD10JPVX-22JC3T0  01.0
    mode sense (10) cdb: 5a 00 01 00 00 00 00 00 08 00
sg_get_mode_page_controls: given response length too small, offset=8 given_len=8
 bd_len=0

>> Read write error recovery mode page [0x1] failed
    mode sense (10) cdb: 5a 00 02 00 00 00 00 00 08 00
sg_get_mode_page_controls: given response length too small, offset=8 given_len=8
 bd_len=0

>> Disconnect-reconnect (SPC + transports) mode page [0x2] failed
    mode sense (10) cdb: 5a 00 03 00 00 00 00 00 08 00
sg_get_mode_page_controls: given response length too small, offset=8 given_len=8
 bd_len=0

>> Format (SBC) mode page [0x3] failed
    mode sense (10) cdb: 5a 00 04 00 00 00 00 00 08 00
sg_get_mode_page_controls: given response length too small, offset=8 given_len=8
 bd_len=0

>> Rigid disk (SBC) mode page [0x4] failed
    mode sense (10) cdb: 5a 00 05 00 00 00 00 00 08 00
sg_get_mode_page_controls: given response length too small, offset=8 given_len=8
 bd_len=0

(...) And many other errors like above

When trying specifically to read the APM:

D:\utils\sdparm>sdparm_64 -vv -g APM PD1
mp_settings: page,subpage=0x1a,0xf1  num=1
  [0x1a,0xf1]  pdt=-1 start_byte=0x6 start_bit=7 num_bits=8  val=0  acronym: APM

>>> about to open device name: PD1
    inquiry cdb: 12 00 00 00 24 00
    PD1: WDC       WD10JPVX-22JC3T0  01.0
    mode sense (10) cdb: 5a 00 1a f1 00 00 00 00 08 00
sg_get_mode_page_controls: given response length too small, offset=8 given_len=8
 bd_len=0

APM error in SAT ATA Power condition mode page

Is there anything else that I can do to try to fix this? Eventually I want to be able to change this APM value as it resets per Windows session.

doug-gilbert commented 2 years ago

This is a dark corner. sdparm assumes SCSI devices or SATA devices behind a SCSI to ATA Translation Layer (SATL). The latter is governed by the SAT standard(s). In my experience that requires a professional SATL which rules out the default SATLs in Linux and Windows (as far as I know). For quality SATLs I look to LSI (Broadcom) and Adaptec (Microchip) HBAs connected via a SAS expander to a SATA disk. My LSI HBA is pretty old (SAS 12G, where is Broadcom's 24G HBA??) and it doesn't even support mode sub-pages. My Adaptec HBA1200 (24G) got pretty close, supporting many "SAT" special mode (sub)pages but not "SAT ATA Power Condition mode page" [0x1a,0xf1] required to access/change APM value. So I think the sdparm code is correct but it requires a lot of support from lower layers. From your lower report it looks like 5a 00 1a f1 00 00 00 00 08 00 requesting the mode page in question gets a few bytes of crap back (which probably gets it passed internal test code :-) ).