{"action":"created","issue":{"url":"https://api.github.com/repos/aelveborn/Wii-Scale/issues/14","repository_url":"https://api.github.com/repos/aelveborn/Wii-Scale","labels_url":"https://api.github.com/repos/aelveborn/Wii-Scale/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/aelveborn/Wii-Scale/issues/14/comments","events_url":"https://api.github.com/repos/aelveborn/Wii-Scale/issues/14/events","html_url":"https://github.com/aelveborn/Wii-Scale/pull/14","id":175334851,"number":14,"title":"RFC: Switch back end from wiiboard.py to xwiimote and from Python to C++","user":{"login":"ribbons","id":961548,"avatar_url":"https://avatars.githubusercontent.com/u/961548?v=3","gravatar_id":"","url":"https://api.github.com/users/ribbons","html_url":"https://github.com/ribbons","followers_url":"https://api.github.com/users/ribbons/followers","following_url":"https://api.github.com/users/ribbons/following{/other_user}","gists_url":"https://api.github.com/users/ribbons/gists{/gist_id}","starred_url":"https://api.github.com/users/ribbons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ribbons/subscriptions","organizations_url":"https://api.github.com/users/ribbons/orgs","repos_url":"https://api.github.com/users/ribbons/repos","events_url":"https://api.github.com/users/ribbons/events{/privacy}","received_events_url":"https://api.github.com/users/ribbons/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-06T19:49:29Z","updated_at":"2016-09-09T10:06:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/aelveborn/Wii-Scale/pulls/14","html_url":"https://github.com/aelveborn/Wii-Scale/pull/14","diff_url":"https://github.com/aelveborn/Wii-Scale/pull/14.diff","patch_url":"https://github.com/aelveborn/Wii-Scale/pull/14.patch"},"body":"Similar to #11, I have been unable to get Wii-Scale to work for me under Kubuntu 16.04.  With a paired, trusted balance board the Python backend gives a `bluetooth.btcommon.BluetoothError: (111, 'Connection refused')`, but unlike @dm8tbr, I can't even get it to work in pairing mode.\r\n\r\nMy hypothesis is that the `hid_wiimote` module included in the distro jumps in and connects to the balance board as soon as it has the chance, blocking the direct connection that `wiiboard.py` attempts to make.  Unfortunately I've been unable to properly test my hypothesis as despite my best efforts I don't seem to be able to prevent the module being loaded (I think this is because the 'hid' module automatically loads it but I may be wrong about that).\r\n\r\nInstead I settled on a different although rather drastic solution of re-writing the Python backend in C++.  This allows us to use the hid interface exposed by the kernel module.  I've opted to use the `xwiimote` library to do most of the heavy lifting for us.  I did originally look at the python `xwiimote-bindings` but these aren't available as a package in my distro (and I think are no-longer maintained), so ended up being more faff than switching completely to C++.\r\n\r\nThis PR is a *very* rough proof of concept re-write of the backend in C++ which isn't ready to merge.  It just about works but needs splitting up into proper classes, having support for pairing & disconnecting added, to use the calibration parameter and have much better error handling.  I'm submitting this to see if this is something that you'd be interested in adopting into this repository when I've finished it off, or if you'd prefer to stick with your current Python approach and I should just maintain this change separately in my fork?\r\n\r\nIf you do want to give the POC a try, you'll need CMake, the libxwiimote development library and headers and to recursively init the socket.io-client submodule as it also has submodules.  The built `wii-board` binary also needs to be run as root as annoyingly it isn't possible to connect to the balance board functionality otherwise."},"comment":{"url":"https://api.github.com/repos/aelveborn/Wii-Scale/issues/comments/245873499","html_url":"https://github.com/aelveborn/Wii-Scale/pull/14#issuecomment-245873499","issue_url":"https://api.github.com/repos/aelveborn/Wii-Scale/issues/14","id":245873499,"user":{"login":"Delmw","id":22051197,"avatar_url":"https://avatars.githubusercontent.com/u/22051197?v=3","gravatar_id":"","url":"https://api.github.com/users/Delmw","html_url":"https://github.com/Delmw","followers_url":"https://api.github.com/users/Delmw/followers","following_url":"https://api.github.com/users/Delmw/following{/other_user}","gists_url":"https://api.github.com/users/Delmw/gists{/gist_id}","starred_url":"https://api.github.com/users/Delmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Delmw/subscriptions","organizations_url":"https://api.github.com/users/Delmw/orgs","repos_url":"https://api.github.com/users/Delmw/repos","events_url":"https://api.github.com/users/Delmw/events{/privacy}","received_events_url":"https://api.github.com/users/Delmw/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T10:06:38Z","updated_at":"2016-09-09T10:06:38Z","body":"> Do you mean that you can retrieve data from the board when it is in 'sync' mode (e.g. pressing the red button in the battery compartment)? I couldn't get the board to work for me in this mode either but it may just be I was doing things in the wrong sequence as @dm8tbr was able to get data in sync mode.\r\n\r\nYes I can retrieve the data when the board is in 'sync' mode, after it is connected of course.\r\n\r\n> Yes, if the board is already paired (in my case using the KDE Bluetooth applet thingy, but I believe that this uses the same bluez APIs as bluetoothctl), this code can connect to it and retrieve data.\r\n\r\nI think it is strange that your code can connect to the board and the python code can't, because they eventually use the bluez API?\r\nMy idea of where the problem lies in the way the python code connects to the board when it is synced already. So did you do any thing different in the communication protocol? Or the way to connect to the board?\r\n\r\nAre you able to reconnect and receive data from the the board when the batteries are pulled out, re-inserted and the board is switched on with the button on the front (without using the sync button)?  \r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"Delmw"}}