[oe-commits] Florian Boor : gpe-conf: fix WiFi part

GIT User account git at amethyst.openembedded.net
Thu Dec 18 20:12:35 UTC 2008


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 5b7738dfeb9356b3b75394a07101c10a1a427956
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=5b7738dfeb9356b3b75394a07101c10a1a427956

Author: Florian Boor <florian.boor at kernelconcepts.de>
Date:   Thu Dec 18 21:09:41 2008 +0100

gpe-conf: fix WiFi part

---

 packages/gpe-conf/gpe-conf-0.2.7/wifi-key.patch |  166 +++++++++++++++++++++++
 packages/gpe-conf/gpe-conf_0.2.7.bb             |    5 +-
 2 files changed, 169 insertions(+), 2 deletions(-)

diff --git a/packages/gpe-conf/gpe-conf-0.2.7/wifi-key.patch b/packages/gpe-conf/gpe-conf-0.2.7/wifi-key.patch
new file mode 100644
index 0000000..f05c04c
--- /dev/null
+++ b/packages/gpe-conf/gpe-conf-0.2.7/wifi-key.patch
@@ -0,0 +1,166 @@
+---
+ ChangeLog         |    4 ++++
+ modules/cfgfile.c |   49 +++++++++++++++++++++++++++++--------------------
+ 2 files changed, 33 insertions(+), 20 deletions(-)
+
+--- ChangeLog.orig
++++ ChangeLog
+@@ -1,5 +1,9 @@
++2008-12-18  Florian Boor <florian at kernelconcepts.de>
++
++	* cfgfile.c: Some fixes to wifi key string generation.
++
+ 2008-05-23      Florian Boor <florian.boor at kernelconcepts.de>
+ 
+ 	* Relase version 0.2.7
+ 	* Update translations
+ 
+--- modules/cfgfile.c.orig
++++ modules/cfgfile.c
+@@ -1,8 +1,8 @@
+ /*
+  *
+- * Copyright (C) 2002, 2003  Florian Boor <florian.boor at kernelconcepts.de>
++ * Copyright (C) 2002, 2003, 2008  Florian Boor <florian.boor at kernelconcepts.de>
+  *               2004  Ole Reinhardt <ole.reinhardt at kernelconcepts.de>
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version
+@@ -128,12 +128,10 @@ gint get_param_val(gchar* line, gchar* p
+ 	for (b=a+1;b<strlen(line);b++)
+ 		if ((line[b]=='\n') || (line[b]=='\0')) break;
+ 	param=strncpy(param,&line[st],sep-st);
+ 	param[sep-st]='\0';
+ 	
+-//KC-OR: changed because singe character values not recognized correctly
+-//		if ((b-a) > 0) value=strncpy(value,&line[a],b-a);	
+ 	if ((b-a) > 0) value=strncpy(value,&line[a],b-a);	
+ 	value[b-a]='\0';
+ 	return 0;
+ }
+ 
+@@ -562,15 +560,17 @@ gchar *get_iflist()
+ 		strncat(result," ",255);
+ 	}
+ 	return result;
+ }
+ 
+-void get_wifikey_string(NWInterface_t iface, char* key)
++void get_wifikey_string(NWInterface_t iface, gchar** key)
+ {
+ 	gint nokeys = FALSE;
+ 	gint count;
+ 	gchar temp[42];
++	gchar *lkey = g_strdup(""), *t;
++
+ 	
+ 	if ((strlen(iface.key[0]) == 0) && 
+ 	    (strlen(iface.key[1]) == 0) && 
+ 	    (strlen(iface.key[2]) == 0) && 
+ 	    (strlen(iface.key[3]) == 0)) 
+@@ -581,29 +581,36 @@ void get_wifikey_string(NWInterface_t if
+ 	
+ 	if (strlen(iface.key[iface.keynr-1]) == 0)
+ 		for (iface.keynr = 1; iface.keynr <=4; iface.keynr++)
+ 			if (strlen(iface.key[iface.keynr-1]) != 0) break;
+ 				
+-	switch (iface.encmode)
+-	{
+-		case ENC_OFF: strcpy(key, "off"); break;
+-		case ENC_OPEN: strcpy(key, "open"); break;
+-		case ENC_RESTRICTED: strcpy(key, "restricted"); break;
+-	}
+-	
+ 	if (!nokeys)
+ 	{
+ 		for (count = 0; count < 4; count++)
+ 			if (strlen(iface.key[count]) > 0)
+ 			{
+-				sprintf(temp, " key %s [%d]", iface.key[count], count+1);
+-				strcat(key, temp);
++				t = lkey;
++				lkey = g_strdup_printf("%s key %s [%d]", lkey, iface.key[count], count+1);
++				g_free(t);
+ 			}
+ 		
+-		sprintf(temp, " key [%d]", iface.keynr);
+-		strcat(key, temp);
++		t = lkey;
++		lkey = g_strdup_printf(" %s key [%d]", lkey, iface.keynr);
++		g_free(t);
+ 	}
++
++	t = lkey;
++	switch (iface.encmode)
++	{
++		case ENC_OPEN: lkey = g_strdup_printf ("%s key open", lkey); break;
++		case ENC_RESTRICTED: lkey = g_strdup_printf("%s key restricted", lkey); break;
++		case ENC_OFF: lkey = g_strdup_printf("%s key off", lkey); break;
++		default: lkey = g_strdup_printf("%s key off", lkey); break;
++	}
++	g_free(t);
++
++ 	*key = lkey;
+ }
+ 
+ gint write_sections()
+ {
+ 	gint i,j;
+@@ -613,11 +620,11 @@ gint write_sections()
+ 	gchar paramval[255];
+ 	gchar ifname[255];
+ 	gint svd[14];
+ 	gint lastwpos = 0;
+ 	gint last_i;
+-	gchar key[128];
++	gchar *key;
+ 	
+ 	for (i=0;i<configlen;i++)
+ 	{
+ 		get_param_val(configtext[i],paramval,ifname);	// get next tokens
+ 		/* handled by hotplug
+@@ -724,12 +731,13 @@ gint write_sections()
+ 				svd[Swifichannel] = TRUE;
+ 				lastwpos = i;
+ 			} else
+ 			if (!strcmp("wireless_key", paramval))
+ 			{
+-				get_wifikey_string(iflist[l-1], key);
++				get_wifikey_string(iflist[l-1], &key);
+ 				configtext[i] = subst_val(configtext[i], key); 
++ 				g_free(key);
+ 				svd[Swifikey] = TRUE;
+ 				lastwpos = i;
+ 			}
+ 			
+ 		} // else
+@@ -807,11 +815,11 @@ gint write_sections()
+ 						add_line(lastwpos,outstr);
+ 						i++;
+ 					} 
+ 					if (!svd[Swifikey])
+ 					{
+-						get_wifikey_string(iflist[l-1], key);
++						get_wifikey_string(iflist[l-1], &key);
+ 						sprintf(outstr,"\twireless_key %s",key);
+ 						add_line(lastwpos,outstr);
+ 						i++;
+ 					} 
+ 				}					
+@@ -884,12 +892,13 @@ gint write_sections()
+ 				if (strlen (iflist[i].channel) > 0)
+ 				{
+ 					sprintf(outstr,"\twireless_channel %s",iflist[i].channel);
+ 					add_line(configlen,outstr);
+ 				} 
+-				get_wifikey_string(iflist[i], key);
+-				sprintf(outstr,"\twireless_key %s",key);
++				get_wifikey_string(iflist[i], &key);
++ 				sprintf(outstr,"\twireless_key %s",key);
++				g_free(key);
+ 				add_line(configlen,outstr);
+ 			}					
+ 			
+ 		} //if status
+ 	
diff --git a/packages/gpe-conf/gpe-conf_0.2.7.bb b/packages/gpe-conf/gpe-conf_0.2.7.bb
index ec836eb..2d4fb21 100644
--- a/packages/gpe-conf/gpe-conf_0.2.7.bb
+++ b/packages/gpe-conf/gpe-conf_0.2.7.bb
@@ -10,13 +10,14 @@ RDEPENDS_gpe-conf-panel = "gpe-conf"
 RPROVIDES_${PN} += " bl"
 RCONFLICTS_${PN} = "bl"
 
-PR = "r1"
+PR = "r2"
 
 GPE_TARBALL_SUFFIX = "bz2"
 
 inherit gpe autotools pkgconfig
 
-SRC_URI += "file://poweroff.patch;patch=1"
+SRC_URI += "file://poweroff.patch;patch=1 \
+            file://wifi-key.patch;patch=1;pnum=0"
 
 PACKAGES += "gpe-conf-panel"
 





More information about the Openembedded-commits mailing list