diff --git a/src/prefs/devices/ConfigurationWindow.cpp b/src/prefs/devices/ConfigurationWindow.cpp index 7d9ec7794b..835ac8a743 100644 --- a/src/prefs/devices/ConfigurationWindow.cpp +++ b/src/prefs/devices/ConfigurationWindow.cpp @@ -1,15 +1,15 @@ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ // -// Copyright (c) 2003-2004, OpenBeOS +// Copyright (c) 2003-2004, Haiku // -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. +// This software is part of the Haiku distribution and is covered +// by the Haiku license. // // // File: ConfigurationWindow.cpp // Author: Jérôme Duval // Description: Devices Preferences -// Created : April 22, 2003 +// Created : April 22, 2004 // // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ @@ -139,13 +139,14 @@ RangeConfItem::Compare(const void *firstArg, const void *secondArg) // ConfigurationWindow - Constructor ConfigurationWindow::ConfigurationWindow(BRect frame, DeviceItem *item) - : BWindow (frame, item->GetInfo()->GetName(), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL , + : BWindow (frame, item->GetInfo()->GetCardName(), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL , B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE|B_NOT_RESIZABLE), fItem(item) { CenterWindowOnScreen(this); fItem->SetWindow(this); InitWindow(); + Show(); } // -------------------------------------------------------------------------------------------------- // @@ -374,7 +375,24 @@ ConfigurationWindow::InitWindow(void) BBox *info = new BBox(rlist, "info", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER); - BRect labelRect(1, 10, 122, 30); + bool isISAPnP = false; + BString compatibleIDString; + + if (devicesInfo->GetInfo()->bus == B_ISA_BUS) { + uint32 id = devicesInfo->GetInfo()->id[0]; + if ((id >> 24 == 'P') + && (((id >> 16) & 0xff) == 'n') + && (((id >> 8) & 0xff) == 'P')) { + isISAPnP = true; + + char string[255]; + sprintf(string, "Compatible ID #%ld:", + devicesInfo->GetInfo()->id[3]); + compatibleIDString = string; + } + } + + BRect labelRect(1, 10, 132, 30); BStringView *label = new BStringView(labelRect, "Card Name", "Card Name:"); label->SetAlignment(B_ALIGN_RIGHT); info->AddChild(label); @@ -402,6 +420,16 @@ ConfigurationWindow::InitWindow(void) label = new BStringView(labelRect, "Card ID", "Card ID:"); label->SetAlignment(B_ALIGN_RIGHT); info->AddChild(label); + if (isISAPnP) { + labelRect.OffsetBy(0, 18); + label = new BStringView(labelRect, "Logical Device ID", "Logical Device ID:"); + label->SetAlignment(B_ALIGN_RIGHT); + info->AddChild(label); + labelRect.OffsetBy(0, 18); + label = new BStringView(labelRect, "Compatible ID#", compatibleIDString.String()); + label->SetAlignment(B_ALIGN_RIGHT); + info->AddChild(label); + } labelRect.OffsetBy(0, 18); label = new BStringView(labelRect, "Current State", "Current State:"); label->SetAlignment(B_ALIGN_RIGHT); @@ -438,22 +466,54 @@ ConfigurationWindow::InitWindow(void) BString vendorString = ""; BString cardID = ""; BString resourceConflicts = "None"; + BString logicalString; switch (devicesInfo->GetInfo()->bus) { case B_ISA_BUS: { char string[255]; - uint32 id = devicesInfo->GetInfo()->id[2]; - sprintf(string, "%c%c%c Product: %x%x Revision: %x", - ((uint8)(id >> 2) & 0x1f) + 'A' - 1, - ((uint8)(id & 0x3) << 3) + ((uint8)(id >> 13) & 0x7) + 'A' - 1, - (uint8)(id >> 8) & 0x1f + 'A' - 1, - (uint8)(id >> 16) & 0xf, - (uint8)(id >> 20) & 0xf, - (uint8)((id >> 24) & 0xff)); - vendor = string; + if (isISAPnP) { + uint32 id = devicesInfo->GetInfo()->id[1]; + sprintf(string, "%c%c%c Product: %x%x%x Revision: %d", + ((uint8)(id >> 2) & 0x1f) + 'A' - 1, + ((uint8)(id & 0x3) << 3) + ((uint8)(id >> 13) & 0x7) + 'A' - 1, + (uint8)(id >> 8) & 0x1f + 'A' - 1, + (uint8)(id >> 20) & 0xf, + (uint8)(id >> 16) & 0xf, + (uint8)(id >> 28) & 0xf, + (uint8)((id >> 24) & 0xf)); + vendor = string; - cardID = "0"; + sprintf(string, "%08lx", devicesInfo->GetInfo()->id[2]); + cardID = string; + + id = devicesInfo->GetInfo()->id[3]; + sprintf(string, "%c%c%c Product: %x%x%x Revision: %d", + ((uint8)(id >> 2) & 0x1f) + 'A' - 1, + ((uint8)(id & 0x3) << 3) + ((uint8)(id >> 13) & 0x7) + 'A' - 1, + (uint8)(id >> 8) & 0x1f + 'A' - 1, + (uint8)(id >> 20) & 0xf, + (uint8)(id >> 16) & 0xf, + (uint8)(id >> 28) & 0xf, + (uint8)((id >> 24) & 0xf)); + logicalString = string; + + cardName = devicesInfo->GetCardName(); + + } else { + uint32 id = devicesInfo->GetInfo()->id[2]; + sprintf(string, "%c%c%c Product: %x%x Revision: %d", + ((uint8)(id >> 2) & 0x1f) + 'A' - 1, + ((uint8)(id & 0x3) << 3) + ((uint8)(id >> 13) & 0x7) + 'A' - 1, + (uint8)(id >> 8) & 0x1f + 'A' - 1, + (uint8)(id >> 16) & 0xf, + (uint8)(id >> 20) & 0xf, + (uint8)((id >> 24) & 0xff)); + vendor = string; + + cardID = "0"; + } + } break; case B_PCI_BUS: @@ -483,11 +543,11 @@ ConfigurationWindow::InitWindow(void) default: state = "Disabled for Unknown Reason"; break; } - labelRect = BRect(127, 10, 400, 30); + labelRect = BRect(137, 10, 400, 30); label = new BStringView(labelRect, "Card Name", cardName.String()); info->AddChild(label); labelRect.OffsetBy(0, 18); - label = new BStringView(labelRect, "Device Name", devicesInfo->GetName()); + label = new BStringView(labelRect, "Device Name", devicesInfo->GetDeviceName()); info->AddChild(label); labelRect.OffsetBy(0, 18); label = new BStringView(labelRect, "Logical Device Name", logicalDeviceName.String()); @@ -507,6 +567,14 @@ ConfigurationWindow::InitWindow(void) labelRect.OffsetBy(0, 18); label = new BStringView(labelRect, "Card ID", cardID.String()); info->AddChild(label); + if (isISAPnP) { + labelRect.OffsetBy(0, 18); + label = new BStringView(labelRect, "Logical Device ID", logicalString.String()); + info->AddChild(label); + labelRect.OffsetBy(0, 18); + label = new BStringView(labelRect, "Compatible ID", logicalString.String()); + info->AddChild(label); + } labelRect.OffsetBy(0, 18); label = new BStringView(labelRect, "Current State", state.String()); info->AddChild(label); diff --git a/src/prefs/devices/Devices.cpp b/src/prefs/devices/Devices.cpp index 3c684efb30..5610f7af6c 100644 --- a/src/prefs/devices/Devices.cpp +++ b/src/prefs/devices/Devices.cpp @@ -1,9 +1,9 @@ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ // -// Copyright (c) 2003-2004, OpenBeOS +// Copyright (c) 2003-2004, Haiku // -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. +// This software is part of the Haiku distribution and is covered +// by the Haiku license. // // // File: Devices.cpp diff --git a/src/prefs/devices/Devices.rdef b/src/prefs/devices/Devices.rdef index 7d9aac19d5..e828dc5b37 100644 --- a/src/prefs/devices/Devices.rdef +++ b/src/prefs/devices/Devices.rdef @@ -55,7 +55,7 @@ resource mini_icon $"FFFF00000E0F0F0F0FFFFFFF000F0FFF" }; -resource(1, "BEOS:FILE_TYPES") message; +resource file_types message; resource app_signature "application/x-vnd.OBOS.Devices"; diff --git a/src/prefs/devices/DevicesInfo.cpp b/src/prefs/devices/DevicesInfo.cpp index fd8c889ebf..0f86d3d5ae 100644 --- a/src/prefs/devices/DevicesInfo.cpp +++ b/src/prefs/devices/DevicesInfo.cpp @@ -1,9 +1,9 @@ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ // -// Copyright (c) 2004, OpenBeOS +// Copyright (c) 2004, Haiku // -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. +// This software is part of the Haiku distribution and is covered +// by the Haiku license. // // // File: DevicesInfo.cpp @@ -19,6 +19,7 @@ #include #include "DevicesInfo.h" #include +#include "isapnpids.h" const char *base_desc[] = { "Legacy", @@ -108,10 +109,34 @@ DevicesInfo::DevicesInfo(struct device_info *info, s++; } } - - fName = strdup((info->devtype.base < 13) - ? ( (s && s->name) ? s->name : base_desc[info->devtype.base]) - : "Unknown"); + + fDeviceName = strdup((info->devtype.base < 13) + ? ( (s && s->name) ? s->name : base_desc[info->devtype.base]) + : "Unknown"); + + fCardName = fDeviceName; + if (fInfo->bus == B_ISA_BUS) { + uint32 id = fInfo->id[0]; + if ((id >> 24 == 'P') + && (((id >> 16) & 0xff) == 'n') + && (((id >> 8) & 0xff) == 'P')) { + id = fInfo->id[3]; + char string[255]; + sprintf(string, "%c%c%c%x%x%x%x", + ((uint8)(id >> 2) & 0x1f) + 'A' - 1, + ((uint8)(id & 0x3) << 3) + ((uint8)(id >> 13) & 0x7) + 'A' - 1, + (uint8)(id >> 8) & 0x1f + 'A' - 1, + (uint8)(id >> 20) & 0xf, + (uint8)(id >> 16) & 0xf, + (uint8)(id >> 28) & 0xf, + (uint8)((id >> 24) & 0xf)); + for (uint32 i=0; idevtype.base < 13) ? base_desc[info->devtype.base] : "Unknown"); fSubTypeString = strdup((s && s->name) ? s->name : "Unknown"); } @@ -122,11 +147,12 @@ DevicesInfo::~DevicesInfo() delete fInfo; delete fCurrent; delete fPossible; - delete fName; + delete fDeviceName; delete fBaseString; delete fSubTypeString; } + DeviceItem::DeviceItem(DevicesInfo *info, const char* name) : BListItem(), fInfo(info), diff --git a/src/prefs/devices/DevicesInfo.h b/src/prefs/devices/DevicesInfo.h index 2d04832bd0..3835057474 100644 --- a/src/prefs/devices/DevicesInfo.h +++ b/src/prefs/devices/DevicesInfo.h @@ -1,9 +1,9 @@ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ // -// Copyright (c) 2004, OpenBeOS +// Copyright (c) 2004, Haiku // -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. +// This software is part of the Haiku distribution and is covered +// by the Haiku license. // // // File: DevicesInfo.h @@ -28,15 +28,17 @@ class DevicesInfo struct possible_device_configurations *possible); ~DevicesInfo(); struct device_info * GetInfo() { return fInfo;} - char * GetName() const { return fName; } + char * GetDeviceName() const { return fDeviceName; } + char * GetCardName() const { return fCardName; } char * GetBaseString() const { return fBaseString; } char * GetSubTypeString() const { return fSubTypeString; } struct device_configuration * GetCurrent() { return fCurrent;} + char * GetISAName() const; private: struct device_info *fInfo; struct device_configuration *fCurrent; struct possible_device_configurations *fPossible; - char* fName, *fBaseString, *fSubTypeString; + char* fDeviceName, *fCardName, *fBaseString, *fSubTypeString; }; class DeviceItem : public BListItem diff --git a/src/prefs/devices/DevicesWindow.cpp b/src/prefs/devices/DevicesWindow.cpp index 44feb9fb5a..be0aba0361 100644 --- a/src/prefs/devices/DevicesWindow.cpp +++ b/src/prefs/devices/DevicesWindow.cpp @@ -91,12 +91,19 @@ DevicesWindow::DevicesWindow(BRect frame) : BWindow (frame, "Devices", B_TITLED_ DevicesInfo *deviceInfo = (DevicesInfo *) fList.ItemAt(i); struct device_info *info = deviceInfo->GetInfo(); BListItem *item = systemMenu; - if (info->bus == B_ISA_BUS) - item = systemMenu; - else if (info->bus == B_PCI_BUS) + if (info->bus == B_ISA_BUS) { + uint32 id = info->id[0]; + if ((id >> 24 == 'P') + && (((id >> 16) & 0xff) == 'n') + && (((id >> 8) & 0xff) == 'P')) { + item = isaMenu; + } else { + item = systemMenu; + } + } else if (info->bus == B_PCI_BUS) item = pciMenu; - outline->AddUnder(new DeviceItem(deviceInfo, deviceInfo->GetName()), item); + outline->AddUnder(new DeviceItem(deviceInfo, deviceInfo->GetCardName()), item); } if (outline->CountItemsUnder(jumperedMenu, true)==0) diff --git a/src/prefs/devices/Jamfile b/src/prefs/devices/Jamfile index 0fe2d0a2cf..89c4ccbc8b 100644 --- a/src/prefs/devices/Jamfile +++ b/src/prefs/devices/Jamfile @@ -2,6 +2,26 @@ SubDir OBOS_TOP src prefs devices ; AddResources Devices : Devices.rdef ; +rule ISAPnPHeaderGen +{ + SetupObjectsDir ; + + SEARCH on $(2) = $(SEARCH_SOURCE) ; + SEARCH on $(3) = $(SEARCH_SOURCE) ; + + Depends $(1) : $(2) $(3) ; + MakeLocate $(<) : $(LOCATE_TARGET) ; + ISAPnPHeaderGen1 $(1) : $(2) $(3) ; + LocalClean clean : $(<) ; +} + +actions ISAPnPHeaderGen1 +{ + grep '^PNP[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] ' $(2[1]) | awk -f $(2[2]) > $(1) ; +} + +ISAPnPHeaderGen [ FGristFiles isapnpids.h ] : isapnp_devids.txt : devlist2h.awk ; + Preference Devices : Devices.cpp DevicesWindow.cpp @@ -10,6 +30,7 @@ Preference Devices : cm_wrapper.c DevicesInfo.cpp ConfigurationWindow.cpp + : be ; -LinkSharedOSLibs Devices : be ; +Includes [ FGristFiles DevicesInfo.cpp ] : [ FGristFiles isapnpids.h ] ; diff --git a/src/prefs/devices/ResourceUsageWindow.cpp b/src/prefs/devices/ResourceUsageWindow.cpp index c00f4c35ad..9bb852c370 100644 --- a/src/prefs/devices/ResourceUsageWindow.cpp +++ b/src/prefs/devices/ResourceUsageWindow.cpp @@ -270,7 +270,7 @@ void ResourceUsageWindow::InitWindow(BList &list) &r, sizeof(resource_descriptor)); if (mask & r.d.m.mask) { - IRQListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetName())); + IRQListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); first = false; } } @@ -300,7 +300,7 @@ void ResourceUsageWindow::InitWindow(BList &list) &r, sizeof(resource_descriptor)); if (mask & r.d.m.mask) { - DMAListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetName())); + DMAListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); first = false; } } @@ -325,7 +325,7 @@ void ResourceUsageWindow::InitWindow(BList &list) &r, sizeof(resource_descriptor)); IORangeListView->AddItem(new RangeItem(r.d.r.minbase, - r.d.r.minbase + r.d.r.len - 1, deviceInfo->GetName())); + r.d.r.minbase + r.d.r.len - 1, deviceInfo->GetCardName())); } } @@ -345,7 +345,7 @@ void ResourceUsageWindow::InitWindow(BList &list) &r, sizeof(resource_descriptor)); memoryListView->AddItem(new RangeItem(r.d.r.minbase, - r.d.r.minbase + r.d.r.len - 1, deviceInfo->GetName())); + r.d.r.minbase + r.d.r.len - 1, deviceInfo->GetCardName())); } } diff --git a/src/prefs/devices/devlist2h.awk b/src/prefs/devices/devlist2h.awk new file mode 100644 index 0000000000..cdc92aea4c --- /dev/null +++ b/src/prefs/devices/devlist2h.awk @@ -0,0 +1,48 @@ +#!/bin/awk +# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ +# +# Copyright (c) 2004, Haiku +# +# This software is part of the Haiku distribution and is covered +# by the Haiku license. +# +# +# File: devlist2h.awk +# Author: Jérôme Duval +# Description: Devices Preferences +# Created : July 8, 2004 +# +# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + +BEGIN { + FS=" " +} +NR == 1 { + printf("/*\tHaiku" "$\t*/\n\n") + printf("/*\n") + printf(" This file is generated automatically. Don't edit. \n") + printf("\n*/") +} + +NF > 0 { + n++ + + ids[n, 1] = $1; + ids[n, 2] = $2; + +} + +END { + printf("\n") + printf("typedef struct { char* id; char* devname; } idTable;\n") + printf("idTable isapnp_devids [] = {\n") + for (i = 1; i <= n; i++) { + printf("\t{\n") + printf("\t\t\"%s\", \"%s\"\n", ids[i,1], ids[i,2]) + printf("\t},\n") + } + printf("\t};\n") + printf("// Use this value for loop control during searching:\n") + printf("#define ISA_DEVTABLE_LEN %i\n", n) +} +