ccimx6ul: Add P2P support

This commit adds a wpa supplicant P2P configuration file and configures
the p2p0 interface automatically at pre-up.

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2017-01-18 12:54:14 +01:00
parent 0bb2cb005d
commit 5d332c7800
5 changed files with 44 additions and 1 deletions

View File

@ -38,6 +38,8 @@ ETH1_STATIC_NETMASK ?= "255.255.255.0"
WLAN0_MODE ?= "static"
WLAN0_STATIC_IP ?= "192.168.43.30"
WLAN0_STATIC_NETMASK ?= "255.255.255.0"
P2P0_STATIC_IP ?= "192.168.45.30"
P2P0_STATIC_NETMASK ?= "255.255.255.0"
# Digi BSP default settings
IMAGE_CLASSES = "image_types_digi"

View File

@ -0,0 +1,8 @@
ctrl_interface=/var/run/wpa_supplicant
update_config=1
device_name=ccimx6ul-p2p
manufacturer=QCA
model_name=McK
device_type=1-0050F204-1
config_methods=display keypad push_button
persistent_reconnect=1

View File

@ -4,4 +4,10 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
PACKAGECONFIG ?= "openssl"
SRC_URI_append_ccimx6ul = "file://wpa_supplicant_p2p.conf"
do_install_append_ccimx6ul() {
install -m 600 ${WORKDIR}/wpa_supplicant_p2p.conf ${D}${sysconfdir}/wpa_supplicant_p2p.conf
}
PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -0,0 +1,10 @@
# WiFi P2P interface
#auto ##WLAN_P2P_INTERFACE##
iface ##WLAN_P2P_INTERFACE## inet static
address ##P2P0_STATIC_IP##
netmask ##P2P0_STATIC_NETMASK##
gateway ##P2P0_STATIC_GATEWAY##
dns-nameservers ##P2P0_STATIC_DNS##
wpa-driver ##WPA_DRIVER##
wpa-conf /etc/wpa_supplicant_p2p.conf

View File

@ -13,6 +13,7 @@ SRC_URI_append = " \
file://interfaces.eth1.dhcp \
file://interfaces.wlan0.static \
file://interfaces.wlan0.dhcp \
file://interfaces.p2p \
file://interfaces.cellular \
file://resolv \
"
@ -26,7 +27,15 @@ do_install_append() {
# Create 'interfaces' file dynamically
cat ${WORKDIR}/interfaces.eth0.${ETH0_MODE} >> ${D}${sysconfdir}/network/interfaces
[ -n "${HAVE_SECOND_ETH}" ] && cat ${WORKDIR}/interfaces.eth1.${ETH1_MODE} >> ${D}${sysconfdir}/network/interfaces
[ -n "${HAVE_WIFI}" ] && cat ${WORKDIR}/interfaces.wlan0.${WLAN0_MODE} >> ${D}${sysconfdir}/network/interfaces
if [ -n "${HAVE_WIFI}" ]; then
cat ${WORKDIR}/interfaces.wlan0.${WLAN0_MODE} >> ${D}${sysconfdir}/network/interfaces
if [ -n "${WLAN_P2P_INTERFACE}" ]; then
cat ${WORKDIR}/interfaces.p2p >> ${D}${sysconfdir}/network/interfaces
[ -n "${WLAN_P2P_AUTO}" ] && sed -i -e 's/^#auto ##WLAN_P2P_INTERFACE##/auto ##WLAN_P2P_INTERFACE##/g' ${D}${sysconfdir}/network/interfaces
sed -i -e 's,##WLAN_P2P_INTERFACE##,${WLAN_P2P_INTERFACE},g' ${D}${sysconfdir}/network/interfaces
fi
fi
cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces
# Remove config entries if corresponding variable is not defined
@ -42,6 +51,10 @@ do_install_append() {
[ -z "${WLAN0_STATIC_GATEWAY}" ] && sed -i -e "/##WLAN0_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces
[ -z "${WLAN0_STATIC_IP}" ] && sed -i -e "/##WLAN0_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces
[ -z "${WLAN0_STATIC_NETMASK}" ] && sed -i -e "/##WLAN0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces
[ -z "${P2P0_STATIC_DNS}" ] && sed -i -e "/##P2P0_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces
[ -z "${P2P0_STATIC_GATEWAY}" ] && sed -i -e "/##P2P0_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces
[ -z "${P2P0_STATIC_IP}" ] && sed -i -e "/##P2P0_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces
[ -z "${P2P0_STATIC_NETMASK}" ] && sed -i -e "/##P2P0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces
# Cellular interface
if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then
@ -94,5 +107,9 @@ do_install_append() {
sed -i -e "s,##WLAN0_STATIC_NETMASK##,${WLAN0_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces
sed -i -e "s,##WLAN0_STATIC_GATEWAY##,${WLAN0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces
sed -i -e "s,##WLAN0_STATIC_DNS##,${WLAN0_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces
sed -i -e "s,##P2P0_STATIC_IP##,${P2P0_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces
sed -i -e "s,##P2P0_STATIC_NETMASK##,${P2P0_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces
sed -i -e "s,##P2P0_STATIC_GATEWAY##,${P2P0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces
sed -i -e "s,##P2P0_STATIC_DNS##,${P2P0_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces
sed -i -e "s,##WPA_DRIVER##,${WPA_DRIVER},g" ${D}${sysconfdir}/network/interfaces
}