* Copyright 2008-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck, kallisti5@unixzen.com
*/
#include "DeviceSCSI.h"
#include <scsi.h>
#include <sstream>
#include <stdlib.h>
#include <Catalog.h>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "DeviceSCSI"
const char* SCSITypeMap[] = {
B_TRANSLATE("Disk Drive"),
B_TRANSLATE("Tape Drive"),
B_TRANSLATE("Printer"),
B_TRANSLATE("Processor"),
B_TRANSLATE("Worm"),
B_TRANSLATE("CD-ROM"),
B_TRANSLATE("Scanner"),
B_TRANSLATE("Optical Drive"),
B_TRANSLATE("Changer"),
B_TRANSLATE("Communications"),
B_TRANSLATE("Graphics Peripheral"),
B_TRANSLATE("Graphics Peripheral"),
B_TRANSLATE("Array"),
B_TRANSLATE("Enclosure"),
B_TRANSLATE("RBC"),
B_TRANSLATE("Card Reader"),
B_TRANSLATE("Bridge"),
B_TRANSLATE("Other")
};
DeviceSCSI::DeviceSCSI(Device* parent)
:
Device(parent)
{
}
DeviceSCSI::~DeviceSCSI()
{
}
void
DeviceSCSI::InitFromAttributes()
{
BString nodeVendor(GetAttribute("scsi/vendor").fValue);
BString nodeProduct(GetAttribute("scsi/product").fValue);
fCategory = (Category)CAT_MASS;
uint32 nodeTypeID = atoi(GetAttribute("scsi/type").fValue);
SetAttribute(B_TRANSLATE("Device name"), nodeProduct.String());
SetAttribute(B_TRANSLATE("Manufacturer"), nodeVendor.String());
SetAttribute(B_TRANSLATE("Device class"), SCSITypeMap[nodeTypeID]);
BString listName;
listName
<< "SCSI " << SCSITypeMap[nodeTypeID] << " (" << nodeProduct << ")";
SetText(listName.String());
}