2020-11-03 05:34 PM
Hello Guys.
I am using STM32MP157C-DK2 and st-image-core.
Looking at the st-image-weston and wiki Page, I am configuring the hotspot mode to be available in my image.
First, while looking at the wiki page and st-image-weston, I composed a script that uses the following command.
(/usr/sbin/hostapd /etc/hostapd.conf -P /run/hostapd.pid -B)
I created systemd because there is no response from the installed hostapd systemd.
Next, I made systemd execute my script.
However, the hotspot mode did not work.
If I run the script directly from the terminal or crontab, hotspot mode operates normally as shown below.
---------------------------------------------------------------
Configuration file: /etc/hostapd.conf
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr 10:98:c3:63:a7:e3 and ssid "HSGT_SsgRk4hU"
random: Only 19/20 bytes of strong random data available
random: Not enough entropy pool available for secure operations
WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
wlan0 Link encap:Ethernet HWaddr 10:98:C3:63:A7:E3
inet addr:192.168.72.1 Bcast:192.168.72.255 Mask:255.255.255.0
inet6 addr: fe80::1298:c3ff:fe63:a7e3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:197392 (192.7 KiB)
---------------------------------------------------------------
However, if I run it from systemd, it will not run with the following message.
----------------------------------------------------------------
Could not set channel for kernel driver
Interface initialization failed
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: Unable to setup interface.
wlan0: interface state DISABLED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
----------------------------------------------------------------
Or, it appears as if it succeeded as below, but it is not actually applied in ifconfig.
----------------------------------------------------------------
current no hotspot mode -> hotspot start
Configuration file: /etc/hostapd.conf
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr 10:98:c3:63:a7:e3 and ssid "HSGT_SsgRk4hU"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
Hotspot mode start success
wlan0 Link encap:Ethernet HWaddr 10:98:C3:63:A7:E3
inet6 addr: fe80::1298:c3ff:fe63:a7e3/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1289 (1.2 KiB)
----------------------------------------------------------------
How can I solve this problem? Can't I run it with the commands listed above?
If there is any other way, please let me know.
In addition, the script I configured is composed as follows.
It is designed to simply search for IP and execute the command if it does not exist.
-----------------------------------------------------------------
#!/bin/sh
status=`/sbin/ifconfig | grep 192.168.72.1 | wc -l`
if [ $status -gt 0 ]
then
echo "current hotspot mode -> skip"
else
echo "no hotspot mode -> hotspot start"
/usr/sbin/hostapd /etc/hostapd.conf -P /run/hostapd.pid -B > /home/root/result.txt
status_again=`/sbin/ifconfig | grep 192.168.72.1 | wc -l`
if [ $status_again -gt 0 ]
then
echo "Hotspot mode start success"
else
echo "Hotspot mode start fail"
fi
fi
-----------------------------------------------------------------
thanks
2020-11-25 01:50 AM
Hi @SPark.15 ,
I think you don't need to create a new service that manages hostapd, as hostapd service already does the job. You only need to update /etc/default/hostapd according with your needs, and restart the related services.
I would recommand to have a look into st-hotspot-wifi-service.sh script which already manage this (on target : /usr/local/demo/bin)
Please also cross-check that the network file is correct :
root@stm32mp1:~# networkctl status wlan0
Link File: /lib/systemd/network/99-default.link
Network File: /lib/systemd/network/hostapd.network
BR,
Christophe
2020-12-17 05:34 PM
I understood what you say. I check that script you said(st-hotspot-wifi-service.sh).
I understood that after updating hostapd.network as I want, And restart the hostapd service.
I try that you recommend.
Thank you for your help