Ticket #7245: devices-fix.patch
File devices-fix.patch, 28.3 KB (added by , 13 years ago) |
---|
-
src/apps/devices/Device.cpp
37 37 B_TRANSLATE("Encryption controller"), // 0x10 38 38 B_TRANSLATE("Signal processing controller"), // 0x11 39 39 B_TRANSLATE("Computer"), // 0x12 (added later) 40 B_TRANSLATE("ACPI controller") // 0x13 (added later) 40 B_TRANSLATE("ACPI controller"), // 0x13 (added later) 41 B_TRANSLATE("USB controller"), // 0x14 (added later) 42 B_TRANSLATE("SCSI controller") // 0x15 (added later) 41 43 }; 42 44 43 45 … … 50 52 fCategory(category), 51 53 fPhysicalParent(physicalParent) 52 54 { 53 SetAttribute( B_TRANSLATE("Device name"), name);54 SetAttribute( B_TRANSLATE("Manufacturer"), manufacturer);55 SetAttribute( B_TRANSLATE("Driver used"), driverUsed);56 SetAttribute( B_TRANSLATE("Device paths"), devPathsPublished);55 SetAttribute("Device name", name); 56 SetAttribute("Manufacturer", manufacturer); 57 SetAttribute("Driver used", driverUsed); 58 SetAttribute("Device paths", devPathsPublished); 57 59 } 58 60 59 61 … … 65 67 void 66 68 Device::SetAttribute(const BString& name, const BString& value) 67 69 { 68 if (name == B_TRANSLATE("Device name")) {70 if (name == "Device name") { 69 71 SetText(value.String()); 70 72 } 71 73 fAttributeMap[name] = value; … … 132 134 { 133 135 BString str; 134 136 AttributeMapIterator iter; 137 AttributeMapIterator another; 138 bool getaway = false; 139 const BString deviceName = B_TRANSLATE_MARK("Device name"); 140 int32 laskuri = 0; 135 141 for (iter = fAttributeMap.begin(); iter != fAttributeMap.end(); iter++) { 142 getaway = false; 143 laskuri++; 144 if (iter->first == "Device name" && iter->second == "Unknown device") { 145 for (another = fAttributeMap.begin(); another != fAttributeMap.end(); another++) { 146 if ((another->first == "Device name") && 147 ((another->second != "unknown") || 148 (another->second != "Unknown") || 149 (another->second != "Unknown device"))) { 150 str << deviceName << " : " << another->second << "\n"; 151 getaway = true; 152 continue; 153 } 154 if (another->first == "controller_name" && 155 ((another->second != "unknown") || 156 (another->second != "Unknown"))) { 157 str << deviceName << " : " << another->second << "\n"; 158 getaway = true; 159 continue; 160 } 161 if (another->first == "ide/controller_name" && 162 ((another->second != "unknown") || 163 (another->second != "Unknown"))) { 164 str << deviceName << " : " << another->second << "\n"; 165 getaway = true; 166 continue; 167 } 168 if (another->first == "isa/controller_name" && 169 ((another->second != "unknown") || 170 (another->second != "Unknown"))) { 171 str << deviceName << " : " << another->second << "\n"; 172 getaway = true; 173 continue; 174 } 175 if (another->first == "pci/controller_name" && 176 ((another->second != "unknown") || 177 (another->second != "Unknown"))) { 178 str << deviceName << " : " << another->second << "\n"; 179 getaway = true; 180 continue; 181 } 182 if (another->first == "acpi/controller_name" && 183 ((another->second != "unknown") || 184 (another->second != "Unknown"))) { 185 str << deviceName << " : " << another->second << "\n"; 186 getaway = true; 187 continue; 188 } 189 if (another->first == "scsi/controller_name" && 190 ((another->second != "unknown") || 191 (another->second != "Unknown"))) { 192 str << deviceName << " : " << another->second << "\n"; 193 getaway = true; 194 continue; 195 } 196 if (another->first == "usb/controller_name" && 197 ((another->second != "unknown") || 198 (another->second != "Unknown"))) { 199 str << deviceName << " : " << another->second << "\n"; 200 getaway = true; 201 continue; 202 } 203 204 if (another->first == "device/pretty name" && 205 ((another->second != "unknown") || 206 (another->second != "Unknown"))) { 207 str << deviceName << " : " << another->second << "\n"; 208 getaway = true; 209 continue; 210 } 211 } 212 } else if (iter->first == "Device name" && 213 ((iter->second != "unknown") || 214 (iter->second != "Unknown"))) { 215 for (another = fAttributeMap.begin(); 216 another != fAttributeMap.end(); another++) { 217 if ((another->first == "Device name") && 218 ((another->second != "unknown") || 219 (another->second != "Unknown") || 220 (another->second != "Unknown device"))) { 221 str << deviceName << " : " << another->second << "\n"; 222 getaway = true; 223 continue; 224 } 225 if (another->first == "controller_name" && 226 ((another->second != "unknown") || 227 (another->second != "Unknown"))) { 228 str << deviceName << " : " << another->second << "\n"; 229 getaway = true; 230 continue; 231 } 232 if (another->first == "ide/controller_name" && 233 ((another->second != "unknown") || 234 (another->second != "Unknown"))) { 235 str << deviceName << " : " << another->second << "\n"; 236 getaway = true; 237 continue; 238 } 239 if (another->first == "isa/controller_name" && 240 ((another->second != "unknown") || 241 (another->second != "Unknown"))) { 242 str << deviceName << " : " << another->second << "\n"; 243 getaway = true; 244 continue; 245 } 246 if (another->first == "pci/controller_name" && 247 ((another->second != "unknown") || 248 (another->second != "Unknown"))) { 249 str << deviceName << " : " << another->second << "\n"; 250 getaway = true; 251 continue; 252 } 253 if (another->first == "acpi/controller_name" && 254 ((another->second != "unknown") || 255 (another->second != "Unknown"))) { 256 str << deviceName << " : " << another->second << "\n"; 257 getaway = true; 258 continue; 259 } 260 if (another->first == "scsi/controller_name" && 261 ((another->second != "unknown") || 262 (another->second != "Unknown"))) { 263 str << deviceName << " : " << another->second << "\n"; 264 getaway = true; 265 continue; 266 } 267 if (another->first == "usb/controller_name" && 268 ((another->second != "unknown") || 269 (another->second != "Unknown"))) { 270 str << deviceName << " : " << another->second << "\n"; 271 getaway = true; 272 continue; 273 } 274 if (another->first == "device/pretty name" && 275 ((another->second != "unknown") || 276 (another->second != "Unknown"))) { 277 str << deviceName << " : " << another->second << "\n"; 278 getaway = true; 279 continue; 280 } 281 } 282 } 283 if (iter->first == "Manufacturer" && (iter->second == "Unknown" || 284 iter->second == "unknown")) { 285 for (another = fAttributeMap.begin(); 286 another != fAttributeMap.end(); another++) { 287 if ((another->first == "Manufacturer") && 288 ((another->second != "unknown") || 289 (another->second != "Unknown"))) { 290 str << another->first << " : "; 291 str << another->second << "\n"; 292 getaway = true; 293 continue; 294 } 295 } 296 } 297 if (iter->first == "controller_name") { 298 for (another = fAttributeMap.begin(); 299 another != fAttributeMap.end(); another++) { 300 if ((another->first == "Device name") && 301 ((another->second == "unknown") || 302 (another->second == "Unknown"))) { 303 fAttributeMap["Device name"] = iter->second; 304 str << another->first << " : "; 305 str << iter->second << "\n"; 306 getaway = true; 307 continue; 308 } 309 } 310 } 311 if (getaway) continue; 136 312 str << iter->first << " : " << iter->second << "\n"; 137 313 } 138 314 return str; -
src/apps/devices/DevicePCI.h
13 13 #include <Catalog.h> 14 14 15 15 #undef B_TRANSLATE_CONTEXT 16 #define B_TRANSLATE_CONTEXT "DevicePCI "16 #define B_TRANSLATE_CONTEXT "DevicePCI_H" 17 17 18 BString ToHex(uint16 num); 19 BString GetClassinfo(uint16 fClassBaseId, uint16 fClassSubId, uint16 fClassApiId); 20 BString GetVendorInfo(uint16 vendor_id); 21 BString GetDeviceinfo(uint16 VendorId, uint16 DeviceId, 22 uint16 SubsystemVendorId, uint16 SubSystemId, 23 const char* devShort, const char* devFull); 24 25 18 26 class DevicePCI : public Device { 19 27 public: 20 28 DevicePCI(Device* parent); -
src/apps/devices/DeviceACPI.h
13 13 #include <Catalog.h> 14 14 15 15 #undef B_TRANSLATE_CONTEXT 16 #define B_TRANSLATE_CONTEXT "DeviceACPI "16 #define B_TRANSLATE_CONTEXT "DeviceACPI_H" 17 17 18 18 class DeviceACPI : public Device { 19 19 public: -
src/apps/devices/Device.h
12 12 #include <map> 13 13 #include <vector> 14 14 15 #include <Catalog.h> 15 16 #include <String.h> 16 17 #include <StringItem.h> 17 18 19 #undef B_TRANSLATE_CONTEXT 20 #define B_TRANSLATE_CONTEXT "Device_H" 21 18 22 extern "C" { 19 23 #include "dm_wrapper.h" 20 24 } … … 25 29 BUS_PCI, 26 30 BUS_SCSI, 27 31 BUS_ACPI, 32 BUS_USB, 28 33 BUS_NONE 29 34 } BusType; 30 35 … … 47 52 CAT_NONE = 0, 48 53 CAT_BUS = 6, 49 54 CAT_COMPUTER = 0x12, 50 CAT_ACPI = 0x13 55 CAT_ACPI = 0x13, 56 CAT_USB = 0x14 51 57 } Category; 52 58 53 59 … … 89 95 virtual BString GetAllStrings(); 90 96 91 97 virtual BString GetBusTabName() 92 { return "Bus Information"; }98 { return B_TRANSLATE("Bus Information"); } 93 99 94 100 virtual Attribute GetAttribute(const BString& name) 95 101 { return Attribute(name.String(), -
src/apps/devices/DevicesApplication.cpp
53 53 void 54 54 DevicesApplication::ShowAbout() 55 55 { 56 B Alert* alert = new BAlert("about", B_TRANSLATE("Devices\n"57 "\twritten by Pieter Panman\n"58 "\n"59 "\tBased on listdev by Jérôme Duval\n"60 "\tand the previous Devices preference\n"61 "\tby Jérôme Duval and Sikosis\n"62 "\tCopyright 2009, Haiku, Inc.\n"), B_TRANSLATE("OK"));56 BString aboutStr("%1\n%2\n\n%3\nCopyright 2009, Haiku, Inc.\n"); 57 aboutStr.ReplaceFirst("%1", B_TRANSLATE("Devices")); 58 aboutStr.ReplaceFirst("%2", B_TRANSLATE("written by Pieter Panman")); 59 aboutStr.ReplaceFirst("%3", B_TRANSLATE("Based on listdev by Jérôme " 60 "Duval\nand the previous Devices preference\nby Jérôme Duval and " 61 "Sikosis")); 62 BAlert* alert = new BAlert("about", aboutStr.String(), B_TRANSLATE("OK")); 63 63 BTextView* view = alert->TextView(); 64 64 BFont font; 65 65 … … 68 68 view->GetFont(&font); 69 69 font.SetSize(18); 70 70 font.SetFace(B_BOLD_FACE); 71 view->SetFontAndColor(0, 7, &font);71 view->SetFontAndColor(0, strlen(B_TRANSLATE("Devices")), &font); 72 72 73 73 alert->Go(); 74 74 } -
src/apps/devices/DeviceUSB.cpp
1 /* 2 * Copyright 2008-2011 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Pieter Panman 7 * Jorma Karvonen 8 */ 9 10 11 #include <sstream> 12 #include <stdlib.h> 13 14 #include "DeviceUSB.h" 15 16 extern BString ToHex(uint16); 17 extern BString GetClassinfo(uint16, uint16,uint16); 18 extern BString GetVendorInfo(uint16); 19 extern BString GetDeviceinfo(uint16, uint16, uint16, uint16); 20 21 22 DeviceUSB::DeviceUSB(Device* parent) 23 : 24 Device(parent), 25 fClassBaseId(0), 26 fClassSubId(0), 27 fClassApiId(0), 28 fVendorId(0), 29 fDeviceId(0), 30 fSubsystemVendorId(0), 31 fSubSystemId(0) 32 { 33 } 34 35 36 DeviceUSB::~DeviceUSB() 37 { 38 } 39 40 41 void 42 DeviceUSB::InitFromAttributes() 43 { 44 // Process the attributes 45 fClassBaseId = atoi(fAttributeMap[B_DEVICE_TYPE].String()); 46 fClassSubId = atoi(fAttributeMap[B_DEVICE_SUB_TYPE].String()); 47 fClassApiId = atoi(fAttributeMap[B_DEVICE_INTERFACE].String()); 48 fVendorId = atoi(fAttributeMap[B_DEVICE_VENDOR_ID].String()); 49 fDeviceId = atoi(fAttributeMap[B_DEVICE_ID].String()); 50 51 // Looks better in Hex, so rewrite 52 fAttributeMap[B_DEVICE_TYPE] = ToHex(fClassBaseId); 53 fAttributeMap[B_DEVICE_SUB_TYPE] = ToHex(fClassSubId); 54 fAttributeMap[B_DEVICE_INTERFACE] = ToHex(fClassApiId); 55 fAttributeMap[B_DEVICE_VENDOR_ID] = ToHex(fVendorId); 56 fAttributeMap[B_DEVICE_ID] = ToHex(fDeviceId); 57 58 // Fetch ClassInfo 59 BString classInfo = GetClassinfo(fClassBaseId, fClassSubId, fClassApiId); 60 61 // Fetch ManufacturerName 62 BString ManufacturerName = GetVendorInfo(fVendorId); 63 64 // Fetch DeviceName 65 BString DeviceName = GetDeviceinfo(fVendorId, fDeviceId, 66 fSubsystemVendorId, fSubSystemId); 67 68 SetAttribute("Device name", DeviceName); 69 SetAttribute("Manufacturer", ManufacturerName); 70 SetAttribute("Driver used", "Not implemented"); 71 SetAttribute("Device paths", "Not implemented"); 72 SetAttribute("Class info", classInfo.String()); 73 //fCategory = (Category)fClassBaseId; 74 fCategory = (Category)CAT_USB; 75 BString outlineName; 76 outlineName << ManufacturerName << " " << DeviceName; 77 SetText(outlineName.String()); 78 } 79 80 81 Attributes 82 DeviceUSB::GetBusAttributes() 83 { 84 Attributes attributes; 85 attributes.push_back(GetAttribute(B_DEVICE_TYPE)); 86 attributes.push_back(GetAttribute(B_DEVICE_SUB_TYPE)); 87 attributes.push_back(GetAttribute(B_DEVICE_INTERFACE)); 88 attributes.push_back(GetAttribute(B_DEVICE_VENDOR_ID)); 89 attributes.push_back(GetAttribute(B_DEVICE_ID)); 90 attributes.push_back(GetAttribute("device/bus")); 91 attributes.push_back(GetAttribute("usb/path")); 92 attributes.push_back(GetAttribute("usb/type")); 93 return attributes; 94 } 95 96 97 BString 98 DeviceUSB::GetBusStrings() 99 { 100 BString str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%")); 101 str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]); 102 return str; 103 } -
src/apps/devices/DevicesView.cpp
275 275 attrString << attr.value.ui64; 276 276 break; 277 277 default: 278 attrString << "Raw data";278 attrString << B_TRANSLATE("Raw data"); 279 279 } 280 280 attributes.push_back(Attribute(attr.name, attrString)); 281 281 } … … 285 285 // Devices Root 286 286 if (attributes[i].fName == B_DEVICE_PRETTY_NAME 287 287 && attributes[i].fValue == "Devices Root") { 288 newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, "Computer");288 newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, B_TRANSLATE("Computer")); 289 289 break; 290 290 } 291 291 292 292 // ACPI Controller 293 293 if (attributes[i].fName == B_DEVICE_PRETTY_NAME 294 294 && attributes[i].fValue == "ACPI") { 295 newDevice = new Device(parent, BUS_ACPI, CAT_BUS, "ACPI bus");295 newDevice = new Device(parent, BUS_ACPI, CAT_BUS, B_TRANSLATE("ACPI bus")); 296 296 break; 297 297 } 298 299 // SCSI Controller 300 /* if (attributes[i].fName == B_DEVICE_PRETTY_NAME 301 && attributes[i].fValue == "SCSI") { 302 newDevice = new Device(parent, BUS_SCSI, CAT_BUS, "SCSI bus"); 303 break; 304 } */ 298 305 299 306 // PCI bus 300 307 if (attributes[i].fName == B_DEVICE_PRETTY_NAME 301 308 && attributes[i].fValue == "PCI") { 302 newDevice = new Device(parent, BUS_PCI, CAT_BUS, "PCI bus");309 newDevice = new Device(parent, BUS_PCI, CAT_BUS, B_TRANSLATE("PCI bus")); 303 310 break; 304 311 } 305 312 313 // USB bus 314 if (attributes[i].fName == B_DEVICE_PRETTY_NAME 315 && attributes[i].fValue == "USB") { 316 newDevice = new Device(parent, BUS_USB, CAT_BUS, "USB bus"); 317 break; 318 } 319 306 320 // ISA bus 307 321 if (attributes[i].fName == B_DEVICE_BUS 308 322 && attributes[i].fValue == "isa") { 309 newDevice = new Device(parent, BUS_ISA, CAT_BUS, "ISA bus");323 newDevice = new Device(parent, BUS_ISA, CAT_BUS, B_TRANSLATE("ISA bus")); 310 324 break; 311 325 } 326 327 // SCSI bus 328 /* if (attributes[i].fName == B_DEVICE_BUS 329 && attributes[i].fValue == "scsi") { 330 newDevice = new DeviceSCSI(parent); 331 break; 332 } */ 312 333 313 334 // PCI device 314 335 if (attributes[i].fName == B_DEVICE_BUS … … 323 344 newDevice = new DeviceACPI(parent); 324 345 break; 325 346 } 347 348 // USB device 349 if (attributes[i].fName == B_DEVICE_BUS 350 && attributes[i].fValue == "usb") { 351 newDevice = new DeviceUSB(parent); 352 break; 353 } 326 354 } 327 355 328 356 if (newDevice == NULL) { -
src/apps/devices/DeviceUSB.h
1 /* 2 * Copyright 2008-2011 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Pieter Panman 7 * Jorma Karvonen 8 */ 9 #ifndef DEVICEUSB_H 10 #define DEVICEUSB_H 11 12 13 #include "Device.h" 14 #include <Catalog.h> 15 16 #undef B_TRANSLATE_CONTEXT 17 #define B_TRANSLATE_CONTEXT "DeviceUSB_H" 18 19 class DeviceUSB : public Device { 20 public: 21 DeviceUSB(Device* parent); 22 virtual ~DeviceUSB(); 23 virtual Attributes GetBusAttributes(); 24 virtual BString GetBusStrings(); 25 virtual void InitFromAttributes(); 26 27 virtual BString GetBusTabName() 28 { return B_TRANSLATE("USB Information"); } 29 30 private: 31 uint16 fClassBaseId; 32 uint16 fClassSubId; 33 uint16 fClassApiId; 34 uint16 fVendorId; 35 uint16 fDeviceId; 36 uint16 fSubsystemVendorId; 37 uint16 fSubSystemId; 38 }; 39 40 #endif /* DEVICEUSB_H */ -
src/apps/devices/PropertyList.cpp
8 8 9 9 10 10 #include "PropertyList.h" 11 12 #include <Catalog.h> 11 13 #include <ColumnTypes.h> 12 14 13 15 //#include <stdio.h> 14 16 17 #undef B_TRANSLATE_CONTEXT 18 #define B_TRANSLATE_CONTEXT "PropertyList" 19 15 20 PropertyRow::PropertyRow(const char* name, const char* value) 16 21 : BRow(), 17 22 fName(name), fValue(value) -
src/apps/devices/DeviceSCSI.cpp
1 /* 2 * Copyright 2008-2011 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Pieter Panman 7 * Jorma Karvonen 8 */ 9 10 11 #include <sstream> 12 #include <stdlib.h> 13 14 #include "DeviceSCSI.h" 15 16 extern BString ToHex(uint16); 17 extern BString GetClassinfo(uint16 fClassBaseId, uint16 fClassSubId, 18 uint16 fClassApiId); 19 extern BString GetVendorInfo(uint16); 20 extern BString GetDeviceinfo(uint16, uint16, uint16, uint16); 21 22 23 DeviceSCSI::DeviceSCSI(Device* parent) 24 : 25 Device(parent), 26 fClassBaseId(0), 27 fClassSubId(0), 28 fClassApiId(0), 29 fVendorId(0), 30 fDeviceId(0), 31 fSubsystemVendorId(0), 32 fSubSystemId(0) 33 { 34 } 35 36 37 DeviceSCSI::~DeviceSCSI() 38 { 39 } 40 41 42 void 43 DeviceSCSI::InitFromAttributes() 44 { 45 // Process the attributes 46 fClassBaseId = atoi(fAttributeMap[B_DEVICE_TYPE].String()); 47 fClassSubId = atoi(fAttributeMap[B_DEVICE_SUB_TYPE].String()); 48 fClassApiId = atoi(fAttributeMap[B_DEVICE_INTERFACE].String()); 49 fVendorId = atoi(fAttributeMap[B_DEVICE_VENDOR_ID].String()); 50 fDeviceId = atoi(fAttributeMap[B_DEVICE_ID].String()); 51 52 // Looks better in Hex, so rewrite 53 fAttributeMap[B_DEVICE_TYPE] = ToHex(fClassBaseId); 54 fAttributeMap[B_DEVICE_SUB_TYPE] = ToHex(fClassSubId); 55 fAttributeMap[B_DEVICE_INTERFACE] = ToHex(fClassApiId); 56 fAttributeMap[B_DEVICE_VENDOR_ID] = ToHex(fVendorId); 57 fAttributeMap[B_DEVICE_ID] = ToHex(fDeviceId); 58 59 // Fetch ClassInfo 60 BString classInfo = GetClassinfo(fClassBaseId, fClassSubId, fClassApiId); 61 62 // Fetch ManufacturerName 63 BString ManufacturerName; 64 ManufacturerName << GetVendorInfo(fVendorId); 65 66 // Fetch DeviceName 67 BString DeviceName; 68 DeviceName << GetDeviceinfo(fVendorId, fDeviceId, fSubsystemVendorId, 69 fSubSystemId); 70 71 SetAttribute("Device name", DeviceName); 72 SetAttribute("Manufacturer", ManufacturerName); 73 SetAttribute("Driver used", "Not implemented"); 74 SetAttribute("Device paths", "Not implemented"); 75 SetAttribute("Class info", classInfo.String()); 76 fCategory = (Category)fClassBaseId; 77 BString outlineName; 78 outlineName << ManufacturerName << " " << DeviceName; 79 SetText(outlineName.String()); 80 } 81 82 83 Attributes 84 DeviceSCSI::GetBusAttributes() 85 { 86 Attributes attributes; 87 attributes.push_back(GetAttribute(B_DEVICE_TYPE)); 88 attributes.push_back(GetAttribute(B_DEVICE_SUB_TYPE)); 89 attributes.push_back(GetAttribute(B_DEVICE_INTERFACE)); 90 attributes.push_back(GetAttribute(B_DEVICE_VENDOR_ID)); 91 attributes.push_back(GetAttribute(B_DEVICE_ID)); 92 return attributes; 93 } 94 95 96 BString 97 DeviceSCSI::GetBusStrings() 98 { 99 BString str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%")); 100 str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]); 101 return str; 102 } -
src/apps/devices/DevicesView.h
25 25 #include <map> 26 26 27 27 #include "Device.h" 28 #include "DeviceSCSI.h" 28 29 #include "DevicePCI.h" 29 30 #include "DeviceACPI.h" 31 #include "DeviceUSB.h" 30 32 #include "PropertyList.h" 31 33 #include "PropertyListPlain.h" 32 34 -
src/apps/devices/PropertyList.h
16 16 #include <Catalog.h> 17 17 18 18 #undef B_TRANSLATE_CONTEXT 19 #define B_TRANSLATE_CONTEXT "PropertyList "19 #define B_TRANSLATE_CONTEXT "PropertyList_H" 20 20 21 21 struct Attribute; 22 22 -
src/apps/devices/Jamfile
72 72 Device.cpp 73 73 PropertyList.cpp 74 74 PropertyListPlain.cpp 75 DeviceUSB.cpp 76 # DeviceSCSI.cpp 75 77 : be libcolumnlistview.a tracker $(TARGET_LIBSUPC++) $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS) 76 78 : Devices.rdef 77 79 ; … … 79 81 DoCatalogs Devices : 80 82 x-vnd.Haiku-Devices 81 83 : 84 Device.h 85 Device.cpp 82 86 DevicesApplication.cpp 83 87 DevicesView.cpp 88 DeviceACPI.h 89 DeviceACPI.cpp 90 DevicePCI.h 84 91 DevicePCI.cpp 92 PropertyList.h 85 93 PropertyList.cpp 86 PropertyListPlain.cpp 94 DeviceUSB.h 95 ResourceUsageWindow.cpp 96 # DeviceSCSI.h 87 97 ; 88 98 89 99 Includes [ FGristFiles DevicesInfo.cpp ] : [ FGristFiles isapnpids.h usbdevs.h -
src/apps/devices/DeviceSCSI.h
1 /* 2 * Copyright 2008-2011 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Pieter Panman 7 * Jorma Karvonen 8 */ 9 #ifndef DEVICESCSI_H 10 #define DEVICESCSI_H 11 12 13 #include "Device.h" 14 #include <Catalog.h> 15 16 #undef B_TRANSLATE_CONTEXT 17 #define B_TRANSLATE_CONTEXT "DeviceSCSI_H" 18 19 class DeviceSCSI : public Device { 20 public: 21 DeviceSCSI(Device* parent); 22 virtual ~DeviceSCSI(); 23 virtual Attributes GetBusAttributes(); 24 virtual BString GetBusStrings(); 25 virtual void InitFromAttributes(); 26 27 virtual BString GetBusTabName() 28 { return B_TRANSLATE("SCSI Information"); } 29 30 private: 31 uint16 fClassBaseId; 32 uint16 fClassSubId; 33 uint16 fClassApiId; 34 uint16 fVendorId; 35 uint16 fDeviceId; 36 uint16 fSubsystemVendorId; 37 uint16 fSubSystemId; 38 }; 39 40 #endif /* DEVICESCSI_H */ -
src/apps/devices/DevicePCI.cpp
16 16 #include "dm_wrapper.h" 17 17 #include "pcihdr.h" 18 18 #include "pci-utils.h" 19 }; 20 21 BString 22 ToHex(uint16 num) 23 { 24 std::stringstream ss; 25 ss.flags(std::ios::hex | std::ios::showbase); 26 ss << num; 27 return BString(ss.str().c_str()); 19 28 } 20 29 21 30 31 BString 32 GetClassinfo(uint16 fClassBaseId, uint16 fClassSubId, uint16 fClassApiId) 33 { 34 // Fetch ClassInfo 35 BString ret; 36 char classInfo[128]; 37 memset(classInfo, 0x00, sizeof(classInfo)); 38 get_class_info(fClassBaseId, fClassSubId, fClassApiId, classInfo, 39 sizeof(classInfo)); 40 ret << classInfo; 41 return ret; 42 } 43 44 45 BString 46 GetVendorInfo(uint16 vendor_id) 47 { 48 BString ret; 49 const char* venShort; 50 const char* venFull; 51 get_vendor_info(vendor_id, &venShort, &venFull); 52 if (!venShort && !venFull) { 53 ret << "Unknown"; 54 } else if (venShort && venFull) { 55 ret << venFull << "(" << venShort << ")"; 56 } else { 57 ret << (venShort ? venShort : venFull); 58 } 59 return ret; 60 } 61 62 63 BString 64 GetDeviceinfo(uint16 VendorId, uint16 DeviceId, 65 uint16 SubsystemVendorId, uint16 SubSystemId) 66 { 67 BString ret; 68 const char* devShort; 69 const char* devFull; 70 get_device_info(VendorId, DeviceId, SubsystemVendorId, SubSystemId, 71 &devShort, &devFull); 72 if (!devShort && !devFull) { 73 ret << "Unknown"; 74 } else if (devShort && devFull) { 75 ret << devFull << "(" << devShort << ")"; 76 } else { 77 ret << (devShort ? devShort : devFull); 78 } 79 return ret; 80 } 81 82 22 83 DevicePCI::DevicePCI(Device* parent) 23 84 : 24 85 Device(parent), … … 38 99 } 39 100 40 101 41 BString ToHex(uint16 num)42 {43 std::stringstream ss;44 ss.flags(std::ios::hex | std::ios::showbase);45 ss << num;46 return BString(ss.str().c_str());47 }48 49 50 102 void 51 103 DevicePCI::InitFromAttributes() 52 104 { … … 71 123 72 124 // Fetch ManufacturerName 73 125 BString ManufacturerName; 74 const char *venShort; 75 const char *venFull; 76 get_vendor_info(fVendorId, &venShort, &venFull); 77 if (!venShort && !venFull) { 78 ManufacturerName << B_TRANSLATE("Unknown"); 79 } else if (venShort && venFull) { 80 ManufacturerName << venFull << "(" << venShort << ")"; 81 } else { 82 ManufacturerName << (venShort ? venShort : venFull); 83 } 126 ManufacturerName << GetVendorInfo(fVendorId); 84 127 85 128 // Fetch DeviceName 86 129 BString DeviceName; 87 const char *devShort; 88 const char *devFull; 89 get_device_info(fVendorId, fDeviceId, fSubsystemVendorId, fSubSystemId, 90 &devShort, &devFull); 91 if (!devShort && !devFull) { 92 DeviceName << B_TRANSLATE("Unknown"); 93 } else if (devShort && devFull) { 94 DeviceName << devFull << "(" << devShort << ")"; 95 } else { 96 DeviceName << (devShort ? devShort : devFull); 97 } 130 DeviceName << GetDeviceinfo(fVendorId, fDeviceId, fSubsystemVendorId, 131 fSubSystemId); 98 132 99 SetAttribute( B_TRANSLATE("Device name"), DeviceName);100 SetAttribute( B_TRANSLATE("Manufacturer"), ManufacturerName);101 SetAttribute( B_TRANSLATE("Driver used"), B_TRANSLATE("Not implemented"));102 SetAttribute( B_TRANSLATE("Device paths"), B_TRANSLATE("Not implemented"));103 SetAttribute( B_TRANSLATE("Class info"), classInfo);133 SetAttribute("Device name", DeviceName); 134 SetAttribute("Manufacturer", ManufacturerName); 135 SetAttribute("Driver used", "Not implemented"); 136 SetAttribute("Device paths", "Not implemented"); 137 SetAttribute("Class info", classInfo); 104 138 fCategory = (Category)fClassBaseId; 105 139 BString outlineName; 106 140 outlineName << ManufacturerName << " " << DeviceName; … … 124 158 BString 125 159 DevicePCI::GetBusStrings() 126 160 { 127 BString str( "Class Info:\t\t\t\t: %classInfo%");161 BString str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%")); 128 162 str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]); 129 163 return str; 130 164 } -
src/apps/devices/DeviceACPI.cpp
12 12 13 13 #include "DeviceACPI.h" 14 14 15 #include <Catalog.h> 15 16 17 #undef B_TRANSLATE_CONTEXT 18 #define B_TRANSLATE_CONTEXT "DeviceACPI" 19 20 16 21 DeviceACPI::DeviceACPI(Device* parent) 17 22 : 18 23 Device(parent) … … 55 60 outlineName << string.String(); 56 61 } else if (rootACPIPath == "\\_SI_") { 57 62 outlineName = B_TRANSLATE("ACPI System Indicator"); 63 } else if ((rootACPIPath == "\\_BAT1_") || (rootACPIPath == "\\_BAT2_")){ 64 outlineName = B_TRANSLATE("ACPI Battery"); 58 65 } else { 59 66 // This allows to localize apostrophes, too 60 67 BString string(B_TRANSLATE("ACPI node '%1'")); … … 62 69 outlineName << string.String(); 63 70 } 64 71 65 SetAttribute( B_TRANSLATE("Device name"), outlineName.String());66 SetAttribute( B_TRANSLATE("Manufacturer"), B_TRANSLATE("Not implemented"));72 SetAttribute("Device name", outlineName.String()); 73 SetAttribute("Manufacturer", "Not implemented"); 67 74 68 75 SetText(outlineName.String()); 69 76 } … … 84 91 BString 85 92 DeviceACPI::GetBusStrings() 86 93 { 87 BString str( "Class Info:\t\t\t\t: %classInfo%");94 BString str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%")); 88 95 str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]); 89 96 90 97 return str;