Skip to content

Conversation

@dbieber
Copy link
Owner

@dbieber dbieber commented Apr 14, 2025

Summary

  • Replace wpa_supplicant with NetworkManager for WiFi management
  • Add migration script and documentation for existing users

Test plan

  • Test WiFi network configuration through settings UI
  • Test WiFi commands (add, remove, list networks)
  • Test wifi-scan command to scan for available networks
  • Test migration from wpa_supplicant to NetworkManager using the script
  • Verify installation instructions are accurate

Let's move away from wpa_supplicant in favor of NetworkManager and nmcli.

🤖 Generated with Claude Code

dbieber and others added 2 commits April 14, 2025 21:32
- Update WiFi module to use NetworkManager (nmcli) instead of wpa_supplicant
- Update command handlers to work with NetworkManager
- Add a new wifi-scan command to scan for available networks
- Add a new migrate_to_networkmanager.sh script to help with migration
- Update installation instructions and add NetworkManager to dependencies
- Add migration information to README

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
"""Update NetworkManager connections for Go Note Go managed WiFi networks."""
networks = get_networks()
filepath = '/etc/wpa_supplicant/wpa_supplicant.conf'
result = True
Copy link
Owner Author

Choose a reason for hiding this comment

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

remove

# Read the existing config


def get_gonote_managed_connections():
Copy link
Owner Author

Choose a reason for hiding this comment

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

gonotego

with open(filepath, 'r') as f:
config = f.read()
result = subprocess.run(
["nmcli", "-t", "-f", "NAME,TYPE", "connection", "show"],
Copy link
Owner Author

Choose a reason for hiding this comment

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

fix indentation

shell('sudo cp /tmp/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf')
shell('rm /tmp/wpa_supplicant.conf')
cmd = [
"sudo", "nmcli", "connection", "add",
Copy link
Owner Author

Choose a reason for hiding this comment

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

fix indentation (use 4 spaces for hanging indents like these)

return False


def add_open_connection(ssid):
Copy link
Owner Author

Choose a reason for hiding this comment

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

probably better to combine add_open_connection and add_wpa_connection since they're so similar

if ssid in available_networks:
# Try to connect to this network
subprocess.run(
["nmcli", "connection", "up", "id", ssid],
Copy link
Owner Author

Choose a reason for hiding this comment

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

indentation

filepath = '/etc/wpa_supplicant/wpa_supplicant.conf'

if not os.path.exists(filepath):
if not subprocess.run(["test", "-f", filepath], capture_output=True).returncode == 0:
Copy link
Owner Author

Choose a reason for hiding this comment

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

os.path.exists is better than test -f, right?

try:
# Get all wifi connections
result = subprocess.run(
["nmcli", "-t", "-f", "NAME,TYPE", "connection", "show"],
Copy link
Owner Author

Choose a reason for hiding this comment

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

indentation

for conn_name in wifi_connections:
# Get connection details
result = subprocess.run(
["sudo", "nmcli", "--show-secrets", "connection", "show", conn_name],
Copy link
Owner Author

Choose a reason for hiding this comment

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

indentation

installation.md Outdated
sudo apt update
sudo apt upgrade
sudo apt install firefox-esr xvfb portaudio19-dev libatlas-base-dev redis-server espeak rustc python3-dev
sudo apt install firefox-esr xvfb portaudio19-dev libatlas-base-dev redis-server espeak rustc python3-dev network-manager
Copy link
Owner Author

Choose a reason for hiding this comment

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

Leave the installation.md as it was -- we'll update it in a separate pull request

@dbieber dbieber merged commit 3027fc4 into main Apr 14, 2025
2 checks passed
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.

2 participants