1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 01:57:09 +00:00

Add support for $wireless_freq

This commit is contained in:
Nikolas Garofil 2010-06-07 10:50:02 +02:00
parent 7b9d69950c
commit 99fc975780
5 changed files with 31 additions and 1 deletions

View File

@ -4179,6 +4179,16 @@
<listitem>Wireless access point ESSID (Linux only)
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>wireless_freq</option>
</command>
<option>(net)</option>
</term>
<listitem>Frequency on which device 'net' is listening (Linux only)
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>

View File

@ -363,6 +363,9 @@ struct text_object *construct_text_object(char *s, const char *arg, long
END OBJ(wireless_channel, &update_net_stats)
parse_net_stat_arg(obj, arg, free_at_crash);
obj->callbacks.print = &print_wireless_channel;
END OBJ(wireless_freq, &update_net_stats)
parse_net_stat_arg(obj, arg, free_at_crash);
obj->callbacks.print = &print_wireless_frequency;
END OBJ(wireless_mode, &update_net_stats)
parse_net_stat_arg(obj, arg, free_at_crash);
obj->callbacks.print = &print_wireless_mode;

View File

@ -546,12 +546,14 @@ int update_net_stats(void)
snprintf(ns->essid, 32, "off/any");
}
}
// get channel
// get channel and freq
if (winfo->b.has_freq) {
if(winfo->has_range == 1) {
ns->channel = iw_freq_to_channel(winfo->b.freq, &(winfo->range));
iw_print_freq_value(ns->freq, 16, winfo->b.freq);
} else {
ns->channel = 0;
ns->freq[0] = 0;
}
}

View File

@ -260,6 +260,19 @@ void print_wireless_channel(struct text_object *obj, char *p, int p_max_size)
snprintf(p, p_max_size, "/");
}
}
void print_wireless_frequency(struct text_object *obj, char *p, int p_max_size)
{
struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns)
return;
if(ns->freq[0] != 0) {
snprintf(p, p_max_size, "%s", ns->freq);
} else {
snprintf(p, p_max_size, "/");
}
}
void print_wireless_bitrate(struct text_object *obj, char *p, int p_max_size)
{
struct net_stat *ns = (struct net_stat *)obj->data.opaque;

View File

@ -47,6 +47,7 @@ struct net_stat {
// wireless extensions
char essid[32];
int channel;
char freq[16];
char bitrate[16];
char mode[16];
int link_qual;
@ -78,6 +79,7 @@ double upspeedgraphval(struct text_object *);
#ifdef BUILD_WLAN
void print_wireless_essid(struct text_object *, char *, int);
void print_wireless_channel(struct text_object *, char *, int);
void print_wireless_frequency(struct text_object *, char *, int);
void print_wireless_mode(struct text_object *, char *, int);
void print_wireless_bitrate(struct text_object *, char *, int);
void print_wireless_ap(struct text_object *, char *, int);