Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QT zephyr build fixes #11941

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/oss-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
uses: nrfconnect/action-oss-history@main
with:
workspace: 'ncs'
args: -p zephyr -p mcuboot -p hostap
args: -p zephyr -p mcuboot -p hostap -p wfa-qt-control-app
15 changes: 15 additions & 0 deletions samples/wifi/wfa_qt_app/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2023 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

source "Kconfig.zephyr"

menu "Nordic WFA QT sample"

config NET_CONFIG_USB_IPV4_ADDR
string "USB IPv4 address"
help
Static IPv4 address for USB interface
endmenu
13 changes: 13 additions & 0 deletions samples/wifi/wfa_qt_app/overlay-netusb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# USB Device settings
CONFIG_USB_DEVICE_STACK=y

# Select USB Configurations
CONFIG_USB_DEVICE_NETWORK_ECM=y

# Logging
CONFIG_USB_DRIVER_LOG_LEVEL_INF=y
CONFIG_USB_DEVICE_LOG_LEVEL_INF=y
# Number of IPv4 enabled network interfaces
CONFIG_NET_IF_MAX_IPV4_COUNT=2
CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2
CONFIG_NET_CONFIG_USB_IPV4_ADDR="192.0.2.1"
5 changes: 5 additions & 0 deletions samples/wifi/wfa_qt_app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_WFA_QT_CONTROL_APP=y
# Ideally this has to be done in the QT module, but we already override this in the
# hostap module (7), so, hostap will override QT module's settings, so, we have to
# override hostap's settings here.
CONFIG_POSIX_MAX_FDS=10

# WPA supplicant
CONFIG_WPA_SUPP=y
Expand Down Expand Up @@ -79,6 +83,7 @@ CONFIG_DEVICE_SHELL=y
CONFIG_POSIX_CLOCK=y
CONFIG_DATE_SHELL=y
CONFIG_NET_CONFIG_AUTO_INIT=n
CONFIG_NET_CONFIG_SETTINGS=y

CONFIG_WIFI_MGMT_EXT=y
CONFIG_WIFI_CREDENTIALS=y
Expand Down
70 changes: 70 additions & 0 deletions samples/wifi/wfa_qt_app/src/qt_app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,61 @@
#include <zephyr/device.h>
#include <zephyr/net/net_config.h>

#ifdef CONFIG_USB_DEVICE_STACK
#include <zephyr/usb/usb_device.h>

int init_usb(void)
{
int ret;

ret = usb_enable(NULL);
if (ret != 0) {
printk("Cannot enable USB (%d)", ret);
return ret;
}

return 0;
}
#endif /* CONFIG_USB_DEVICE_STACK */

int main(void)
{
struct in_addr addr;

#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
/* For now hardcode to 128MHz */
nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK,
NRF_CLOCK_HFCLK_DIV_1);
#endif
printk("Starting %s with CPU frequency: %d MHz\n", CONFIG_BOARD, SystemCoreClock/MHZ(1));

#ifdef CONFIG_USB_DEVICE_STACK
init_usb();
krish2718 marked this conversation as resolved.
Show resolved Hide resolved
/* Redirect static IP address to netusb*/
const struct device *usb_dev = device_get_binding("eth_netusb");
struct net_if *iface = net_if_lookup_by_dev(usb_dev);

if (!iface) {
printk("Cannot find network interface: %s", "eth_netusb");
return -1;
}
if (sizeof(CONFIG_NET_CONFIG_USB_IPV4_ADDR) > 1) {
D-Triveni marked this conversation as resolved.
Show resolved Hide resolved
if (net_addr_pton(AF_INET, CONFIG_NET_CONFIG_USB_IPV4_ADDR, &addr)) {
printk("Invalid address: %s", CONFIG_NET_CONFIG_USB_IPV4_ADDR);
return -1;
}
net_if_ipv4_addr_add(iface, &addr, NET_ADDR_MANUAL, 0);
}
if (sizeof(CONFIG_NET_CONFIG_MY_IPV4_NETMASK) > 1) {
/* If not empty */
if (net_addr_pton(AF_INET, CONFIG_NET_CONFIG_MY_IPV4_NETMASK, &addr)) {
printk("Invalid netmask: %s", CONFIG_NET_CONFIG_MY_IPV4_NETMASK);
} else {
net_if_ipv4_set_netmask(iface, &addr);
}
}
#endif /* CONFIG_USB_DEVICE_STACK */

#ifdef CONFIG_NET_CONFIG_SETTINGS
/* Without this, DHCPv4 starts on first interface and if that is not Wi-Fi or
* only supports IPv6, then its an issue. (E.g., OpenThread)
Expand All @@ -33,6 +79,30 @@ int main(void)
*/
/* TODO: Replace device name with DTS settings later */
const struct device *dev = device_get_binding("wlan0");
struct net_if *wifi_iface = net_if_lookup_by_dev(dev);

if (!wifi_iface) {
printk("Cannot find network interface: %s", "wlan0");
return -1;
}
if (sizeof(CONFIG_NET_CONFIG_MY_IPV4_ADDR) > 1) {
if (net_addr_pton(AF_INET, CONFIG_NET_CONFIG_MY_IPV4_ADDR, &addr)) {
printk("Invalid address: %s", CONFIG_NET_CONFIG_MY_IPV4_ADDR);
return -1;
}
net_if_ipv4_addr_add(wifi_iface, &addr, NET_ADDR_MANUAL, 0);
}
if (sizeof(CONFIG_NET_CONFIG_MY_IPV4_NETMASK) > 1) {
/* If not empty */
if (net_addr_pton(AF_INET, CONFIG_NET_CONFIG_MY_IPV4_NETMASK, &addr)) {
printk("Invalid netmask: %s", CONFIG_NET_CONFIG_MY_IPV4_NETMASK);
} else {
net_if_ipv4_set_netmask(wifi_iface, &addr);
}
}
krish2718 marked this conversation as resolved.
Show resolved Hide resolved

/* As both are Ethernet, we need to set specific interface*/
net_if_set_default(wifi_iface);

net_config_init_app(dev, "Initializing network");
#endif
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ manifest:
ncs:
upstream-url: https://github.com/Wi-FiQuickTrack/Wi-FiQuickTrack-ControlAppC
upstream-sha: 1225729e8d84075f03bf9fc51eee85d84dfb0091
compare-by-default: false
compare-by-default: true
- name: mcuboot
repo-path: sdk-mcuboot
revision: 54319b44950463936e75b4cf898ba5222083a497
Expand Down
Loading