aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-01-19 15:17:16 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2018-01-19 15:25:37 +0100
commita15d0ec52518e76b8d4f2f6bb8e0e880429411d6 (patch)
tree2a9c06b6b9009d6aaaa661f8178b801f9838c938
parent9a8bab21c9996020b16f1dd140647efe8e262a42 (diff)
downloadsubsurface-a15d0ec52518e76b8d4f2f6bb8e0e880429411d6.tar.gz
Preserve wiki pages about headless Subsurface from trac wiki
Signed-off-by: Robert C. Helling <helling@atdotde.de>
-rw-r--r--packaging/headless/HOWTO110
-rw-r--r--packaging/headless/SubsurfaceBox108
2 files changed, 218 insertions, 0 deletions
diff --git a/packaging/headless/HOWTO b/packaging/headless/HOWTO
new file mode 100644
index 000000000..285e64142
--- /dev/null
+++ b/packaging/headless/HOWTO
@@ -0,0 +1,110 @@
+This is a protocoll of my (Robert's) attempts to come up with a headless version
+of Subsurface that runs on a small one chip computer like a RaspberryPi or C.H.I.P.
+
+The idea behind this is that that computer could do the talking to the dive computer
+and then provide the data (I thought the easiest way would be via being a wifi
+access point running a git server serving the user's divelog in git).
+
+This is still very far from working and a lot more needs to be done. As this task is
+mainly SysAdmin stuff on the small computer, it's hard to preserve this. So I decided
+to take a log of what I did. This is a dump of the corresponding wiki page on the old
+trac system.
+
+* Bought RPi3 with SD card.
+* Downloaded Raspian Jessie from https://www.raspberrypi.org/downloads/raspbian/ and decompress it
+* Downloaded PiFiller and run it, follow instructions there
+* Give up as RPi 3 wants a micro SD card, not an SD card.
+* Reinstalled on a micro SD
+* Connected network cable from Laptop (enabled Internet sharing in System Preferences)
+* ifconfig suggests RPi got IP address 192.168.2.2
+* logged in as user pi and pw raspberry
+* sudo apt-get update and upgrade
+* no space left on device. Hmm. Trying to reboot
+* ah running sudo rasps-config allows to extend the file system
+* sudo dpkg-reconfigure tzdata
+* mkdir src
+* cd src
+* git clone git://subsurface-divelog.org/subsurface.git
+* sudo apt-get install git g++ make autoconf automake libtool cmake pkg-config \
+ libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
+ libusb-1.0-0-dev libgit2-dev \
+ qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \
+ libqt5webkit5-dev libqt5qml5 libqt5quick5 libqt5declarative5 \
+ qtscript5-dev libssh2-1-dev libcurl4-openssl-dev qttools5-dev \
+ qtconnectivity5-dev qtpositioning5-dev (qtlocation5-dev was not found)
+* subsurface/scripts/build.sh
+* fails to find an include file, trying export QtDir=/usr/include/i386-linux-gnu/qt5
+* that did not help, now trying CPATH
+* Argh, of course, it's not i386-linux-gnu but arm...
+* Now, it complains about qt wanting fPIC for position independent code. Setting that in CMakeText
+* Ah, no, that is just for some test. The subsurface binary is already built. good.
+* And it starts (after I have installed XQuartz on my Macbook)
+* after initial problems (I don't know), it downloads dives from the Vytec.
+* I created a new directory and do git init there and then I can save in git format
+* From the laptop: git clone ssh://pi@192.168.2.2/home/pi/.subsurface/gitsave works
+
+==RPi as wifi access point==
+* sudo apt-get install hosted
+* Following https://www.elektronik-kompendium.de/sites/raspberry-pi/2002171.htm
+* sudo vi /etc/hostapd/hostapd.conf
+* sudo chmod 600 /etc/hostapd/hostapd.conf
+* sudo hostapd -dd /etc/hostapd/hostapd.conf
+* I see the AP but my passphrase is rejected. Now trying http://elinux.org/RPI-Wireless-Hotspot
+* sudo apt-get install udhcpd
+* sudo vi /etc/udhcpd.conf
+* sudo vi /etc/default/udhcpd
+* once more sudo vi /etc/hostapd/hostapd.conf
+* reboot
+* one day later: I have to do the sudo ifconfig wlan0 192.168.42.1 again, but then it works. The iPhone take the connection and sees 192.168.42.1
+
+* sudo apt-get install apache2
+
+== Installing the command line version of subsurface ==
+
+* cd ~/src/subsurface
+* mv build build.full
+* git remote add github https://github.com/atdotde/subsurface.git
+* git checkout github/command_line -b command_line
+* cd ~/src
+* subsurface/scripts/build.sh
+
+
+==BIND==
+* sudo apt-get install bind9 bind9utils dnsutils
+* sudo vim /etc/bind/named.conf.local
+* sudo vi /etc/bind/db.example.com
+
+==Git server on CHIP==
+So far, no significant difference to the Pi
+
+* run subsurface and save to local git repository (with [] syntax)
+* cd src/subsurface/build/
+* ./subsurface
+* cd cloud
+* git init
+* git checkout robert
+* sudo apt-get install apache2 apache2-utils
+* sudo /etc/init.d/apache2 start
+* git clone --bar cloud/ cloud.git
+* sudo adduser git
+* sudo mv cloud.git/ ~git
+* sudo chown git.git -R /home/git/cloud.git/
+* sudo Cash git (set it to /usr/bin/git-shell)
+* a2enmod cgi alias env rewrite
+* sudo mkdir /opt/git
+* sudo cp -r ~git/cloud.git/ /opt/git/
+* sudo chgrp -R www-data /opt/git
+* sudo vi /etc/apache2/sites-enabled/000-default.conf
+* sudo htpasswd -c /opt/git/.htpasswd subsurface
+* sudo chgrp www-data /opt/git/.htpasswd
+* sudo apt-get install gitweb
+* sudo a2enmod env alias fcgid auth_digest
+* sudo service apache2 restart
+* sudo vi /etc/gitweb.conf
+
+==a new attempt==
+* threw away the default site and roughly followed http://p0l0.binware.org/index.php/2011/08/26/git-over-http-git-http-backend/ (without SSL or authentication)
+* /etc/apache2/sites-enabled/001-git.conf
+* created /var/www/git/test.git as a repository and gave rights to www-data
+* git config http.receivepack true
+* this seems to work as in serves git repository clone and push
diff --git a/packaging/headless/SubsurfaceBox b/packaging/headless/SubsurfaceBox
new file mode 100644
index 000000000..685294a98
--- /dev/null
+++ b/packaging/headless/SubsurfaceBox
@@ -0,0 +1,108 @@
+== A simple "download my dives" box that works with Subsurface and Subsurface-mobile ==
+
+=== Rationale ===
+
+While it may be possible to connect some dive computers to Android (BT, BLE, FTDI based cables) and iOS (likely only BLE), it seems unlikely that we'll be able to get the majority of typical dive computers to work with a tablet / phone. And even on the desktop there are issues (iRDA based dive computers on Mac and Windows 10).
+One possible solution could be a small Linux box that connects to the dive computer and then offers a very simple way for a device or computer running Subsurface-mobile or even the full Subsurface to connect to that box.
+
+=== Requirements ===
+
+* Target group is A out of:
+ * A) actual divers and users of Subsurface-mobile on their iPhone with no discernible knowledge of computers
+ * B) people who are comfortable installing debian on some random device and making all this work
+ This is really important:
+ - The Spouse Approval Factor has to be very high
+ - It has to be plug-and-play
+ - There should be as good as no FAQ needed for this so that support needed is minimal
+
+
+* small, cheap
+* supports downloading from most dive computers (this might be very easily achieved if we have a Linux board with a USB connector)
+ - Basically: it needs to run libdivecomputer
+* supports connection to Subsurface and Subsurface-mobile
+ * BLE:
+ [[BR]]Pros:
+ * available on most phones and devices
+ * zero configuration
+ Cons:
+ * low bandwidth for data transfer
+ * requires us to invent a custom protocol
+ * WIFI
+ [[BR]]Pros:
+ * high bandwidth
+ * existing transfer protocols (REST/HTTP)
+ Cons:
+ * complicated setup for the user with switching access points to the box
+* battery life: box should survive a day on a dive boat, should be able to recharge
+ - C.H.I.P. takes LiPo batteries (1S / single cell only though)
+ - USB "Battery Pack" could be another method
+* upgrade capability
+ - Reflash the whole image in one go
+ - No state on the device, config happens using BT
+* Case:
+ - mostly water-proof-ish
+ - nice bright yellow plastic so it can't get lost
+* Distribution: C.H.I.P. and Raspberry Pi are all Debian based, going for this is likely the best path forward.
+* Filesystem: Read-only system partition, minimize risk of filesystem corruption
+ - C.H.I.P. is mounted rw, but a custom image can likely be made readonly in chunks
+* Software:
+ - likely just libdivecomputer with some kind of interface (BLE / WiFi) to the mobile device
+ - sending raw DC data will be most compact.
+
+=== Possible hardware choices ===
+
+==== C.H.I.P. ====
+Pro:
+ * Cheap (<10 EUR)
+ * Has all interfaces we need (Wifi, Bluetooth)
+ * Very small size
+ * Good contact with developers
+ * LiPo Battery (1S)
+Con:
+ * Currently limited availability (but NextThing is working with us to address this for development of the Subsurface Box)
+
+Device Details: [[NextThingCHIP|NextThing C.H.I.P. Details]]
+
+==== Raspberry ====
+Pro:
+ * Availability
+Con:
+ * Cheap-ish (~60 EUR)
+ * RPi 3 has all interfaces we need, before that you need dongles for WIFI and Bluetooth.
+ * Rather big size
+ * USB Battery Pack
+
+atdotde: I have an evening to spend and a Rpi3 in front of me, let's see how far I can get. I will log my efforts [[Subsurface on RPi]] here.
+
+=== BLE Protocol ===
+Services:
+ * Device Information Service (Bluetooth SIG approved service)
+ * Battery Service (Bluetooth SIG approved service) ??
+ * Subsurface Service (proprietary)
+Advertisement Data:
+ * Device name (max 26 Bytes if only advertising the name, which is in general sufficient)
+ - `Users's SsrfBox` (already 15 bytes :()
+
+Summary of BLE Protocol details: http://chapters.comsoc.org/vancouver/BTLER3.pdf
+
+Working (on C.H.I.P.) GATT Server (golang though): https://github.com/paypal/gatt/tree/master/examples
+
+=== Future Features ===
+
+===== Pin Requirement (Bluetooth) =====
+
+ - Initially we will not require a PIN on Bluetooth connection.
+ We do not expect any attacks to this when on a boat anyway...
+ - Future: allow a PIN to be configured and required through the configuration menu
+
+===== Home / Away button =====
+
+This is a design idea that uses Wifi as the main communication with the box (instead of BLE)
+ - When switched to "Home" it will try to connect to the local
+ home Wifi Network, that way it becomes available to the home
+ network and one can use it that way, thus avoiding need
+ to have to have your mobile device switch between the home-wifi
+ and the device wifi.
+ - When switched to "Away" it will be a AP, your mobile device
+ can then connect to it and use it directly.
+This requires additional configuration / setup and possibly a hardware switch to select the mode the box is in.