From bf40f4cb9eed35745c3e346d24f22585a027f8e4 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Tue, 20 Dec 2005 14:46:07 +0000 Subject: matchbox-panel 0.9.2: add 2 patches to fix wireless applet and cpu/mem applet, courtesy Patrick Steiner --- .../matchbox-panel-0.9.2/.mtn2git_empty | 0 .../matchbox-panel-0.9.2/add_hostap.patch | 24 +++ .../matchbox-panel-0.9.2/kernel2.6.patch | 227 +++++++++++++++++++++ 3 files changed, 251 insertions(+) create mode 100644 packages/matchbox-panel/matchbox-panel-0.9.2/.mtn2git_empty create mode 100644 packages/matchbox-panel/matchbox-panel-0.9.2/add_hostap.patch create mode 100644 packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch (limited to 'packages/matchbox-panel/matchbox-panel-0.9.2') diff --git a/packages/matchbox-panel/matchbox-panel-0.9.2/.mtn2git_empty b/packages/matchbox-panel/matchbox-panel-0.9.2/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/matchbox-panel/matchbox-panel-0.9.2/add_hostap.patch b/packages/matchbox-panel/matchbox-panel-0.9.2/add_hostap.patch new file mode 100644 index 0000000000..94cc08364b --- /dev/null +++ b/packages/matchbox-panel/matchbox-panel-0.9.2/add_hostap.patch @@ -0,0 +1,24 @@ +--- matchbox-panel-0.9.2/applets/mb-applet-wireless.c.old 2005-04-05 19:55:39.000000000 +0200 ++++ matchbox-panel-0.9.2/applets/mb-applet-wireless.c 2005-12-17 14:00:01.000000000 +0100 +@@ -354,8 +354,19 @@ + if (Mwd.iface != NULL) + return 0; + +- /* mark first found as one to monitor */ +- Mwd.iface = strdup(ifname); ++ if(iw_get_range_info(Wfd, ifname, &(WInfo.range)) >= 0) ++ WInfo.has_range = 1; ++ ++ if (iw_get_stats(Wfd, ifname, ++ &(WInfo.stats), ++ &(WInfo.range), WInfo.has_range) >= 0) ++ { ++ Mwd.iface = strdup(ifname); ++ } ++ else ++ { ++ Mwd.iface = "wlan0"; ++ } + + return 0; + } diff --git a/packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch b/packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch new file mode 100644 index 0000000000..0cea66645d --- /dev/null +++ b/packages/matchbox-panel/matchbox-panel-0.9.2/kernel2.6.patch @@ -0,0 +1,227 @@ +--- matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c.old 2005-03-20 18:43:31.000000000 +0100 ++++ matchbox-panel-0.9.2/applets/mb-applet-system-monitor.c 2005-12-19 22:50:54.000000000 +0100 +@@ -112,70 +112,165 @@ + + int system_memory(void) + { +- u_int64_t my_mem_used, my_mem_max; +- u_int64_t my_swap_max; ++ FILE * osrelease; ++ char kernelversion[90] = "0", kernelcut[90] = "0"; ++ int kernellength = 3; + +- static int mem_delay = 0; +- FILE *mem; +- static u_int64_t total, used, mfree, shared, buffers, cached, +- cache_total, cache_used; +- +- /* put this in permanent storage instead of stack */ +- static char not_needed[2048]; +- +- if (mem_delay-- <= 0) { +- if ((mem = fopen("/proc/meminfo", "r")) == NULL) +- { +- fprintf(stderr, "mb-applet-system-monitor: failed to open /proc/meminfo. Exiting.\n"); +- exit(1); +- } ++ osrelease = fopen("/proc/sys/kernel/osrelease","r"); + ++ fscanf (osrelease, "%s", kernelversion); + ++ strncpy(kernelcut, kernelversion, kernellength); + +- fgets(not_needed, 2048, mem); +- +- /* +- total: used: free: shared: buffers: cached: +- */ +- +- fscanf(mem, "%*s %Ld %Ld %Ld %Ld %Ld %Ld", &total, &used, &mfree, +- &shared, &buffers, &cached); +- +- fscanf(mem, "%*s %Ld %Ld", &cache_total, &cache_used); +- +- fclose(mem); +- mem_delay = 25; +- +- /* calculate it */ +- my_mem_max = total; +- my_swap_max = cache_total; +- +- my_mem_used = cache_used + used - cached - buffers; +- +- /* No swap on ipaq +- if (my_mem_used > my_mem_max) { +- my_swap_used = my_mem_used - my_mem_max; +- my_mem_used = my_mem_max; +- } else { +- my_swap_used = 0; +- } +- */ +- +- msd.mem_used = my_mem_used; +- msd.mem_max = my_mem_max; +- //msd.swap_used = my_swap_used; +- //msd.swap_max = my_swap_max; +- +- msd.mem_percent = (100 * msd.mem_used) / msd.mem_max; +- //msd.swap_percent = (100 * msd.swap_used) / msd.swap_max; +- +- /* memory info changed - update things */ +- return 1; +- } +- /* nothing new */ +- return 0; +-} ++ if ((strcmp (kernelcut, "2.4")) == 0) ++ { ++ static u_int64_t total, used, mfree, shared, buffers, cached, ++ cache_total, cache_used; ++ ++ u_int64_t my_mem_used, my_mem_max; ++ u_int64_t my_swap_max; ++ ++ static int mem_delay = 0; ++ FILE *mem; ++ ++ /* put this in permanent storage instead of stack */ ++ static char not_needed[2048]; ++ ++ if (mem_delay-- <= 0) { ++ if ((mem = fopen("/proc/meminfo", "r")) == NULL) { ++ fprintf(stderr, "mb-applet-system-monitor: failed to open /proc/meminfo. Exiting.\n"); ++ exit(1); ++ } ++ ++ fgets(not_needed, 2048, mem); ++ ++ /* ++ total: used: free: shared: buffers: cached: ++ */ ++ fscanf(mem, "%*s %Ld %Ld %Ld %Ld %Ld %Ld", &total, &used, &mfree, ++ &shared, &buffers, &cached); ++ ++ fscanf(mem, "%*s %Ld %Ld", &cache_total, &cache_used); ++ ++ fclose(mem); ++ ++ mem_delay = 25; ++ ++ /* calculate it */ ++ my_mem_max = total; ++ my_swap_max = cache_total; ++ ++ my_mem_used = cache_used + used - cached - buffers; ++ ++ /* No swap on ipaq ++ if (my_mem_used > my_mem_max) { ++ my_swap_used = my_mem_used - my_mem_max; ++ my_mem_used = my_mem_max; ++ } else { ++ my_swap_used = 0; ++ } ++ */ ++ ++ msd.mem_used = my_mem_used; ++ msd.mem_max = my_mem_max; ++ //msd.swap_used = my_swap_used; ++ //msd.swap_max = my_swap_max; ++ ++ msd.mem_percent = (100 * msd.mem_used) / msd.mem_max; ++ //msd.swap_percent = (100 * msd.swap_used) / msd.swap_max; ++ ++ /* memory info changed - update things */ ++ return 1; ++ } ++ /* nothing new */ ++ return 0; ++ } ++ else if ((strcmp (kernelcut, "2.6")) == 0) ++ { ++ u_int64_t total, mfree, buffers, cached, used, shared, ++ cache_total, cache_free, cache_used; ++ ++ u_int64_t my_mem_used, my_mem_max; ++ u_int64_t my_swap_max; + ++ static int mem_delay = 0; ++ FILE *mem; ++ ++ /* put this in permanent storage instead of stack */ ++ static char not_needed[2048]; ++ ++ if (mem_delay-- <= 0) { ++ if ((mem = fopen("/proc/meminfo", "r")) == NULL) { ++ fprintf(stderr, "mb-applet-system-monitor: failed to open /proc/meminfo. Exiting.\n"); ++ exit(1); ++ } ++ ++ fgets(not_needed, 2048, mem); ++ ++ rewind (mem); ++ ++ fscanf (mem, "%*s %Ld %*s", &total); ++ fscanf (mem, "%*s %Ld %*s", &mfree); ++ fscanf (mem, "%*s %Ld %*s", &buffers); ++ fscanf (mem, "%*s %Ld %*s", &cached); ++ fscanf (mem, "%*s %Ld %*s", &shared); ++ fscanf (mem, "%*s %Ld %*s", &used); ++ fscanf (mem, "%*s %*Ld %*s"); ++ fscanf (mem, "%*s %*Ld %*s"); ++ fscanf (mem, "%*s %*Ld %*s"); ++ fscanf (mem, "%*s %*Ld %*s"); ++ fscanf (mem, "%*s %*Ld %*s"); ++ fscanf (mem, "%*s %Ld %*s", &cache_total); ++ fscanf (mem, "%*s %Ld %*s", &cache_free); ++ ++ fclose (mem); ++ ++ total = total * 1024; ++ mfree = mfree * 1024; ++ buffers = buffers * 1024; ++ cached = cached * 1024; ++ used = used * 1024; ++ shared = shared * 1024; ++ cache_total = cache_total * 1024; ++ cache_used = cache_total - (cache_free * 1024); ++ ++ mem_delay = 25; ++ ++ /* calculate it */ ++ my_mem_max = total; ++ my_swap_max = cache_total; ++ ++ my_mem_used = cache_used + used - cached - buffers; ++ ++ /* No swap on ipaq ++ if (my_mem_used > my_mem_max) { ++ my_swap_used = my_mem_used - my_mem_max; ++ my_mem_used = my_mem_max; ++ } else { ++ my_swap_used = 0; ++ } ++ */ ++ ++ msd.mem_used = my_mem_used; ++ msd.mem_max = my_mem_max; ++ //msd.swap_used = my_swap_used; ++ //msd.swap_max = my_swap_max; ++ ++ msd.mem_percent = (100 * msd.mem_used) / msd.mem_max; ++ //msd.swap_percent = (100 * msd.swap_used) / msd.swap_max; ++ ++ /* memory info changed - update things */ ++ return 1; ++ } ++ /* nothing new */ ++ return 0; ++ } ++ else ++ { ++ printf("unsupported kernel version\n"); ++ exit(1); ++ } ++} + + void + paint_callback (MBTrayApp *app, Drawable drw ) -- cgit v1.2.3