aelveborn / Wii-Scale

Turns your Wii Balance Board into a scale and presents your weight on a responsive website. Runs Linux and works on your Raspberry Pi.
http://aelveborn.github.io/Wii-Scale/
GNU General Public License v2.0
116 stars 27 forks source link

Install fails with error - build process needs an update! #31

Closed mo-g closed 3 years ago

mo-g commented 6 years ago
zzz@glados ~/Projects/wiiscale/build $ cmake ../wii-scale/ && make-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   program_options
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'giomm-2.4'
--   Found giomm-2.4, version 2.46.3
CMake Error at CMakeLists.txt:26 (add_subdirectory):
  The source directory

    /home/zzz/Projects/wiiscale/wii-scale/socket.io-client-cpp

  does not contain a CMakeLists.txt file.

-- Configuring incomplete, errors occurred!
See also "/home/zzz/Projects/wiiscale/build/CMakeFiles/CMakeOutput.log".

I've managed to install nodejs, xwiimote-dev, libboost-program-options-dev, libglibmm-2.4-dev but for the life of me I can't fix this one by mashing my face against apt. Currently, socket.io-client-cpp is empty,

Cloning from git: ribbons/socket.io-client-cpp into wiimote/socket.io-client-cpp fixes it, this should be added to the instructions (or automated by the config script).

mo-g commented 6 years ago

Haha, missed the recursive flag. user=1D10T for sure.

Also found libssl-dev and cppcheck are dependencies.

mo-g commented 6 years ago

Ended up finding a genu-ine issue in the end!

On debian and derivatives, node has been renamed nodejs which also caused an issue.

Have now completely updated the ubuntu guide to reflect the changes in both this project and the OS. The raspbian one should follow; especially as all new models of the Raspberry Pi are getting wifi and bluetooth out of the box. (I'm testing on my workstation, with a plan to follow with a 0W hidden in my bookcase)

mo-g commented 6 years ago

Ok, well - since I have a 3B+ and a 0W sat on my desk, I'll use the former to build a small headless server on the latter, and see about putting together an updated guide for that as well. I have a completely unrelated project going on where I need a monitor of my health, and having a platform agnostic web-based client for that would be helpful.

Unrelated question, since I haven't dug through the code yet - does the software have any battery saving auto-disconnect time-outs? Something along the lines of:

mo-g commented 6 years ago

git isn't a default install on Raspbian Lite. Wasn't actually expecting that! Cmake either. It also needs some additional boost libraries to be manually installed: libboost-system-dev libboost-date-time-dev libboost-random-dev

mo-g commented 6 years ago

Managed to get my board connected through bluetoothctl, but wii-scale doesn't seem to be able to disconnect it. Interesting.

GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.17" (uid=1000 pid=11554 comm="build/wii-scale -h0.0.0.0 -p8080 -c0 ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination=":1.3" (uid=0 pid=477 comm="/usr/lib/bluetooth/bluetoothd ")

terminate called after throwing an instance of 'Gio::DBus::Error'
mo-g commented 6 years ago
power on
agent on
default-agent
scan on
<press red sync button>
pair <MAC of the found wiimote>
# note: we do not explicitly connect, we just pair!
connect <MAC of the wiimote>
# there seems to be a pretty short timeout, so execute this immediately after the pairing command

trust <MAC of the wiimote>
disconnect <MAC of the wiimote>
scan off
exit

Also, the dbus error requires usermod -aG lp <username> to fix.

mo-g commented 6 years ago

So, both guides have now been updated.

Last thing is the daemonization of Wii-Scale on the Raspberry Pi guide - When I start it through forever, the port remains closed. I need to look at it further, but it's 1am, so it can wait till tomorrow! Night!

mo-g commented 6 years ago

Right, it's morning now! I need to go buy some food and then cook some freezer boxes, but here's some logs:

pi@scales:/opt/wiiscale $ forever start /opt/wiiscale/scripts/start.js 
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: /opt/wiiscale/scripts/start.js

Decided to try using the log file option:

pi@scales:/opt/wiiscale $ sudo mkdir /var/log/wiiscale
pi@scales:/opt/wiiscale $ sudo chown root:pi /var/log/wiiscale
pi@scales:/opt/wiiscale $ sudo chmod 775 /var/log/wiiscale
pi@scales:/opt/wiiscale $ forever stopall
info:    Forever stopped processes:
data:        uid  command         script                         forever pid  id logfile                    uptime      
data:    [0] xain /usr/bin/nodejs /opt/wiiscale/scripts/start.js 4005    4267    /home/pi/.forever/xain.log 0:0:0:6.748 
pi@scales:/opt/wiiscale $ forever start /opt/wiiscale/scripts/start.js -o /var/log/wiiscale/stdout.log -e /var/log/wiiscale/stderr.log 
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: /opt/wiiscale/scripts/start.js
pi@scales:/opt/wiiscale $ tail -f /var/log/wiiscale/*
tail: cannot open '/var/log/wiiscale/*' for reading: No such file or directory
tail: no files remaining
pi@scales:/opt/wiiscale $ touch /var/log/wiiscale/stdout.log
pi@scales:/opt/wiiscale $ touch /var/log/wiiscale/stderr.log
pi@scales:/opt/wiiscale $ tail -f /var/log/wiiscale/*
==> /var/log/wiiscale/stderr.log <==

==> /var/log/wiiscale/stdout.log <==

And:

pi@scales:/opt/wiiscale $ telnet localhost 8080
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
pi@scales:/opt/wiiscale $ forever start -c "npm start" /opt/wiiscale/ -o /var/log/wiiscale/stdout.log -e /var/log/wiiscale/stderr.log 
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: /opt/wiiscale/
pi@scales:/opt/wiiscale $ cat /var/log/wiiscale/*
pi@scales:/opt/wiiscale $ cat /var/log/wiiscale/*
pi@scales:/opt/wiiscale $ cat /var/log/wiiscale/*
pi@scales:/opt/wiiscale $ cat /var/log/wiiscale/*
pi@scales:/opt/wiiscale $ telnet localhost 8080
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET
Connection closed by foreign host.

So that works - but the log files are still empty. Will update the documentation to remove the bad command suggestion, at least.

mo-g commented 6 years ago

That's done - the wiki instructions are now correct - but if anyone else wants to run through them on a fresh SD card and confirm that I haven't made a typo, or forgotten to copy something I did into the wiki - would appreciate.

Please don't close this yet, I'd like to get the logging issue fixed before we do.

mo-g commented 6 years ago

Managed to get forever logging right, which showed the havok it was playing with the process (repeatedly killing it). Looking into a better solution.

mo-g commented 6 years ago

Opened #35.