Author Topic: Issues with changing Wifi?  (Read 11631 times)

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Issues with changing Wifi?
« Reply #15 on: August 23, 2016, 11:21:14 pm »
Hmmm... my memory had 1.0.2 being the version that was pulled offline (along with 1.03 and 1.04).

v1.0.1 was the version that introduced manual mode. (but was otherwise only a minor tweak of v1.0.0). This was the best and most stable release until v1.0.5 came out about 6 weeks ago (which fixes some particle cloud bugs which had been there through the earlier stable releases and is also the first stable release of OakTerm).

The other version numbering though makes it all very confusing! This is especially true if we really did have two firmwares versions both reporting themselves as "System Version 6" (eg v1.0.0 and v1.0.1 - is that true? or was v1.0.1 called "System Version 7"?).

Even more confusing if we now have v1.0.5 is using "System Version 5" in some places!!! (although I think that is meant to be less confusing as it is intended to be reported as Major version 10, Minor Version 5 maybe?)

But I digress... back to the topic on-hand:


I think you got me on that one... it was 1.0.2 and 1.0.3 that were pulled, and we reverted to 1.0.1. Thanks for the reminder... need to keep my story straight!  ;)

There weren't any changes to particle_globals.h between 1.0.0 and 1.0.2 (with 1.0.2 changing the OAK_SYSTEM_VERSION_INTEGER from 6 to 7, and OAK_SYSTEM_VERSION_RELEASE from 0 to 2), so FWIW, it appears 1.0.0 and 1.0.1 would both report as system version 6 or fw 1.0.0.

I appear to have misread the system version flag when previously trying to work out why 1.0.5 reports as version 10 - tracing back through the code in particle_core.cpp, it appears that any reference to system version will respond with the OAK_SYSTEM_VERSION_INTEGER, and that is what SoftAP requests, so whilst a query to 192.168.0.1/info will return 1.0.5 as the version string, the system version will be the integer, and is the version shown at the bottom of the wifi config screen. Phew! So basically there are two verson strings - the integer one, and the major.minor.release one. Think that little titbit needs to go on the wiki firmware release table thingy.

emardee

  • Full Member
  • ***
  • Posts: 135
Re: Issues with changing Wifi?
« Reply #16 on: August 23, 2016, 11:32:35 pm »
I've had that table open for editing already for a the last half hour or so! (It is quite a major overhaul in line with the things we discussed previously!)

Edit:  To save this thread from de-railing, I've taken the Firmware discussion back to the Firmware Discussion Thread. I've just posted a major update to the Wiki Table. (Hopefully we weren't editing it at the same time!)
« Last Edit: August 23, 2016, 11:44:28 pm by emardee »

kh

  • Jr. Member
  • **
  • Posts: 64
  • OakTerm developer
Re: Issues with changing Wifi?
« Reply #17 on: September 11, 2016, 02:16:03 pm »
Hi @emardee,

Just curious, did you ever have any success getting your Oaks to take your new Wifi settings?

Code: [Select]
Error:    config.html:970:1767
[238]</t.exports.newInvalidAsn1Error()   config.html:970
[240]</</n.prototype.readString()   config.html:970
[251]</</t.exports.publicImport()   config.html:972
[250]</t.exports.detectAndImport()   config.html:972
[245]</</t.exports</e.prototype.importKey()   config.html:971
e()   config.html:971
t()   config.html:973
bound t()
self-hosted
o()   config.html:973
[260]</</i.prototype.__httpRequest/n</<()   config.html:973
[201]</n.prototype.emit()   config.html:968
S()   config.html:968
r/<()    config.html:969
[205]</o.prototype.run()    config.html:968
i()    config.html:968

I tested this on Win10 with Firefox 45 and 47 and I don't get these error messages. As far as I can tell, they originate from the OakSoftAP code that reads the Oak's public key...the key is in ASN1 format and it appears to be running into an error parsing the data. It makes me wonder if the key on your Oak is corrupted somehow, but I doubt your Oak could communicate with the Particle Cloud with a bad key.

It will be interesting to see what happens when you follow my manual instructions. Check the oak_pubkey.der file you get from step 3. It should be 162 bytes long, and the contents, viewed with "xxd oak_pubkey.der | less" should look like this, with random data in place of the question marks:
Code: [Select]
00000000: 3081 9f30 0d06 092a 8648 86f7 0d01 0101  0..0...*.H......
00000010: 0500 0381 8d00 3081 8902 8181 00?? ????  ......0...??????
00000020: ???? ???? ???? ???? ???? ???? ???? ????  ????????????????
00000030: ???? ???? ???? ???? ???? ???? ???? ????  ????????????????
00000040: ???? ???? ???? ???? ???? ???? ???? ????  ????????????????
00000050: ???? ???? ???? ???? ???? ???? ???? ????  ????????????????
00000060: ???? ???? ???? ???? ???? ???? ???? ????  ????????????????
00000070: ???? ???? ???? ???? ???? ???? ???? ????  ????????????????
00000080: ???? ???? ???? ???? ???? ???? ???? ????  ????????????????
00000090: ???? ???? ???? ???? ???? ???? ??02 0301  ?????????????...
000000a0: 0001                                     ..

It's possible to reset the Oak's public key if it's bad, but I haven't found a way to do it without using a USB to serial adapter.

emardee

  • Full Member
  • ***
  • Posts: 135
Re: Issues with changing Wifi?
« Reply #18 on: September 12, 2016, 12:58:46 am »
It is temporarily on hold, as I've been too busy to investigate the last couple of weeks. Will report back when I get a moment. I appreciate the help and the follow up. Thanks.

thejim

  • Newbie
  • *
  • Posts: 10
Re: Issues with changing Wifi?
« Reply #19 on: January 02, 2018, 08:46:22 pm »
I had a similar Javascript error while trying to update my Kickstarter Oaks just this week.  I had to downgrade my version of Firefox to 45.6.0 ESR.  More details here: https://digistump.com/board/index.php/topic,2830.msg13261.html#msg13261

rbabiak

  • Newbie
  • *
  • Posts: 1
Re: Issues with changing Wifi?
« Reply #20 on: January 16, 2018, 08:40:16 pm »
Hi I am having the same problem with configuring my OAK.

I get to the
Code: [Select]
http://192.168.0.1/configure-ap?plain={"ssid":"YourSSID","pwd":"a3f0a0d1819647fdc792ad74955af52115a89f387b2b9af06331a7f0402cf9d7d6dea4a608a1f5ee05bab62cb0261c283d875fd2852cfcad67b30f66ca1424f2d15adba60c701a6ebe47a49c2a584dc36f2e334e98a4bc5bafa0302903330835e50c553f4633b82e3e0a7fab7e7b19b0f4df4a5fc77043e6f5262aa30d0a3c02","sec":1}This sets the SSID and passcode on your Oak. If it's successful, you should see {"r":0} in your browser. If there's an error, it should be {"r":-1}.

Part and it returns the {"r":-1} as the error code.

I am using a mac for my PC and Chrome form my browser, if that makes any difference.

all I get is, "saving to device" and it just stays on that screen forever.

I took a look at the OakSoftAP code. It shouldn't be staying on that screen forever...it should either proceed or give you an error, so I suspect there's a bug in SoftAP code. If you open the Javascript console in your browser (hit F12), does it happen to log any errors while it's "saving to device"?

A few other thoughts:
  • What Wifi security mode are you using, e.g WEP, WPA, WPA2? (if it's something unusual, the Oak might possibly have a problem with it)
  • How many characters are in your passcode? (if it's more than 63 characters, that might be problematic too)

If your ssid and passcode actually have been saved to the device, then you can manually force the next step.  First, make sure you're connected to the ACORN_nnnnnn wifi network, then in a web browser, go to the url:

http://192.168.0.1/connect-ap

This is what OakSoftAP is supposed to do, and the Oak is supposed to respond by rebooting and connecting to the new wifi network. Does your wifi router provide a list of connected devices? If so, that's a good way to confirm whether or not the Oak sucessfully connected.


If this doesn't work, you can manually set the ssid and passcode, but it's quite involved because the Oak expects the passcode to be encrypted. Here's what to do:

(I'm assuming you're running Windows. If not, let me know.)

1. Download and install Git for Windows version 2 or later if you don't have it already, then open a Git Bash Shell and type the commands below (We don't actually use git itself, but it provides all the tools needed in one easy to install package).

2. Connect to the ACORN_nnnnnn wifi network

3. Get your Oak's public key by running the following commands (the public key is needed to encrypt the wifi passcode):
Code: [Select]
mkdir ~/OakDebugging
cd ~/OakDebugging
curl -s http://192.168.0.1/public-key | sed 's/^.*"b":"\([^"]*\)".*$/\1/' | xxd -r -p - > oak_pubkey.der

4. Encrypt your wifi passcode with the following command:
Code: [Select]
echo -n "YourPasscodeHere" | openssl rsautl -pubin -keyform DER -inkey oak_pubkey.der -encrypt -pkcs | xxd -p - | tr -d '\n'This will print out a string of hexadecimal digits something like this:
Code: [Select]
a3f0a0d1819647fdc792ad74955af52115a89f387b2b9af06331a7f0402cf9d7d6dea4a608a1f5ee05bab62cb0261c283d875fd2852cfcad67b30f66ca1424f2d15adba60c701a6ebe47a49c2a584dc36f2e334e98a4bc5bafa0302903330835e50c553f4633b82e3e0a7fab7e7b19b0f4df4a5fc77043e6f5262aa30d0a3c02(FYI, every time you run this command, the hexadecimal digits will be different - this is a normal consequence of the encryption process)

5. Copy and paste into the url below your wifi ssid (in place of YourSSID) and the string of hexadecimal digits (in place of the ones above). Then copy and paste the completed url into your web browser.
Code: [Select]
http://192.168.0.1/configure-ap?plain={"ssid":"YourSSID","pwd":"a3f0a0d1819647fdc792ad74955af52115a89f387b2b9af06331a7f0402cf9d7d6dea4a608a1f5ee05bab62cb0261c283d875fd2852cfcad67b30f66ca1424f2d15adba60c701a6ebe47a49c2a584dc36f2e334e98a4bc5bafa0302903330835e50c553f4633b82e3e0a7fab7e7b19b0f4df4a5fc77043e6f5262aa30d0a3c02","sec":1}This sets the SSID and passcode on your Oak. If it's successful, you should see {"r":0} in your browser. If there's an error, it should be {"r":-1}.

6. Finally, click this url to tell your Oak to reboot and try to connect to the new wifi network: http://192.168.0.1/connect-ap


(Note that this process only sets the wifi ssid and passcode. It will not work for the first setup of a new Oak as OakSoftAP does other things such as initiate a firmware update and negotiate a claim with the Particle Cloud.)

pkirchner

  • Newbie
  • *
  • Posts: 5
Re: Issues with changing Wifi?
« Reply #21 on: January 17, 2018, 01:10:33 pm »
Same here.

tried with 3 different oaks. Different Firmware versions (1.0.5, 1.0.2).

I can't even get them to recognize my open network.

trying
curl http://192.168.0.1/configure-ap?{"ssid":"Freifunk","sec":0}

I always get this:
{"r":-1}{"r":-1}

Does anybody have a suggestion?
I can't use the webconfig due to the ASN.1 error......

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Issues with changing Wifi?
« Reply #22 on: January 17, 2018, 06:46:18 pm »
Not sure what is going on there. Just some things to check... is the (missing) "plain=" in the url of importance?. Also maybe try putting the pwd paramater in, but leaving it blank, as maybe it's not an optional parameter?

pippin88

  • Newbie
  • *
  • Posts: 7
Re: Issues with changing Wifi?
« Reply #23 on: February 16, 2018, 07:39:29 pm »
I'm having this issue with an Oak that has worked previously with a different router / wifi setup.

Gets stuck at "Saving settings to device".

Tried different SSID / password / no password on router (Netgear CG3000v2).
Tried mobile hotspots.
Tried moving oak / phones.
Tried setting up from android, iphone, ipad.

All the same result.

This oak has worked ok previously!

If I change the router to the old SSID / password (from the other router), the oak connects to it!!!
« Last Edit: February 16, 2018, 07:57:55 pm by pippin88 »