mirobot / mirobot-ui

The web application that is used to control Mirobot (http://mirobot.io)
GNU General Public License v2.0
16 stars 14 forks source link

Support SSID name with quotes #17

Closed automata closed 9 years ago

automata commented 9 years ago

I have a not so common SSID name. I really appreciate ASCII art, so my SSID name is -._.-'"'-._.-'"'-._.- ><((("> a little :fish:. The first time I configured the wifi using mirobot-ui, the scan button didn't works so I tried manual configuration. Now, my SSID is set on mirobot-ui, but the JS file shows an error regarding bad format for the SSID variable. That's because the quotes aren't escaped appropriately. Something like 'foo"bar'.replace(/\"/g, "\\\""); could fix that.

I tried to update the mirobot-ui using a bin file but the SSID variable doesn't changes. Any way to set the variable manually or to force a reset?

bjpirt commented 9 years ago

Hmmm, that's a tricky one - the WiFI module just prints whatever is in that field into the page and since you've got both single and double quotes in your SSID I'm not sure how to escape it exactly. All I can think is to put it into a html field and parse the doc for that, but the way the module works is that it can accept one <% %> block, within which you can print as many variables as you want, but they all print out with the whole "var whatever = 'foo'".

I think the only way this can be fixed is to ask the WiFi module manufacturer to fix it in their firmware so that they output escaped text, which I'll do.

Unless you can think of an alternative cunning plan for fixing this.

Regarding resetting the WiFi module, it's relatively straightforward to reset the SSID if you can connect to the module using serial, alternatively you might be able to send a request using curl with the correct parameters. You could also generate a bin file that includes a dummy variable for that parameter and reset it that way.

On 10 Dec 2014, at 00:55, Vilson Vieira notifications@github.com wrote:

I have a not so common SSID name. I really appreciate ASCII art, so my SSID name is -..-'"'-..-'"'-._.- ><((("> a little . The first time I configured the wifi using mirobot-ui, the scan button didn't works so I tried manual configuration. Now, my SSID is set on mirobot-ui, but the JS file shows an error regarding bad format for the SSID variable. That's because the quotes aren't escaped appropriately. Something like 'foo"bar'.replace(/\"/g, "\""); could fix that.

I tried to update the mirobot-ui using a bin file but the SSID variable doesn't changes. Any way to set the variable manually or to force a reset?

— Reply to this email directly or view it on GitHub.

automata commented 9 years ago

I can't think about an alternative fix now... does WiFi module manufacture has some kind of ticket system where we could report this and follow progress?

About resetting the WiFi module, do I need a programmer or I can emulate that using another Arduino? Do you have any instructions about? Thank you Ben!

bjpirt commented 9 years ago

No ticket system I'm afraid :-(

Here's the datasheet for the WiFi module: http://en.usr.cn/download/USR-WIFI232-T.pdf

You'll need to connect up the serial lines (3.3V remember! And 57600 baud) and then send AT commands to reconfigure the access point. Something like this (from memory):

> == you sending data
< == data from module

> +++
< a
> a
> AT+WSSSID=newap
< +ok

Good luck!

bjpirt commented 9 years ago

I'm going to close this because unfortunately there's nothing I can do about it. I'm currently looking at a switch of WiFi modules so I will have more control over the firmware in that part.