You are not logged in.
I am using the Awesome window manager (version 3) and CPU frequency scaling. I created a widget that displays the current CPU frequency. In order to update the widget, the following code is called periodically:
io.input("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq")
cpufreq = tonumber(io.read("*all")) / 1000
cpuwidget.text = " " .. cpufreq .. " MHz "
The problem is that by default, root permissions are required to read from the /sys filesystem.
If I run the command
chmod a+r /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
the widget works, but only until the next restart.
Is there a more permanent solution to this problem?
Offline
Your could use /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq or run 'cpufreq-info -f' instead.
Last edited by byte (2008-10-01 22:41:24)
1000
Offline
It would work better if you just ran it like this:
cpufreq=io.popen("cpufreq-info -f"):lines)(){1}
cpuwidget.text = " " .. cpufreq/1000 .. " MHz "
Last edited by kett (2008-10-02 17:32:51)
Offline
Thanks, works great (but without that extra parenthesis).
Last edited by dmlawrence (2008-10-02 18:10:25)
Offline