Skip to content

Wireless: fix potential double entries in station list#2084

Merged
limetech merged 11 commits into
unraid:masterfrom
bergware:master
Mar 25, 2025
Merged

Wireless: fix potential double entries in station list#2084
limetech merged 11 commits into
unraid:masterfrom
bergware:master

Conversation

@bergware

@bergware bergware commented Mar 24, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Enhanced Wi-Fi scan results processing to provide a comprehensive list of available networks with detailed attributes.
    • Added frequency band information (2.4G, 5G, 6G) to wireless network display for improved understanding of connection quality.
    • Updated wireless network information retrieval to include additional details such as frequency and bitrate, enhancing the user experience.
    • Introduced error handling for connection status checks to improve reliability.

@coderabbitai

coderabbitai Bot commented Mar 24, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request updates the scanWifi($port) function within emhttp/plugins/dynamix/include/Wireless.php to enhance the processing of Wi-Fi scan results by including frequency information and modifying the loop structure. The return value now provides a comprehensive $wlan array. Additionally, the port function in emhttp/plugins/dynamix/include/NetworkInfo.php is updated to include frequency details, improving the output with band categorization based on the frequency ranges.

Changes

File Change Summary
emhttp/plugins/dynamix/include/Wireless.php Modified scanWifi($port): Enhanced processing of scan results with frequency info, changed loop structure, and updated return value to a comprehensive $wlan array. Added error handling. Added function array_ssid(&$key, &$ssid). Updated saveWifi(): Changed attribute assignment to indexed keys. Updated saveAttr(): Adjusted handling of $wlan array.
emhttp/plugins/dynamix/include/NetworkInfo.php Updated port function: Now retrieves and displays frequency along with SSID, signal, and bitrate; modified parsing logic and added categorization for wireless bands based on frequency.

Possibly related PRs

  • Network: fix regression errors #2051: The changes in the main PR to the scanWifi($port) function in Wireless.php are directly related to the modifications in the saveAttr() function from the retrieved PR, as both involve adjustments to how attributes are assigned and handled within the $wlan array.
  • Wireless support - fine tuning #2002: The changes in the main PR regarding the restructuring of the scanWifi($port) function and the handling of the $wlan array are related to the modifications in the retrieved PR that enhance the handling of wireless interfaces, specifically through the inclusion of wlan in network checks and configurations.

Poem

I'm a rabbit hopping with glee,
Code updates set my spirit free.
Scanning Wi-Fi with a brand new twist,
Unique SSIDs now can’t be missed.
In code we trust, in hops we sing—
A merry update, let the bytes ring!
🐇🎶


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 2437620 and e87172d.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/include/NetworkInfo.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/include/NetworkInfo.php

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e5c0dac and 75a522a.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/include/Wireless.php (2 hunks)

Comment thread emhttp/plugins/dynamix/include/Wireless.php Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between d92a07c and f171b47.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/include/Wireless.php (4 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
emhttp/plugins/dynamix/include/Wireless.php (1)
emhttp/plugins/dynamix/include/NetworkInfo.php (1)
  • port (23-28)
🔇 Additional comments (6)
emhttp/plugins/dynamix/include/Wireless.php (6)

38-38: Improved scan command with better output formatting.

The command now includes frequency information in the scan results and uses sed to format the output into a more processable form. This is a good improvement as it enriches the network data.


39-51: Enhanced network processing with better deduplication.

The new approach effectively addresses the previous duplicate entries issue by:

  1. Using network names as array keys (inherent deduplication)
  2. Adding validation to skip incomplete entries and null networks
  3. Properly grouping frequency information for the same network

This implementation fixes the issue identified in the past review where array_column($scan, 'ssid') was being applied to raw text output.


98-102: Added error handling for file operations.

Good addition of a try-catch block for reading the carrier file, which prevents potential exceptions from breaking the UI if the file is inaccessible.


107-112: Updated attribute handling for consistency.

The attribute handling has been updated to work with the new array structure, ensuring consistency with the changes made to the scanWifi function.


178-178: Added frequency information to form.

The hidden field for ATTR4 has been added to store the frequency information, which aligns with the changes to include frequency data in the network scanning process.


53-53:

Details

❓ Verification inconclusive

Return value change - verify downstream impacts.

The function now returns the $wlan array instead of the filtered $scan array, which has a different structure. Ensure all code that calls this function is updated to handle the new return format.


🏁 Script executed:

#!/bin/bash
# Find all calls to scanWifi function to verify they handle the new return format
rg -A 3 -B 3 "scanWifi\(" --type php

Length of output: 1104


Attention: Verify Downstream Handling of New Return Format

The scanWifi function now returns the $wlan array (with its updated structure) rather than the previously filtered $scan array. Our search indicates that the only call to scanWifi is the internal (recursive) usage within emhttp/plugins/dynamix/include/Wireless.php. Please confirm that this recursive call—and any other potential downstream consumers—are properly adjusted to work with the new structure of $wlan.

  • Verify that the processing logic in the internal recursive call (around line 53 in Wireless.php) correctly handles the structure of $wlan.
  • Ensure that future external calls (if any) are also updated to accommodate the change in return value.

Comment thread emhttp/plugins/dynamix/include/Wireless.php
@limetech limetech merged commit 35c65c8 into unraid:master Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants