External WLAN LM816/LM842

Good day,

I am currently, trying to integrate a WLAN AP on our Verdin IMX8MP.
I am using the LM842.

I found the LM816 among your accessories, but its product page opened up some questions about it.

The product page for the LM816 states the following:

Warning: This product is offered by Toradex especially for Windows CE customers. It is not recommended for using with Embedded Linux.

What is the reason behind this? Are there certain problems with integrating this USB adapter on Linux?
Is there a possibility that these reasons extend to the LM842?

Furthermore, the Verdin SoMs are not among the compatible modules for the LM816. Is this an oversight?
Or is there somthing that would prevent integration between Verdin and LM816?

I am asking since my integration of the LM842 is stuck on the following message, when trying to start an AP on the device:

nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED 
wlan0: CTRL-EVENT-TERMINATING 
hostapd_free_hapd_data: Interface wlan0 wasn't started

Comilation and loading of the driver worked fine tho.

Best regards

Hi @aigF

Unfortunately, the USB WLAN modules often have a lot of issues under Linux. However, the LM842 should use a different driver than the LM816 therefore they should behave different.

Did you try to use the stick as a Client? Does that work? How does your hostapd configuration look like? Do you use some special feature of hostapd which might cause the problem? What is the output of hostpad?
Try to start hostapd in debug mode:

hostapd -d -v -f <config file>

Regards,
Stefan

Hi @stefan_e.tx,

I am working with the following guide from your developers page.

Connecting to an AP with connman works fine.

The config used is the very basics from the dev page:

interface=wlan0
ssid=access-point
hw_mode=g
channel=1
own_ip_addr=192.168.8.1

The output of hostapd /etc/hostapd.conf is as already posted above:

Configuration file: /etc/hostapd.conf
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn’t started

The same result happens, if I try to start the AP with systemctl:
Result of systemctl status after calling systemctl start hostapd.service.

hostapd.service - Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Loaded: loaded (/lib/systemd/system/hostapd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2022-01-17 13:23:44 UTC; 2s ago
Process: 864 ExecStart=/usr/sbin/hostapd /etc/hostapd.conf -P /run/hostapd.pid -B (code=exited, status=1/FAILURE)

Jan 17 13:23:44 verdin-imx8mp-07012035 hostapd[864]: nl80211: Could not configure driver mode
Jan 17 13:23:44 verdin-imx8mp-07012035 hostapd[864]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Jan 17 13:23:44 verdin-imx8mp-07012035 hostapd[864]: nl80211 driver initialization failed.
Jan 17 13:23:44 verdin-imx8mp-07012035 hostapd[864]: wlan0: interface state UNINITIALIZED->DISABLED
Jan 17 13:23:44 verdin-imx8mp-07012035 hostapd[864]: wlan0: AP-DISABLED
Jan 17 13:23:44 verdin-imx8mp-07012035 hostapd[864]: wlan0: CTRL-EVENT-TERMINATING
Jan 17 13:23:44 verdin-imx8mp-07012035 hostapd[864]: hostapd_free_hapd_data: Interface wlan0 wasn’t started
Jan 17 13:23:44 verdin-imx8mp-07012035 systemd[1]: hostapd.service: Control process exited, code=exited, status=1/FAILURE
Jan 17 13:23:44 verdin-imx8mp-07012035 systemd[1]: hostapd.service: Failed with result ‘exit-code’.
Jan 17 13:23:44 verdin-imx8mp-07012035 systemd[1]: Failed to start Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.

The result of hostapd -d -v -f /etc/hostapd.conf is:

hostapd v2.9
User space daemon for IEEE 802.11 AP management,
IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Copyright (c) 2002-2019, Jouni Malinen j@w1.fi and contributors

Afterwards hostapd exits and no AP is started.

On another note, the WLAN module on the verdin works with this config file in client and AP -mode without problems. So I don’t think it is a configuration problem.

Best regards

Hi @aigF

Sorry I took the wrong man page. I guess it would be:

hostapd -dd -f <config file>

The idea is to have a more verbose output because from the default message I don’t see anything meaningful. Also a dmesg would be interesting, maybe the driver reports something.

Regards,
Stefan

Hi,

Try running iw phy command. In Supported interface modes: you should see * AP mode listed. If it’s not listed, then your driver (not WLAN card) can’t be used to create AP. You may try looking for better driver, which is not easy process.

Edward

Hi @stefan_e.tx ,

Here is the output for hostapd -dd /etc/hostapd.conf (I ommited the -f since it seems like it’s not implemented in this verison of hostapd. Atleast it doesn’t show with the help prompt):

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd.conf
nl80211: TDLS supported
[ 216.860898] RTW: rtw_ndev_notifier_call(wlan0) state:4
nl80211: TDLS external setup
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-14-72:1
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supports Probe Response offload in AP mode
nl80211: TDLS channel switch
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 8 iftype 3 (AP)
nl80211: Failed to set interface 8 to mode 3: -19 (No such device)
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=8 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 8 iftype 2 (STATION)
nl80211: Failed to set interface 8 to mode 2: -19 (No such device)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0xaaaacf358870)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0xaaaacf358870)
wlan0: interface state UNINITIALIZED->DISABLED
hostapd_bss_deinit: deinit bss wlan0
wlan0: AP-DISABLED
hostapd_cleanup(hapd=0xaaaacf359df0 (wlan0))
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn’t started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) → hapd_deinit
hostapd_interface_free(0xaaaacf358870)
hostapd_interface_free: free hapd 0xaaaacf359df0
hostapd_cleanup_iface(0xaaaacf358870)
hostapd_cleanup_iface_partial(0xaaaacf358870)
hostapd_cleanup_iface: free iface=0xaaaacf358870

@Edward
I ran a iw dev and the wlan0 doesn’t even show up.
iw only seems to find the on board wlan on the uap0 interface.

An ifconfig command shows the wlan0 fine thought.

best regards

Hi,

it seems like I missed some flags while building the driver, to properly support AP-mode.
For anyone interessted, you need to add the following to your make configuration, if you are building the LM driver with AP-mode in mind:

EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT

This is documented in the QuickStart_guide_for_SoftAP and not in the Compilation_and_Installation documentation.

Thanks for the help regardless.
Best regards

I meant not iw dev, which shows current operating mode, but iw phy, which lists supported modes. AP must be listed for AP mode.

Some drivers show incomplete/wrong information in iw phy while interface is down. But I haven’t seen yet iw dev not listing WLAN interface at all.

Edward