added ISA PnP support
isa device ids list is parsed with grep and awk by jam tested with VirtualPC2004 ISA PnP devices : Game Port and Sound Blaster 16 git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8361 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -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 = "<Unknown>";
|
||||
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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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 <View.h>
|
||||
#include "DevicesInfo.h"
|
||||
#include <stdio.h>
|
||||
#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; i<ISA_DEVTABLE_LEN; i++)
|
||||
if (stricmp(isapnp_devids[i].id, string)==0) {
|
||||
fCardName = isapnp_devids[i].devname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fBaseString = strdup((info->devtype.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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 ] ;
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user