summary refs log tree commit diff stats
AgeCommit message (Expand)Author
2015-10-16build: Let 'make dist' do a better jobRico Tzschichholz
2015-10-12win32: Fix installertomek
2015-10-12common: Moved some functions over from plugins/sysinfo that are useful for th...Arnavion
2015-10-11win32: Update Visual Studio 2015 redist links in installertomek
2015-10-11win32: Add Windows 10 ID to manifesttomek
2015-10-11readme.md: Update jenkins linkstomek
2015-10-10Use VS 2015Arnavion
2015-10-10fe-gtk: Use manual registration for resources.Arnavion
2015-10-09Update logo .ico with new shadow and standard sizesobskyr
2015-10-09Update logo SVG to smaller, solid shadowobskyr
2015-10-05win32: Don't rely on CWD for portable-mode checkPatrick Griffis
2015-09-30configure: Clean up Python checkingPatrick Griffis
2015-09-21Merge pull request #1162 from obskyr/masterTingPing
2015-09-14Don't use SASL on an unknown networkPatrick Griffis
2015-09-11TLS: Set SNI hostname before connectmoparisthebest
2015-09-05Removed SeionIRC from the serverlistLee Watson
2015-09-03Improve /mode behaviorTingPing
2015-08-20Fix select regression.RichardHitt
2015-08-02Fix crash in DBus pluginasarium
2015-06-04Fix possible overflowTingPing
2015-05-28Fix warningTingPing
2015-05-27Fix mnemonic collisionTingPing
2015-05-18xtext: Fix poor performance with nick indent enabledRichardHitt
2015-05-08Update alternative font listtomek
2015-04-25Fixed pango attributes not being applied in some cases.Arnavion
2015-04-24Disable pango attributes on sexy entry while it contains preedit text.Arnavion
2015-04-23Remove unused fileTingPing
2015-04-22travis: But it needs intltoolTingPing
2015-04-22travis: No longer need gnome-commonTingPing
2015-04-22travis: No longer need to run ./configureTingPing
2015-04-22configure: Simplify perl testsTingPing
2015-04-22configure: Better handling of missing pkgconfigTingPing
2015-04-22configure: Consistently use autoconf macros for conditionalsTingPing
2015-04-21configure: Target versions of Ubuntu 10.04TingPing
2015-04-21configure: Replace --enable-minimial-flags with standard --disable-debugTingPing
2015-04-21configure: Some modernizationTingPing
2015-04-21Remove requirement on gnome-commonTingPing
2015-04-21Remove r from mode buttonsTingPing
2015-04-21Fix mode button text being cut offTingPing
2015-04-14winamp: More code cleanupTingPing
2015-04-14winamp: Fix project fileTingPing
2015-04-13winamp: Clean up formattingTingPing
2015-04-13winamp: Fix utf8 song titlesTingPing
2015-04-07Fix possible overflow in pluginprefTingPing
2015-04-05Improve /AWAY help messageTingPing
2015-04-04Fix some text event descriptionsTingPing
2015-03-20sysinfo: Strip trailing space on video cardTingPing
2015-03-20Fix typoTingPing
2015-03-20Remove unused filesTingPing
2015-03-20Fix conflicting type in headerTingPing
/span> #include <pci/pci.h> #include "xsys.h" static struct pci_filter filter; /* Device filter */ static struct pci_access *pacc; int bus, dev, func; /* Location of the card */ struct device { struct device *next; struct pci_dev *dev; unsigned int config_cnt; u8 config[256]; }; static struct device *first_dev; static struct device *scan_device(struct pci_dev *p) { int how_much = 64; struct device *d; if (!pci_filter_match(&filter, p)) return NULL; d = malloc(sizeof(struct device)); bzero(d, sizeof(*d)); d->dev = p; if (!pci_read_block(p, 0, d->config, how_much)) exit(1); 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); how_much = 128; } d->config_cnt = how_much; pci_setup_cache(p, d->config, d->config_cnt); pci_fill_info(p, PCI_FILL_IDENT); return d; } static void scan_devices(void) { struct device *d; struct pci_dev *p; pci_scan_bus(pacc); for(p=pacc->devices; p; p=p->next) if ((d = scan_device(p))) { d->next = first_dev; first_dev = d; } } static u16 get_conf_word(struct device *d, unsigned int pos) { return d->config[pos] | (d->config[pos+1] << 8); } int pci_find_by_class(u16 *class, char *vendor, char *device) { struct device *d; struct pci_dev *p; int nomatch = 1; pacc = pci_alloc(); pci_filter_init(pacc, &filter); pci_init(pacc); scan_devices(); for(d=first_dev; d; d=d->next) { p = d->dev; /* Acquire vendor & device ID if the class matches */ if(get_conf_word(d, PCI_CLASS_DEVICE) == *class) { nomatch = 0; snprintf(vendor,7,"%04x",p->vendor_id); snprintf(device,7,"%04x",p->device_id); break; } } pci_cleanup(pacc); return nomatch; } void pci_find_fullname(char *fullname, char *vendor, char *device) { char buffer[bsize]; char vendorname[bsize/2] = ""; char devicename[bsize/2] = ""; char *position; int cardfound = 0; sysinfo_get_pciids (buffer); FILE *fp = fopen (buffer, "r"); if(fp == NULL) { snprintf(fullname, bsize, "%s:%s", vendor, device); sysinfo_print_error ("pci.ids file not found! You might want to adjust your pciids setting with /SYSINFO SET pciids (you can query its current value with /SYSINFO LIST).\n"); return; } while(fgets(buffer, bsize, fp) != NULL) { if (!isspace(buffer[0]) && strstr(buffer, vendor) != NULL) { position = strstr(buffer, vendor); position += 6; strncpy(vendorname, position, bsize/2); position = strstr(vendorname, "\n"); *(position) = '\0'; break; } } while(fgets(buffer, bsize, fp) != NULL) { if(strstr(buffer, device) != NULL) { position = strstr(buffer, device); position += 6; strncpy(devicename, position, bsize/2); position = strstr(devicename, " ("); if (position == NULL) position = strstr(devicename, "\n"); *(position) = '\0'; cardfound = 1; break; } } if (cardfound == 1) snprintf(fullname, bsize, "%s %s", vendorname, devicename); else snprintf(fullname, bsize, "%s:%s", vendor, device); fclose(fp); }