le_dcs_GetChannels doesn't return wifi networks

I’m trying to use the new legato dcs api to setup the wifi channel, but I’m hitting a roadblock because I cannot get the api le_dcs_GetChannels to return ANY wifi networks. I even see log statements saying that it has found them. Is this a bug? Attached is a very simple app that starts up and calls the api.

testNetworkApp.zip (449.0 KB)

Following is the logs from the test:
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 832 | Wifi result: SSID = TheDangerZone, BSSID = 00:11:32:ce:b7:eb, AP reference 0x6b, signal strength = -38
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1004 | AP ref = 0x26b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1014 | AP ref = 0x26b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1134 | AP ref 0x26b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1154 | apPtr->AccessPoint.ssidLength 13
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1004 | AP ref = 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1014 | AP ref = 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1134 | AP ref 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1154 | apPtr->AccessPoint.ssidLength 10
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSignalStrength() 1045 | Get signal strength
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetBssid() 1082 | AP ref 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 832 | Wifi result: SSID = ATTWAeuQXt, BSSID = f4:17:b8:d8:f1:87, AP reference 0x46b, signal strength = -81
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1004 | AP ref = 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1014 | AP ref = 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1134 | AP ref 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1154 | apPtr->AccessPoint.ssidLength 0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSignalStrength() 1045 | Get signal strength
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetBssid() 1082 | AP ref 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 832 | Wifi result: SSID = , BSSID = ae:ae:19:b3:a7:28, AP reference 0x66b, signal strength = -77
May 20 17:17:38 swi-mdm9x28-wp user.err Legato: =ERR= | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c DcsWifiCreateConnDb() 569 | Cannot create wifi connection db with null SSID
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1019 | AP not found
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 859 | Wifi SSID results: 2 found
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetCurrentConnection() 1177 | AP reference of currently selected connection: (nil)
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcs T=main | dcsTech.c le_dcsTech_CollectChannelQueryResults() 702 | Query channel list results collected from technology 1, retcode 0, list size 2
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcs T=main | dcsTech.c DcsTechPostChannelList() 681 | Posting collected channel list to apps of size 36
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c DcsWifiClientStop() 291 | Stopping Wifi client
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 90 | Received channel query result 0, channel list size 36

I see this line says it has at least 2 wifi networks in the list:
dcsTech.c le_dcsTech_CollectChannelQueryResults() 702 | Query channel list results collected from technology 1, retcode 0, list size 2

When I look at the returned list, its all ethernet and cellular connections.
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #1: name 1 from technology 2, state 0, reference 0x3bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #2: name 2 from technology 2, state 0, reference 0x5bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #3: name 3 from technology 2, state 0, reference 0x7bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #4: name 4 from technology 2, state 0, reference 0x9bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #5: name ecm0 from technology 3, state 0, reference 0x1bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #6: name from technology 0, state 0, reference (nil)
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #7: name from technology 0, state 0, reference (nil)
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #8: name from technology 0, state 0, reference (nil)

I’m running Legato 19.11.3 Legato version for WP76xx on mangoh yellow hardware.

Did you try "wifi client scan”

I did and it worked fine for our sample application, but we are trying to use the new api le_dcs. Based on my findings, this api 1) Has bugs so that valid wifi lists are not properly added to the list of availiable connections or 2) There is some unknown and undocumented prerequisite for the return of le_dcs_GetChannels to include wifi networks that the scan found.

Normally i used "wifi client scan” only

That solution works for a manual test, but not a production setup. Could someone from development team look at the app I provided and give feedback if in fact the api is 1) Broken or 2) Not fully documented?

Why it cannot be used in production?

wifi command is typed in the command line, and in production setup, there will be no user with terminal access. We need to have app controlling with various api’s like le_data or le_dcs. le_data works, but from documentation, it seems to be preferred for future flexibility that we should use le_dcs. The le_dcs api isn’t what is working.

You can port the source code of "wifi client scan” to your code

We have ported most of that code over to preliminary application, but there are still issues when using it with drawbacks.

  1. DNS isn’t setup automatically
  2. I believe to run the system() command to setup DNS as per recommendation from earlier forum post causes us to run in an unsandboxed mode.
  3. That application I don’t think has any retry logic built-in after wifi beacon loss etc. The dcs service I see documented in Data Channel Service - Legato Docs should have all this functionality already developed. Appreciate the guidance for a work-around, but at this point I would appreciate if you could just compile the app and see if at least what I’m reporting is a bug on everyones setup.

You can run two app, one is unsandboxed, one is sandboxed.

When you call system() api, you can use ipc to ask the unsandboxed app to run it

@jwolla have you found a solution to this? I am having exactly the same problem with the le_dcs_GetChannels not returning the wifi channel whatsoever…

Unfortunately, I have not been able to overcome this. The only way we got wifi working was to revert to using the le_data api which is said to be deprecated in future version. :frowning:

I feel your pain, I have been struggling with this problem for a bit now and unfortunately it doesn`t sound that we will get any fix on it.

This issue is being analyzed internally, I’ll keep you in touch.
QTI9X07-4321

BR

1 Like

@mehdiALL1 thank you for your reply, I have got this working but it seems my legato layer is not behaving properly…
What I have found out is that I need to initialize the wifi interface and then to call the:
le_dcs_GetChannels()
function, this way it will find the wifi channel in the dcs API, but it is very difficult to understand what is happening because also online documentation says that now the dcs should work on top of the configTree of the wifiService while I see that if I remove the channel in the dataConnectionService, then the connection to AirVantage wont work as the dcsDaemon wont be able to find a proper channel for the connection.

Also, everytime the avcService finished with the checks will invoke StopBearer() which is stopping the channel, which basically also effect the channel of my app, so it seems that there is only one channel available and not multiple as per documentation?

In the same talking, the le_wifiClient_LoadSSid definetely needs the secStore and the configTree for the wifiService or it won`t be able to initialize the reference for the client.

we are using the le=19.11.5, and can`t understand if this is the problem with the sequence of start we have done or with the legato version, and troubleshooting this problem with different legato versions on different hardware make all of this very time consuming to resolve.

The hardware is fantastic but why you don`t spend a little more on making proper documentation for different revisions of the legato? As with the bits and pieces found online it is very troublesome and time consuming to manually test all configurations.
We are talking about days of troubleshooting for a legato layer which is technically pointed at shorting the release time of the application… while at the moment we have been able to sort out everything but the legato which keep looking very doggy.

please understand this is not a complain but really a beg for improvement as I see we are struggling to get proper answers on the forum from the developers and/or the support team, if there is anyone…

@mehdiALL1 I’ve tracked the problem down to this area on the code

Aug 20 13:29:34 swi-mdm9x28-wp user.debug Legato: DBUG | dcsDaemon[1816]/dcs T=main | dcsTech.c le_dcsTech_CollectChannelQueryResults() 721 | QueryChannelListSize: 36 NewListsize: 3
Aug 20 13:29:34 swi-mdm9x28-wp user.debug Legato: DBUG | dcsDaemon[1816]/dcs T=main | dcsTech.c le_dcsTech_CollectChannelQueryResults() 727 | Query channel list maxed out; collected list trimmed to size 0
Aug 20 13:29:34 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1816]/dcs T=main | dcsTech.c DcsTechPostChannelList() 681 | Posting collected channel list to apps of size 36
Aug 20 13:29:34 swi-mdm9x28-wp user.debug Legato: DBUG | dcsDaemon[1816]/dcs T=main | dcs_db.c le_dcs_ChannelQueryNotifier() 405 | Got channel list query result 0, list size 36

It appears that the list of wifi connections is getting trimmed down to 0 because for some reason the variable QueryChannel.listSize is getting set to 36. I’m thinking this is because in some bug of how the list is generated for ethernet:

Aug 20 14:38:04 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[14739]/dcs T=main | dcsTech.c le_dcsTech_CollectChannelQueryResults() 702 | Query channel list results collected from technology 3, retcode 0, list size 36
Aug 20 14:38:04 swi-mdm9x28-wp user.err Legato: =ERR= | dcsDaemon[14739]/le_pa_ethernet T=main | pa_ethernet_linux.c pa_ethernet_GetInterfaceState() 198 | Failed to open file :“/sys/class/net//operstate”
Aug 20 14:38:04 swi-mdm9x28-wp user.debug Legato: DBUG | dcsDaemon[14739]/dcsEthernet T=main | dcsEthernet.c DcsEthernetCreateConnDb() 147 | ConnRef 0x3e3 created for Ethernet connection with opState 0

We are not using ethernet on our implementation with Legato on Mangoh Yellow WP76xx.

@mehdiALL1 : Any update on QTI9X07-4321?

@ClaudioBaldo : We found the issue was a legato issue bugfix that was never ported to legato 19.11 path firmwares:

Pulled in fix LE14350(wrong break location) and LE14249(wrong number ethernet networks shows in le_dcs_GetChannels API call.

See Fix the location of a "break" in le_data's ChannelEventHandler · legatoproject/legato-af@9852b91 · GitHub and Fix data channel collection code in dcsEthernet · legatoproject/legato-af@cd9c45b · GitHub. Using le_dcs for wifi networks now works!

1 Like