area515 / Photonic3D

Control software for resin 3D printers
http://photonic3d.com
GNU General Public License v3.0
133 stars 115 forks source link

Support for raspberry pi 3 wifi #175

Closed kloknibor closed 7 years ago

kloknibor commented 8 years ago

Hi Guys,

Just got the pi 3. Super fast booting times and I've tested on the latest photonic3d image... But I can't get wifi to work, not with the sd card method nor the ethernet wifi way. It just doesn't show any wifi acces points. Can it be we use an older version of raspbian jessie? I'll dig around some more ;)!

Robin

jmkao commented 8 years ago

I guess what I want to confirm is whether DT is enabled in Raspbian Jessie, but disabled in Jessie Lite.

If so, if you can do some asking as to why the images are built this way, that would give me a better idea as to what kind of longer-term lifecycle effects altering the default Jessie Lite config would have.

WGAndrew commented 7 years ago

From what I can tell, DT is already enabled in Raspbian Jessie Lite/the photonic image.

Running ifconfig shows that the wlan0 interface is there, and Wpa_cli and iwlist show local SSIDs.

I'm not sure if it's a bug in Photonic3d that's preventing that Wifi setup being populated now. If you'd like logs or CLI output, more than happy to help, but certainly in Photonic3d 1.0.0-beta2 (aka build 298 iirc?) WiFi's not showing on rpi3.

WesGilster commented 7 years ago

I'm kindof flying blind with the RPi3 as I don't own one. WIFI management is a simple class org.area515.resinprinter.network.LinuxNetworkManager which is nothing more than a commandline parser that enumerates your networks with the following command: ifconfig | grep Link | awk '{ print $1 }'

Then checks each interface to determine if it's a wifi interface with: wpa_cli -i [interface] ping ...to receive a pong

Next it tries to bring the interface up with: ifup [interface] but I don't believe that is the problem since it builds wireless info before that.

One of those commands isn't finding your networks on the RPi3. You can probably try this out yourself to determine what the issue is. Or send the logs and I'll take a look, but this area has very little logging in it. :( If you'd like to send me the commands that work for you, I can turn out a dev release that has your fix.

WGAndrew commented 7 years ago

So from the top: ifconfig | grep Link |awk '{print $1}'

eth0
inet6
lo
wlan0
inet6

...which would lead to: wpa_cli -i wlan0 ping PONG now ifup on the pi seems to require SU, so here's both: ifup wlan0 ifup: failed to open lockfile /run/network/.ifstate.lock: Permission denied sudo ifup wlan0 ifup: interface wlan0 already configured

It's been about 13 years since I did any serious Java, so I'm not really great at going through the code and picking apart what's being done and where it might be hitting a wall :(

What I can do though is help with more info: wpa_cli -i wlan0 scan and wpa_cli -i wlan0 scan_results both work and give local SSIDs - a few censored samples:

bssid / frequency / signal level / flags / ssid
04:18:d6:19:79:21       2462    -67     [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]      Wildcard | Super-fast Broadband
92:63:fe:43:9a:1d       2437    -78     [WPA-EAP-CCMP+TKIP][WPA2-EAP-CCMP+TKIP][ESS]    BTWifi-X
90:4d:4a:26:50:ee       2412    -80     [WPA2-PSK-CCMP][WPS][ESS]       BTHub6-2Q92
90:4d:4a:12:b5:ac       2412    -81     [WPA2-PSK-CCMP][WPS][ESS]       BTHub6-Z63C
d4:63:fe:43:9a:1b       2437    -81     [WPA2-PSK-CCMP][WPS][ESS]       BTHub5-NP7H
92:4d:4a:26:52:ec       2412    -82     [WPA2-EAP-CCMP-preauth][ESS]    BTWifi-X
3c:83:75:bd:09:5a       2462    -86     [WPA2-PSK-CCMP][WPS][ESS][P2P]  Windows Phone2909
50:17:ff:34:39:02       2437    -88     [WPA-EAP-TKIP][WPA2-EAP-CCMP][ESS]      BTWifi-X
92:4d:4a:26:52:ef       2412    -79     [ESS]   BTWifi-with-FON
92:63:fe:43:9a:1c       2437    -79     [ESS]   BTWifi-with-FON
92:4d:4a:27:37:37       2437    -80     [ESS]   BTWifi-with-FON
50:17:ff:34:39:01       2437    -87     [ESS]   BTOpenzone
02:33:bb:00:1b:6a       2422    -89     [ESS]   BTWiFi
ac:d1:b8:3e:96:10       2437    -91     [ESS][P2P]      HP-Print-10-LaserJet 1102

I'm guessing that'lll be the next set of info to pull, regex out the SSID info, and then present in the photonic settings page?

Also: Where are you in the world Wes? Just thinking I might be able to donate a pi3 if that'd help?

jmkao commented 7 years ago

Actually, I should have updated this, but I have an RPi 3 and have been doing all my recent image development on it. I have not encountered any issues with it.

Using the Photonic3D image that is downloadable from photonic3d.com, Wifi works out of the box without any modification, outside of modifying the octopi-network.txt file as described in the documentation.

As the problem described earlier in the thread from @kloknibor is intermittent, my best guess is that the root cause in that case may be the rekeying issues described in an earlier posting that is a specific interaction between the RPi's wifi and certain wifi access points.

For this new issue, can you describe the exact symptoms and the sequence you went through when installing the RPi system image?

WGAndrew commented 7 years ago

James: what're the mods to octopi-network.txt? I haven't encountered those docs yet, but it might be what I'm after potentially if there's something in there preventing browsing Wifi SSIDs. [I had a quick google to find the doc you mentioned, but the only thing I could find was an empty wiki page here: https://wiki.photonic3d.com/doku.php?id=set_up_wifi ]

Sequence was pretty much grabbing the autogenerated vendor-specific Pi image here: https://photonic3d.com/downloads/Photocentric_photonic3d.zip extract, setup onto SD, boot in the pi, update the pi with apt-get and similar, etc.

jmkao commented 7 years ago

Raspberry Pi image installation instructions: https://wiki.photonic3d.com/doku.php?id=raspberry_pi

WGAndrew commented 7 years ago

Thanks James - I'd actually went through and looked into the config file directly. Obviously it's great for a static config to a single wifi network.

Sadly, I'm looking more for it to work like a wifi detection + setup util, like the photonic settings page sorta suggests is possible...

WesGilster commented 7 years ago

I live in the US(Iowa), but we might be able to fix this without a pi3. It's possible we aren't parsing your output properly with this regex: \s*([A-Fa-f0-9:]+)\s+(\d+)\s+(\d+)\s+([[]+-\w]+)\t(.+)

Immediately it looks like signal level is now negative? I'm not sure what that means, but it's an easy fix, and I can add a test for this, if this is the precise output of your command.

WesGilster commented 7 years ago

There was already an existing test for this parsing routine so I modified it with a negative signal value and all networks failed to come up which pretty much reproduces your exact situation. Fixed/checked in and a build started for: WesGilster-bd82963.

WesGilster commented 7 years ago

I had a bad semicolon in that release that broke index.js. This version is fixed: WesGilster-0b526fad

WGAndrew commented 7 years ago

Just had a chance to try that - Wes, your checkin has done the trick! Thankyou so much! Just tried changing to a different access point through Photonic and it worked perfectly. 👍

WesGilster commented 7 years ago

Good news. I'll close this bug then.