diff options
| author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-01-31 23:35:06 +0000 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-01-31 23:35:06 +0000 | 
| commit | 6ad1c1c257c74c82179a0eb62277ceef1cc4e9e0 (patch) | |
| tree | 73a0657cad8a96c0d0611ec900b95adc4a264be0 /hardinfo2/arch/linux | |
| parent | e9906f6d9335ae96cd6afac714646b97edc469a5 (diff) | |
Sync with internal subversion
Diffstat (limited to 'hardinfo2/arch/linux')
79 files changed, 505 insertions, 9 deletions
| diff --git a/hardinfo2/arch/linux/common/net.h b/hardinfo2/arch/linux/common/net.h index d0738ce5..87e7e59b 100644 --- a/hardinfo2/arch/linux/common/net.h +++ b/hardinfo2/arch/linux/common/net.h @@ -42,7 +42,6 @@ void get_net_info(char *if_name, NetInfo *netinfo)      strcpy(ifr.ifr_name, if_name);      strcpy(netinfo->name, if_name); -    strcpy(ifr.ifr_name, if_name);      if (ioctl(fd, SIOCGIFMTU, &ifr) < 0) {          netinfo->mtu = 0;      } else { diff --git a/hardinfo2/arch/linux/common/os.h b/hardinfo2/arch/linux/common/os.h index c8204e92..0f7b59e3 100644 --- a/hardinfo2/arch/linux/common/os.h +++ b/hardinfo2/arch/linux/common/os.h @@ -58,6 +58,9 @@ get_os_compiled_date(void)      return g_strdup(buf);  } + +#include <gdk/gdkx.h> +  void  detect_desktop_environment(OperatingSystem * os)  { @@ -66,14 +69,15 @@ detect_desktop_environment(OperatingSystem * os)      int maj, min;      if (tmp) { -	/* FIXME: this might not be true, as the gnome-panel in path may not be the one that's running. -	   see where the user's running panel is and run *that* to obtain the version. - -	   the same applies do kcontrol --version. */ +	/* FIXME: this might not be true, as the gnome-panel in path +	   may not be the one that's running. +	   see where the user's running panel is and run *that* to +	   obtain the version. */  	version = popen("gnome-panel --version", "r");  	if (version) {  	    fscanf(version, "Gnome gnome-panel %d.%d", &maj, &min); -	    if (pclose(version)) goto unknown; +	    if (pclose(version)) +	        goto unknown;  	} else {  	    goto unknown;  	} @@ -89,7 +93,8 @@ detect_desktop_environment(OperatingSystem * os)  	    fgets(buf, 32, version);  	    fscanf(version, "KDE: %d.%d", &maj, &min); -	    if (pclose(version)) goto unknown; +	    if (pclose(version)) +	        goto unknown;  	} else {  	    goto unknown;  	} @@ -100,7 +105,19 @@ detect_desktop_environment(OperatingSystem * os)  	if (!g_getenv("DISPLAY")) {  	    os->desktop = g_strdup("Terminal");  	} else { -	    os->desktop = g_strdup("Unknown"); +            const gchar *windowman; +            GdkScreen *screen = gdk_screen_get_default(); + +            windowman = gdk_x11_screen_get_window_manager_name(screen); +             +            if (g_str_equal(windowman, "Xfwm4")) { +                /* FIXME: check if xprop -root | grep XFCE_DESKTOP_WINDOW +                   is defined */ +                os->desktop = g_strdup("XFCE 4"); +            } else { +  	        os->desktop = g_strdup_printf("Unknown (Window Manager: %s)", +  	                                      windowman); +            }  	}      }  } diff --git a/hardinfo2/arch/linux/common/pci.h b/hardinfo2/arch/linux/common/pci.h index 8f3216e2..f8c9d319 100644 --- a/hardinfo2/arch/linux/common/pci.h +++ b/hardinfo2/arch/linux/common/pci.h @@ -84,7 +84,8 @@ scan_pci(void)  	    strdevice =  		g_strdup_printf("%sOEM Vendor=%s\n", strdevice, buf);  	} else if (!strncmp(buf, "Capabilities", 12) -		   && !strstr(buf, "only to root")) { +		   && !strstr(buf, "only to root") &&  +		      !strstr(buf, "access denied")) {  	    WALK_UNTIL(' ');  	    WALK_UNTIL(']');  	    buf++; diff --git a/hardinfo2/arch/linux/m68k/alsa.h b/hardinfo2/arch/linux/m68k/alsa.h new file mode 120000 index 00000000..0216845a --- /dev/null +++ b/hardinfo2/arch/linux/m68k/alsa.h @@ -0,0 +1 @@ +../../linux/common/alsa.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/filesystem.h b/hardinfo2/arch/linux/m68k/filesystem.h new file mode 120000 index 00000000..6b325b40 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/filesystem.h @@ -0,0 +1 @@ +../../linux/common/filesystem.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/inputdevices.h b/hardinfo2/arch/linux/m68k/inputdevices.h new file mode 120000 index 00000000..b9226a29 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/inputdevices.h @@ -0,0 +1 @@ +../../linux/common/inputdevices.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/loadavg.h b/hardinfo2/arch/linux/m68k/loadavg.h new file mode 120000 index 00000000..daaed6d5 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/loadavg.h @@ -0,0 +1 @@ +../../linux/common/loadavg.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/memory.h b/hardinfo2/arch/linux/m68k/memory.h new file mode 120000 index 00000000..5ffc013e --- /dev/null +++ b/hardinfo2/arch/linux/m68k/memory.h @@ -0,0 +1 @@ +../../linux/common/memory.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/modules.h b/hardinfo2/arch/linux/m68k/modules.h new file mode 120000 index 00000000..8ce5a808 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/modules.h @@ -0,0 +1 @@ +../../linux/common/modules.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/net.h b/hardinfo2/arch/linux/m68k/net.h new file mode 120000 index 00000000..72d77b26 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/net.h @@ -0,0 +1 @@ +../../linux/common/net.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/os.h b/hardinfo2/arch/linux/m68k/os.h new file mode 120000 index 00000000..ef547be5 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/os.h @@ -0,0 +1 @@ +../../linux/common/os.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/pci.h b/hardinfo2/arch/linux/m68k/pci.h new file mode 120000 index 00000000..63760048 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/pci.h @@ -0,0 +1 @@ +../../linux/common/pci.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/processor.h b/hardinfo2/arch/linux/m68k/processor.h new file mode 100644 index 00000000..0a1bab62 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/processor.h @@ -0,0 +1,74 @@ +/* + *    HardInfo - Displays System Information + *    Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * + *    This program is free software; you can redistribute it and/or modify + *    it under the terms of the GNU General Public License as published by + *    the Free Software Foundation, version 2. + * + *    This program is distributed in the hope that it will be useful, + *    but WITHOUT ANY WARRANTY; without even the implied warranty of + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *    GNU General Public License for more details. + * + *    You should have received a copy of the GNU General Public License + *    along with this program; if not, write to the Free Software + *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA + */ + +static Processor * +computer_get_processor(void) +{ +    Processor *processor; +    FILE *cpuinfo; +    gchar buffer[128]; + +    cpuinfo = fopen("/proc/cpuinfo", "r"); +    if (!cpuinfo) +	return NULL; + +    processor = g_new0(Processor, 1); +    while (fgets(buffer, 128, cpuinfo)) { +	gchar **tmp = g_strsplit(buffer, ":", 2); + +	if (tmp[0] && tmp[1]) { +	    tmp[0] = g_strstrip(tmp[0]); +	    tmp[1] = g_strstrip(tmp[1]); + +	    get_str("CPU", processor->model_name); +	    get_float("Clocking", processor->cpu_mhz); +	    get_float("bogomips", processor->bogomips); + +	    get_str("FPU", processor->has_fpu); +	} +	g_strfreev(tmp); +    } +     +    gchar *tmp; +    tmp = g_strconcat("Motorola ", processor->model_name, NULL); +    g_free(processor->model_name); +    processor->model_name = tmp; +     +    fclose(cpuinfo); + +    return processor; +} + +static gchar * +processor_get_info(Processor *processor) +{ +	return g_strdup_printf("[Processor]\n" +	                       "Name=%s\n" +			       "Frequency=%.2fMHz\n" +			       "BogoMips=%.2f\n" +			       "Byte Order=%s\n", +			       processor->model_name, +			       processor->cpu_mhz, +			       processor->bogomips, +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +                               "Little Endian" +#else +                               "Big Endian" +#endif +                               ); +} diff --git a/hardinfo2/arch/linux/m68k/samba.h b/hardinfo2/arch/linux/m68k/samba.h new file mode 120000 index 00000000..9227f722 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/samba.h @@ -0,0 +1 @@ +../../linux/common/samba.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/sensors.h b/hardinfo2/arch/linux/m68k/sensors.h new file mode 120000 index 00000000..35e5f37a --- /dev/null +++ b/hardinfo2/arch/linux/m68k/sensors.h @@ -0,0 +1 @@ +../../linux/common/sensors.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/storage.h b/hardinfo2/arch/linux/m68k/storage.h new file mode 120000 index 00000000..55b68de3 --- /dev/null +++ b/hardinfo2/arch/linux/m68k/storage.h @@ -0,0 +1 @@ +../../linux/common/storage.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/uptime.h b/hardinfo2/arch/linux/m68k/uptime.h new file mode 120000 index 00000000..78c026ff --- /dev/null +++ b/hardinfo2/arch/linux/m68k/uptime.h @@ -0,0 +1 @@ +../../linux/common/uptime.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/m68k/usb.h b/hardinfo2/arch/linux/m68k/usb.h new file mode 120000 index 00000000..8b8fbb5d --- /dev/null +++ b/hardinfo2/arch/linux/m68k/usb.h @@ -0,0 +1 @@ +../../linux/common/usb.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/alsa.h b/hardinfo2/arch/linux/mips/alsa.h new file mode 120000 index 00000000..0216845a --- /dev/null +++ b/hardinfo2/arch/linux/mips/alsa.h @@ -0,0 +1 @@ +../../linux/common/alsa.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/filesystem.h b/hardinfo2/arch/linux/mips/filesystem.h new file mode 120000 index 00000000..6b325b40 --- /dev/null +++ b/hardinfo2/arch/linux/mips/filesystem.h @@ -0,0 +1 @@ +../../linux/common/filesystem.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/inputdevices.h b/hardinfo2/arch/linux/mips/inputdevices.h new file mode 120000 index 00000000..b9226a29 --- /dev/null +++ b/hardinfo2/arch/linux/mips/inputdevices.h @@ -0,0 +1 @@ +../../linux/common/inputdevices.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/loadavg.h b/hardinfo2/arch/linux/mips/loadavg.h new file mode 120000 index 00000000..daaed6d5 --- /dev/null +++ b/hardinfo2/arch/linux/mips/loadavg.h @@ -0,0 +1 @@ +../../linux/common/loadavg.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/memory.h b/hardinfo2/arch/linux/mips/memory.h new file mode 120000 index 00000000..5ffc013e --- /dev/null +++ b/hardinfo2/arch/linux/mips/memory.h @@ -0,0 +1 @@ +../../linux/common/memory.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/modules.h b/hardinfo2/arch/linux/mips/modules.h new file mode 120000 index 00000000..8ce5a808 --- /dev/null +++ b/hardinfo2/arch/linux/mips/modules.h @@ -0,0 +1 @@ +../../linux/common/modules.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/net.h b/hardinfo2/arch/linux/mips/net.h new file mode 120000 index 00000000..72d77b26 --- /dev/null +++ b/hardinfo2/arch/linux/mips/net.h @@ -0,0 +1 @@ +../../linux/common/net.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/os.h b/hardinfo2/arch/linux/mips/os.h new file mode 120000 index 00000000..ef547be5 --- /dev/null +++ b/hardinfo2/arch/linux/mips/os.h @@ -0,0 +1 @@ +../../linux/common/os.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/pci.h b/hardinfo2/arch/linux/mips/pci.h new file mode 120000 index 00000000..63760048 --- /dev/null +++ b/hardinfo2/arch/linux/mips/pci.h @@ -0,0 +1 @@ +../../linux/common/pci.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/processor.h b/hardinfo2/arch/linux/mips/processor.h new file mode 100644 index 00000000..8be922f9 --- /dev/null +++ b/hardinfo2/arch/linux/mips/processor.h @@ -0,0 +1,70 @@ +/* + *    HardInfo - Displays System Information + *    Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * + *    This program is free software; you can redistribute it and/or modify + *    it under the terms of the GNU General Public License as published by + *    the Free Software Foundation, version 2. + * + *    This program is distributed in the hope that it will be useful, + *    but WITHOUT ANY WARRANTY; without even the implied warranty of + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *    GNU General Public License for more details. + * + *    You should have received a copy of the GNU General Public License + *    along with this program; if not, write to the Free Software + *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA + */ + +static Processor * +computer_get_processor(void) +{ +    Processor *processor; +    FILE *cpuinfo; +    gchar buffer[128]; + +    cpuinfo = fopen("/proc/cpuinfo", "r"); +    if (!cpuinfo) +	return NULL; + +    processor = g_new0(Processor, 1); +    while (fgets(buffer, 128, cpuinfo)) { +	gchar **tmp = g_strsplit(buffer, ":", 2); + +	if (tmp[0] && tmp[1]) { +	    tmp[0] = g_strstrip(tmp[0]); +	    tmp[1] = g_strstrip(tmp[1]); + +	    get_str("system type", processor->model_name); +	    get_str("cpu model", processor->vendor_id); +	    get_float("cpu MHz", processor->cpu_mhz); +	    get_float("BogoMIPS", processor->bogomips); +	} +	g_strfreev(tmp); +    } + +    fclose(cpuinfo); + +    return processor; +} + +static gchar * +processor_get_info(Processor *processor) +{ +	return g_strdup_printf("[Processor]\n" +	                       "System Type=%s\n" +	                       "CPU Model=%s\n" +                               "Frequency=%.2fMHz\n" +			       "BogoMIPS=%.2f\n" +			       "Byte Order=%s\n", +			       processor->model_name, +			       processor->vendor_id, +			       processor->cpu_mhz, +			       processor->bogomips, +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +                               "Little Endian" +#else +                               "Big Endian" +#endif +			       ); +} diff --git a/hardinfo2/arch/linux/mips/samba.h b/hardinfo2/arch/linux/mips/samba.h new file mode 120000 index 00000000..9227f722 --- /dev/null +++ b/hardinfo2/arch/linux/mips/samba.h @@ -0,0 +1 @@ +../../linux/common/samba.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/sensors.h b/hardinfo2/arch/linux/mips/sensors.h new file mode 120000 index 00000000..35e5f37a --- /dev/null +++ b/hardinfo2/arch/linux/mips/sensors.h @@ -0,0 +1 @@ +../../linux/common/sensors.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/storage.h b/hardinfo2/arch/linux/mips/storage.h new file mode 120000 index 00000000..55b68de3 --- /dev/null +++ b/hardinfo2/arch/linux/mips/storage.h @@ -0,0 +1 @@ +../../linux/common/storage.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/uptime.h b/hardinfo2/arch/linux/mips/uptime.h new file mode 120000 index 00000000..78c026ff --- /dev/null +++ b/hardinfo2/arch/linux/mips/uptime.h @@ -0,0 +1 @@ +../../linux/common/uptime.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/mips/usb.h b/hardinfo2/arch/linux/mips/usb.h new file mode 120000 index 00000000..8b8fbb5d --- /dev/null +++ b/hardinfo2/arch/linux/mips/usb.h @@ -0,0 +1 @@ +../../linux/common/usb.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/alsa.h b/hardinfo2/arch/linux/parisc/alsa.h new file mode 120000 index 00000000..0216845a --- /dev/null +++ b/hardinfo2/arch/linux/parisc/alsa.h @@ -0,0 +1 @@ +../../linux/common/alsa.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/filesystem.h b/hardinfo2/arch/linux/parisc/filesystem.h new file mode 120000 index 00000000..6b325b40 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/filesystem.h @@ -0,0 +1 @@ +../../linux/common/filesystem.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/inputdevices.h b/hardinfo2/arch/linux/parisc/inputdevices.h new file mode 120000 index 00000000..b9226a29 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/inputdevices.h @@ -0,0 +1 @@ +../../linux/common/inputdevices.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/loadavg.h b/hardinfo2/arch/linux/parisc/loadavg.h new file mode 120000 index 00000000..daaed6d5 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/loadavg.h @@ -0,0 +1 @@ +../../linux/common/loadavg.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/memory.h b/hardinfo2/arch/linux/parisc/memory.h new file mode 120000 index 00000000..5ffc013e --- /dev/null +++ b/hardinfo2/arch/linux/parisc/memory.h @@ -0,0 +1 @@ +../../linux/common/memory.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/modules.h b/hardinfo2/arch/linux/parisc/modules.h new file mode 120000 index 00000000..8ce5a808 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/modules.h @@ -0,0 +1 @@ +../../linux/common/modules.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/net.h b/hardinfo2/arch/linux/parisc/net.h new file mode 120000 index 00000000..72d77b26 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/net.h @@ -0,0 +1 @@ +../../linux/common/net.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/os.h b/hardinfo2/arch/linux/parisc/os.h new file mode 120000 index 00000000..ef547be5 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/os.h @@ -0,0 +1 @@ +../../linux/common/os.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/pci.h b/hardinfo2/arch/linux/parisc/pci.h new file mode 120000 index 00000000..63760048 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/pci.h @@ -0,0 +1 @@ +../../linux/common/pci.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/processor.h b/hardinfo2/arch/linux/parisc/processor.h new file mode 100644 index 00000000..41b628f4 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/processor.h @@ -0,0 +1,82 @@ +/* + *    HardInfo - Displays System Information + *    Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * + *    This program is free software; you can redistribute it and/or modify + *    it under the terms of the GNU General Public License as published by + *    the Free Software Foundation, version 2. + * + *    This program is distributed in the hope that it will be useful, + *    but WITHOUT ANY WARRANTY; without even the implied warranty of + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *    GNU General Public License for more details. + * + *    You should have received a copy of the GNU General Public License + *    along with this program; if not, write to the Free Software + *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA + */ + +static Processor * +computer_get_processor(void) +{ +    Processor *processor; +    FILE *cpuinfo; +    gchar buffer[128]; + +    cpuinfo = fopen("/proc/cpuinfo", "r"); +    if (!cpuinfo) +	return NULL; + +    processor = g_new0(Processor, 1); +    while (fgets(buffer, 128, cpuinfo)) { +	gchar **tmp = g_strsplit(buffer, ":", 2); + +	if (tmp[0] && tmp[1]) { +	    tmp[0] = g_strstrip(tmp[0]); +	    tmp[1] = g_strstrip(tmp[1]); + +	    get_str("cpu family", processor->model_name); +	    get_str("cpu", processor->vendor_id); +	    get_float("cpu MHz", processor->cpu_mhz); +	    get_float("bogomips", processor->bogomips); +	     +	    get_str("model name", processor->strmodel); +	     +	    get_int("I-cache", processor->has_fpu); +	    get_int("D-cache", processor->flags); + +	} +	g_strfreev(tmp); +    } + +    fclose(cpuinfo); + +    return processor; +} + +static gchar * +processor_get_info(Processor *processor) +{ +	return  g_strdup_printf("[Processor]\n" +	                       "CPU Family=%s\n" +	                       "CPU=%s\n" +                               "Frequency=%.2fMHz\n" +			       "Bogomips=%.2f\n" +			       "Model Name=%s\n" +			       "Byte Order=%s\n" +			       "[Cache]\n" +			       "I-Cache=%s\n" +			       "D-Cache=%s\n", +			       processor->model_name, +			       processor->vendor_id, +			       processor->cpu_mhz, +			       processor->bogomips, +			       processor->strmodel, +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +                               "Little Endian", +#else +                               "Big Endian", +#endif +			       processor->has_fpu, +			       processor->flags); +} diff --git a/hardinfo2/arch/linux/parisc/samba.h b/hardinfo2/arch/linux/parisc/samba.h new file mode 120000 index 00000000..9227f722 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/samba.h @@ -0,0 +1 @@ +../../linux/common/samba.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/sensors.h b/hardinfo2/arch/linux/parisc/sensors.h new file mode 120000 index 00000000..35e5f37a --- /dev/null +++ b/hardinfo2/arch/linux/parisc/sensors.h @@ -0,0 +1 @@ +../../linux/common/sensors.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/storage.h b/hardinfo2/arch/linux/parisc/storage.h new file mode 120000 index 00000000..55b68de3 --- /dev/null +++ b/hardinfo2/arch/linux/parisc/storage.h @@ -0,0 +1 @@ +../../linux/common/storage.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/uptime.h b/hardinfo2/arch/linux/parisc/uptime.h new file mode 120000 index 00000000..78c026ff --- /dev/null +++ b/hardinfo2/arch/linux/parisc/uptime.h @@ -0,0 +1 @@ +../../linux/common/uptime.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/parisc/usb.h b/hardinfo2/arch/linux/parisc/usb.h new file mode 120000 index 00000000..8b8fbb5d --- /dev/null +++ b/hardinfo2/arch/linux/parisc/usb.h @@ -0,0 +1 @@ +../../linux/common/usb.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/alsa.h b/hardinfo2/arch/linux/ppc/alsa.h new file mode 120000 index 00000000..0216845a --- /dev/null +++ b/hardinfo2/arch/linux/ppc/alsa.h @@ -0,0 +1 @@ +../../linux/common/alsa.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/filesystem.h b/hardinfo2/arch/linux/ppc/filesystem.h new file mode 120000 index 00000000..6b325b40 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/filesystem.h @@ -0,0 +1 @@ +../../linux/common/filesystem.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/inputdevices.h b/hardinfo2/arch/linux/ppc/inputdevices.h new file mode 120000 index 00000000..b9226a29 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/inputdevices.h @@ -0,0 +1 @@ +../../linux/common/inputdevices.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/loadavg.h b/hardinfo2/arch/linux/ppc/loadavg.h new file mode 120000 index 00000000..daaed6d5 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/loadavg.h @@ -0,0 +1 @@ +../../linux/common/loadavg.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/memory.h b/hardinfo2/arch/linux/ppc/memory.h new file mode 120000 index 00000000..5ffc013e --- /dev/null +++ b/hardinfo2/arch/linux/ppc/memory.h @@ -0,0 +1 @@ +../../linux/common/memory.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/modules.h b/hardinfo2/arch/linux/ppc/modules.h new file mode 120000 index 00000000..8ce5a808 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/modules.h @@ -0,0 +1 @@ +../../linux/common/modules.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/net.h b/hardinfo2/arch/linux/ppc/net.h new file mode 120000 index 00000000..72d77b26 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/net.h @@ -0,0 +1 @@ +../../linux/common/net.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/os.h b/hardinfo2/arch/linux/ppc/os.h new file mode 120000 index 00000000..ef547be5 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/os.h @@ -0,0 +1 @@ +../../linux/common/os.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/pci.h b/hardinfo2/arch/linux/ppc/pci.h new file mode 120000 index 00000000..63760048 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/pci.h @@ -0,0 +1 @@ +../../linux/common/pci.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/processor.h b/hardinfo2/arch/linux/ppc/processor.h new file mode 100644 index 00000000..f4ff5b0e --- /dev/null +++ b/hardinfo2/arch/linux/ppc/processor.h @@ -0,0 +1,78 @@ +/* + *    HardInfo - Displays System Information + *    Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * + *    This program is free software; you can redistribute it and/or modify + *    it under the terms of the GNU General Public License as published by + *    the Free Software Foundation, version 2. + * + *    This program is distributed in the hope that it will be useful, + *    but WITHOUT ANY WARRANTY; without even the implied warranty of + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *    GNU General Public License for more details. + * + *    You should have received a copy of the GNU General Public License + *    along with this program; if not, write to the Free Software + *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA + */ + +static Processor * +computer_get_processor(void) +{ +    Processor *processor; +    FILE *cpuinfo; +    gchar buffer[128]; + +    cpuinfo = fopen("/proc/cpuinfo", "r"); +    if (!cpuinfo) +	return NULL; + +    processor = g_new0(Processor, 1); +    while (fgets(buffer, 128, cpuinfo)) { +	gchar **tmp = g_strsplit(buffer, ":", 2); + +	if (tmp[0] && tmp[1]) { +	    tmp[0] = g_strstrip(tmp[0]); +	    tmp[1] = g_strstrip(tmp[1]); + +	    get_str("cpu", processor->model_name); +	    get_str("machine", processor->vendor_id); +	    get_int("L2 cache", processor->cache_size); +	    get_float("clock", processor->cpu_mhz); +	    get_float("bogomips", processor->bogomips); + +	} +	g_strfreev(tmp); +    } +     +    gchar *tmp = g_strconcat("PowerPC ", processor->model_name, NULL); +    g_free(processor->model_name); +    processor->model_name = tmp; + +    fclose(cpuinfo); + +    return processor; +} + +static gchar * +processor_get_info(Processor *processor) +{ +	return g_strdup_printf("[Processor]\n" +	                       "Machine=%s\n" +	                       "CPU=%s\n" +	                       "L2 Cache=%.2f\n" +	                       "Frequency=%.2fMHz\n" +	                       "BogoMips=%.2f" +	                       "Byte Order=%s\n", +			       processor->vendor_id, +			       processor->model_name, +			       processor->cache_size, +			       processor->cpu_mhz, +			       processor->bogomips, +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +                               "Little Endian" +#else +                               "Big Endian" +#endif +                              ); +} diff --git a/hardinfo2/arch/linux/ppc/samba.h b/hardinfo2/arch/linux/ppc/samba.h new file mode 120000 index 00000000..9227f722 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/samba.h @@ -0,0 +1 @@ +../../linux/common/samba.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/sensors.h b/hardinfo2/arch/linux/ppc/sensors.h new file mode 120000 index 00000000..35e5f37a --- /dev/null +++ b/hardinfo2/arch/linux/ppc/sensors.h @@ -0,0 +1 @@ +../../linux/common/sensors.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/storage.h b/hardinfo2/arch/linux/ppc/storage.h new file mode 120000 index 00000000..55b68de3 --- /dev/null +++ b/hardinfo2/arch/linux/ppc/storage.h @@ -0,0 +1 @@ +../../linux/common/storage.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/uptime.h b/hardinfo2/arch/linux/ppc/uptime.h new file mode 120000 index 00000000..78c026ff --- /dev/null +++ b/hardinfo2/arch/linux/ppc/uptime.h @@ -0,0 +1 @@ +../../linux/common/uptime.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/ppc/usb.h b/hardinfo2/arch/linux/ppc/usb.h new file mode 120000 index 00000000..8b8fbb5d --- /dev/null +++ b/hardinfo2/arch/linux/ppc/usb.h @@ -0,0 +1 @@ +../../linux/common/usb.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/alsa.h b/hardinfo2/arch/linux/sparc/alsa.h new file mode 120000 index 00000000..0216845a --- /dev/null +++ b/hardinfo2/arch/linux/sparc/alsa.h @@ -0,0 +1 @@ +../../linux/common/alsa.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/filesystem.h b/hardinfo2/arch/linux/sparc/filesystem.h new file mode 120000 index 00000000..6b325b40 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/filesystem.h @@ -0,0 +1 @@ +../../linux/common/filesystem.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/inputdevices.h b/hardinfo2/arch/linux/sparc/inputdevices.h new file mode 120000 index 00000000..b9226a29 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/inputdevices.h @@ -0,0 +1 @@ +../../linux/common/inputdevices.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/loadavg.h b/hardinfo2/arch/linux/sparc/loadavg.h new file mode 120000 index 00000000..daaed6d5 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/loadavg.h @@ -0,0 +1 @@ +../../linux/common/loadavg.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/memory.h b/hardinfo2/arch/linux/sparc/memory.h new file mode 120000 index 00000000..5ffc013e --- /dev/null +++ b/hardinfo2/arch/linux/sparc/memory.h @@ -0,0 +1 @@ +../../linux/common/memory.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/modules.h b/hardinfo2/arch/linux/sparc/modules.h new file mode 120000 index 00000000..8ce5a808 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/modules.h @@ -0,0 +1 @@ +../../linux/common/modules.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/net.h b/hardinfo2/arch/linux/sparc/net.h new file mode 120000 index 00000000..72d77b26 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/net.h @@ -0,0 +1 @@ +../../linux/common/net.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/os.h b/hardinfo2/arch/linux/sparc/os.h new file mode 120000 index 00000000..ef547be5 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/os.h @@ -0,0 +1 @@ +../../linux/common/os.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/pci.h b/hardinfo2/arch/linux/sparc/pci.h new file mode 120000 index 00000000..63760048 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/pci.h @@ -0,0 +1 @@ +../../linux/common/pci.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/processor.h b/hardinfo2/arch/linux/sparc/processor.h new file mode 100644 index 00000000..211ea56b --- /dev/null +++ b/hardinfo2/arch/linux/sparc/processor.h @@ -0,0 +1,59 @@ +/* + *    HardInfo - Displays System Information + *    Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * + *    This program is free software; you can redistribute it and/or modify + *    it under the terms of the GNU General Public License as published by + *    the Free Software Foundation, version 2. + * + *    This program is distributed in the hope that it will be useful, + *    but WITHOUT ANY WARRANTY; without even the implied warranty of + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *    GNU General Public License for more details. + * + *    You should have received a copy of the GNU General Public License + *    along with this program; if not, write to the Free Software + *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA + */ + +static Processor * +computer_get_processor(void) +{ +    Processor *processor; +    FILE *cpuinfo; +    gchar buffer[128]; + +    cpuinfo = fopen("/proc/cpuinfo", "r"); +    if (!cpuinfo) +	return NULL; + +    processor = g_new0(Processor, 1); +    while (fgets(buffer, 128, cpuinfo)) { +	gchar **tmp = g_strsplit(buffer, ":", 2); + +	if (tmp[0] && tmp[1]) { +	    tmp[0] = g_strstrip(tmp[0]); +	    tmp[1] = g_strstrip(tmp[1]); + +	    get_str("cpu", processor->model_name); +	    get_str("fpu", processor->has_fpu); +	} +	g_strfreev(tmp); +    } + +    get_processor_strfamily(processor); + +    fclose(cpuinfo); + +    return processor; +} + +static gchar * +processor_get_info(Processor *processor) +{ +	return g_strdup_printf("[Processor]\n" +	                       "CPU=%s\n" +	                       "FPU=%s\n", +			       processor->model_name, +			       processor->has_fpu); +} diff --git a/hardinfo2/arch/linux/sparc/samba.h b/hardinfo2/arch/linux/sparc/samba.h new file mode 120000 index 00000000..9227f722 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/samba.h @@ -0,0 +1 @@ +../../linux/common/samba.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/sensors.h b/hardinfo2/arch/linux/sparc/sensors.h new file mode 120000 index 00000000..35e5f37a --- /dev/null +++ b/hardinfo2/arch/linux/sparc/sensors.h @@ -0,0 +1 @@ +../../linux/common/sensors.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/storage.h b/hardinfo2/arch/linux/sparc/storage.h new file mode 120000 index 00000000..55b68de3 --- /dev/null +++ b/hardinfo2/arch/linux/sparc/storage.h @@ -0,0 +1 @@ +../../linux/common/storage.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/uptime.h b/hardinfo2/arch/linux/sparc/uptime.h new file mode 120000 index 00000000..78c026ff --- /dev/null +++ b/hardinfo2/arch/linux/sparc/uptime.h @@ -0,0 +1 @@ +../../linux/common/uptime.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/sparc/usb.h b/hardinfo2/arch/linux/sparc/usb.h new file mode 120000 index 00000000..8b8fbb5d --- /dev/null +++ b/hardinfo2/arch/linux/sparc/usb.h @@ -0,0 +1 @@ +../../linux/common/usb.h
\ No newline at end of file diff --git a/hardinfo2/arch/linux/x86/processor.h b/hardinfo2/arch/linux/x86/processor.h index 395b6aa3..571943f6 100644 --- a/hardinfo2/arch/linux/x86/processor.h +++ b/hardinfo2/arch/linux/x86/processor.h @@ -224,6 +224,7 @@ static struct {      { "dts",		"Debug Store" },      { "ss",		"Self Snoop" },      { "tm",		"Thermal Monitor" }, +    { "pbe",		"Pending Break Enable" },      { "pb",		"Pending Break Enable" },      { NULL, NULL}  }; @@ -255,3 +256,48 @@ processor_get_capabilities_from_flags(gchar * strflags)      g_strfreev(old);      return tmp;  } + +static gchar * +processor_get_info(Processor *processor) +{ +	gchar *tmp = processor_get_capabilities_from_flags(processor-> +						  flags); +	gchar *ret = g_strdup_printf("[Processor]\n" +	                       "Name=%s\n" +	                       "Specification=%s\n" +                               "Family, model, stepping=%d, %d, %d\n" +			       "Vendor=%s\n" +			       "Cache Size=%dkb\n" +			       "Frequency=%.2fMHz\n" +			       "BogoMips=%.2f\n" +			       "Byte Order=%s\n" +			       "[Features]\n" +			       "FDIV Bug=%s\n" +			       "HLT Bug=%s\n" +			       "F00F Bug=%s\n" +			       "Coma Bug=%s\n" +			       "Has FPU=%s\n" +			       "[Capabilities]\n" "%s", +			       processor->strmodel, +			       processor->model_name, +			       processor->family, +			       processor->model, +			       processor->stepping, +			       processor->vendor_id, +			       processor->cache_size, +			       processor->cpu_mhz, +			       processor->bogomips, +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +                               "Little Endian", +#else +                               "Big Endian", +#endif +			       processor->bug_fdiv, +			       processor->bug_hlt, +			       processor->bug_f00f, +			       processor->bug_coma, +			       processor->has_fpu, +			       tmp); +      g_free(tmp); +      return ret; +} | 
