# How to find the ssid name?

**URL:** <https://forum.legato.io/t/how-to-find-the-ssid-name/6142>\
**Category:** Uncategorized\
**Created:** [March 17, 2022, 2:50am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142 "2022-03-17T02:50:01Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanaporn\_y](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tanaporn\_y](https://forum.legato.io/u/tanaporn_y)\
**Post date:** [March 17, 2022, 2:50am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/1 "2022-03-17T02:50:01Z")

</div>

Do anyone have the sample code of how to find the ssid name if we didn’t input it all?

for example :  
I want to find the ssid name that start with “Buffalo” and the full name is “Buffalo-xxxx”.  
How can I write it?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 17, 2022, 3:19am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/2 "2022-03-17T03:19:05Z")

</div>

you can try

wifi client scan |grep “Buffalo”

---

<div class="post-metadata">

**Author:** ![tanaporn\_y](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tanaporn\_y](https://forum.legato.io/u/tanaporn_y)\
**Post date:** [March 17, 2022, 4:49am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/3 "2022-03-17T04:49:21Z")

</div>

can i write it right this?

```auto
LE_FATAL_IF(LE_OK == le_wifiClient_Scan(),"SCAN SUCCESSED");
	AccessPointRefToConnectTo = le_wifiClient_GetFirstAccessPoint();
	if(le_wifiClient_GetSsid(AccessPointRefToConnectTo,ssidd,&ssids) == LE_OK){
		p1 = strstr((char*)ssidd,ssidkey);
		if(p1 == NULL){
			for(;;){
				AccessPointRefToConnectTo = le_wifiClient_GetFirstAccessPoint();
				if(le_wifiClient_GetSsid(AccessPointRefToConnectTo,ssidd,&ssids) == LE_OK){
					p1 = strstr((char*)ssidd,ssidkey);
					if(p1 != NULL){
						break;
					}
				}
			}
		}
	}

```

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 17, 2022, 4:50am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/4 "2022-03-17T04:50:29Z")

</div>

you can run and debug your code

---

<div class="post-metadata">

**Author:** ![tanaporn\_y](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tanaporn\_y](https://forum.legato.io/u/tanaporn_y)\
**Post date:** [March 17, 2022, 4:51am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/5 "2022-03-17T04:51:22Z")

</div>

Mar 17 13:47:44 swi-mdm9x28-wp user.emerg Legato: _EMR_ | NAD[27523]/NADComponent T=main | wifi.c wifi\_init() 487 | SCAN SUCCESSED  
Mar 17 13:48:19 swi-mdm9x28-wp user.info Legato: INFO | supervisor[827]/supervisor T=main | proc.c proc\_SigChildHandler() 2051 | Process ‘NAD’ (PID: 27523) has exited with exit code 1.  
Mar 17 13:48:19 swi-mdm9x28-wp user.warn Legato: -WRN- | supervisor[827]/supervisor T=main | app.c app\_SigChildHandler() 4015 | Process ‘NAD’ in app ‘NAD’ faulted: Ignored.  
Mar 17 13:48:19 swi-mdm9x28-wp user.info Legato: INFO | supervisor[827]/supervisor T=main | app.c app\_StopComplete() 4686 | app ‘NAD’ has stopped.  
Mar 17 13:48:19 swi-mdm9x28-wp user.info Legato: INFO | supervisor[827]/supervisor T=main | apps.c DeactivateAppContainer() 374 | Application ‘NAD’ has stopped.

---

<div class="post-metadata">

**Author:** ![tanaporn\_y](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tanaporn\_y](https://forum.legato.io/u/tanaporn_y)\
**Post date:** [March 17, 2022, 5:12am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/6 "2022-03-17T05:12:36Z")

</div>

I think It error because of this line  
AccessPointRefToConnectTo = le\_wifiClient\_GetFirstAccessPoint();

how can I do?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 17, 2022, 5:16am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/7 "2022-03-17T05:16:48Z")

</div>

you can see how legato works with the wifi command and use the le\_wifiClient\_GetFirstAccessPoint()

> <https://github.com/legatoproject/legato-WiFi/blob/master/apps/tools/wifi/wifi/wifi_client.c>

---

<div class="post-metadata">

**Author:** ![tanaporn\_y](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tanaporn\_y](https://forum.legato.io/u/tanaporn_y)\
**Post date:** [March 17, 2022, 5:33am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/8 "2022-03-17T05:33:18Z")

</div>

got same error. How to fixed?

this the code i have write now

```auto
LE_FATAL_IF(LE_OK == le_wifiClient_Scan(),"SCAN SUCCESSED");
	if (NULL != (AccessPointRefToConnectTo = le_wifiClient_GetFirstAccessPoint())){
		//AccessPointRefToConnectTo = le_wifiClient_GetFirstAccessPoint();
		//p1 = strstr((char*)ssidd,ssidkey);
		LE_FATAL_IF(LE_OK != le_wifiClient_GetSsid(AccessPointRefToConnectTo,ssidd,&ssids),"ERROR");
		if(le_wifiClient_GetSsid(AccessPointRefToConnectTo,ssidd,&ssids) == LE_OK){
			p1 = strstr((char*)ssidd,ssidkey);
			LE_INFO("%s: %s: %s",ssidd,ssidkey,p1);
			if(p1 == NULL){
				for(;;){
					AccessPointRefToConnectTo = le_wifiClient_GetFirstAccessPoint();
					if(le_wifiClient_GetSsid(AccessPointRefToConnectTo,ssidd,&ssids) == LE_OK){
						p1 = strstr((char*)ssidd,ssidkey);
						LE_INFO("%s: %s: %s",ssidd,ssidkey,p1);
						if(p1 != NULL){
							break;
						}
					}
				}
			}
		}
	}
	else
	{
		LE_INFO("AccessPointRefToConnectTo NULL");
	}

```

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 17, 2022, 5:44am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/9 "2022-03-17T05:44:19Z")

</div>

why it is ok to use wifi command in console?

---

<div class="post-metadata">

**Author:** ![tanaporn\_y](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tanaporn\_y](https://forum.legato.io/u/tanaporn_y)\
**Post date:** [March 17, 2022, 5:52am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/10 "2022-03-17T05:52:31Z")

</div>

yes. I can use wifi client scan | grep “”  
 ![Screenshot from 2022-03-17 14-51-30](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/a/ae789ebc08b9817825801c6d4f94767e69804b96.png)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 17, 2022, 6:09am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/11 "2022-03-17T06:09:33Z")

</div>

then that mean the code is working fine?

---

<div class="post-metadata">

**Author:** ![tanaporn\_y](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tanaporn\_y](https://forum.legato.io/u/tanaporn_y)\
**Post date:** [March 17, 2022, 9:18am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/12 "2022-03-17T09:18:17Z")

</div>

```auto
Mar 17 18:15:29 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[872]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 823 | Get next AP
Mar 17 18:15:29 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[872]/daemon T=main | le_wifiClient.c IsScanRunning() 515 | IsScanRunning .0
Mar 17 18:15:29 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[872]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 840 | AP ref = 0x10000001
Mar 17 18:15:29 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[872]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 850 | AP ref = 0x10000001
Mar 17 18:15:29 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[872]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 970 | AP ref 0x10000001
Mar 17 18:15:29 swi-mdm9x28-wp user.err Legato: =ERR= | wifiService[872]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 985 | SSID buffer length (13) is too small to contain SSID of length (19)

```

what “=ERR= | wifiService[872]/daemon T=main | le\_wifiClient.c le\_wifiClient\_GetSsid() 985 | SSID buffer length (13) is too small to contain SSID of length (19)” mean?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 17, 2022, 9:28am UTC](https://forum.legato.io/t/how-to-find-the-ssid-name/6142/13 "2022-03-17T09:28:39Z")

</div>

you can see the source code here:

> <https://github.com/legatoproject/legato-WiFi/blob/master/service/daemon/le_wifiClient.c>
