*
* Home page of code is: http://www.smartmontools.org
*
- * Copyright (C) 2008-16 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2008-16 Christian Franke
*
* 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
#include "config.h"
#include "int64.h"
#include "dev_interface.h"
+#include "dev_intelliprop.h"
#include "dev_tunnelled.h"
#include "atacmds.h" // ATA_SMART_CMD/STATUS
#include "utility.h"
#include <sys/timeb.h>
#endif
-const char * dev_interface_cpp_cvsid = "$Id: dev_interface.cpp 4283 2016-04-10 12:55:59Z chrfranke $"
+const char * dev_interface_cpp_cvsid = "$Id: dev_interface.cpp 4431 2017-08-08 19:38:15Z chrfranke $"
DEV_INTERFACE_H_CVSID;
/////////////////////////////////////////////////////////////////////////////
{
// default
std::string s =
- "ata, scsi, nvme[,NSID], sat[,auto][,N][+TYPE], "
- "usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus";
+ "ata, scsi, nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], "
+ "usbjmicron[,p][,x][,N], usbprolific, usbsunplus, intelliprop,N[+TYPE]";
// append custom
std::string s2 = get_valid_custom_dev_types_str();
if (!s2.empty()) {
return get_sat_device(sattype.c_str(), basedev.release()->to_scsi());
}
+ else if (str_starts_with(type, "intelliprop")) {
+ // Parse "intelliprop,N[+base...]"
+ unsigned phydrive = ~0; int n = -1; char c = 0;
+ sscanf(type, "intelliprop,%u%n%c", &phydrive, &n, &c);
+ if (!((n == (int)strlen(type) || c == '+') && phydrive <= 3)) {
+ set_err(EINVAL, "Option '-d intelliprop,N' requires N between 0 and 3");
+ return 0;
+ }
+ const char * basetype = (type[n] ? type + n + 1 : "");
+ // Recurse to allocate base device, default is standard ATA
+ if (!*basetype)
+ basetype = "ata";
+ smart_device_auto_ptr basedev( get_smart_device(name, basetype) );
+ if (!basedev) {
+ set_err(EINVAL, "Type '%s': %s", type, get_errmsg());
+ return 0;
+ }
+ // Result must be ATA
+ if (!basedev->is_ata()) {
+ set_err(EINVAL, "Type '%s': Device type '%s' is not ATA", type, basetype);
+ return 0;
+ }
+ return get_intelliprop_device(this, phydrive, basedev.release()->to_ata());
+ }
+
else {
set_err(EINVAL, "Unknown device type '%s'", type);
return 0;