mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 04:32:55 +00:00
Add support for $wireless_channel (based on a patch by Timothy Ball)
This commit is contained in:
parent
b5800a3418
commit
6ccde5e7e7
@ -360,6 +360,9 @@ struct text_object *construct_text_object(char *s, const char *arg, long
|
||||
END OBJ(wireless_essid, &update_net_stats)
|
||||
obj->data.opaque = get_net_stat(arg, obj, free_at_crash);
|
||||
obj->callbacks.print = &print_wireless_essid;
|
||||
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_mode, &update_net_stats)
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
obj->callbacks.print = &print_wireless_mode;
|
||||
|
@ -546,6 +546,14 @@ int update_net_stats(void)
|
||||
snprintf(ns->essid, 32, "off/any");
|
||||
}
|
||||
}
|
||||
// get channel
|
||||
if (winfo->b.has_freq) {
|
||||
if(winfo->has_range == 1) {
|
||||
ns->channel = iw_freq_to_channel(winfo->b.freq, &(winfo->range));
|
||||
} else {
|
||||
ns->channel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(ns->mode, 16, "%s", iw_operation_mode[winfo->b.mode]);
|
||||
}
|
||||
|
@ -247,6 +247,19 @@ void print_wireless_mode(struct text_object *obj, char *p, int p_max_size)
|
||||
|
||||
snprintf(p, p_max_size, "%s", ns->mode);
|
||||
}
|
||||
void print_wireless_channel(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->channel != 0) {
|
||||
snprintf(p, p_max_size, "%i", ns->channel);
|
||||
} 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;
|
||||
|
@ -46,6 +46,7 @@ struct net_stat {
|
||||
double net_rec[15], net_trans[15];
|
||||
// wireless extensions
|
||||
char essid[32];
|
||||
int channel;
|
||||
char bitrate[16];
|
||||
char mode[16];
|
||||
int link_qual;
|
||||
@ -76,6 +77,7 @@ double upspeedgraphval(struct text_object *);
|
||||
#endif /* BUILD_X11 */
|
||||
#ifdef BUILD_WLAN
|
||||
void print_wireless_essid(struct text_object *, char *, int);
|
||||
void print_wireless_channel(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);
|
||||
|
Loading…
Reference in New Issue
Block a user