|
7 | 7 |
|
8 | 8 | #include <zephyr/logging/log.h>
|
9 | 9 | #include <zephyr/sys/__assert.h>
|
10 |
| -#include <nwp.h> |
| 10 | +#include <zephyr/version.h> |
11 | 11 |
|
| 12 | +#include <nwp.h> |
12 | 13 | #include "siwx91x_wifi.h"
|
13 | 14 | #include "siwx91x_wifi_socket.h"
|
14 | 15 |
|
|
20 | 21 | #include "sl_wifi.h"
|
21 | 22 | #include "sl_net.h"
|
22 | 23 |
|
23 |
| -#define SIWX91X_INTERFACE_MASK (0x03) |
| 24 | +#define SIWX91X_DRIVER_VERSION KERNEL_VERSION_STRING |
24 | 25 |
|
25 | 26 | LOG_MODULE_REGISTER(siwx91x_wifi);
|
26 | 27 |
|
@@ -722,6 +723,36 @@ static int siwx91x_stats(const struct device *dev, struct net_stats_wifi *stats)
|
722 | 723 | }
|
723 | 724 | #endif
|
724 | 725 |
|
| 726 | +static int siwx91x_get_version(const struct device *dev, struct wifi_version *params) |
| 727 | +{ |
| 728 | + sl_wifi_firmware_version_t fw_version = { }; |
| 729 | + struct siwx91x_dev *sidev = dev->data; |
| 730 | + static char fw_version_str[32]; |
| 731 | + sl_status_t status; |
| 732 | + |
| 733 | + __ASSERT(params, "params cannot be NULL"); |
| 734 | + |
| 735 | + if (sidev->state == WIFI_STATE_INTERFACE_DISABLED) { |
| 736 | + return -EIO; |
| 737 | + } |
| 738 | + |
| 739 | + status = sl_wifi_get_firmware_version(&fw_version); |
| 740 | + if (status != SL_STATUS_OK) { |
| 741 | + return -EINVAL; |
| 742 | + } |
| 743 | + |
| 744 | + snprintf(fw_version_str, sizeof(fw_version_str), "%02x%02x.%d.%d.%d.%d.%d.%d", |
| 745 | + fw_version.chip_id, fw_version.rom_id, |
| 746 | + fw_version.major, fw_version.minor, |
| 747 | + fw_version.security_version, fw_version.patch_num, |
| 748 | + fw_version.customer_id, fw_version.build_num); |
| 749 | + |
| 750 | + params->fw_version = fw_version_str; |
| 751 | + params->drv_version = SIWX91X_DRIVER_VERSION; |
| 752 | + |
| 753 | + return 0; |
| 754 | +} |
| 755 | + |
725 | 756 | static void siwx91x_iface_init(struct net_if *iface)
|
726 | 757 | {
|
727 | 758 | struct siwx91x_dev *sidev = iface->if_dev->dev->data;
|
@@ -768,6 +799,7 @@ static const struct wifi_mgmt_ops siwx91x_mgmt = {
|
768 | 799 | #if defined(CONFIG_NET_STATISTICS_WIFI)
|
769 | 800 | .get_stats = siwx91x_stats,
|
770 | 801 | #endif
|
| 802 | + .get_version = siwx91x_get_version, |
771 | 803 | };
|
772 | 804 |
|
773 | 805 | static const struct net_wifi_mgmt_offload siwx91x_api = {
|
|
0 commit comments