[maemo-users] Changing ESSID

From: Leandro Sales leandroal at gmail.com
Date: Tue Jan 29 02:20:17 EET 2008
Hi list.
   How can I change the wireless access point via programming code in
maemo platform? I have the following piece of code that works
perfectly in my laptop, but when used in maemo, the wlan0 interface
disconnect but not reconnect to the new ESSID.
    Any suggestion? Thanks


int setEssid (char iface[6], char essid[IW_ESSID_MAX_SIZE]) {
	int soc;
	struct iwreq wrq;

	cout << "Changing Access Points...";
	strcpy(wrq.ifr_name, iface);
	wrq.u.essid.pointer = (caddr_t)essid;
	wrq.u.essid.length = strlen(essid)+1;
	wrq.u.essid.flags = 1;

	soc = socket(AF_UNIX, SOCK_DGRAM, 0);
	if (ioctl(soc, SIOCSIWESSID, &wrq) < 0) {
		printf("Error setting ESSID on %s: %s\n", iface, strerror(errno));
	} else {
		cout << " done!\n";
	return 1;

More information about the maemo-users mailing list