mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-12-05 06:22:18 +00:00
improve hardware probes+ legacy cleanup
This commit is contained in:
2 files changed
+36
-18
No files matched your search
@@ -51,12 +51,18 @@ static struct device *scan_device(struct pci_dev *p)
|
||||
d = g_new0 (struct device, 1);
|
||||
d->dev = p;
|
||||
if (!pci_read_block(p, 0, d->config, how_much))
|
||||
exit(1);
|
||||
{
|
||||
g_free (d);
|
||||
return NULL;
|
||||
}
|
||||
if (how_much < 128 && (d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS)
|
||||
{
|
||||
/* For cardbus bridges, we need to fetch 64 bytes more to get the full standard header... */
|
||||
if (!pci_read_block(p, 64, d->config+64, 64))
|
||||
exit(1);
|
||||
{
|
||||
g_free (d);
|
||||
return NULL;
|
||||
}
|
||||
how_much = 128;
|
||||
}
|
||||
d->config_cnt = how_much;
|
||||
@@ -116,6 +122,14 @@ int pci_find_by_class(u16 *class, char *vendor, char *device)
|
||||
}
|
||||
|
||||
pci_cleanup(pacc);
|
||||
pacc = NULL;
|
||||
/* Free the cached configuration buffers after libpci is done with them. */
|
||||
while (first_dev)
|
||||
{
|
||||
d = first_dev;
|
||||
first_dev = d->next;
|
||||
g_free (d);
|
||||
}
|
||||
return nomatch;
|
||||
}
|
||||
|
||||
@@ -142,8 +156,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
|
||||
position = strstr(buffer, vendor);
|
||||
position += 6;
|
||||
g_strlcpy(vendorname, position, sizeof (vendorname));
|
||||
position = strstr(vendorname, "\n");
|
||||
*(position) = '\0';
|
||||
g_strchomp (vendorname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -155,9 +168,9 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
|
||||
position += 6;
|
||||
g_strlcpy(devicename, position, sizeof (devicename));
|
||||
position = strstr(devicename, " (");
|
||||
if (position == NULL)
|
||||
position = strstr(devicename, "\n");
|
||||
*(position) = '\0';
|
||||
if (position)
|
||||
*position = '\0';
|
||||
g_strchomp (devicename);
|
||||
cardfound = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user