Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 498ca793 authored by Dominik Brodowski's avatar Dominik Brodowski
Browse files

cpupower: use man(1) when calling "cpupower help subcommand"



Instead of printing something non-formatted to stdout, call
man(1) to show the man page for the proper subcommand.

Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 47c33630
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
.TH "cpufreq-info" "1" "0.1" "Mattia Dongili" ""
.TH "cpupower-frequency-info" "1" "0.1" "Mattia Dongili" ""
.SH "NAME"
.LP 
cpufreq\-info \- Utility to retrieve cpufreq kernel information
cpupower frequency\-info \- Utility to retrieve cpufreq kernel information
.SH "SYNTAX"
.LP 
cpufreq\-info [\fIoptions\fP]
cpupower [ \-c cpulist ] frequency\-info [\fIoptions\fP]
.SH "DESCRIPTION"
.LP 
A small tool which prints out cpufreq information helpful to developers and interested users.
+4 −4
Original line number Diff line number Diff line
.TH "cpufreq-set" "1" "0.1" "Mattia Dongili" ""
.TH "cpupower-freqency-set" "1" "0.1" "Mattia Dongili" ""
.SH "NAME"
.LP 
cpufreq\-set \- A small tool which allows to modify cpufreq settings.
cpupower frequency\-set \- A small tool which allows to modify cpufreq settings.
.SH "SYNTAX"
.LP 
cpufreq\-set [\fIoptions\fP]
cpupower [ \-c cpu ] frequency\-set [\fIoptions\fP]
.SH "DESCRIPTION"
.LP 
cpufreq\-set allows you to modify cpufreq settings without having to type e.g. "/sys/devices/system/cpu/cpu0/cpufreq/scaling_set_speed" all the time.
cpupower frequency\-set allows you to modify cpufreq settings without having to type e.g. "/sys/devices/system/cpu/cpu0/cpufreq/scaling_set_speed" all the time.
.SH "OPTIONS"
.LP 
.TP 
+7 −7
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
cpupower \- Shows and sets processor power related values
.SH SYNOPSIS
.ft B
.B cpupower [ \-c cpulist ] subcommand [ARGS]
.B cpupower [ \-c cpulist ] <command> [ARGS]

.B cpupower \-v|\-\-version

@@ -13,24 +13,24 @@ cpupower \- Shows and sets processor power related values
\fBcpupower \fP is a collection of tools to examine and tune power saving
related features of your processor.

The manpages of the subcommands (cpupower\-<subcommand>(1)) provide detailed
The manpages of the commands (cpupower\-<command>(1)) provide detailed
descriptions of supported features. Run \fBcpupower help\fP to get an overview
of supported subcommands.
of supported commands.

.SH Options
.PP
\-\-help, \-h
.RS 4
Shows supported subcommands and general usage.
Shows supported commands and general usage.
.RE
.PP
\-\-cpu cpulist,  \-c cpulist
.RS 4
Only show or set values for specific cores.
This option is not supported by all subcommands, details can be found in the
manpages of the subcommands.
This option is not supported by all commands, details can be found in the
manpages of the commands.

Some subcommands access all cores (typically the *\-set commands), some only
Some commands access all cores (typically the *\-set commands), some only
the first core (typically the *\-info commands) by default.

The syntax for <cpulist> is based on how the kernel exports CPU bitmasks via
+0 −7
Original line number Diff line number Diff line
@@ -8,11 +8,4 @@ extern int cmd_freq_info(int argc, const char **argv);
extern int cmd_idle_info(int argc, const char **argv);
extern int cmd_monitor(int argc, const char **argv);

extern void set_help(void);
extern void info_help(void);
extern void freq_set_help(void);
extern void freq_info_help(void);
extern void idle_info_help(void);
extern void monitor_help(void);

#endif
+1 −41
Original line number Diff line number Diff line
@@ -510,37 +510,6 @@ static int get_latency(unsigned int cpu, unsigned int human)
	return 0;
}

void freq_info_help(void)
{
	printf(_("Usage: cpupower freqinfo [options]\n"));
	printf(_("Options:\n"));
	printf(_("  -e, --debug          Prints out debug information [default]\n"));
	printf(_("  -f, --freq           Get frequency the CPU currently runs at, according\n"
	       "                       to the cpufreq core *\n"));
	printf(_("  -w, --hwfreq         Get frequency the CPU currently runs at, by reading\n"
	       "                       it from hardware (only available to root) *\n"));
	printf(_("  -l, --hwlimits       Determine the minimum and maximum CPU frequency allowed *\n"));
	printf(_("  -d, --driver         Determines the used cpufreq kernel driver *\n"));
	printf(_("  -p, --policy         Gets the currently used cpufreq policy *\n"));
	printf(_("  -g, --governors      Determines available cpufreq governors *\n"));
	printf(_("  -r, --related-cpus   Determines which CPUs run at the same hardware frequency *\n"));
	printf(_("  -a, --affected-cpus  Determines which CPUs need to have their frequency\n"
			"                       coordinated by software *\n"));
	printf(_("  -s, --stats          Shows cpufreq statistics if available\n"));
	printf(_("  -y, --latency        Determines the maximum latency on CPU frequency changes *\n"));
	printf(_("  -b, --boost          Checks for turbo or boost modes  *\n"));
	printf(_("  -o, --proc           Prints out information like provided by the /proc/cpufreq\n"
	       "                       interface in 2.4. and early 2.6. kernels\n"));
	printf(_("  -m, --human          human-readable output for the -f, -w, -s and -y parameters\n"));
	printf(_("  -h, --help           Prints out this screen\n"));

	printf("\n");
	printf(_("If no argument is given, full output about\n"
	       "cpufreq is printed which is useful e.g. for reporting bugs.\n\n"));
	printf(_("By default info of CPU 0 is shown which can be overridden\n"
		 "with the cpupower --cpu main command option.\n"));
}

static struct option info_opts[] = {
	{ .name = "debug",	.has_arg = no_argument,		.flag = NULL,	.val = 'e'},
	{ .name = "boost",	.has_arg = no_argument,		.flag = NULL,	.val = 'b'},
@@ -556,7 +525,6 @@ static struct option info_opts[] = {
	{ .name = "latency",	.has_arg = no_argument,		.flag = NULL,	.val = 'y'},
	{ .name = "proc",	.has_arg = no_argument,		.flag = NULL,	.val = 'o'},
	{ .name = "human",	.has_arg = no_argument,		.flag = NULL,	.val = 'm'},
	{ .name = "help",	.has_arg = no_argument,		.flag = NULL,	.val = 'h'},
	{ },
};

@@ -570,16 +538,12 @@ int cmd_freq_info(int argc, char **argv)
	int output_param = 0;

	do {
		ret = getopt_long(argc, argv, "hoefwldpgrasmyb", info_opts, NULL);
		ret = getopt_long(argc, argv, "oefwldpgrasmyb", info_opts, NULL);
		switch (ret) {
		case '?':
			output_param = '?';
			cont = 0;
			break;
		case 'h':
			output_param = 'h';
			cont = 0;
			break;
		case -1:
			cont = 0;
			break;
@@ -642,11 +606,7 @@ int cmd_freq_info(int argc, char **argv)
		return -EINVAL;
	case '?':
		printf(_("invalid or unknown argument\n"));
		freq_info_help();
		return -EINVAL;
	case 'h':
		freq_info_help();
		return EXIT_SUCCESS;
	case 'o':
		proc_cpufreq_output();
		return EXIT_SUCCESS;
Loading