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

Not working with Raspberry Pi 3 (on-board WiFi) #33

Closed
tlangmo opened this issue Mar 24, 2016 · 19 comments
Closed

Not working with Raspberry Pi 3 (on-board WiFi) #33

tlangmo opened this issue Mar 24, 2016 · 19 comments
Assignees

Comments

@tlangmo
Copy link

tlangmo commented Mar 24, 2016

Everything installs fine and the Access Point "ResinAP" shows up on other devices. But once you try to connect to it, it never succeeds and the capture portal never appears. I tested with Pi2 and USB dongle and it worked fine.

The internet suggests that the on-board wifi chip supports SoftAP, e.g. https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/

@tlangmo tlangmo changed the title Not working on Raspberry Pi 3 Not working with Raspberry Pi 3 (on-board WiFi) Mar 24, 2016
@pcarranzav
Copy link
Contributor

Thanks for reporting @tlangmo - we hadn't yet tested on an RPi 3.

Might be that we have to use hostapd like we did on the edison branch.
Or it could also work with connman if we manually add wlan0 to the bridge using brctl (I've seen sometimes connman fails to add the interface to the bridge, which causes that behaviour where the AP appears but you can't connect to it).
In any case, I'll have to do some tinkering to figure it out. (And you're more than welcome to give it a try if you want ;)

@pcarranzav
Copy link
Contributor

@tlangmo I've prepared a branch that uses hostapd basing from the edison branch with a few changes.
Haven't tested it, but wanna give it a try?
It's rpi3-hostapd

@tlangmo
Copy link
Author

tlangmo commented Mar 29, 2016

@pcarranzav I've tested it successfully on Rpi3 with your hostapd version. The AP comes up and I can connect to it.

I have noticed a few things though:
*Sometimes, a hotspot gets opened although the network can be joined and the credentials are correct. I have not really figured out how to replicate this. Can I set a timeout somewhere?

*Unfortunately, systemd (ENV INITSYSTEM on) does not work with resin-wifi-connect. This is a bummer since systemd is quite important. Whenever it is active, I get this error message:

Unhandled rejection Error: No WiFi networks found
    at /usr/src/app/node_modules/connman-simplified/lib/WiFi.js:509:17
    at mgr.GetServices.finish (/usr/src/app/node_modules/connman-simplified/node_modules/connman-api/lib/connman.js:160:5)
    at /usr/src/app/node_modules/connman-simplified/node_modules/connman-api/node_modules/dbus/lib/interface.js:49:10

Not sure yet whether this is Rpi3 related or generally a problem with the wifi-connect app

@pcarranzav
Copy link
Contributor

@tlangmo the systemd thing is a known issue, that has a workaround that was implemented on the master branch but not the rpi3 version. It requires changing this line to:

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host_run/dbus/system_bus_socket npm start &> wifi.log

As for the other issue, there might be a bug in how we save the credentials after a container restart (also fixed in master but not on this branch). I'll clean up and fix as soon as possible.

@tlangmo
Copy link
Author

tlangmo commented Mar 30, 2016

@pcarranzav I think there are several issues at play which cause problems with resin-wifi-connect on Rpi3. Here is what I noticed so far in my tests:

  • Hotspot via connman tethering with on-board broadcom chip does not work. However hostapd works
  • Even with correct credentials, connman-simplified-resin cannot join a WPA network. This causes the hotspot to be opened on every reboot
    Unhandled rejection Error: Joining network failed (wrong password?) at onChange (/usr/src/app/node_modules/connman-simplifiedresin/lib/WiFi.js:256:23) at emit (events.js:98:17) at null.<anonymous> (/usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/lib/service.js:87:12) at emit (events.js:117:20) at null.<anonymous> (/usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/node_modules/dbus/lib/bus.js:43:22) at emit (events.js:106:17)at /usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/node_modules/dbus/lib/dbus.js:70:42
  • Standalone connmanctl using the same SSID/password works fine though! Maybe some agent problem?
  • Systemd and connman have some issues on Rpi3 which I have not noticed on Rp2. For example, if connman service is running with INITSYSTEM on, the SSH web terminal does not work anymore.

@pcarranzav
Copy link
Contributor

@tlangmo about the systemd problem, yes, it's because this branch doesn't have this fix:
ce4da53
(basically the systemctl disable connman on the Dockerfile avoids a connman daemon starting on the container and conflicting with the host connman)
Also the connman-simplified-resin version is outdated (master has 0.1.5), so probably the join error is fixed there (I recall seeing that in the past).

I'll PR fixes for this as soon as I can.

@pcarranzav
Copy link
Contributor

@tlangmo think could you try the branch rpi3-rebased to see if it fixes those issues?

I interactively rebased from master so that the newest fixes are applied, but haven't been able to test it yet.

@tlangmo
Copy link
Author

tlangmo commented Apr 1, 2016

@pcarranzav I did more testing with rpi3-rebased and found s.th. interesting. The good news, it works in principle, but not right away.
After the AP is up, and you enter the credentials the first time, it will enter the AP mode again on next boot. If you then enter the same credentials a second time, it will work from there on.

Looking closer and /data/connections.json, you can see that the second entry got appended to the list. While the first network join fails, subsequent will work. Here is a print out the /data/connections.json file and the corresponding node error msgs. I added a non existing entry manually for testing.

[{"ssid":"Motesque 2.4Ghz","passphrase":"P@ssw0rd"},{"ssid": "noexist", "passphrase" : "whoknows"}, {"ssid":"Motesque 2.4Ghz","passphrase":"P@ssw0rd"}]

Trying to join previously known networks

Trying to join Motesque 2.4Ghz pwd:P@ssw0rd
Error joining network { [Error: Joining network failed (wrong password?)]
  cause: [Error: Joining network failed (wrong password?)],
  isOperational: true } Error: Joining network failed (wrong password?)
    at onChange (/usr/src/app/node_modules/connman-simplified-resin/lib/WiFi.js:256:23)
    at emit (events.js:98:17)
    at null.<anonymous> (/usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/lib/service.js:87:12)
    at emit (events.js:117:20)
    at null.<anonymous> (/usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/node_modules/dbus/lib/bus.js:43:22)
    at emit (events.js:106:17)
    at /usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/node_modules/dbus/lib/dbus.js:70:42
No success Error: Joining network failed (wrong password?)

Trying to join noexist pwd:whoknows
Error joining network { [Error: Service not found] cause: [Error: Service not found], isOperational: true } Error: Service not found
    at /usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/lib/connman.js:228:23
    at mgr.GetServices.finish (/usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/lib/connman.js:160:5)
    at /usr/src/app/node_modules/connman-simplified-resin/node_modules/connman-api-resin/node_modules/dbus/lib/interface.js:49:10
No success Error: Service not found

Trying to join Motesque 2.4Ghz pwd:P@ssw0rd
Joined! Exiting.

@tlangmo
Copy link
Author

tlangmo commented Apr 1, 2016

@pcarranzav Actually, I had instances now where also the second time it did not work with the same No success Error: Joining network failed (wrong password?) error message. So bottom line, something works but not reliable.

@pcarranzav
Copy link
Contributor

@tlangmo maybe you've thought of this, but is it possible that the signal is just not so strong? Could you try moving closing to the router and seeing if it works more consistently?
It might be worth just adding a few retries to the join...

@tlangmo
Copy link
Author

tlangmo commented Apr 1, 2016

@pcarranzav I tried a lot already... Signal is not the issue, I tried two different location (home & office), also very close to router. I also cross checked with Rpi2, everything works fine on that device...

@pcarranzav
Copy link
Contributor

@tlangmo sorry for the delay. I'll be working on debugging this throughout next week - I'll keep you updated!

@tlangmo
Copy link
Author

tlangmo commented Apr 9, 2016

@pcarranzav I checked the wifi connection mechanism using the python test scripts of connman (https://sources.debian.net/src/connman/1.21-1.2/test/) itself. That worked without problem meaning on every start up, the wifi is joined with known credentials using dbus messages. I ran the agent in a separate process.

So my guess is the problem lies somewhere in one of the node.js abstractions.

@pcarranzav
Copy link
Contributor

@tlangmo thanks for digging in. I've pushed a version that adds some retries - doesn't solve the core issue but might get you going while I keep on researching.

@dovy
Copy link

dovy commented May 26, 2016

@pcarranzav tried it out. The SSID's never populate. Any hints as to where the issue may be?

@danielbh
Copy link

danielbh commented Jul 2, 2016

+1 did not work for me either.

Edit: To be more specific I deployed the app to a resin project as a stand alone app. Then I tried to connect with the resulting un-provisioned access point 'Resin AP'. It wouldn't even connect.

@curcuz
Copy link
Contributor

curcuz commented Jul 13, 2016

this is stuck until #42 is fixed

@danielbh
Copy link

rpi3-rebased branch works for me after recent changes. THANK YOU SO MUCH!!

@petrosagg
Copy link
Contributor

RaspberryPi 3 support is now merged to master

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

6 participants