meekworth / pylwdrone

Python module to communicate with a lewei camera module.
Apache License 2.0
19 stars 4 forks source link

Set wifi password/security fails #7

Open CharlieTemplar opened 2 years ago

CharlieTemplar commented 2 years ago

Trying to enable wifi security on a eachine drone and set password with: pylwdrone wifi set password PASSW0RD then noticed security was still open so tried to set that:

 pylwdrone config set --wifi-security wpa2_psk
Traceback (most recent call last):
  File "/home/wsl/.local/bin/pylwdrone", line 11, in <module>
    sys.exit(main())
  File "/home/wsl/.local/lib/python3.7/site-packages/pylwdrone/__main__.py", line 25, in main
    ret = args.func(drone, args)
  File "/home/wsl/.local/lib/python3.7/site-packages/pylwdrone/__main__.py", line 103, in _cmd_config_set
    args.wifi_password, args.wifi_security, flip)
  File "/home/wsl/.local/lib/python3.7/site-packages/pylwdrone/lwdrone.py", line 219, in set_config
    raise ValueError('enabling WiFi security requires a password')
ValueError: enabling WiFi security requires a password

So finally tried the same command with password, but that fails

pylwdrone config set --wifi-password PASSW0RD --wifi-security wpa2_psk
failure

Doesn't seem to send a password...?? Any ideas?

request 6c657765695f636d6400250000000000000000000000000000000000000000000000000000000000000000000000

response 6c657765695f636d64002500000000000000000000008c0000000000000000000000000000000000000000000000

response 24000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000df8fffffffffffff0000000000000000000000000000000000563330300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

request 6c657765695f636d64002600000000000000000000008c00000000000000000000000000000000000000000000002400010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

response 6c657765695f636d6400260000000702000000000000000000000000000000000000000000000000000000000000

hieyou1 commented 2 years ago

Looking into this right now. In the meantime, could you please provide pylwdrone config get with sensitive credentials censored out? Thanks!

hieyou1 commented 2 years ago

Could you maybe also try pylwdrone wifi set password \<password> --wifi-security wpa2_psk? Might give same response but worth a shot before going into more complex debug

CharlieTemplar commented 2 years ago
pylwdrone config get
Camera flip:    up
WiFi Channel:   36
WiFi Security:  open
WiFi Name:
WiFi Password:  PASSW0RD
SD card ready:  False
SD card size:   0 MiB
SD card free:   0 MiB
Version:        V300
Current time:   1970-01-01 01:00:00
success
pylwdrone wifi set password PASSW0RD --wifi-security wpa2_psk
usage: pylwdrone [-h] [--ip IP] [--command-port PORT] [--stream-port PORT]
                 [-q] [-v]
                 ...
pylwdrone: error: unrecognized arguments: --wifi-security wpa2_psk
hieyou1 commented 2 years ago

Hmm, interesting that there is no Wi-Fi name. Try setting that before setting password?

CharlieTemplar commented 2 years ago

assumed that wifi name was same as ssid and that blank meant use default, but that doesn't change. like all wifi settings config set doesn't work. is there a way to enable security with the wifi set command?

pylwdrone config set --wifi-name drone1
failure
pylwdrone wifi set name drone1
success
pylwdrone config set --wifi-password PASSW0RD --wifi-security wpa2_psk
failure
pylwdrone config get
Camera flip:    up
WiFi Channel:   36
WiFi Security:  open
WiFi Name:      drone1
WiFi Password:  PASSW0RD
SD card ready:  False
SD card size:   0 MiB
SD card free:   0 MiB
Version:        V300
Current time:   1970-01-01 01:00:00
CharlieTemplar commented 2 years ago

what do the packets of successful config set --wifi-security look like?

CharlieTemplar commented 2 years ago

5Ghz wifi on this drone, the channel command is incorrect and probably different format which probably the reason the config set wifi commands fail. :(

pylwdrone wifi set channel 36
usage: pylwdrone wifi set channel [-h] CHAN
pylwdrone wifi set channel: error: argument CHAN: invalid choice: 36 (choose from 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)

Where did the command structure come from used in the code here?