Hacked AccelerantHWInterface::GetDriverPath() to call the accelerants

B_GET_ACCELERANT_CLONE_INFO (as that's what the caller actually wants).
Unfortunately, it's currently hard-coded to path names, that is, if there
is a driver out there that doesn't follow this quasi standard, it will
break this mechanism.
We should either change the driver interface to explicetly use path
names, or change the mechanism we're using (in BWindowScreen upwards to
the app_server) to the one as thought by Be.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17299 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-05-02 20:17:45 +00:00
parent 6c858b7022
commit 4f4035561f
2 changed files with 24 additions and 14 deletions
+2 -2
View File
@@ -2325,13 +2325,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
{
int32 index;
fLink.Read<int32>(&index);
BString path;
status_t status = fDesktop->HWInterface()->GetDriverPath(path);
fLink.StartMessage(status);
if (status == B_OK)
fLink.AttachString(path.String());
fLink.Flush();
break;
}
@@ -187,21 +187,21 @@ AccelerantHWInterface::_OpenGraphicsDevice(int deviceNumber)
// removed.
int count = 0;
struct dirent *entry;
int current_card_fd = -1;
int device = -1;
char path[PATH_MAX];
while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") ||
!strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa"))
continue;
if (current_card_fd >= 0) {
close(current_card_fd);
current_card_fd = -1;
if (device >= 0) {
close(device);
device = -1;
}
sprintf(path, "/dev/graphics/%s", entry->d_name);
current_card_fd = open(path, B_READ_WRITE);
if (current_card_fd >= 0)
device = open(path, B_READ_WRITE);
if (device >= 0)
count++;
}
@@ -209,14 +209,14 @@ AccelerantHWInterface::_OpenGraphicsDevice(int deviceNumber)
if (count < deviceNumber) {
if (deviceNumber == 1) {
sprintf(path, "/dev/graphics/vesa");
current_card_fd = open(path, B_READ_WRITE);
device = open(path, B_READ_WRITE);
} else {
close(current_card_fd);
current_card_fd = B_ENTRY_NOT_FOUND;
close(device);
device = B_ENTRY_NOT_FOUND;
}
}
return current_card_fd;
return device;
}
@@ -662,8 +662,18 @@ AccelerantHWInterface::GetAccelerantPath(BString &string)
status_t
AccelerantHWInterface::GetDriverPath(BString &string)
{
// TODO: hardcoded to vesa for now. Fix me
string = "graphics/vesa";
// TODO: this currently assumes that the accelerant's clone info
// is always the path name of its driver (that's the case for
// all of our drivers)
char path[B_PATH_NAME_LENGTH];
get_accelerant_clone_info getCloneInfo;
getCloneInfo = (get_accelerant_clone_info)fAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL);
if (getCloneInfo == NULL)
return B_NOT_SUPPORTED;
getCloneInfo((void *)path);
string.SetTo(path);
return B_OK;
}