-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix bugs in nmcli wifi driver #17857
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
Conversation
bde3259
to
5ac5811
Compare
else | ||
/* This assumes the password doesn't contain single quotes */ | ||
snprintf(cmd, sizeof(cmd), | ||
"nmcli dev wifi connect '%s' password '%s'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single quotes in SSIDs would probably be malicious, but generated passwords will contain those in legitimate cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this, but in principle if you pass "nmcli dev wifi connect $'%s' password $'%s'"
then it should be only a matter of replacing each '
with \'
in each the SSID and password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is not super robust, and I'm not very happy with it. I'll come up with something better soon.
- Use the password stored in the connection profile instead of asking each time to the user - `Disconnect` menu item wasn't shown even when connected When entering the Wi-Fi menu first, `nmcli_connection_info` is called with `NULL`. If we return `false` here, the menu doesn't show the `Disconnect` menu item even when the wifi is on and connected. - Don't consider wired connections when checking if the device is connected `cmd_file = popen("nmcli -f NAME c show --active | tail -n+2", "r");` That command returns all active connections, even the wired ones. That means that if the wifi is not connected but we have a wired connection, retroarch shows the Disconnect menu item to disconnect ... a non-existent wifi connection.
5ac5811
to
3637f49
Compare
Description
I'm developing a nixos config for my RPI CM3 handheld.
I've tried using the
nmcli
wifi driver for the user to be able to configure his wifi with the builtin gamepad. However, it wasn't usable in this state.A few bugs here and there, and most importantly, the driver was asking for a password each time one connected to a network. That makes the feature useless IMO. As a user, I'd like to be able to configure my wifi network with a password once, turn off the wifi to save battery and only turn it on when I need. But I really don't want to set the password each time I want to use the wifi. It's already cumbersome enough do it once.
Anyway, I dove into the driver and fixed a few things:
Disconnect
menu item wasn't shown even when connected