Skip to content
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

Couldn't flash device #12

Open
hungpr0 opened this issue Jan 22, 2019 · 7 comments
Open

Couldn't flash device #12

hungpr0 opened this issue Jan 22, 2019 · 7 comments

Comments

@hungpr0
Copy link

hungpr0 commented Jan 22, 2019

root@orangepiplus:~/TuyOTA# ./tuyota.pl -ip 192.168.2.82 -s myWiFi -p mypassword
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 13343
Redirecting device 192.168.2.82 to use Access Point ZAGDU-789
**** Redirect appears successful
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address

The script freezes there for

I use orange pi Plus 2 with armbian ubuntu 18.04. I already kill wpa_supplicant process. I also make sure that I did't open tuya app on my mobile devices. Homeassistant instance was also stopped
192.168.2.82 is IP address when my 3 gangs wifi switch connects to myWiFi network.
the orange pi box is on the same network of 192.168.2.82. I couldn't find dhcpd on my OS. Is that maybe issue? I also have my DHCP service on my router on 192.168.2.x network. Do I need to disable it or something?
When the script froze and stopped at that. The led on my 3 gangs wifi switch indicated that it is working with static green led. Flashing green led is connecting/searching wifi. Gang is turned on: red led, gang is turned off: blue led. Since the device is at static green led, I need to hold the button for 20 seconds to reset it, I then can add it to tuya app.
Device info: https://www.aliexpress.com/item/Alexa-compatible-Tuya-smart-life-app-control-WiFi-light-switch-US-touch-and-remote-control-switches/32950455100.html?spm=a2g0s.8937460.0.0.5fd52e0ex3dPme
Thanks for help or let me know step to debug.

@SynAckFin
Copy link
Owner

Can you run the script again and in a second terminal ping the device while the script is running?
You should see the pings stop after the following appears in the output.

Redirecting device 192.168.2.82 to use Access Point ZAGDU-789
**** Redirect appears successful

That would mean the device has been successfully redirected to the ZAGDU-789 access point and that the problem might be with the access point.
If that is the case then run the following without the script running:

hostapd hostapd.conf

Then try connecting to ZAGDU-789 with your phone. This will fail, but the output from the hostapd command will tell me something.
You should see something like this:

wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED 
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED xx:xx:xx:xx:xx:xx
wlan0: STA xx:xx:xx:xx:xx:xx RADIUS: starting accounting session 07EB2952226E564D
wlan0: STA xx:xx:xx:xx:xx:xx WPA: pairwise key handshake completed (RSN)

You don't need to have DHCP or DNS servers running on the machine the script runs on because it has its own cut down DHCP server built in.

@hungpr0
Copy link
Author

hungpr0 commented Jan 23, 2019

Thanks SynAckFin

I have just tried
root@orangepiplus: /TuyOTA# cat hostapd.conf
interface=wlan0
wpa=2
ssid=ZAGDU-789
wpa_passphrase=un49fqxc
hw_mode=g
channel=1
root@orangepiplus:~/TuyOTA# hostapd hostapd.conf
Configuration file: hostapd.conf

Using interface wlan0 with hwaddr 28:f3:66:b6:10:ce and ssid "ZAGDU-789"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: disassociated

Both of my phone can't connect to the ZP ZAGDU-789. It said incorrect password although I make sure that it is un49fqxc. Tried to change to password but it had the same result. I will recheck this.

@SynAckFin
Copy link
Owner

If you comment out the wpa=2 and wpa_passphrase=un49fqxc lines with a # then the access point wont require a password

@hungpr0
Copy link
Author

hungpr0 commented Jan 23, 2019

Thanks. I tried to comment out those 2 lines but my phones still ask for password!. I tried to rename the SSID to make sure it using the current config file.
interface=wlan0
#wpa=2
ssid=ZAGDU-7890
#wpa_passphrase=un49fqxc
hw_mode=g
channel=3

@hungpr0
Copy link
Author

hungpr0 commented Jan 23, 2019

root@orangepiplus:~/TuyOTA# hostapd -d ./hostapd.conf
random: Trying to read entropy from /dev/random
Configuration file: ./hostapd.conf
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Using driver-based off-channel TX
nl80211: Supported vendor command: vendor_id=0xe04c subcmd=1
nl80211: Supported vendor command: vendor_id=0x1a11 subcmd=4106
nl80211: Supported vendor command: vendor_id=0x1a11 subcmd=4107
nl80211: Supported vendor event: vendor_id=0xe04c subcmd=0
nl80211: Supported vendor event: vendor_id=0xe04c subcmd=1
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 4 iftype 3 (AP)
nl80211: Setup AP(wlan0) - device_ap_sme=1 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x1b3e370 (device SME)
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=04
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=0501
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=0504
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=08
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=0a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=11
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=7f
nl80211: Enable Probe Request reporting nl_preq=0x1b39548
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x1b39548 match=
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: Add own interface ifindex 4 (ifidx_reason -1)
nl80211: if_indices[16]: 4(-1)
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR)
nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
Completing interface initialization
Mode: IEEE 802.11g Channel: 3 Frequency: 2422 MHz
DFS 0 channels required radar detection
nl80211: Set freq 2422 (ht_enabled=0, vht_enabled=0, bandwidth=20 MHz, cf1=2422 MHz, cf2=0 MHz)

  • freq=2422
  • vht_enabled=0
  • ht_enabled=0
  • channel_type=0
    RATE[0] rate=10 flags=0x1
    RATE[1] rate=20 flags=0x1
    RATE[2] rate=55 flags=0x1
    RATE[3] rate=110 flags=0x1
    RATE[4] rate=60 flags=0x0
    RATE[5] rate=90 flags=0x0
    RATE[6] rate=120 flags=0x0
    RATE[7] rate=180 flags=0x0
    RATE[8] rate=240 flags=0x0
    RATE[9] rate=360 flags=0x0
    RATE[10] rate=480 flags=0x0
    RATE[11] rate=540 flags=0x0
    hostapd_setup_bss(hapd=0x1b383f0 (wlan0), first=1)
    wlan0: Flushing old station entries
    nl80211: flush -> DEL_STATION wlan0 (all)
    wlan0: Deauthenticate all stations
    nl80211: sta_remove -> DEL_STATION wlan0 ff:ff:ff:ff:ff:ff --> -22 (Invalid argument)
    wpa_driver_nl80211_set_key: ifindex=4 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
    wpa_driver_nl80211_set_key: ifindex=4 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
    wpa_driver_nl80211_set_key: ifindex=4 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
    wpa_driver_nl80211_set_key: ifindex=4 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
    Using interface wlan0 with hwaddr 28:f3:66:b6:10:ce and ssid "ZAGDU-7890"
    nl80211: Set beacon (beacon_set=0)
    nl80211: Beacon head - hexdump(len=61): 80 00 00 00 ff ff ff ff ff ff 28 f3 66 b6 10 ce 28 f3 66 b6 10 ce 00 00 00 00 00 00 00 00 00 00 64 00 01 04 00 0a 5a 41 47 44 55 2d $
    7 38 39 30 01 08 82 84 8b 96 0c 12 18 24 03 01 03
    nl80211: Beacon tail - hexdump(len=9): 2a 01 04 32 04 30 48 60 6c
    nl80211: ifindex=4
    nl80211: beacon_int=100
    nl80211: dtim_period=2
    nl80211: ssid - hexdump_ascii(len=10):
    5a 41 47 44 55 2d 37 38 39 30 ZAGDU-7890
  • beacon_int=100
  • dtim_period=2
    nl80211: hidden SSID not in use
    nl80211: privacy=0
    nl80211: auth_algs=0x3
    nl80211: wpa_version=0x0
    nl80211: key_mgmt_suites=0x4
    nl80211: pairwise_ciphers=0x0
    nl80211: group_cipher=0x1
    nl80211: Set wlan0 operstate 0->1 (UP)
    netlink: Operstate: ifindex=4 linkmode=-1 (no change), operstate=6 (IF_OPER_UP)
    Failed to set TX queue parameters for queue 0.
    Failed to set TX queue parameters for queue 1.
    Failed to set TX queue parameters for queue 2.
    Failed to set TX queue parameters for queue 3.
    wlan0: interface state UNINITIALIZED->ENABLED
    wlan0: AP-ENABLED
    wlan0: Setup of interface done.
    ctrl_iface not configured!
    random: Got 20/20 bytes from /dev/random

@SynAckFin
Copy link
Owner

Thanks. I tried to comment out those 2 lines but my phones still ask for password!. I tried to rename the SSID to make sure it using the current config file.
interface=wlan0
#wpa=2
ssid=ZAGDU-7890
#wpa_passphrase=un49fqxc
hw_mode=g
channel=3

I'm surprised at the phone asking for a password. Type in any password it should still connect to the access point and then fail to get an IP.

@hungpr0
Copy link
Author

hungpr0 commented Jan 23, 2019

Thanks. I tried to comment out those 2 lines but my phones still ask for password!. I tried to rename the SSID to make sure it using the current config file.
interface=wlan0
#wpa=2
ssid=ZAGDU-7890
#wpa_passphrase=un49fqxc
hw_mode=g
channel=3

I'm surprised at the phone asking for a password. Type in any password it should still connect to the access point and then fail to get an IP.

Same problem with default AP ARMBIAN armbian-config command line. Password is incorrect. Not sure if it is hardware issue or not...

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

No branches or pull requests

2 participants