File: | cpufreq/src/cpufreq-monitor-factory.c |
Warning: | line 49, column 9 This statement is never executed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* |
2 | * CAFE CPUFreq Applet |
3 | * Copyright (C) 2004 Carlos Garcia Campos <carlosgc@gnome.org> |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public |
16 | * License along with this library; if not, write to the Free |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
18 | * |
19 | * Authors : Carlos García Campos <carlosgc@gnome.org> |
20 | */ |
21 | |
22 | #ifdef HAVE_CONFIG_H1 |
23 | #include "config.h" |
24 | #endif |
25 | |
26 | #include <glib.h> |
27 | #include <glib/gi18n.h> |
28 | |
29 | #include "cpufreq-applet.h" |
30 | #include "cpufreq-utils.h" |
31 | #include "cpufreq-monitor-sysfs.h" |
32 | #include "cpufreq-monitor-procfs.h" |
33 | #include "cpufreq-monitor-cpuinfo.h" |
34 | #ifdef HAVE_LIBCPUFREQ1 |
35 | #include "cpufreq-monitor-libcpufreq.h" |
36 | #endif |
37 | #include "cpufreq-monitor-factory.h" |
38 | |
39 | CPUFreqMonitor * |
40 | cpufreq_monitor_factory_create_monitor (guint cpu) |
41 | { |
42 | CPUFreqMonitor *monitor = NULL((void*)0); |
43 | |
44 | #ifdef HAVE_LIBCPUFREQ1 |
45 | monitor = cpufreq_monitor_libcpufreq_new (cpu); |
46 | return monitor; |
47 | #endif |
48 | |
49 | if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */ |
This statement is never executed | |
50 | monitor = cpufreq_monitor_sysfs_new (cpu); |
51 | } else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.4 kernel (Deprecated)*/ |
52 | monitor = cpufreq_monitor_procfs_new (cpu); |
53 | } else if (g_file_test ("/proc/cpuinfo", G_FILE_TEST_EXISTS)) { |
54 | /* If there is no cpufreq support it shows only the cpu frequency, |
55 | * I think is better than do nothing. I have to notify it to the user, because |
56 | * he could think that cpufreq is supported but it doesn't work succesfully |
57 | */ |
58 | |
59 | cpufreq_utils_display_error (_("CPU frequency scaling unsupported")gettext ("CPU frequency scaling unsupported"), |
60 | _("You will not be able to modify the frequency of your machine. "gettext ("You will not be able to modify the frequency of your machine. " "Your machine may be misconfigured or not have hardware support " "for CPU frequency scaling.") |
61 | "Your machine may be misconfigured or not have hardware support "gettext ("You will not be able to modify the frequency of your machine. " "Your machine may be misconfigured or not have hardware support " "for CPU frequency scaling.") |
62 | "for CPU frequency scaling.")gettext ("You will not be able to modify the frequency of your machine. " "Your machine may be misconfigured or not have hardware support " "for CPU frequency scaling.")); |
63 | |
64 | monitor = cpufreq_monitor_cpuinfo_new (cpu); |
65 | } |
66 | |
67 | return monitor; |
68 | } |
69 |