Ticket #6503: scsi-device-patch-r1.diff
File scsi-device-patch-r1.diff, 6.1 KB (added by , 14 years ago) |
---|
-
src/apps/devices/Device.cpp
12 12 #include <iostream> 13 13 14 14 15 // This list comes from the pciid list, except for the last one15 // This list comes from the pciid list, except for the last few that don't rely on PCIid numbers 16 16 const char* kCategoryString[] = { 17 "Unclassified device", 17 "Unclassified device", // 0x00 18 18 "Mass storage controller", // 0x01 19 19 "Network controller", // 0x02 20 20 "Display controller", // 0x03 … … 26 26 "Input device controller", // 0x09 27 27 "Docking station", // 0x0a 28 28 "Processor", // 0x0b 29 "Serial bus controller", 29 "Serial bus controller", // 0x0c 30 30 "Wireless controller", // 0x0d 31 31 "Intelligent controller", // 0x0e 32 32 "Satellite communications controller", // 0x0f 33 33 "Encryption controller", // 0x10 34 34 "Signal processing controller", // 0x11 35 35 "Computer", // 0x12 (added later) 36 "ACPI controller" // 0x13 (added later)36 "ACPI controller" // 0x13 (added later) 37 37 }; 38 38 39 39 -
src/apps/devices/Device.h
44 44 45 45 46 46 typedef enum { 47 CAT_NONE = 0 ,48 CAT_BUS = 6,49 CAT_COMPUTER = 0x12, 50 CAT_ACPI = 0x13 47 CAT_NONE = 0x00, // Unknown / Other 48 CAT_BUS = 0x06, // Bus Device 49 CAT_COMPUTER = 0x12, // Generic computer related 50 CAT_ACPI = 0x13 // ACPI Related 51 51 } Category; 52 52 53 53 -
src/apps/devices/DevicesView.cpp
318 318 newDevice = new DeviceACPI(parent); 319 319 break; 320 320 } 321 322 // SCSI device (or an ATA device playing SCSI?) 323 if (attributes[i].fName == B_DEVICE_BUS 324 && attributes[i].fValue == "scsi") { 325 newDevice = new DeviceSCSI(parent); 326 break; 327 } 321 328 } 322 329 323 330 if (newDevice == NULL) { -
src/apps/devices/DeviceSCSI.cpp
1 /* 2 * Copyright 2008-2010 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Handle SCSI devices and show them in a clean way 6 * 7 * Authors: 8 * Alexander von Gluck (kallisti5) 9 */ 10 11 12 #include <sstream> 13 #include <stdlib.h> 14 15 #include "DeviceSCSI.h" 16 17 // Standard SCSI device types 18 const char* SCSITypeMap[] = { 19 "Disk Drive", // 0x00 20 "Tape Drive", // 0x01 21 "Printer", // 0x02 22 "Processor", // 0x03 23 "Worm", // 0x04 24 "CD-ROM", // 0x05 25 "Scanner", // 0x06 26 "Optical", // 0x07 27 "Changer", // 0x08 28 "Communications", // 0x09 29 "Graphics Peripheral", // 0x0A 30 "Graphics Peripheral", // 0x0B 31 "Array", // 0x0C 32 "Enclosure", // 0x0D 33 "RBC", // 0x0E 34 "Card Reader", // 0x0F 35 "Bridge", // 0x10 36 "Other" // 0x11 37 }; 38 39 DeviceSCSI::DeviceSCSI(Device* parent) 40 : 41 Device(parent) 42 { 43 } 44 45 46 DeviceSCSI::~DeviceSCSI() 47 { 48 } 49 50 51 void 52 DeviceSCSI::InitFromAttributes() 53 { 54 BString outlineName; 55 BString nodeProduct; 56 BString nodeVendor; 57 BString nodeType; 58 int nodeTypeID; 59 60 nodeProduct = GetAttribute("scsi/product").fValue; 61 nodeVendor = GetAttribute("scsi/vendor").fValue; 62 nodeType = GetAttribute("scsi/type").fValue; 63 64 nodeTypeID = atoi (nodeType.String()); 65 66 fCategory = (Category)CAT_COMPUTER; 67 68 outlineName << "SCSI " << SCSITypeMap[nodeTypeID] << " (" << nodeProduct << ")"; 69 70 SetAttribute("Device name", outlineName.String()); 71 SetAttribute("Manufacturer", nodeVendor.String()); 72 SetAttribute("Device class", SCSITypeMap[nodeTypeID]); 73 74 SetText(outlineName.String()); 75 } 76 77 78 Attributes 79 DeviceSCSI::GetBusAttributes() 80 { 81 // Push back things that matter for SCSI devices 82 Attributes attributes; 83 attributes.push_back(GetAttribute("device/bus")); 84 attributes.push_back(GetAttribute("scsi/product")); 85 attributes.push_back(GetAttribute("scsi/vendor")); 86 attributes.push_back(GetAttribute("scsi/revision")); 87 attributes.push_back(GetAttribute("scsi/target_id")); 88 attributes.push_back(GetAttribute("scsi/target_lun")); 89 attributes.push_back(GetAttribute("dma/max_transfer_blocks")); 90 attributes.push_back(GetAttribute("Device class")); 91 return attributes; 92 } 93 94 95 BString 96 DeviceSCSI::GetBusStrings() 97 { 98 BString str; 99 str << "Class Info:\t\t\t\t: " << fAttributeMap["Class Info"]; 100 return str; 101 } -
src/apps/devices/DevicesView.h
27 27 #include "Device.h" 28 28 #include "DevicePCI.h" 29 29 #include "DeviceACPI.h" 30 #include "DeviceSCSI.h" 30 31 #include "PropertyList.h" 31 32 #include "PropertyListPlain.h" 32 33 -
src/apps/devices/Jamfile
66 66 dm_wrapper.c 67 67 DevicePCI.cpp 68 68 DeviceACPI.cpp 69 DeviceSCSI.cpp 69 70 Device.cpp 70 71 PropertyList.cpp 71 72 PropertyListPlain.cpp -
src/apps/devices/DeviceSCSI.h
1 /* 2 * Copyright 2008-2010 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Alexander von Gluck (kallisti5) 7 */ 8 #ifndef DEVICESCSI_H 9 #define DEVICESCSI_H 10 11 #include "Device.h" 12 13 class DeviceSCSI : public Device { 14 public: 15 DeviceSCSI(Device* parent); 16 virtual ~DeviceSCSI(); 17 virtual Attributes GetBusAttributes(); 18 virtual BString GetBusStrings(); 19 virtual void InitFromAttributes(); 20 21 virtual BString GetBusTabName() 22 { return "SCSI Information"; } 23 24 }; 25 26 #endif /* DEVICESCSI_H */