Up to Main Index                              Up to Journal for July, 2018

                      JOURNAL FOR TUESDAY 3RD JULY, 2018
______________________________________________________________________________

SUBJECT: Hot summer and Raspberry Pi
   DATE: Tue  3 Jul 04:21:44 BST 2018

Recently I have been quiet, mostly because the weather has been so hot. For
the last week it’s been over 25°C. I don’t like the heat, it makes me very
lethargic and not in the mood for programming or writing. Take this post — it
was supposed to go out last week.

For the v0.0.10 ‘GDPR’ release I wanted to add per-connection logging to the
cmd package. The main motivation being the save command:


  2018/06/25 20:03:21 [123] connection from 127.0.0.1:51008
  2018/06/25 20:03:21 [123] Account login: 986e98ef8………03f2269d4.wrj
  2018/06/25 20:03:23 Player saved: 986e98ef8………03f2269d4.wrj
  2018/06/25 20:03:23 [123] connection error: frontend closed
  2018/06/25 20:03:23 [123] connection closed


It would be nice if the ‘Player saved’ line also included the per-connection
sequence number ‘[123]’. Instead it is necessary to deduce the sequence number
from the ‘Account login’ line by matching the filename of the .wrj file. Not
ideal.

Having looked at the cmd package and the state type in particular it’s not
feasible right now. There is too much ugly code that needs to be cleaned up.
For example, the vast majority of allocations is due to new state instances
being created. The buffers and message handling also needs to be revisited,
that in turn involves the message package. In short, I’m not happy shoehorning
more stuff into the cmd package and the state type at this time.

So what have I been doing? I found myself in need of a portable programming
environment. I have my Chromebook and can code remotely — providing there is a
good, stable WiFi connection. I could put the Chromebook into developer mode
to code locally — but it’s far to easy to accidentally trigger a factory reset
and wipe everything out. There is the promise of Crostini to allow development
on Chromebooks[1], but at the moment it’s still under development.

In the end the solution I used was dead simple:


                   ChromeBook <-> Nokia 5 <-> Raspberry Pi


I enabled a WiFi hot-spot on the Nokia 5, then connected the Chromebook and
Raspberry Pi to the hot-spot. Internet connectivity for the Chromebook and
Raspberry Pi is via the Nokia 5 data connection. The WiFi hot-spot will assign
random IP addresses, and Android no longer makes it easy to find the IP
address of connecting devices. So, on the Nokia 5 I access a local shell using
ConnectBot and type ‘ip neigh’ at the prompt to get the IP address of the
Raspberry Pi.

As I said, dead simple.

I usually plug the Nokia 5 into the Chromebook via USB to charge. Which model
Raspberry Pi I use depends on where I am getting power from. If I’m just
running on battery I’ll use a Raspberry Pi Zero W also plugged into USB — it
draws at less than 350mA as it’s running headless. If I’m running off the
mains I’ll use a Raspberry Pi 3 with a 2.5A power supply.

If I’m using my phone a lot I’ll use my old 2nd gen Moto E just as a WiFi
hot-spot. It has no SIM card and so not internet access — everything is local
to the ad hoc Wifi network.

Instant, portable development environment with the full power of Raspbian
behind it :) The only downside is that there is no race detector for the Go
language when running 32bit ARM :(

I did spend way too much time trying to get USB networking between a Raspberry
Pi Zero and the Chromebook to work. Failed miserably. One thing I have not
tried yet, but worth investigating when I get the time, is to run the
Raspberry Pi Wifi in access point mode. That would eliminate the need to use
my mobile as a hot-spot. For now everything just works, so I’m happy with
that.

It’s now gone 4am and getting late, or early depending on your point of view,
and I guess I should try and get some sleep…

--
Diddymus

  [1] Google blog post officially announcing Crostini:
        https://blog.google/products/chromebooks/linux-on-chromebooks


  Up to Main Index                              Up to Journal for July, 2018