version 1.1.1.2, 2012/10/09 09:36:45
|
version 1.1.1.3, 2013/07/22 01:17:35
|
Line 3
|
Line 3
|
* |
* |
* Home page of code is: http://smartmontools.sourceforge.net |
* Home page of code is: http://smartmontools.sourceforge.net |
* |
* |
* Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net> | * Copyright (C) 2008-13 Christian Franke <smartmontools-support@lists.sourceforge.net> |
* |
* |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
Line 19
|
Line 19
|
#include "int64.h" |
#include "int64.h" |
#include "dev_interface.h" |
#include "dev_interface.h" |
#include "dev_tunnelled.h" |
#include "dev_tunnelled.h" |
|
#include "atacmds.h" // ATA_SMART_CMD/STATUS |
#include "utility.h" |
#include "utility.h" |
|
|
#include <errno.h> |
#include <errno.h> |
Line 138 bool ata_device::ata_pass_through(const ata_cmd_in & i
|
Line 139 bool ata_device::ata_pass_through(const ata_cmd_in & i
|
return ata_pass_through(in, dummy); |
return ata_pass_through(in, dummy); |
} |
} |
|
|
bool ata_device::ata_cmd_is_ok(const ata_cmd_in & in, | bool ata_device::ata_cmd_is_supported(const ata_cmd_in & in, |
bool data_out_support /*= false*/, | unsigned flags, const char * type /* = 0 */) |
bool multi_sector_support /*= false*/, | |
bool ata_48bit_support /*= false*/) | |
{ |
{ |
// Check DATA IN/OUT |
// Check DATA IN/OUT |
switch (in.direction) { |
switch (in.direction) { |
Line 167 bool ata_device::ata_cmd_is_ok(const ata_cmd_in & in,
|
Line 166 bool ata_device::ata_cmd_is_ok(const ata_cmd_in & in,
|
} |
} |
|
|
// Check features |
// Check features |
if (in.direction == ata_cmd_in::data_out && !data_out_support) | const char * errmsg = 0; |
return set_err(ENOSYS, "DATA OUT ATA commands not supported"); | if (in.direction == ata_cmd_in::data_out && !(flags & supports_data_out)) |
if (!(in.size == 0 || in.size == 512) && !multi_sector_support) | errmsg = "DATA OUT ATA commands not implemented"; |
return set_err(ENOSYS, "Multi-sector ATA commands not supported"); | else if ( in.out_needed.is_set() && !(flags & supports_output_regs) |
if (in.in_regs.is_48bit_cmd() && !ata_48bit_support) | && !( in.in_regs.command == ATA_SMART_CMD |
return set_err(ENOSYS, "48-bit ATA commands not supported"); | && in.in_regs.features == ATA_SMART_STATUS |
| && (flags & supports_smart_status))) |
| errmsg = "Read of ATA output registers not implemented"; |
| else if (!(in.size == 0 || in.size == 512) && !(flags & supports_multi_sector)) |
| errmsg = "Multi-sector ATA commands not implemented"; |
| else if (in.in_regs.is_48bit_cmd() && !(flags & (supports_48bit_hi_null|supports_48bit))) |
| errmsg = "48-bit ATA commands not implemented"; |
| else if (in.in_regs.is_real_48bit_cmd() && !(flags & supports_48bit)) |
| errmsg = "48-bit ATA commands not fully implemented"; |
| |
| if (errmsg) |
| return set_err(ENOSYS, "%s%s%s%s", errmsg, |
| (type ? " [" : ""), (type ? type : ""), (type ? "]" : "")); |
| |
return true; |
return true; |
} |
} |
|
|
Line 246 std::string smart_interface::get_valid_dev_types_str()
|
Line 258 std::string smart_interface::get_valid_dev_types_str()
|
{ |
{ |
// default |
// default |
std::string s = |
std::string s = |
"ata, scsi, sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,x][,N], usbsunplus"; | "ata, scsi, sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbsunplus"; |
// append custom |
// append custom |
std::string s2 = get_valid_custom_dev_types_str(); |
std::string s2 = get_valid_custom_dev_types_str(); |
if (!s2.empty()) { |
if (!s2.empty()) { |