-
Notifications
You must be signed in to change notification settings - Fork 1
Support new networking setup #14
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Mark should add a readme here | ||
|
|
||
| TODO | ||
|
|
||
| ## Raspberry Pi OS configuration | ||
|
|
||
| This setup focuses on getting the network configured properly. | ||
| Assuming the Scoreboard hardware is pluged in correctly, the scoreboard app | ||
| built from this repo should "just work". | ||
|
|
||
| I'll need to redo these steps again on a clean image to verify, but this is close enough. | ||
|
|
||
| - I used the January 11th 2021 release of the Raspberry Pi OS Lite | ||
| - Modify `/boot/config.txt` to contain `enable_uart=1` if you want to use the serial port console. | ||
| - enable ssh and rsync | ||
| - `sudo systemctl enable ssh` | ||
| - `sudo systemctl start ssh` | ||
| - `sudo systemctl enable rsync` | ||
| - `sudo systemctl start rsync` | ||
| - make the scoreboard directory & copy over config files | ||
| - `mkdir /var/lib/scoreboard` | ||
| - `chown pi /var/lib/scorboard` | ||
| - copy over `secrets.txt`, `scoreboard_settings.json`, and `environment.conf`. | ||
| - `environment.conf` contains two lines `RUST_LOG="debug"` and `RUST_BACKTRACE=full` | ||
| - run the installer in this repo to copy over the scoreboard binary | ||
| - `ln -s /var/lib/scoreboard/scoreboard /usr/local/bin/scoreboard` | ||
| - Unblock built-in wlan `rfkill unblock wlan` | ||
| - Follow this guide: [https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md](https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md) | ||
| - Skip the Enable routing and IP masquerading section | ||
| - Substitute your own IP addresses for the Access point | ||
| - Use wlan1 as access point | ||
| - Use wlan0 as internet connection | ||
| - Modify the wpa systemctl service such that wpa_supplicant will actually get wlan0 to connect to the internet. | ||
| - Change the exec line to specifiy the drivers, the interface, and the wpa_supplicant.conf file to use | ||
| - `/etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service` | ||
| - `ExecStart=/sbin/wpa_supplicant -u -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -s -O /run/wpa_supplicant` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,16 +100,18 @@ pub fn color_from_string(s: &str) -> Result<rpi_led_matrix::LedColor, Box<dyn Er | |
| } | ||
|
|
||
| pub fn is_connected() -> bool { | ||
| let response = ureq::get("http://clients3.google.com/generate_204").call(); | ||
| info!("Checking connection, status is {:?}", response.status()); | ||
| response.status() == 204 | ||
| true | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stonks. It’s able to connect to AWS to get scores, I assume?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, works fine
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you try running this just before or after getting scores?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wack, still returning 400s on startup. Maybe the scoreboard service is running too early, before other networking things are fully up.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get 204s if I start the scoreboard app manually, so I don't think its the endpoint. |
||
| //let response = ureq::get("http://clients3.google.com/generate_204").call(); | ||
| //info!("Checking connection, status is {:?}", response.status()); | ||
| //response.status() == 204 | ||
| } | ||
|
|
||
| pub fn get_ip_address() -> Option<Ipv4Addr> { | ||
| match Command::new("hostname").arg("-I").output() { | ||
| Ok(output) if output.status.success() => { | ||
| let string = std::str::from_utf8(&output.stdout).expect("Failed to parse hostname"); | ||
| let mut ips = string.split(" "); | ||
| info!("hostname we got: {}", string); | ||
| match ips.next() { | ||
| Some(ip) => Some(ip.parse().unwrap()), | ||
| None => None, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,8 +90,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { | |
| .unwrap(); | ||
|
|
||
| if matches.is_present("wait") { | ||
| info!("Waiting 90 seconds"); | ||
| sleep(Duration::from_secs(90)); | ||
| info!("Waiting 5 seconds"); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figure a short delay might be useful? I tried this to see if the is_connected() function would work again. No change, is_connected() is still broke. |
||
| sleep(Duration::from_secs(5)); | ||
| } else { | ||
| info!("Starting up now"); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you not have to install drivers for the dongle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! Works without installing anything.